Skip to content

Commit d27fc78

Browse files
fan.dudavem330
authored andcommitted
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>
1 parent ba5082c commit d27fc78

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎include/net/sctp/sctp.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ static inline void sctp_v4_map_v6(union sctp_addr *addr)
613613
*/
614614
static inline struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
615615
{
616-
if (t->dst && !dst_check(t->dst, 0)) {
616+
if (t->dst && !dst_check(t->dst, t->dst_cookie)) {
617617
dst_release(t->dst);
618618
t->dst = NULL;
619619
}

‎include/net/sctp/structs.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,7 @@ struct sctp_transport {
946946
__u64 hb_nonce;
947947

948948
struct rcu_head rcu;
949+
u32 dst_cookie;
949950
};
950951

951952
struct sctp_transport *sctp_transport_new(struct net *, const union sctp_addr *,

‎net/sctp/ipv6.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
351351

352352
rt = (struct rt6_info *)dst;
353353
t->dst = dst;
354-
354+
t->dst_cookie = rt->rt6i_node ? rt->rt6i_node->fn_sernum : 0;
355355
pr_debug("rt6_dst:%pI6 rt6_src:%pI6\n", &rt->rt6i_dst.addr,
356356
&fl6->saddr);
357357
} else {

0 commit comments

Comments
 (0)