All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dcbw@redhat.com>
To: Xin Long <lucien.xin@gmail.com>, network dev <netdev@vger.kernel.org>
Cc: davem@davemloft.net, Hannes Frederic Sowa <hannes@stressinduktion.org>
Subject: Re: [PATCHv3 net-next] ipv6: allow routes to be configured with expire values
Date: Wed, 16 Dec 2015 11:03:52 -0600	[thread overview]
Message-ID: <1450285432.23793.12.camel@redhat.com> (raw)
In-Reply-To: <3b977653c7ade52e180d754eb660ec66af212e94.1450259411.git.lucien.xin@gmail.com>

On Wed, 2015-12-16 at 17:50 +0800, Xin Long wrote:
> Add the support for adding expire value to routes,  requested by
> Tom Gundersen <teg@jklm.no> for systemd-networkd, and NetworkManager
> wants it too.
> 
> implement it by adding the new RTNETLINK attribute RTA_EXPIRES.

Could you also add bits to send RTA_EXPIRES back to userspace in the
route dump in rt6_fill_node(), so that userspace can figure out when
RTA_EXPIRES is supported or not?

(obviously having it there isn't foolproof as if there are no routes on
the system yet userspace can't figure out support, but it's better than
nothing...)

Thanks!
Dan

> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
>  include/uapi/linux/rtnetlink.h |  1 +
>  net/ipv6/route.c               | 10 ++++++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/include/uapi/linux/rtnetlink.h
> b/include/uapi/linux/rtnetlink.h
> index 123a5af..ca764b5 100644
> --- a/include/uapi/linux/rtnetlink.h
> +++ b/include/uapi/linux/rtnetlink.h
> @@ -311,6 +311,7 @@ enum rtattr_type_t {
>  	RTA_PREF,
>  	RTA_ENCAP_TYPE,
>  	RTA_ENCAP,
> +	RTA_EXPIRES,
>  	__RTA_MAX
>  };
>  
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index c83b6a5..3c8834b 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -2709,6 +2709,7 @@ static const struct nla_policy
> rtm_ipv6_policy[RTA_MAX+1] = {
>  	[RTA_PREF]              = { .type = NLA_U8 },
>  	[RTA_ENCAP_TYPE]	= { .type = NLA_U16 },
>  	[RTA_ENCAP]		= { .type = NLA_NESTED },
> +	[RTA_EXPIRES]		= { .type = NLA_U32 },
>  };
>  
>  static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr
> *nlh,
> @@ -2809,6 +2810,15 @@ static int rtm_to_fib6_config(struct sk_buff
> *skb, struct nlmsghdr *nlh,
>  	if (tb[RTA_ENCAP_TYPE])
>  		cfg->fc_encap_type =
> nla_get_u16(tb[RTA_ENCAP_TYPE]);
>  
> +	if (tb[RTA_EXPIRES]) {
> +		unsigned long timeout =
> addrconf_timeout_fixup(nla_get_u32(tb[RTA_EXPIRES]), HZ);
> +
> +		if (addrconf_finite_timeout(timeout)) {
> +			cfg->fc_expires = jiffies_to_clock_t(timeout
> * HZ);
> +			cfg->fc_flags |= RTF_EXPIRES;
> +		}
> +	}
> +
>  	err = 0;
>  errout:
>  	return err;

  parent reply	other threads:[~2015-12-16 17:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-16  9:50 [PATCHv3 net-next] ipv6: allow routes to be configured with expire values Xin Long
2015-12-16 11:19 ` Hannes Frederic Sowa
2015-12-16 17:03 ` Dan Williams [this message]
2015-12-17 20:08   ` David Miller
2015-12-17 20:23     ` Dan Williams
2015-12-17 20:32       ` Hannes Frederic Sowa
2015-12-17 21:26       ` David Miller
2015-12-17 20:09 ` David Miller

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=1450285432.23793.12.camel@redhat.com \
    --to=dcbw@redhat.com \
    --cc=davem@davemloft.net \
    --cc=hannes@stressinduktion.org \
    --cc=lucien.xin@gmail.com \
    --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.