summaryrefslogtreecommitdiffstats
path: root/ipv6nd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2013-12-12 13:33:09 +0000
committerRoy Marples <roy@marples.name>2013-12-12 13:33:09 +0000
commit65e5b9f9c48518291cc75781119aed90bf6f7f74 (patch)
tree9ac327fa022a4622a810fd786b674dcd1a5ef8d2 /ipv6nd.c
parente016632bd56a4d48f333e7fbd99757d2c91fa598 (diff)
downloaddhcpcd-65e5b9f9c48518291cc75781119aed90bf6f7f74.tar.xz
Android ships buggy ICMP6 filter headers.
Supply our own until they fix their shit.
Diffstat (limited to 'ipv6nd.c')
-rw-r--r--ipv6nd.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/ipv6nd.c b/ipv6nd.c
index b066112b..e15004e8 100644
--- a/ipv6nd.c
+++ b/ipv6nd.c
@@ -152,6 +152,34 @@ struct rahead ipv6_routers = TAILQ_HEAD_INITIALIZER(ipv6_routers);
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)