From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: Vlad Yasevich <vyasevich@gmail.com>
Cc: davem@davemloft.net, eric.dumazet@gmail.com, sri@us.ibm.com,
linux-sctp@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2 3/4] ipv6: use net->rt_genid to check dst validity
Date: Mon, 10 Sep 2012 14:34:44 +0000 [thread overview]
Message-ID: <504DFA84.40409@6wind.com> (raw)
In-Reply-To: <504DF950.4010401@gmail.com>
Le 10/09/2012 16:29, Vlad Yasevich a écrit :
> On 09/10/2012 09:22 AM, Nicolas Dichtel wrote:
>> IPv6 dst should take care of rt_genid too. When a xfrm policy is inserted or
>> deleted, all dst should be invalidated.
>> To force the validation, dst entries should be created with ->obsolete set to
>> DST_OBSOLETE_FORCE_CHK. This was already the case for all functions calling
>> ip6_dst_alloc(), except for ip6_rt_copy().
>>
>> As a consequence, we can remove the specific code in inet6_connection_sock.
>>
>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>> ---
>> include/net/ip6_fib.h | 2 +-
>> net/ipv6/inet6_connection_sock.c | 23 +----------------------
>> net/ipv6/route.c | 17 +++++++++++++----
>> 3 files changed, 15 insertions(+), 27 deletions(-)
>>
>> diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
>> index cd64cf3..5eb93f4 100644
>> --- a/include/net/ip6_fib.h
>> +++ b/include/net/ip6_fib.h
>> @@ -113,7 +113,7 @@ struct rt6_info {
>> unsigned long _rt6i_peer;
>>
>> #ifdef CONFIG_XFRM
>> - u32 rt6i_flow_cache_genid;
>> + u32 rt6i_genid;
>> #endif
>> /* more non-fragment space at head required */
>> unsigned short rt6i_nfheader_len;
>> diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
>> index 0251a60..c4f9341 100644
>> --- a/net/ipv6/inet6_connection_sock.c
>> +++ b/net/ipv6/inet6_connection_sock.c
>> @@ -175,33 +175,12 @@ void __inet6_csk_dst_store(struct sock *sk, struct
>> dst_entry *dst,
>> const struct in6_addr *saddr)
>> {
>> __ip6_dst_store(sk, dst, daddr, saddr);
>> -
>> -#ifdef CONFIG_XFRM
>> - {
>> - struct rt6_info *rt = (struct rt6_info *)dst;
>> - rt->rt6i_flow_cache_genid = atomic_read(&flow_cache_genid);
>> - }
>> -#endif
>> }
>>
>> static inline
>> struct dst_entry *__inet6_csk_dst_check(struct sock *sk, u32 cookie)
>> {
>> - struct dst_entry *dst;
>> -
>> - dst = __sk_dst_check(sk, cookie);
>> -
>> -#ifdef CONFIG_XFRM
>> - if (dst) {
>> - struct rt6_info *rt = (struct rt6_info *)dst;
>> - if (rt->rt6i_flow_cache_genid != atomic_read(&flow_cache_genid)) {
>> - __sk_dst_reset(sk);
>> - dst = NULL;
>> - }
>> - }
>> -#endif
>> -
>> - return dst;
>> + return __sk_dst_check(sk, cookie);
>> }
>>
>> static struct dst_entry *inet6_csk_route_socket(struct sock *sk,
>> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
>> index 339d921..db7b78f 100644
>> --- a/net/ipv6/route.c
>> +++ b/net/ipv6/route.c
>> @@ -281,13 +281,16 @@ static inline struct rt6_info *ip6_dst_alloc(struct net
>> *net,
>> struct fib6_table *table)
>> {
>> struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev,
>> - 0, DST_OBSOLETE_NONE, flags);
>> + 0, DST_OBSOLETE_FORCE_CHK, flags);
>>
>> if (rt) {
>> struct dst_entry *dst = &rt->dst;
>>
>> 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
>
> This isn't XFRM dependent any more, is it?
Not dependent, but for IPv6, it's only usefull when xfrm is set. Goal of this
ifdef was to avoid the test if xfrm is not used.
WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: Vlad Yasevich <vyasevich@gmail.com>
Cc: davem@davemloft.net, eric.dumazet@gmail.com, sri@us.ibm.com,
linux-sctp@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2 3/4] ipv6: use net->rt_genid to check dst validity
Date: Mon, 10 Sep 2012 16:34:44 +0200 [thread overview]
Message-ID: <504DFA84.40409@6wind.com> (raw)
In-Reply-To: <504DF950.4010401@gmail.com>
Le 10/09/2012 16:29, Vlad Yasevich a écrit :
> On 09/10/2012 09:22 AM, Nicolas Dichtel wrote:
>> IPv6 dst should take care of rt_genid too. When a xfrm policy is inserted or
>> deleted, all dst should be invalidated.
>> To force the validation, dst entries should be created with ->obsolete set to
>> DST_OBSOLETE_FORCE_CHK. This was already the case for all functions calling
>> ip6_dst_alloc(), except for ip6_rt_copy().
>>
>> As a consequence, we can remove the specific code in inet6_connection_sock.
>>
>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>> ---
>> include/net/ip6_fib.h | 2 +-
>> net/ipv6/inet6_connection_sock.c | 23 +----------------------
>> net/ipv6/route.c | 17 +++++++++++++----
>> 3 files changed, 15 insertions(+), 27 deletions(-)
>>
>> diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
>> index cd64cf3..5eb93f4 100644
>> --- a/include/net/ip6_fib.h
>> +++ b/include/net/ip6_fib.h
>> @@ -113,7 +113,7 @@ struct rt6_info {
>> unsigned long _rt6i_peer;
>>
>> #ifdef CONFIG_XFRM
>> - u32 rt6i_flow_cache_genid;
>> + u32 rt6i_genid;
>> #endif
>> /* more non-fragment space at head required */
>> unsigned short rt6i_nfheader_len;
>> diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c
>> index 0251a60..c4f9341 100644
>> --- a/net/ipv6/inet6_connection_sock.c
>> +++ b/net/ipv6/inet6_connection_sock.c
>> @@ -175,33 +175,12 @@ void __inet6_csk_dst_store(struct sock *sk, struct
>> dst_entry *dst,
>> const struct in6_addr *saddr)
>> {
>> __ip6_dst_store(sk, dst, daddr, saddr);
>> -
>> -#ifdef CONFIG_XFRM
>> - {
>> - struct rt6_info *rt = (struct rt6_info *)dst;
>> - rt->rt6i_flow_cache_genid = atomic_read(&flow_cache_genid);
>> - }
>> -#endif
>> }
>>
>> static inline
>> struct dst_entry *__inet6_csk_dst_check(struct sock *sk, u32 cookie)
>> {
>> - struct dst_entry *dst;
>> -
>> - dst = __sk_dst_check(sk, cookie);
>> -
>> -#ifdef CONFIG_XFRM
>> - if (dst) {
>> - struct rt6_info *rt = (struct rt6_info *)dst;
>> - if (rt->rt6i_flow_cache_genid != atomic_read(&flow_cache_genid)) {
>> - __sk_dst_reset(sk);
>> - dst = NULL;
>> - }
>> - }
>> -#endif
>> -
>> - return dst;
>> + return __sk_dst_check(sk, cookie);
>> }
>>
>> static struct dst_entry *inet6_csk_route_socket(struct sock *sk,
>> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
>> index 339d921..db7b78f 100644
>> --- a/net/ipv6/route.c
>> +++ b/net/ipv6/route.c
>> @@ -281,13 +281,16 @@ static inline struct rt6_info *ip6_dst_alloc(struct net
>> *net,
>> struct fib6_table *table)
>> {
>> struct rt6_info *rt = dst_alloc(&net->ipv6.ip6_dst_ops, dev,
>> - 0, DST_OBSOLETE_NONE, flags);
>> + 0, DST_OBSOLETE_FORCE_CHK, flags);
>>
>> if (rt) {
>> struct dst_entry *dst = &rt->dst;
>>
>> 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
>
> This isn't XFRM dependent any more, is it?
Not dependent, but for IPv6, it's only usefull when xfrm is set. Goal of this
ifdef was to avoid the test if xfrm is not used.
next prev parent reply other threads:[~2012-09-10 14:34 UTC|newest]
Thread overview: 104+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-06 15:47 [PATCH] sctp: check dst validity after IPsec operations Nicolas Dichtel
2012-09-06 17:40 ` Nicolas Dichtel
2012-09-06 16:04 ` Vlad Yasevich
2012-09-06 16:04 ` Vlad Yasevich
2012-09-06 16:40 ` Nicolas Dichtel
2012-09-06 16:40 ` Nicolas Dichtel
2012-09-06 17:03 ` Vlad Yasevich
2012-09-06 17:03 ` Vlad Yasevich
2012-09-07 12:24 ` Nicolas Dichtel
2012-09-07 12:24 ` Nicolas Dichtel
2012-09-07 12:07 ` Nicolas Dichtel
2012-09-07 12:07 ` Nicolas Dichtel
2012-09-06 18:10 ` David Miller
2012-09-06 18:10 ` David Miller
2012-09-07 13:47 ` Nicolas Dichtel
2012-09-07 13:47 ` Nicolas Dichtel
2012-09-07 13:55 ` [PATCH RFC net-next 0/2] Take care of xfrm policy when checking dst entries Nicolas Dichtel
2012-09-07 15:57 ` Nicolas Dichtel
2012-09-07 13:56 ` [PATCH 1/2] dst: take into account policy update on check() Nicolas Dichtel
2012-09-07 15:57 ` Nicolas Dichtel
2012-09-07 14:20 ` Vlad Yasevich
2012-09-07 14:20 ` Vlad Yasevich
2012-09-07 14:35 ` Eric Dumazet
2012-09-07 14:35 ` Eric Dumazet
2012-09-07 14:47 ` Nicolas Dichtel
2012-09-07 14:47 ` Nicolas Dichtel
2012-09-07 15:09 ` Eric Dumazet
2012-09-07 15:09 ` Eric Dumazet
2012-09-07 15:13 ` Nicolas Dichtel
2012-09-07 15:13 ` Nicolas Dichtel
2012-09-07 15:21 ` Eric Dumazet
2012-09-07 15:21 ` Eric Dumazet
2012-09-07 18:48 ` David Miller
2012-09-07 18:48 ` David Miller
2012-09-07 18:48 ` David Miller
2012-09-07 18:48 ` David Miller
2012-09-10 12:47 ` Nicolas Dichtel
2012-09-10 12:47 ` Nicolas Dichtel
2012-09-10 13:10 ` Eric Dumazet
2012-09-10 13:10 ` Eric Dumazet
2012-09-10 13:22 ` [PATCH net-next v2] Take care of xfrm policy when checking dst entries Nicolas Dichtel
2012-09-10 13:22 ` Nicolas Dichtel
2012-09-10 13:22 ` [PATCH net-next v2 1/4] netns: move net->ipv4.rt_genid to net->rt_genid Nicolas Dichtel
2012-09-10 13:22 ` Nicolas Dichtel
2012-09-10 13:22 ` [PATCH net-next v2 2/4] xfrm: invalidate dst on policy insertion/deletion Nicolas Dichtel
2012-09-10 13:22 ` Nicolas Dichtel
2012-09-10 14:21 ` Vlad Yasevich
2012-09-10 14:21 ` Vlad Yasevich
2012-09-10 14:56 ` Nicolas Dichtel
2012-09-10 14:56 ` Nicolas Dichtel
2012-09-11 8:09 ` [PATCH net-next v3 0/4] Take care of xfrm policy when checking dst entries Nicolas Dichtel
2012-09-11 8:09 ` Nicolas Dichtel
2012-09-11 8:09 ` [PATCH net-next v3 1/4] netns: move net->ipv4.rt_genid to net->rt_genid Nicolas Dichtel
2012-09-11 8:09 ` Nicolas Dichtel
2012-09-11 8:09 ` [PATCH net-next v3 2/4] xfrm: invalidate dst on policy insertion/deletion Nicolas Dichtel
2012-09-11 8:09 ` Nicolas Dichtel
2012-09-11 8:09 ` [PATCH net-next v3 3/4] ipv6: use net->rt_genid to check dst validity Nicolas Dichtel
2012-09-11 8:09 ` Nicolas Dichtel
2012-09-11 8:09 ` [PATCH net-next v3 4/4] ipv6: use DST_* macro to set obselete field Nicolas Dichtel
2012-09-11 8:09 ` Nicolas Dichtel
2012-09-12 7:40 ` Eric Dumazet
2012-09-12 7:40 ` Eric Dumazet
2012-09-17 16:49 ` [PATCH net-next v3 0/4] Take care of xfrm policy when checking dst entries David Miller
2012-09-17 16:49 ` David Miller
2012-09-17 18:14 ` Vlad Yasevich
2012-09-17 18:14 ` Vlad Yasevich
2012-09-17 18:25 ` David Miller
2012-09-17 18:25 ` David Miller
2012-09-17 19:52 ` Nicolas Dichtel
2012-09-17 19:52 ` Nicolas Dichtel
2012-09-17 19:54 ` David Miller
2012-09-17 19:54 ` David Miller
2012-09-18 20:08 ` David Miller
2012-09-18 20:08 ` David Miller
2012-09-10 13:22 ` [PATCH net-next v2 3/4] ipv6: use net->rt_genid to check dst validity Nicolas Dichtel
2012-09-10 13:22 ` Nicolas Dichtel
2012-09-10 14:29 ` Vlad Yasevich
2012-09-10 14:29 ` Vlad Yasevich
2012-09-10 14:34 ` Nicolas Dichtel [this message]
2012-09-10 14:34 ` Nicolas Dichtel
2012-09-10 14:43 ` Vlad Yasevich
2012-09-10 14:43 ` Vlad Yasevich
2012-09-10 14:44 ` Nicolas Dichtel
2012-09-10 14:44 ` Nicolas Dichtel
2012-09-10 13:22 ` [PATCH net-next v2 4/4] ipv6: use DST_* macro to set obselete field Nicolas Dichtel
2012-09-10 13:22 ` Nicolas Dichtel
2012-09-10 14:35 ` [PATCH net-next v2] Take care of xfrm policy when checking dst entries Vlad Yasevich
2012-09-10 14:35 ` Vlad Yasevich
2012-09-10 14:38 ` Nicolas Dichtel
2012-09-10 14:38 ` Nicolas Dichtel
2012-09-10 17:18 ` David Miller
2012-09-10 17:18 ` David Miller
2012-09-10 17:59 ` Vlad Yasevich
2012-09-10 17:59 ` Vlad Yasevich
2012-09-10 18:01 ` David Miller
2012-09-10 18:01 ` David Miller
2012-09-22 16:49 ` Jan Engelhardt
2012-09-22 16:49 ` Jan Engelhardt
2012-09-07 14:51 ` [PATCH 1/2] dst: take into account policy update on check() Vlad Yasevich
2012-09-07 14:51 ` Vlad Yasevich
2012-09-07 15:08 ` Eric Dumazet
2012-09-07 15:08 ` Eric Dumazet
2012-09-07 13:56 ` [PATCH 2/2] ipv6: remove rt6i_flow_cache_genid field in rt6_info Nicolas Dichtel
2012-09-07 15:57 ` 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=504DFA84.40409@6wind.com \
--to=nicolas.dichtel@6wind.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=linux-sctp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sri@us.ibm.com \
--cc=vyasevich@gmail.com \
/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.