]> Pileus Git - ~andy/linux/commitdiff
sctp: Don't lookup dst if transport dst is still valid
authorfan.du <fan.du@windriver.com>
Fri, 2 Aug 2013 02:45:13 +0000 (10:45 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 2 Aug 2013 19:36:00 +0000 (12:36 -0700)
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>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sctp/sctp.h
include/net/sctp/structs.h
net/sctp/ipv6.c

index 554cf88605fc513a2a55a45021d6c9286d329b34..cb28df9c27819598ecc399db311da41c2d6029f6 100644 (file)
@@ -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;
        }
index 75c4c16601b6a1874385ab64f4d7373f3f157b16..c0f4e29eedd54a0966a448450f4636cb239cc48e 100644 (file)
@@ -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 *,
index 85d688f59e6ae295fb4316b74be36a70ef3a3b92..5a9402e3c0cfa3390dfd4811ad8a9b6183b9cfc9 100644 (file)
@@ -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 {