WindCharger: Backport accept_ra=2 support to kernel.
This is based on the infradead patch as can be found here:
http://git.infradead.org/linux-mtd.git/commit/65e9b62d4503849b10bedfc29bff0473760cc597
This addresses b/20558905
Change-Id: I5016b9153c796304cb2794f013383b92e6b336ff
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
old mode 100755
new mode 100644
index 18a066a..4628bd6
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1108,6 +1108,18 @@
rtnl_set_sk_err(net, RTNLGRP_ND_USEROPT, err);
}
+static inline int accept_ra(struct inet6_dev *in6_dev)
+{
+ /*
+ * If forwarding is enabled, RA are not accepted unless the special
+ * hybrid mode (accept_ra=2) is enabled.
+ */
+ if (in6_dev->cnf.forwarding && in6_dev->cnf.accept_ra < 2)
+ return 0;
+
+ return in6_dev->cnf.accept_ra;
+}
+
static void ndisc_router_discovery(struct sk_buff *skb)
{
struct ra_msg *ra_msg = (struct ra_msg *)skb_transport_header(skb);
@@ -1160,7 +1172,7 @@
return;
}
- if (in6_dev->cnf.forwarding || !in6_dev->cnf.accept_ra) {
+ if (!accept_ra(in6_dev)) {
in6_dev_put(in6_dev);
return;
}