From 942b0a0c0186e3c1b8e02c239f1221db9e0ee9ed Mon Sep 17 00:00:00 2001 From: shw Date: Tue, 11 Apr 2017 22:25:01 +0000 Subject: [PATCH] Bug fix. --- sgfw/policy.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sgfw/policy.go b/sgfw/policy.go index 0e38139..d00e633 100644 --- a/sgfw/policy.go +++ b/sgfw/policy.go @@ -259,12 +259,13 @@ func printPacket(pkt *nfqueue.NFQPacket, hostname string, pinfo *procsnitch.Info SrcPort, DstPort := uint16(0), uint16(0) SrcIp, DstIp := getPacketIP4Addrs(pkt) - switch pkt.Packet.TransportLayer().TransportFlow().EndpointType() { - case 4: - proto = "TCP" - case 5: - proto = "UDP" - default: +// switch pkt.Packet.TransportLayer().TransportFlow().EndpointType() { + if pkt.Packet.Layer(layers.LayerTypeTCP) != nil { +// case 4: + proto = "TCP" + } else if pkt.Packet.Layer(layers.LayerTypeUDP) != nil { +// case 5: + proto = "UDP" } if proto == "TCP" {