* [PATCH net-next] sctp: Don't lookup dst if transport dst is still valid
@ 2013-08-02 2:45 Fan Du
2013-08-02 14:57 ` Vlad Yasevich
2013-08-02 15:58 ` Neil Horman
0 siblings, 2 replies; 4+ messages in thread
From: Fan Du @ 2013-08-02 2:45 UTC (permalink / raw)
To: vyasevich, nhorman; +Cc: davem, netdev
When sctp sits on IPv6, sctp_transport_dst_check pass cookie as ZERO,
as a result ip6_dst_check always fail out. This behaviour makes
transport->dst useless, because every sctp_packet_transmit must look
for valid dst.
Add a dst_cookie into sctp_transport, and set the cookie whenever we
get new dst for sctp_transport. So dst validness could be checked
against it.
Since I have split genid for IPv4 and IPv6, also delete/add IPv6 address
will also bump IPv6 genid. So issues we discussed in:
http://marc.info/?l=linux-netdev&m=137404469219410&w=4
have all been sloved for this patch.
Signed-off-by: Fan Du <fan.du@windriver.com>
---
include/net/sctp/sctp.h | 2 +-
include/net/sctp/structs.h | 1 +
net/sctp/ipv6.c | 2 +-
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 554cf88..cb28df9 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -613,7 +613,7 @@ static inline void sctp_v4_map_v6(union sctp_addr *addr)
*/
static inline struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
{
- if (t->dst && !dst_check(t->dst, 0)) {
+ if (t->dst && !dst_check(t->dst, t->dst_cookie)) {
dst_release(t->dst);
t->dst = NULL;
}
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 75c4c16..c0f4e29 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -946,6 +946,7 @@ struct sctp_transport {
__u64 hb_nonce;
struct rcu_head rcu;
+ u32 dst_cookie;
};
struct sctp_transport *sctp_transport_new(struct net *, const union sctp_addr *,
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 85d688f..5a9402e 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -351,7 +351,7 @@ out:
rt = (struct rt6_info *)dst;
t->dst = dst;
-
+ t->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0;
pr_debug("rt6_dst:%pI6 rt6_src:%pI6\n", &rt->rt6i_dst.addr,
&fl6->saddr);
} else {
--
1.7.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] sctp: Don't lookup dst if transport dst is still valid
2013-08-02 2:45 [PATCH net-next] sctp: Don't lookup dst if transport dst is still valid Fan Du
@ 2013-08-02 14:57 ` Vlad Yasevich
2013-08-02 19:36 ` David Miller
2013-08-02 15:58 ` Neil Horman
1 sibling, 1 reply; 4+ messages in thread
From: Vlad Yasevich @ 2013-08-02 14:57 UTC (permalink / raw)
To: Fan Du; +Cc: nhorman, davem, netdev
On 08/01/2013 10:45 PM, Fan Du wrote:
> When sctp sits on IPv6, sctp_transport_dst_check pass cookie as ZERO,
> as a result ip6_dst_check always fail out. This behaviour makes
> transport->dst useless, because every sctp_packet_transmit must look
> for valid dst.
>
> Add a dst_cookie into sctp_transport, and set the cookie whenever we
> get new dst for sctp_transport. So dst validness could be checked
> against it.
>
> Since I have split genid for IPv4 and IPv6, also delete/add IPv6 address
> will also bump IPv6 genid. So issues we discussed in:
> http://marc.info/?l=linux-netdev&m=137404469219410&w=4
> have all been sloved for this patch.
>
> Signed-off-by: Fan Du <fan.du@windriver.com>
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
-vlad
> ---
> include/net/sctp/sctp.h | 2 +-
> include/net/sctp/structs.h | 1 +
> net/sctp/ipv6.c | 2 +-
> 3 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
> index 554cf88..cb28df9 100644
> --- a/include/net/sctp/sctp.h
> +++ b/include/net/sctp/sctp.h
> @@ -613,7 +613,7 @@ static inline void sctp_v4_map_v6(union sctp_addr *addr)
> */
> static inline struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
> {
> - if (t->dst && !dst_check(t->dst, 0)) {
> + if (t->dst && !dst_check(t->dst, t->dst_cookie)) {
> dst_release(t->dst);
> t->dst = NULL;
> }
> diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
> index 75c4c16..c0f4e29 100644
> --- a/include/net/sctp/structs.h
> +++ b/include/net/sctp/structs.h
> @@ -946,6 +946,7 @@ struct sctp_transport {
> __u64 hb_nonce;
>
> struct rcu_head rcu;
> + u32 dst_cookie;
> };
>
> struct sctp_transport *sctp_transport_new(struct net *, const union sctp_addr *,
> diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
> index 85d688f..5a9402e 100644
> --- a/net/sctp/ipv6.c
> +++ b/net/sctp/ipv6.c
> @@ -351,7 +351,7 @@ out:
>
> rt = (struct rt6_info *)dst;
> t->dst = dst;
> -
> + t->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0;
> pr_debug("rt6_dst:%pI6 rt6_src:%pI6\n", &rt->rt6i_dst.addr,
> &fl6->saddr);
> } else {
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] sctp: Don't lookup dst if transport dst is still valid
2013-08-02 2:45 [PATCH net-next] sctp: Don't lookup dst if transport dst is still valid Fan Du
2013-08-02 14:57 ` Vlad Yasevich
@ 2013-08-02 15:58 ` Neil Horman
1 sibling, 0 replies; 4+ messages in thread
From: Neil Horman @ 2013-08-02 15:58 UTC (permalink / raw)
To: Fan Du; +Cc: vyasevich, davem, netdev
Acked-by: Neil Horman <nhorman@tuxdriver.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] sctp: Don't lookup dst if transport dst is still valid
2013-08-02 14:57 ` Vlad Yasevich
@ 2013-08-02 19:36 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-08-02 19:36 UTC (permalink / raw)
To: vyasevich; +Cc: fan.du, nhorman, netdev
From: Vlad Yasevich <vyasevich@gmail.com>
Date: Fri, 02 Aug 2013 10:57:14 -0400
> On 08/01/2013 10:45 PM, Fan Du wrote:
>> When sctp sits on IPv6, sctp_transport_dst_check pass cookie as ZERO,
>> as a result ip6_dst_check always fail out. This behaviour makes
>> transport->dst useless, because every sctp_packet_transmit must look
>> for valid dst.
>>
>> Add a dst_cookie into sctp_transport, and set the cookie whenever we
>> get new dst for sctp_transport. So dst validness could be checked
>> against it.
>>
>> Since I have split genid for IPv4 and IPv6, also delete/add IPv6
>> address
>> will also bump IPv6 genid. So issues we discussed in:
>> http://marc.info/?l=linux-netdev&m=137404469219410&w=4
>> have all been sloved for this patch.
>>
>> Signed-off-by: Fan Du <fan.du@windriver.com>
>
> Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-08-02 19:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-02 2:45 [PATCH net-next] sctp: Don't lookup dst if transport dst is still valid Fan Du
2013-08-02 14:57 ` Vlad Yasevich
2013-08-02 19:36 ` David Miller
2013-08-02 15:58 ` Neil Horman
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).