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

Commit befc6722 authored by Harout Hedeshian's avatar Harout Hedeshian Committed by Subash Abhinov Kasiviswanathan
Browse files

net: ipv6: Add sysctl entry to disable MTU updates from RA



The kernel forcefully applies MTU values received in router
advertisements provided the new MTU is less than the current. This
behavior is undesirable when the user space is managing the MTU. Instead
a sysctl flag 'accept_ra_mtu' is introduced such that the user space
can control whether or not RA provided MTU updates should be applied.
The default behavior is unchanged; user space must explicitly set this flag
to 0 for RA MTUs to be ignored.

CRs-Fixed: 1076670
Change-Id: I9b2672d7c7804b6d5394516f451888d3ac8d7803
Signed-off-by: default avatarHarout Hedeshian <harouth@codeaurora.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: default avatarSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
parent c4e05e15
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1301,6 +1301,13 @@ accept_ra_prefix_route - BOOLEAN

	Functional default: enabled

accept_ra_mtu - BOOLEAN
	Apply the MTU value specified in RA option 5 (RFC4861). If
	disabled, the MTU specified in the RA will be ignored.

	Functional default: enabled if accept_ra is enabled.
			    disabled if accept_ra is disabled.

accept_redirects - BOOLEAN
	Accept Redirects.

+1 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ struct ipv6_devconf {
	__s32		suppress_frag_ndisc;
	__s32		accept_ra_prefix_route;
	__s32		use_oif_addrs_only;
	__s32		accept_ra_mtu;
	void		*sysctl;
};

+1 −0
Original line number Diff line number Diff line
@@ -168,6 +168,7 @@ enum {
	DEVCONF_USE_OPTIMISTIC,
	DEVCONF_ACCEPT_RA_PREFIX_ROUTE,
	DEVCONF_USE_OIF_ADDRS_ONLY,
	DEVCONF_ACCEPT_RA_MTU,
	DEVCONF_MAX
};

+10 −0
Original line number Diff line number Diff line
@@ -204,6 +204,7 @@ static struct ipv6_devconf ipv6_devconf __read_mostly = {
	.suppress_frag_ndisc	= 1,
	.accept_ra_prefix_route = 1,
	.use_oif_addrs_only	= 0,
	.accept_ra_mtu		= 1,
};

static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
@@ -244,6 +245,7 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
	.suppress_frag_ndisc	= 1,
	.accept_ra_prefix_route = 1,
	.use_oif_addrs_only	= 0,
	.accept_ra_mtu		= 1,
};

/* Check if a valid qdisc is available */
@@ -4466,6 +4468,7 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
	array[DEVCONF_SUPPRESS_FRAG_NDISC] = cnf->suppress_frag_ndisc;
	array[DEVCONF_ACCEPT_RA_FROM_LOCAL] = cnf->accept_ra_from_local;
	array[DEVCONF_USE_OIF_ADDRS_ONLY] = cnf->use_oif_addrs_only;
	array[DEVCONF_ACCEPT_RA_MTU] = cnf->accept_ra_mtu;
}

static inline size_t inet6_ifla6_size(void)
@@ -5394,6 +5397,13 @@ static struct addrconf_sysctl_table
			.mode           = 0644,
			.proc_handler   = proc_dointvec,
		},
		{
			.procname	= "accept_ra_mtu",
			.data		= &ipv6_devconf.accept_ra_mtu,
			.maxlen		= sizeof(int),
			.mode		= 0644,
			.proc_handler	= proc_dointvec,
		},
		{
			/* sentinel */
		}
+1 −1
Original line number Diff line number Diff line
@@ -1356,7 +1356,7 @@ skip_routeinfo:
		}
	}

	if (ndopts.nd_opts_mtu) {
	if (ndopts.nd_opts_mtu && in6_dev->cnf.accept_ra_mtu) {
		__be32 n;
		u32 mtu;