allow more protos to have ports parsed

This commit is contained in:
JackDoan committed 2026-09-29 15:51:59 -05:00
1 parent 641d1fb703
commit 14f80450fb
2 files changed
+5 -2

No files matched your search

+3
View File
@@ -32,6 +32,9 @@ const (
IPProtocolICMPv6 = 58 IPProtocolICMPv6 = 58
IPProtocolTCP = 6 IPProtocolTCP = 6
IPProtocolUDP = 17 IPProtocolUDP = 17
IPProtocolUDPLite = 136
IPProtocolDCCP = 33
IPProtocolSCTP = 132
ICMPv6TypeEchoRequest = 128 ICMPv6TypeEchoRequest = 128
ICMPv6TypeEchoReply = 129 ICMPv6TypeEchoReply = 129
) )
+2 -2
View File
@@ -385,7 +385,7 @@ func parseV6(data []byte, incoming bool, fp *firewall.ParsedPacket) error {
fp.RemotePort = 0 fp.RemotePort = 0
} }
case iputil.IPProtocolTCP, iputil.IPProtocolUDP: case iputil.IPProtocolTCP, iputil.IPProtocolUDP, iputil.IPProtocolDCCP, iputil.IPProtocolSCTP, iputil.IPProtocolUDPLite:
if dataLen < offset+4 { if dataLen < offset+4 {
return ErrIPv6PacketTooShort 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.RemotePort = binary.BigEndian.Uint16(data[ihl+4 : ihl+6]) //identifier
fp.LocalPort = 0 //code would be uint16(data[ihl+1]) 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 { if incoming {
fp.RemotePort = binary.BigEndian.Uint16(data[ihl : ihl+2]) //src port fp.RemotePort = binary.BigEndian.Uint16(data[ihl : ihl+2]) //src port
fp.LocalPort = binary.BigEndian.Uint16(data[ihl+2 : ihl+4]) //dst port fp.LocalPort = binary.BigEndian.Uint16(data[ihl+2 : ihl+4]) //dst port