diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2008-09-25 18:37:08 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2008-09-25 18:37:08 +0000 |
| commit | af82b7bd5b71d5f25c4c40e9965899d597437833 (patch) | |
| tree | ac390f2cafe631991ee03f9a67a1d9bba53b886c | |
| parent | bb1527c61c8a0698065a4a0ecc3c8db51cb21938 (diff) | |
Notes
| -rw-r--r-- | sys/netinet/in.h | 2 | ||||
| -rw-r--r-- | sys/netinet/ip_icmp.c | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/sys/netinet/in.h b/sys/netinet/in.h index 1fca43d43792..e9847381a0fb 100644 --- a/sys/netinet/in.h +++ b/sys/netinet/in.h @@ -379,6 +379,8 @@ __END_DECLS #define IN_BADCLASS(i) (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) #define IN_LINKLOCAL(i) (((u_int32_t)(i) & 0xffff0000) == 0xa9fe0000) +#define IN_LOOPBACK(i) (((u_int32_t)(i) & 0xff000000) == 0x7f000000) +#define IN_ZERONET(i) (((u_int32_t)(i) & 0xff000000) == 0) #define IN_PRIVATE(i) ((((u_int32_t)(i) & 0xff000000) == 0x0a000000) || \ (((u_int32_t)(i) & 0xfff00000) == 0xac100000) || \ diff --git a/sys/netinet/ip_icmp.c b/sys/netinet/ip_icmp.c index 59f190faba5a..7183339c65c4 100644 --- a/sys/netinet/ip_icmp.c +++ b/sys/netinet/ip_icmp.c @@ -629,13 +629,14 @@ icmp_reflect(struct mbuf *m) struct mbuf *opts = 0; int optlen = (ip->ip_hl << 2) - sizeof(struct ip); - if (!in_canforward(ip->ip_src) && - ((ntohl(ip->ip_src.s_addr) & IN_CLASSA_NET) != - (IN_LOOPBACKNET << IN_CLASSA_NSHIFT))) { + if (IN_MULTICAST(ntohl(ip->ip_src.s_addr)) || + IN_EXPERIMENTAL(ntohl(ip->ip_src.s_addr)) || + IN_ZERONET(ntohl(ip->ip_src.s_addr)) ) { m_freem(m); /* Bad return address */ icmpstat.icps_badaddr++; goto done; /* Ip_output() will check for broadcast */ } + t = ip->ip_dst; ip->ip_dst = ip->ip_src; |
