Skip to content

Commit

Permalink
ipv4: icmp: do not process ICMP_EXT_ECHOREPLY for broadcast/multicast…
Browse files Browse the repository at this point in the history
… addresses

There is no point processing ICMP_EXT_ECHOREPLY for routes
which would drop ICMP_ECHOREPLY (RFC 1122 3.2.2.6, 3.2.2.8)

This seems an oversight of the initial implementation.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Link: https://patch.msgid.link/20250226183437.1457318-2-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Eric Dumazet authored and Jakub Kicinski committed Feb 28, 2025
1 parent 8e7e3d9 commit daeb6a8
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions net/ipv4/icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1248,22 +1248,6 @@ int icmp_rcv(struct sk_buff *skb)
goto reason_check;
}

if (icmph->type == ICMP_EXT_ECHOREPLY) {
reason = ping_rcv(skb);
goto reason_check;
}

/*
* 18 is the highest 'known' ICMP type. Anything else is a mystery
*
* RFC 1122: 3.2.2 Unknown ICMP messages types MUST be silently
* discarded.
*/
if (icmph->type > NR_ICMP_TYPES) {
reason = SKB_DROP_REASON_UNHANDLED_PROTO;
goto error;
}

/*
* Parse the ICMP message
*/
Expand All @@ -1290,6 +1274,22 @@ int icmp_rcv(struct sk_buff *skb)
}
}

if (icmph->type == ICMP_EXT_ECHOREPLY) {
reason = ping_rcv(skb);
goto reason_check;
}

/*
* 18 is the highest 'known' ICMP type. Anything else is a mystery
*
* RFC 1122: 3.2.2 Unknown ICMP messages types MUST be silently
* discarded.
*/
if (icmph->type > NR_ICMP_TYPES) {
reason = SKB_DROP_REASON_UNHANDLED_PROTO;
goto error;
}

reason = icmp_pointers[icmph->type].handler(skb);
reason_check:
if (!reason) {
Expand Down

0 comments on commit daeb6a8

Please sign in to comment.