aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfan.du <fan.du@windriver.com>2013-08-01 22:45:13 -0400
committerDavid S. Miller <davem@davemloft.net>2013-08-02 15:36:00 -0400
commitd27fc78208b53ccdfd6a57d4ac44a459ca66806f (patch)
tree700f653b85cac0da64bdcbfb86021a4da07cd3d9
parentba5082c71476891623757956ebfc36040ac317e2 (diff)
sctp: Don't lookup dst if transport dst is still valid
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>
-rw-r--r--include/net/sctp/sctp.h2
-rw-r--r--include/net/sctp/structs.h1
-rw-r--r--net/sctp/ipv6.c2
3 files changed, 3 insertions, 2 deletions
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 554cf88605fc..cb28df9c2781 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)
613 */ 613 */
614static inline struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t) 614static inline struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
615{ 615{
616 if (t->dst && !dst_check(t->dst, 0)) { 616 if (t->dst && !dst_check(t->dst, t->dst_cookie)) {
617 dst_release(t->dst); 617 dst_release(t->dst);
618 t->dst = NULL; 618 t->dst = NULL;
619 } 619 }
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 75c4c16601b6..c0f4e29eedd5 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -946,6 +946,7 @@ struct sctp_transport {
946 __u64 hb_nonce; 946 __u64 hb_nonce;
947 947
948 struct rcu_head rcu; 948 struct rcu_head rcu;
949 u32 dst_cookie;
949}; 950};
950 951
951struct sctp_transport *sctp_transport_new(struct net *, const union sctp_addr *, 952struct sctp_transport *sctp_transport_new(struct net *, const union sctp_addr *,
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
index 85d688f59e6a..5a9402e3c0cf 100644
--- a/net/sctp/ipv6.c
+++ b/net/sctp/ipv6.c
@@ -351,7 +351,7 @@ out:
351 351
352 rt = (struct rt6_info *)dst; 352 rt = (struct rt6_info *)dst;
353 t->dst = dst; 353 t->dst = dst;
354 354 t->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0;
355 pr_debug("rt6_dst:%pI6 rt6_src:%pI6\n", &rt->rt6i_dst.addr, 355 pr_debug("rt6_dst:%pI6 rt6_src:%pI6\n", &rt->rt6i_dst.addr,
356 &fl6->saddr); 356 &fl6->saddr);
357 } else { 357 } else {