Skip to content

Commit f384742

Browse files
committed
net/packet: allow more ICMP errors
We now allow some more ICMP errors to flow, specifically: - ICMP parameter problem in both IPv4 and IPv6 (corrupt headers) - ICMP Packet Too Big (for IPv6 PMTU) Updates tailscale#311 Updates tailscale#8102 Updates tailscale#11002 Signed-off-by: James Tucker <james@tailscale.com>
1 parent 92ca770 commit f384742

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

net/packet/icmp4.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const (
2323
ICMP4EchoRequest ICMP4Type = 0x08
2424
ICMP4Unreachable ICMP4Type = 0x03
2525
ICMP4TimeExceeded ICMP4Type = 0x0b
26+
ICMP4ParamProblem ICMP4Type = 0x12
2627
)
2728

2829
func (t ICMP4Type) String() string {
@@ -35,6 +36,8 @@ func (t ICMP4Type) String() string {
3536
return "Unreachable"
3637
case ICMP4TimeExceeded:
3738
return "TimeExceeded"
39+
case ICMP4ParamProblem:
40+
return "ParamProblem"
3841
default:
3942
return "Unknown"
4043
}

net/packet/icmp6.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ type ICMP6Type uint8
2020

2121
const (
2222
ICMP6Unreachable ICMP6Type = 1
23+
ICMP6PacketTooBig ICMP6Type = 2
2324
ICMP6TimeExceeded ICMP6Type = 3
25+
ICMP6ParamProblem ICMP6Type = 4
2426
ICMP6EchoRequest ICMP6Type = 128
2527
ICMP6EchoReply ICMP6Type = 129
2628
)
@@ -29,8 +31,12 @@ func (t ICMP6Type) String() string {
2931
switch t {
3032
case ICMP6Unreachable:
3133
return "Unreachable"
34+
case ICMP6PacketTooBig:
35+
return "PacketTooBig"
3236
case ICMP6TimeExceeded:
3337
return "TimeExceeded"
38+
case ICMP6ParamProblem:
39+
return "ParamProblem"
3440
case ICMP6EchoRequest:
3541
return "EchoRequest"
3642
case ICMP6EchoReply:

net/packet/packet.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,13 +416,13 @@ func (q *Parsed) IsError() bool {
416416
return false
417417
}
418418
t := ICMP4Type(q.b[q.subofs])
419-
return t == ICMP4Unreachable || t == ICMP4TimeExceeded
419+
return t == ICMP4Unreachable || t == ICMP4TimeExceeded || t == ICMP4ParamProblem
420420
case ipproto.ICMPv6:
421421
if len(q.b) < q.subofs+8 {
422422
return false
423423
}
424424
t := ICMP6Type(q.b[q.subofs])
425-
return t == ICMP6Unreachable || t == ICMP6TimeExceeded
425+
return t == ICMP6Unreachable || t == ICMP6PacketTooBig || t == ICMP6TimeExceeded || t == ICMP6ParamProblem
426426
default:
427427
return false
428428
}

0 commit comments

Comments
 (0)