Edgio / vflow

Enterprise Network Flow Collector (IPFIX, sFlow, Netflow)
http://www.verizonmedia.com
Apache License 2.0
1.09k stars 224 forks source link

sflow packets with sample packets of non-UDP/TCP/ICMP are dropped #174

Open dbardbar opened 1 year ago

dbardbar commented 1 year ago

A sflow packet with multiple samples, where one of the samples contains non-UDP/TCP/ICMP packet sample causes the whole sflow packet to be dropped.

A simple fix for this is to change decodeNextLayer() in network.go, so that the default case just states that all the remaining bytes are unparsed, and fills the p.L4 with an empty struct, so that the resulting JSON would have an empty L4. For example:

{"Version":5,"IPVersion":1,"AgentSubID":5,"SequenceNo":37591,"SysUpTime":3287084017,"SamplesNo":1,"Samples":[{"SequenceNo":1530345639,"SourceID":0,"SamplingRate":4096,"SamplePool":1938456576,"Drops":0,"Input":536,"Output":728,"RecordsNo":3,"Records":{"ExtRouter":{"NextHop":"115.131.251.90","SrcMask":24,"DstMask":14},"ExtSwitch":{"SrcVlan":0,"SrcPriority":0,"DstVlan":0,"DstPriority":0},"RawHeader":{"L2":{"SrcMAC":"58:00:bb:e7:57:6f","DstMAC":"f4:a7:39:44:a8:27","Vlan":0,"EtherType":2048},"L3":{"Version":4,"TOS":0,"TotalLen":1452,"ID":13515,"Flags":0,"FragOff":0,"TTL":62,"Protocol":50,"Checksum":8564,"Src":"10.1.8.5","Dst":"161.140.24.181"},"L4":{}}}],"IPAddress":"192.168.10.0"}

dbardbar commented 1 year ago

Example pcap of non-TCP/UDP/ICMP traffic - sflow_protocol_50.zip