summaryrefslogtreecommitdiffstats
path: root/sys/netinet6/ip6_var.h
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2005-07-02 23:13:31 +0000
committerthompsa <thompsa@FreeBSD.org>2005-07-02 23:13:31 +0000
commitd7e928629d1fd82199b336e5a513e6308c7ec45b (patch)
tree89cd1b3b1b8fc11081f836fcc5b77a4e00d644f2 /sys/netinet6/ip6_var.h
parentdd5c43b57252ea9dec17cd9c876da75544db45c4 (diff)
downloadFreeBSD-src-d7e928629d1fd82199b336e5a513e6308c7ec45b.zip
FreeBSD-src-d7e928629d1fd82199b336e5a513e6308c7ec45b.tar.gz
Check the alignment of the IP header before passing the packet up to the
packet filter. This would cause a panic on architectures that require strict alignment such as sparc64 (tier1) and ia64/ppc (tier2). This adds two new macros that check the alignment, these are compile time dependent on __NO_STRICT_ALIGNMENT which is set for i386 and amd64 where alignment isn't need so the cost is avoided. IP_HDR_ALIGNED_P() IP6_HDR_ALIGNED_P() Move bridge_ip_checkbasic()/bridge_ip6_checkbasic() up so that the alignment is checked for ipfw and dummynet too. PR: ia64/81284 Obtained from: NetBSD Approved by: re (dwhite), mlaier (mentor)
Diffstat (limited to 'sys/netinet6/ip6_var.h')
-rw-r--r--sys/netinet6/ip6_var.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h
index 4d0be83..227f75e 100644
--- a/sys/netinet6/ip6_var.h
+++ b/sys/netinet6/ip6_var.h
@@ -282,6 +282,12 @@ struct ip6aux {
#define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */
#define IPV6_MINMTU 0x04 /* use minimum MTU (IPV6_USE_MIN_MTU) */
+#ifdef __NO_STRICT_ALIGNMENT
+#define IP6_HDR_ALIGNED_P(ip) 1
+#else
+#define IP6_HDR_ALIGNED_P(ip) ((((intptr_t) (ip)) & 3) == 0)
+#endif
+
extern struct ip6stat ip6stat; /* statistics */
extern int ip6_defhlim; /* default hop limit */
extern int ip6_defmcasthlim; /* default multicast hop limit */
OpenPOWER on IntegriCloud