Fix the length check for reinjected ICMP packets: sizeof(struct icmp) is
authorlteo <lteo@openbsd.org>
Sun, 10 Aug 2014 03:26:20 +0000 (03:26 +0000)
committerlteo <lteo@openbsd.org>
Sun, 10 Aug 2014 03:26:20 +0000 (03:26 +0000)
commit74c8ac698c9829f14fb658bb2ff2fe17503505fe
tree1300db28144d83e6939f240ca124d99311d83a3e
parentf3d2a372a924371acc2cba30d1ef1c71908d2fe8
Fix the length check for reinjected ICMP packets: sizeof(struct icmp) is
28 but an ICMP packet can be as small as 8 bytes (e.g. an ICMP echo
request packet with no payload), so check against ICMP_MINLEN instead.

Prior to this fix, divert(4) would erroneously discard valid ICMP
packets that are shorter than 20 bytes.

ICMPv6 is not affected, so this change applies to ICMP over IPv4 only.

ok florian@ henning@
sys/netinet/ip_divert.c