From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: Fan Du <fan.du@windriver.com>
Cc: netdev <netdev@vger.kernel.org>
Subject: Re: [DISCUSSION] rt6i_genid
Date: Thu, 18 Jul 2013 17:12:25 +0200 [thread overview]
Message-ID: <51E805D9.9040408@6wind.com> (raw)
In-Reply-To: <51E7B522.4070105@windriver.com>
Le 18/07/2013 11:28, Fan Du a écrit :
>
> Thanks for replying :)
>
> On 2013年07月18日 17:13, Nicolas Dichtel wrote:
>> Le 18/07/2013 05:22, Fan Du a écrit :
>>> Hello Nicolas
>>>
>>> Commit 6f3118b571b8a4c06c7985dc3172c3526cb86253: "ipv6: use net->rt_genid to
>>> check dst validity"
>>> makes ip6_dst_check to check rt6i_genid against with struct net->rt_genid,
>>> As a matter of fact, struct net->rt_genid could only be modified by two places,
>>> first is adding/delete IPv4 address, second is inserting new XFRM policy.
>>>
>>> Is there any other considerations that adding/deleting IPv4 address would
>>> invalid all IPv6 dst
>>> as well? because I'm working a patch which actually depends on the result of
>>> this question.
>> No, the goal was to cover the IPsec case, ie invalidate dst entries when an
>> xfrm policy is inserted/deleted.
>
> Ok, then how about we only checking rt6i_genid against rt_genid *only*
> when XFRM is enabled for IPv6, because when XFRM is not enabled for IPv6
> ip6_dst_check for rt_genid is really not necessary.
>
> So what do you think of below modifications?
Seems good. Just a small comment below.
>
> diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
> index 2a601e7..4ae35fd 100644
> --- a/include/net/ip6_fib.h
> +++ b/include/net/ip6_fib.h
> @@ -119,7 +119,9 @@ struct rt6_info {
> struct inet6_dev *rt6i_idev;
> unsigned long _rt6i_peer;
>
> +#ifdef CONFIG_XFRM
> u32 rt6i_genid;
> +#endif
>
> /* more non-fragment space at head required */
> unsigned short rt6i_nfheader_len;
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index bd5fd70..1b64406 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -277,7 +277,9 @@ static inline struct rt6_info *ip6_dst_alloc(struct net *net,
>
> memset(dst + 1, 0, sizeof(*rt) - sizeof(*dst));
> rt6_init_peer(rt, table ? &table->tb6_peers : net->ipv6.peers);
> +#ifdef CONFIG_XFRM
> rt->rt6i_genid = rt_genid(net);
> +#endif
> INIT_LIST_HEAD(&rt->rt6i_siblings);
> rt->rt6i_nsiblings = 0;
> }
> @@ -1041,12 +1043,15 @@ static struct dst_entry *ip6_dst_check(struct dst_entry
> *dst, u32 cookie)
>
> rt = (struct rt6_info *) dst;
>
> +#ifdef CONFIG_XFRM
> /* All IPV6 dsts are created with ->obsolete set to the value
> * DST_OBSOLETE_FORCE_CHK which forces validation calls down
> * into this function always.
> + * Note: for IPv6, rt6i_genid is noly used when XFRM enabled.
indentation is wrong, but I'm not sure this comment is really needed ... you've
put the ifdef 4 lines above.
> */
> if (rt->rt6i_genid != rt_genid(dev_net(rt->dst.dev)))
> return NULL;
> +#endif
>
> if (rt->rt6i_node && (rt->rt6i_node->fn_sernum == cookie))
> return dst;
next prev parent reply other threads:[~2013-07-18 15:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-18 3:22 [DISCUSSION] rt6i_genid Fan Du
2013-07-18 9:13 ` Nicolas Dichtel
2013-07-18 9:28 ` Fan Du
2013-07-18 15:12 ` Nicolas Dichtel [this message]
2013-07-19 0:01 ` Fan Du
2013-07-19 3:18 ` David Miller
2013-07-19 3:28 ` Fan Du
2013-07-19 3:31 ` David Miller
2013-07-19 7:50 ` Fan Du
2013-07-19 9:33 ` David Miller
2013-07-22 5:43 ` [RFC PATCH net-next] net: split rt_genid for ipv4 and ipv6 Fan Du
2013-07-22 10:53 ` Steffen Klassert
2013-07-22 20:40 ` Nicolas Dichtel
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=51E805D9.9040408@6wind.com \
--to=nicolas.dichtel@6wind.com \
--cc=fan.du@windriver.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).