diff options
| author | 2014-11-20 11:05:19 +0000 | |
|---|---|---|
| committer | 2014-11-20 11:05:19 +0000 | |
| commit | 7e5860a99c6711cecfbf255f88bb15e43abe37ce (patch) | |
| tree | da317cf883a9e0c4d88535deb5b65e90a9fd82ac /sys/netinet/udp_usrreq.c | |
| parent | Fix previous. (diff) | |
| download | wireguard-openbsd-7e5860a99c6711cecfbf255f88bb15e43abe37ce.tar.xz wireguard-openbsd-7e5860a99c6711cecfbf255f88bb15e43abe37ce.zip | |
In TCP and UDP layers do not (ab)use the receiving interface to check
for a multicast/broadcast destination address.
These checks have already been done in the Ethernet and IP layers and
the mbuf(9) should contain all the required information at this point.
But since we cannot trust this spaghetti stack, be paranoid and make
sure to set the flags in the IP input routines.
Use explicit comments, requested by deraadt@. ok claudio@
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
| -rw-r--r-- | sys/netinet/udp_usrreq.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 1ccc39ee992..f8e192bcc72 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_usrreq.c,v 1.191 2014/11/09 22:05:08 bluhm Exp $ */ +/* $OpenBSD: udp_usrreq.c,v 1.192 2014/11/20 11:05:19 mpi Exp $ */ /* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */ /* @@ -400,16 +400,7 @@ udp_input(struct mbuf *m, ...) } #endif -#ifdef INET6 - if ((ip6 && IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) || - (ip && IN_MULTICAST(ip->ip_dst.s_addr)) || - (ip && in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif, - m->m_pkthdr.ph_rtableid))) { -#else /* INET6 */ - if (IN_MULTICAST(ip->ip_dst.s_addr) || - in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif, - m->m_pkthdr.ph_rtableid)) { -#endif /* INET6 */ + if (m->m_flags & (M_BCAST|M_MCAST)) { struct inpcb *last; /* * Deliver a multicast or broadcast datagram to *all* sockets |
