mirror of
https://github.com/slackhq/nebula.git
synced 2026-11-15 12:36:52 +01:00
allow more protos to have ports parsed
This commit is contained in:
1 parent
641d1fb703
commit
14f80450fb
2 files changed
+5
-2
No files matched your search
@@ -32,6 +32,9 @@ const (
|
||||
IPProtocolICMPv6 = 58
|
||||
IPProtocolTCP = 6
|
||||
IPProtocolUDP = 17
|
||||
IPProtocolUDPLite = 136
|
||||
IPProtocolDCCP = 33
|
||||
IPProtocolSCTP = 132
|
||||
ICMPv6TypeEchoRequest = 128
|
||||
ICMPv6TypeEchoReply = 129
|
||||
)
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
Reference in new issue
Block a user