Commit e0268868 authored by Nicolas Dichtel's avatar Nicolas Dichtel Committed by David S. Miller

sctp: check cached dst before using it

dst_check() will take care of SA (and obsolete field), hence
IPsec rekeying scenario is taken into account.
Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: default avatarVlad Yaseivch <vyasevich@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c57b5468
...@@ -704,4 +704,17 @@ static inline void sctp_v4_map_v6(union sctp_addr *addr) ...@@ -704,4 +704,17 @@ static inline void sctp_v4_map_v6(union sctp_addr *addr)
addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff); addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff);
} }
/* The cookie is always 0 since this is how it's used in the
* pmtu code.
*/
static inline struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
{
if (t->dst && !dst_check(t->dst, 0)) {
dst_release(t->dst);
t->dst = NULL;
}
return t->dst;
}
#endif /* __net_sctp_h__ */ #endif /* __net_sctp_h__ */
...@@ -377,9 +377,7 @@ int sctp_packet_transmit(struct sctp_packet *packet) ...@@ -377,9 +377,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
*/ */
skb_set_owner_w(nskb, sk); skb_set_owner_w(nskb, sk);
/* The 'obsolete' field of dst is set to 2 when a dst is freed. */ if (!sctp_transport_dst_check(tp)) {
if (!dst || (dst->obsolete > 1)) {
dst_release(dst);
sctp_transport_route(tp, NULL, sctp_sk(sk)); sctp_transport_route(tp, NULL, sctp_sk(sk));
if (asoc && (asoc->param_flags & SPP_PMTUD_ENABLE)) { if (asoc && (asoc->param_flags & SPP_PMTUD_ENABLE)) {
sctp_assoc_sync_pmtu(asoc); sctp_assoc_sync_pmtu(asoc);
......
...@@ -226,23 +226,6 @@ void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk) ...@@ -226,23 +226,6 @@ void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk)
transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT; transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
} }
/* this is a complete rip-off from __sk_dst_check
* the cookie is always 0 since this is how it's used in the
* pmtu code
*/
static struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
{
struct dst_entry *dst = t->dst;
if (dst && dst->obsolete && dst->ops->check(dst, 0) == NULL) {
dst_release(t->dst);
t->dst = NULL;
return NULL;
}
return dst;
}
void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)
{ {
struct dst_entry *dst; struct dst_entry *dst;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment