changeset 2200:bdc70c92e7a1 draft

Android ships buggy ICMP6 filter headers. Supply our own until they fix their shit.
author Roy Marples <roy@marples.name>
date Thu, 12 Dec 2013 13:33:09 +0000
parents bb26f6bc07fc
children e3eb0a69b1db
files ipv6nd.c
diffstat 1 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ipv6nd.c	Thu Dec 12 10:24:14 2013 +0000
+++ b/ipv6nd.c	Thu Dec 12 13:33:09 2013 +0000
@@ -152,6 +152,34 @@
 
 static void ipv6nd_handledata(void *arg);
 
+/*
+ * Android ships buggy ICMP6 filter headers.
+ * Supply our own until they fix their shit.
+ * References:
+ *     https://android-review.googlesource.com/#/c/58438/
+ *     http://code.google.com/p/android/issues/original?id=32621&seq=24
+ */
+#ifdef __ANDROID__
+#undef ICMP6_FILTER_WILLPASS
+#undef ICMP6_FILTER_WILLBLOCK
+#undef ICMP6_FILTER_SETPASS
+#undef ICMP6_FILTER_SETBLOCK
+#undef ICMP6_FILTER_SETPASSALL
+#undef ICMP6_FILTER_SETBLOCKALL
+#define ICMP6_FILTER_WILLPASS(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
+#define ICMP6_FILTER_WILLBLOCK(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
+#define ICMP6_FILTER_SETPASS(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))))
+#define ICMP6_FILTER_SETBLOCK(type, filterp) \
+	((((filterp)->icmp6_filt[(type) >> 5]) |=  (1 << ((type) & 31))))
+#define ICMP6_FILTER_SETPASSALL(filterp) \
+	memset(filterp, 0, sizeof(struct icmp6_filter));
+#define ICMP6_FILTER_SETBLOCKALL(filterp) \
+	memset(filterp, 0xff, sizeof(struct icmp6_filter));
+#endif
+
 #if DEBUG_MEMORY
 static void
 ipv6nd_cleanup(void)