skydive-project / skydive

An open source real-time network topology and protocols analyzer
https://skydive.network
Apache License 2.0
2.65k stars 400 forks source link

Agent crash with capture on libvirt tun interface #206

Closed eonpatapon closed 7 years ago

eonpatapon commented 7 years ago

On my local libvirt with a VM using the NAT network the capture on vnet0 (vm interface linked to the network bridge) makes the agent crash.

207: vnet0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master virbr0 state UNKNOWN group default qlen 500
    link/ether fe:54:00:5d:d0:73 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::fc54:ff:fe5d:d073/64 scope link 
       valid_lft forever preferred_lft forever

Metadatas:

Driver : tun
EncapType : ether
IPV6 : fe80::fc54:ff:fe5d:d073/64
IfIndex : 207
MAC : fe:54:00:5d:d0:73
MTU : 1500
Name : vnet0
State : UP
TID : 36a02548-8a69-55e1-6b87-8bb0fcd89698
Type : tun
2017-02-02T09:31:07.901+01:00 gnion:agent flow.go:386 flow run.feedFlowTable.FlowPacketsFromGoPacket FlowPacketsFromGoPacket > ERRO 064 Decoding failure on layerpath Ethernet/LLC/DecodeFailure
2017-02-02T09:31:07.902+01:00 gnion:agent flow.go:387 flow run.feedFlowTable.FlowPacketsFromGoPacket FlowPacketsFromGoPacket > DEBU 065 -- FULL PACKET DATA (52 bytes) ------------------------------------
00000000  01 80 c2 00 00 00 fe 54  00 5d d0 73 00 26 42 42  |.......T.].s.&BB|
00000010  03 00 00 00 00 00 80 00  52 54 00 5a 62 3d 00 00  |........RT.Zb=..|
00000020  00 00 80 00 52 54 00 5a  62 3d 80 02 00 00 14 00  |....RT.Zb=......|
00000030  02 00 02 00                                       |....|
--- Layer 1 ---
Ethernet    {Contents=[..14..] Payload=[..38..] SrcMAC=fe:54:00:5d:d0:73 DstMAC=01:80:c2:00:00:00 EthernetType=LLC Length=38}
00000000  01 80 c2 00 00 00 fe 54  00 5d d0 73 00 26        |.......T.].s.&|
--- Layer 2 ---
LLC {Contents=[66, 66, 3] Payload=[..35..] DSAP=66 IG=false SSAP=66 CR=false Control=3}
00000000  42 42 03                                          |BB.|
--- Layer 3 ---
DecodeFailure   Packet decoding error: Layer type not currently supported
00000000  00 00 00 00 00 80 00 52  54 00 5a 62 3d 00 00 00  |.......RT.Zb=...|
00000010  00 80 00 52 54 00 5a 62  3d 80 02 00 00 14 00 02  |...RT.Zb=.......|
00000020  00 02 00                                          |...|
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x5590b584644b]

goroutine 91 [running]:
panic(0x5590b6406e80, 0xc42000e0e0)
    /usr/lib/go/src/runtime/panic.go:500 +0x1a1
github.com/skydive-project/skydive/flow/probes.(*GoPacketProbe).feedFlowTable(0xc42184cdc0, 0xc421856480)
    /home/eon/go/src/github.com/skydive-project/skydive/flow/probes/gopacket.go:72 +0xeb
github.com/skydive-project/skydive/flow/probes.(*GoPacketProbe).run(0xc42184cdc0, 0xc421365e80, 0xc4217965d0, 0xc42184b2a0, 0x0, 0x0)
    /home/eon/go/src/github.com/skydive-project/skydive/flow/probes/gopacket.go:141 +0x5de
github.com/skydive-project/skydive/flow/probes.(*GoPacketProbesHandler).RegisterProbe.func1(0xc4215efcc0, 0xc42184cdc0, 0xc4217965d0, 0xc42184b2a0)
    /home/eon/go/src/github.com/skydive-project/skydive/flow/probes/gopacket.go:215 +0x7c
created by github.com/skydive-project/skydive/flow/probes.(*GoPacketProbesHandler).RegisterProbe
    /home/eon/go/src/github.com/skydive-project/skydive/flow/probes/gopacket.go:216 +0x727
safchain commented 7 years ago

I think this is due to this line

https://github.com/skydive-project/skydive/blob/master/flow/flow.go#L388

do you plan to send a fix or do you want us to fix it ?

eonpatapon commented 7 years ago

I will have a look

safchain commented 7 years ago

https://softwarefactory-project.io/r/#/c/6325/1