Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 55bc2419 authored by Tianyi Gou's avatar Tianyi Gou Committed by Stephen Boyd
Browse files

net/ipv6/addrconf: IPv6 tethering enhancement



Added new procfs flag to toggle the automatic addition of prefix
routes on a per device basis. The new flag is accept_ra_prefix_route.
Defaults to 1 as to not break existing behavior.

Change-Id: If25493890c7531c27f5b2c4855afebbbbf5d072a
CRs-Fixed: 435320
Acked-by: default avatarHarout S. Hedeshian <harouth@qti.qualcomm.com>
Signed-off-by: default avatarTianyi Gou <tgou@codeaurora.org>
parent 14c89d97
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1137,6 +1137,11 @@ accept_ra_rtr_pref - BOOLEAN
	Functional default: enabled if accept_ra is enabled.
			    disabled if accept_ra is disabled.

accept_ra_prefix_route - BOOLEAN
	Set the prefix route for the autoconfigured interface address

	Functional default: enabled

accept_redirects - BOOLEAN
	Accept Redirects.

+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ struct ipv6_devconf {
	__s32		accept_dad;
	__s32		force_tllao;
	__s32           ndisc_notify;
	__s32		accept_ra_prefix_route;
	void		*sysctl;
};

+1 −0
Original line number Diff line number Diff line
@@ -160,6 +160,7 @@ enum {
	DEVCONF_ACCEPT_DAD,
	DEVCONF_FORCE_TLLAO,
	DEVCONF_NDISC_NOTIFY,
	DEVCONF_ACCEPT_RA_PREFIX_ROUTE,
	DEVCONF_MAX
};

+1 −0
Original line number Diff line number Diff line
@@ -524,6 +524,7 @@ static const struct bin_table bin_net_ipv6_conf_var_table[] = {
	{ CTL_INT,	NET_IPV6_ACCEPT_RA_RT_INFO_MAX_PLEN,	"accept_ra_rt_info_max_plen" },
	{ CTL_INT,	NET_IPV6_PROXY_NDP,			"proxy_ndp" },
	{ CTL_INT,	NET_IPV6_ACCEPT_SOURCE_ROUTE,		"accept_source_route" },
	{ CTL_INT,	NET_IPV6_ACCEPT_RA_PREFIX_ROUTE,	"accept_ra_prefix_route" },
	{}
};

+15 −2
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@
 *	YOSHIFUJI Hideaki @USAGI	:	improved source address
 *						selection; consider scope,
 *						status etc.
 *	Harout S. Hedeshian		:	procfs flag to toggle automatic
 *						addition of prefix route
 */

#define pr_fmt(fmt) "IPv6: " fmt
@@ -202,6 +204,7 @@ static struct ipv6_devconf ipv6_devconf __read_mostly = {
	.accept_source_route	= 0,	/* we do not accept RH0 by default. */
	.disable_ipv6		= 0,
	.accept_dad		= 1,
	.accept_ra_prefix_route = 1,
};

static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
@@ -236,6 +239,7 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
	.accept_source_route	= 0,	/* we do not accept RH0 by default. */
	.disable_ipv6		= 0,
	.accept_dad		= 1,
	.accept_ra_prefix_route = 1,
};

/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
@@ -2121,8 +2125,10 @@ void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len, bool sllao)
				flags |= RTF_EXPIRES;
				expires = jiffies_to_clock_t(rt_expires);
			}
			addrconf_prefix_route(&pinfo->prefix, pinfo->prefix_len,
					      dev, expires, flags);
			if (dev->ip6_ptr->cnf.accept_ra_prefix_route) {
				addrconf_prefix_route(&pinfo->prefix,
					pinfo->prefix_len, dev, expires, flags);
			}
		}
		ip6_rt_put(rt);
	}
@@ -4928,6 +4934,13 @@ static struct addrconf_sysctl_table
			.mode           = 0644,
			.proc_handler   = proc_dointvec
		},
		{
			.procname	= "accept_ra_prefix_route",
			.data		= &ipv6_devconf.accept_ra_prefix_route,
			.maxlen		= sizeof(int),
			.mode		= 0644,
			.proc_handler	= proc_dointvec,
		},
		{
			/* sentinel */
		}