diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-03-19 14:58:55 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-03-19 14:58:55 +0000 |
commit | 2fdf264c02be93c0ec1c1bef136145a0a4cfb84b (patch) | |
tree | d3758fbf58cfc6bc7aa87960311b10d338d7f266 | |
parent | 67f8e8f437716aac0cdc60be570c68ffa1d0a1f3 (diff) |
drop TCP connections to broadcast address.
From: "Crist J. Clark" <cjclark@alum.mit.edu>
-rw-r--r-- | sys/netinet/tcp_input.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 83f82f07335..847eacf5947 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.109 2002/03/15 18:19:52 millert Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.110 2002/03/19 14:58:54 itojun Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -1080,21 +1080,19 @@ findpcb: /* * RFC1122 4.2.3.10, p. 104: discard bcast/mcast SYN - * in_broadcast() should never return true on a received - * packet with M_BCAST not set. */ if (m->m_flags & (M_BCAST|M_MCAST)) goto drop; switch (af) { #ifdef INET6 case AF_INET6: - /* XXX What about IPv6 Anycasting ?? :-( rja */ if (IN6_IS_ADDR_MULTICAST(&ipv6->ip6_dst)) goto drop; break; #endif /* INET6 */ case AF_INET: - if (IN_MULTICAST(ip->ip_dst.s_addr)) + if (IN_MULTICAST(ip->ip_dst.s_addr) || + in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif)) goto drop; break; } @@ -2139,7 +2137,8 @@ dropwithreset: break; #endif /* INET6 */ case AF_INET: - if (IN_MULTICAST(ip->ip_dst.s_addr)) + if (IN_MULTICAST(ip->ip_dst.s_addr) || + in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif)) goto drop; } if (tiflags & TH_ACK) { |