hotfix(pmtud/icmp): ignore non echo messages instead of returning an error

This commit is contained in:
Quentin McGaw
2026-02-19 18:05:48 +00:00
parent 007c5159f4
commit 2192874de8
+8 -2
View File
@@ -151,11 +151,17 @@ func collectReplies(conn net.PacketConn, ipVersion string,
return fmt.Errorf("parsing message: %w", err)
}
echoBody, ok := message.Body.(*icmp.Echo)
if !ok {
switch message.Body.(type) {
case *icmp.Echo:
case *icmp.DstUnreach, *icmp.TimeExceeded:
logger.Debugf("ignoring ICMP message (type: %d, code: %d)", message.Type, message.Code)
continue
default:
return fmt.Errorf("%w: %T", ErrBodyUnsupported, message.Body)
}
echoBody, _ := message.Body.(*icmp.Echo)
id := uint16(echoBody.ID) //nolint:gosec
testIndex, testing := echoIDToTestIndex[id]
if !testing { // not an id we expected so ignore it