All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kirjanov <kda@linux-powerpc.org>
To: Roman Gushchin <klamm@yandex-team.ru>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] net: sysctl for RA default route MTU
Date: Wed, 25 Mar 2015 15:34:38 +0300	[thread overview]
Message-ID: <CAOJe8K1QCE37jDTpMbkUC3WOBu1WOhQfta0jWOQ3URPUjnjzUw@mail.gmail.com> (raw)
In-Reply-To: <1427281679-13007-1-git-send-email-klamm@yandex-team.ru>

On 3/25/15, Roman Gushchin <klamm@yandex-team.ru> wrote:
> This patch introduces new ipv6 sysctl: ra_default_route_mtu.
> If it's set (> 0), it defines per-route MTU for any new default route
> received by RA.
>
> This sysctl will help in the following configuration: we want to use
> jumbo-frames for internal networks and default ethernet frames for
> default route. Per-route MTU can only lower per-link MTU, so link MTU
> should be set to ~9000 (statically or via RA).
>
> Due to dynamic nature of RA, setting MTU for default route will require
> userspace agent, that will monitor changes of default route
> and (re)configure it. Not simple. The suggested sysctl solves this
> problem.
>
> Signed-off-by: Roman Gushchin <klamm@yandex-team.ru>

It's net-next material

