sctp: Don't lookup dst if transport dst is still valid
Subsystems (3)
PATCH 1/1 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.
--- include/net/sctp/sctp.h | 2 +- include/net/sctp/structs.h | 1 + net/sctp/ipv6.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-)
include/net/sctp/sctp.h +1 -1
@@ -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 ; }
include/net/sctp/structs.h +1 -0
@@ -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 *,
net/sctp/ipv6.c +1 -1
@@ -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 {
Signature · 1 line
1.7.1
Quoted 9 lines · Fan Du
When sctp sits on IPv6,
sctp_transport_dst_checkpass cookie as ZERO, as a resultip6_dst_checkalways fail out. This behaviour makestransport->dstuseless, because everysctp_packet_transmitmust look for valid dst.Add a
dst_cookieintosctp_transport, and set the cookie whenever we get new dst forsctp_transport. So dst validness could be checked against it.
Quoted 6 lines
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 <[email protected]>
-vlad
Quoted 45 lines
--- include/net/sctp/sctp.h | 2 +- include/net/sctp/structs.h | 1 + net/sctp/ipv6.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-)include/net/sctp/sctp.h +1
-1@@ -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 ; }include/net/sctp/structs.h +1
-0@@ -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 *,net/sctp/ipv6.c +1
-1@@ -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 {
From: Vlad Yasevich <[email protected]>
Date: Fri, 02 Aug 2013 10:57:14 -0400
Quoted 16 lines · Fan Du
Quoted 15 lines
When sctp sits on IPv6,
sctp_transport_dst_checkpass cookie as ZERO, as a resultip6_dst_checkalways fail out. This behaviour makestransport->dstuseless, because everysctp_packet_transmitmust look for valid dst.Add a
dst_cookieintosctp_transport, and set the cookie whenever we get new dst forsctp_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.
Quoted 3 lines
Quoted 1 line
Signed-off-by Fan Du <[email protected]>Acked-by Vlad Yasevich <[email protected]>
Applied.