summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>2001-06-14 18:00:03 +0000
committerNiels Provos <provos@cvs.openbsd.org>2001-06-14 18:00:03 +0000
commitcd048a35906aa4c3661cef4f9d8b60e4561d1c7f (patch)
treec458f9fe589041a8a1581373e1445b5d030e4d9e /sys
parent7092148fc00b8090b808d58567aebb003dca93ab (diff)
limited broadcast 255.255.255.255 was not recognized correctly, reported
by crh@ubiqx.mn.org, fix from NetBSD; okay angelos@
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_output.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 180412f42ec..b3b0e6ed34c 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_output.c,v 1.102 2001/06/12 10:59:53 angelos Exp $ */
+/* $OpenBSD: ip_output.c,v 1.103 2001/06/14 18:00:02 provos Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@@ -400,10 +400,12 @@ ip_output(m0, va_alist)
ip->ip_src = ia->ia_addr.sin_addr;
}
- if (IN_MULTICAST(ip->ip_dst.s_addr)) {
+ if (IN_MULTICAST(ip->ip_dst.s_addr) ||
+ (ip->ip_dst.s_addr == INADDR_BROADCAST)) {
struct in_multi *inm;
- m->m_flags |= M_MCAST;
+ m->m_flags |= (ip->ip_dst.s_addr == INADDR_BROADCAST) ?
+ M_BCAST : M_MCAST;
/*
* IP destination address is multicast. Make sure "dst"
@@ -427,7 +429,10 @@ ip_output(m0, va_alist)
* but only if the packet actually is going out on that
* interface (i.e., no IPsec is applied).
*/
- if (((ifp->if_flags & IFF_MULTICAST) == 0) && (sproto == 0)) {
+ if ((((m->m_flags & M_MCAST) &&
+ (ifp->if_flags & IFF_MULTICAST) == 0) ||
+ ((m->m_flags & M_BCAST) &&
+ (ifp->if_flags & IFF_BROADCAST) == 0)) && (sproto == 0)) {
ipstat.ips_noroute++;
error = ENETUNREACH;
goto bad;