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.

Change-Id: I9b2672d7c7804b6d5394516f451888d3ac8d7803
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
This commit is contained in:
Harout Hedeshian
2015-10-20 15:47:58 +05:30
committed by Srinivasarao P
parent c177c662df
commit e5170374f1
4 changed files with 20 additions and 1 deletions
+7
View File
@@ -1117,6 +1117,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.
+2
View File
@@ -174,6 +174,7 @@ struct ipv6_devconf {
__s32 accept_dad;
__s32 force_tllao;
__s32 accept_ra_prefix_route;
__s32 accept_ra_mtu;
void *sysctl;
};
@@ -217,6 +218,7 @@ enum {
DEVCONF_FORCE_TLLAO,
DEVCONF_ACCEPT_RA_PREFIX_ROUTE,
DEVCONF_ACCEPT_RA_RT_TABLE,
DEVCONF_ACCEPT_RA_MTU,
DEVCONF_MAX
};
+10
View File
@@ -201,6 +201,7 @@ static struct ipv6_devconf ipv6_devconf __read_mostly = {
.disable_ipv6 = 0,
.accept_dad = 1,
.accept_ra_prefix_route = 1,
.accept_ra_mtu = 1,
};
static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
@@ -237,6 +238,7 @@ static struct ipv6_devconf ipv6_devconf_dflt __read_mostly = {
.disable_ipv6 = 0,
.accept_dad = 1,
.accept_ra_prefix_route = 1,
.accept_ra_mtu = 1,
};
/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
@@ -3962,6 +3964,7 @@ static inline void ipv6_store_devconf(struct ipv6_devconf *cnf,
array[DEVCONF_DISABLE_IPV6] = cnf->disable_ipv6;
array[DEVCONF_ACCEPT_DAD] = cnf->accept_dad;
array[DEVCONF_FORCE_TLLAO] = cnf->force_tllao;
array[DEVCONF_ACCEPT_RA_MTU] = cnf->accept_ra_mtu;
}
static inline size_t inet6_ifla6_size(void)
@@ -4646,6 +4649,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
View File
@@ -1379,7 +1379,7 @@ skip_routeinfo:
}
}
if (ndopts.nd_opts_mtu) {
if (ndopts.nd_opts_mtu && in6_dev->cnf.accept_ra_mtu) {
__be32 n;
u32 mtu;