> ---
>
> Changes from v1: add forgotten brace.
> ---
>  Documentation/networking/ip-sysctl.txt |  5 +++++
>  include/linux/ipv6.h                   |  1 +
>  include/uapi/linux/ipv6.h              |  1 +
>  net/ipv6/addrconf.c                    | 10 ++++++++++
>  net/ipv6/ndisc.c                       |  3 ++-
>  net/ipv6/route.c                       |  8 ++++++++
>  6 files changed, 27 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/networking/ip-sysctl.txt
> b/Documentation/networking/ip-sysctl.txt
> index 1b8c964..c013dda 100644
> --- a/Documentation/networking/ip-sysctl.txt
> +++ b/Documentation/networking/ip-sysctl.txt
> @@ -1316,6 +1316,11 @@ accept_ra_mtu - BOOLEAN
>  	Functional default: enabled if accept_ra is enabled.
>  			    disabled if accept_ra is disabled.
>
> +ra_default_route_mtu - INTEGER
> +	Define MTU for any new default route received by RA.
> +
> +	Functional default: disabled (0).
> +
>  accept_redirects - BOOLEAN
>  	Accept Redirects.
>
> diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
> index 4d5169f..b310c9f 100644
> --- a/include/linux/ipv6.h
> +++ b/include/linux/ipv6.h
> @@ -40,6 +40,7 @@ struct ipv6_devconf {
>  	__s32		proxy_ndp;
>  	__s32		accept_source_route;
>  	__s32		accept_ra_from_local;
> +	__s32		ra_default_route_mtu;
>  #ifdef CONFIG_IPV6_OPTIMISTIC_DAD
>  	__s32		optimistic_dad;
>  	__s32		use_optimistic;
> diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h
> index 437a6a4..4539c31 100644
> --- a/include/uapi/linux/ipv6.h
> +++ b/include/uapi/linux/ipv6.h
> @@ -170,6 +170,7 @@ enum {
>  	DEVCONF_ACCEPT_RA_FROM_LOCAL,
>  	DEVCONF_USE_OPTIMISTIC,
>  	DEVCONF_ACCEPT_RA_MTU,
> +	DEVCONF_RA_DEFAULT_ROUTE_MTU,
>  	DEVCONF_MAX
>  };
>
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index b603002..322dd733 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -189,6 +189,7 @@ static struct ipv6_devconf ipv6_devconf __read_mostly =
> {
>  	.accept_ra_defrtr	= 1,
>  	.accept_ra_from_local	= 0,
>  	.accept_ra_pinfo	= 1,
> +	.ra_default_route_mtu	= 0,
>  #ifdef CONFIG_IPV6_ROUTER_PREF
>  	.accept_ra_rtr_pref	= 1,
>  	.rtr_probe_interval	= 60 * HZ,
> @@ -240,6 +241,7 @@ static struct ipv6_devconf ipv6_devconf_dflt
> __read_mostly = {
>  	.accept_dad		= 1,
>  	.suppress_frag_ndisc	= 1,
>  	.accept_ra_mtu		= 1,
> +	.ra_default_route_mtu	= 0,
>  };
>
>  /* Check if a valid qdisc is available */
> @@ -4398,6 +4400,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_ACCEPT_RA_MTU] = cnf->accept_ra_mtu;
> +	array[DEVCONF_RA_DEFAULT_ROUTE_MTU] = cnf->ra_default_route_mtu;
>  }
>
>  static inline size_t inet6_ifla6_size(void)
> @@ -5315,6 +5318,13 @@ static struct addrconf_sysctl_table
>  			.proc_handler	= proc_dointvec,
>  		},
>  		{
> +			.procname	= "ra_default_route_mtu",
> +			.data		= &ipv6_devconf.ra_default_route_mtu,
> +			.maxlen		= sizeof(int),
> +			.mode		= 0644,
> +			.proc_handler	= proc_dointvec,
> +		},
> +		{
>  			/* sentinel */
>  		}
>  	},
> diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
> index 471ed24..c70ab44 100644
> --- a/net/ipv6/ndisc.c
> +++ b/net/ipv6/ndisc.c
> @@ -1362,7 +1362,8 @@ skip_routeinfo:
>  		} else if (in6_dev->cnf.mtu6 != mtu) {
>  			in6_dev->cnf.mtu6 = mtu;
>
> -			if (rt)
> +			if (rt && (!in6_dev->cnf.ra_default_route_mtu ||
> +				   mtu < in6_dev->cnf.ra_default_route_mtu))
>  				dst_metric_set(&rt->dst, RTAX_MTU, mtu);
>
>  			rt6_mtu_change(skb->dev, mtu);
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 4688bd4..6394adf 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -1714,6 +1714,14 @@ int ip6_route_add(struct fib6_config *cfg)
>
>  	rt->rt6i_flags = cfg->fc_flags;
>
> +	if ((cfg->fc_flags & (RTF_ADDRCONF | RTF_DEFAULT | RTF_GATEWAY)) ==
> +	    (RTF_ADDRCONF | RTF_DEFAULT | RTF_GATEWAY)) {
> +		u32 mtu = idev->cnf.ra_default_route_mtu;
> +
> +		if (mtu && mtu >= IPV6_MIN_MTU && mtu <= idev->cnf.mtu6)
> +			dst_metric_set(&rt->dst, RTAX_MTU, mtu);
> +	}
> +
>  install_route:
>  	rt->dst.dev = dev;
>  	rt->rt6i_idev = idev;
> --
> 2.1.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  reply	other threads:[~2015-03-25 12:34 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24 18:03 [PATCH] net: sysctl for RA default route MTU Roman Gushchin
2015-03-24 19:27 ` David Miller
2015-03-25  9:49   ` Roman Gushchin
2015-03-25 11:07   ` [PATCH v2] " Roman Gushchin
2015-03-25 12:34     ` Denis Kirjanov [this message]
2015-03-25 15:52     ` Hannes Frederic Sowa
     [not found]       ` <39171427301187@webcorp02f.yandex-team.ru>
2015-03-25 18:14         ` Hannes Frederic Sowa
2015-03-26 11:49           ` [PATCH v3] " Roman Gushchin
2015-03-26 14:49             ` Hannes Frederic Sowa
2015-03-29 19:42             ` David Miller
2015-03-30 12:30               ` Roman Gushchin
2015-03-31 20:05                 ` David Miller
2015-03-31 20:35                   ` Hannes Frederic Sowa
2015-03-31 20:49                     ` David Miller
2015-04-01  9:58                       ` Roman Gushchin
2015-04-01 17:55                         ` David Miller
2015-04-01 19:27                           ` Hannes Frederic Sowa
2015-04-02 18:08                             ` Roman Gushchin
2015-04-07 15:58                               ` Hannes Frederic Sowa
2015-04-08 19:03                                 ` Roman Gushchin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOJe8K1QCE37jDTpMbkUC3WOBu1WOhQfta0jWOQ3URPUjnjzUw@mail.gmail.com \
    --to=kda@linux-powerpc.org \
    --cc=davem@davemloft.net \
    --cc=klamm@yandex-team.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.