From 14f80450fb632b77a5daecbfa3106d76fc5e6367 Mon Sep 17 00:00:00 2001 From: JackDoan Date: Tue, 29 Sep 2026 15:51:59 -0500 Subject: [PATCH] allow more protos to have ports parsed --- iputil/packet.go | 3 +++ outside.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/iputil/packet.go b/iputil/packet.go index 166ede60..0b7cad3a 100644 --- a/iputil/packet.go +++ b/iputil/packet.go @@ -32,6 +32,9 @@ const ( IPProtocolICMPv6 = 58 IPProtocolTCP = 6 IPProtocolUDP = 17 + IPProtocolUDPLite = 136 + IPProtocolDCCP = 33 + IPProtocolSCTP = 132 ICMPv6TypeEchoRequest = 128 ICMPv6TypeEchoReply = 129 ) diff --git a/outside.go b/outside.go index f449511e..3ae326fd 100644 --- a/outside.go +++ b/outside.go @@ -385,7 +385,7 @@ func parseV6(data []byte, incoming bool, fp *firewall.ParsedPacket) error { fp.RemotePort = 0 } - case iputil.IPProtocolTCP, iputil.IPProtocolUDP: + case iputil.IPProtocolTCP, iputil.IPProtocolUDP, iputil.IPProtocolDCCP, iputil.IPProtocolSCTP, iputil.IPProtocolUDPLite: if dataLen < offset+4 { return ErrIPv6PacketTooShort } @@ -464,7 +464,7 @@ func parseV4(data []byte, incoming bool, fp *firewall.ParsedPacket) error { fp.RemotePort = binary.BigEndian.Uint16(data[ihl+4 : ihl+6]) //identifier fp.LocalPort = 0 //code would be uint16(data[ihl+1]) - case iputil.IPProtocolTCP, iputil.IPProtocolUDP: + case iputil.IPProtocolTCP, iputil.IPProtocolUDP, iputil.IPProtocolDCCP, iputil.IPProtocolSCTP, iputil.IPProtocolUDPLite: if incoming { fp.RemotePort = binary.BigEndian.Uint16(data[ihl : ihl+2]) //src port fp.LocalPort = binary.BigEndian.Uint16(data[ihl+2 : ihl+4]) //dst port