summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/in.h9
-rw-r--r--sys/netinet/ip_input.c7
2 files changed, 13 insertions, 3 deletions
diff --git a/sys/netinet/in.h b/sys/netinet/in.h
index 87ceda5a391..42ca8ab8a2e 100644
--- a/sys/netinet/in.h
+++ b/sys/netinet/in.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.h,v 1.83 2010/05/11 09:25:10 claudio Exp $ */
+/* $OpenBSD: in.h,v 1.84 2010/06/07 13:26:35 henning Exp $ */
/* $NetBSD: in.h,v 1.20 1996/02/13 23:41:47 christos Exp $ */
/*
@@ -195,6 +195,13 @@ struct in_addr {
#define IN_LOCAL_GROUP(i) (((u_int32_t)(i) & __IPADDR(0xffffff00)) == \
__IPADDR(0xe0000000))
+#ifdef _KERNEL
+#define IN_CLASSFULBROADCAST(i, b) \
+ ((IN_CLASSC(b) && (b | IN_CLASSC_HOST) == i) || \
+ (IN_CLASSB(b) && (b | IN_CLASSB_HOST) == i) || \
+ (IN_CLASSA(b) && (b | IN_CLASSA_HOST) == i))
+#endif /* _KERNEL */
+
#define INADDR_ANY __IPADDR(0x00000000)
#define INADDR_LOOPBACK __IPADDR(0x7f000001)
#define INADDR_BROADCAST __IPADDR(0xffffffff) /* must be masked */
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 23ed1aa375e..e8177a35e42 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_input.c,v 1.180 2010/06/04 11:35:43 blambert Exp $ */
+/* $OpenBSD: ip_input.c,v 1.181 2010/06/07 13:26:35 henning Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/*
@@ -691,10 +691,13 @@ in_iawithaddr(struct in_addr ina, struct mbuf *m, u_int rdomain)
(IFF_LOOPBACK|IFF_LINK1) &&
ia->ia_net == (ina.s_addr & ia->ia_netmask)))
return ia;
+ /* check ancient classful too, e. g. for rarp-based netboot */
if (((ip_directedbcast == 0) || (m && ip_directedbcast &&
ia->ia_ifp == m->m_pkthdr.rcvif)) &&
(ia->ia_ifp->if_flags & IFF_BROADCAST)) {
- if (ina.s_addr == ia->ia_broadaddr.sin_addr.s_addr) {
+ if (ina.s_addr == ia->ia_broadaddr.sin_addr.s_addr ||
+ IN_CLASSFULBROADCAST(ina.s_addr,
+ ia->ia_addr.sin_addr.s_addr)) {
/* Make sure M_BCAST is set */
if (m)
m->m_flags |= M_BCAST;