summaryrefslogtreecommitdiff
path: root/sys/netinet/in.h
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2011-07-06 01:57:38 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2011-07-06 01:57:38 +0000
commit331b4363053aa0348db11124ffb4bbe57f433a8a (patch)
treeaafbb1d01e016aee46e6313cb4ccf591c05833ca /sys/netinet/in.h
parent45b3845c4bcc6cce64d0a683b18f928a9bda8d6a (diff)
allow /31s on broadcast interfaces (eg ethernet) to work as per rfc3021.
the issue in our kernel was the broadcast address calculated on the /31 caused a ton of checks for use of broadcast addresses to kick in and prevent one of the two addresses on the /31 from being used. this diff basically detects if a /31 has been configured and doesnt configure a broadcast address for it, which makes the ips usable for normal traffic. i wrote this so i could interoperate with "carrier" network gear better, and sthen wants it so he can conserve address space use. the further special casing of broadcast address handling was from claudio@ ok claudio@ markus@ sthen@ henning@
Diffstat (limited to 'sys/netinet/in.h')
-rw-r--r--sys/netinet/in.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/netinet/in.h b/sys/netinet/in.h
index 979f61ff831..adfd4b31f6f 100644
--- a/sys/netinet/in.h
+++ b/sys/netinet/in.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.h,v 1.89 2011/06/15 09:11:01 mikeb Exp $ */
+/* $OpenBSD: in.h,v 1.90 2011/07/06 01:57:37 dlg Exp $ */
/* $NetBSD: in.h,v 1.20 1996/02/13 23:41:47 christos Exp $ */
/*
@@ -187,6 +187,12 @@ struct in_addr {
#define IN_CLASSD_HOST __IPADDR(0x0fffffff)
#define IN_MULTICAST(i) IN_CLASSD(i)
+#define IN_RFC3021_NET __IPADDR(0xfffffffe)
+#define IN_RFC3021_NSHIFT 31
+#define IN_RFC3021_HOST __IPADDR(0x00000001)
+#define IN_RFC3021_SUBNET(n) (((u_int32_t)(n) & IN_RFC3021_NET) == \
+ IN_RFC3021_NET)
+
#define IN_EXPERIMENTAL(i) (((u_int32_t)(i) & __IPADDR(0xf0000000)) == \
__IPADDR(0xf0000000))
#define IN_BADCLASS(i) (((u_int32_t)(i) & __IPADDR(0xf0000000)) == \