diff options
author | Xin Long <lucien.xin@gmail.com> | 2018-09-20 05:27:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-09-20 14:29:30 -0400 |
commit | d7ab5cdce54da631f0c8c11e506c974536a3581e (patch) | |
tree | 013a257de980989041bcdeecf8209f365d157e7c | |
parent | 8c6ec3613e7b0aade20a3196169c0bab32ed3e3f (diff) |
sctp: update dst pmtu with the correct daddr
When processing pmtu update from an icmp packet, it calls .update_pmtu
with sk instead of skb in sctp_transport_update_pmtu.
However for sctp, the daddr in the transport might be different from
inet_sock->inet_daddr or sk->sk_v6_daddr, which is used to update or
create the route cache. The incorrect daddr will cause a different
route cache created for the path.
So before calling .update_pmtu, inet_sock->inet_daddr/sk->sk_v6_daddr
should be updated with the daddr in the transport, and update it back
after it's done.
The issue has existed since route exceptions introduction.
Fixes: 4895c771c7f0 ("ipv4: Add FIB nexthop exceptions.")
Reported-by: ian.periam@dialogic.com
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/sctp/transport.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/net/sctp/transport.c b/net/sctp/transport.c index 12cac85da994..033696e6f74f 100644 --- a/net/sctp/transport.c +++ b/net/sctp/transport.c | |||
@@ -260,6 +260,7 @@ void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk) | |||
260 | bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) | 260 | bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) |
261 | { | 261 | { |
262 | struct dst_entry *dst = sctp_transport_dst_check(t); | 262 | struct dst_entry *dst = sctp_transport_dst_check(t); |
263 | struct sock *sk = t->asoc->base.sk; | ||
263 | bool change = true; | 264 | bool change = true; |
264 | 265 | ||
265 | if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) { | 266 | if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) { |
@@ -271,12 +272,19 @@ bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) | |||
271 | pmtu = SCTP_TRUNC4(pmtu); | 272 | pmtu = SCTP_TRUNC4(pmtu); |
272 | 273 | ||
273 | if (dst) { | 274 | if (dst) { |
274 | dst->ops->update_pmtu(dst, t->asoc->base.sk, NULL, pmtu); | 275 | struct sctp_pf *pf = sctp_get_pf_specific(dst->ops->family); |
276 | union sctp_addr addr; | ||
277 | |||
278 | pf->af->from_sk(&addr, sk); | ||
279 | pf->to_sk_daddr(&t->ipaddr, sk); | ||
280 | dst->ops->update_pmtu(dst, sk, NULL, pmtu); | ||
281 | pf->to_sk_daddr(&addr, sk); | ||
282 | |||
275 | dst = sctp_transport_dst_check(t); | 283 | dst = sctp_transport_dst_check(t); |
276 | } | 284 | } |
277 | 285 | ||
278 | if (!dst) { | 286 | if (!dst) { |
279 | t->af_specific->get_dst(t, &t->saddr, &t->fl, t->asoc->base.sk); | 287 | t->af_specific->get_dst(t, &t->saddr, &t->fl, sk); |
280 | dst = t->dst; | 288 | dst = t->dst; |
281 | } | 289 | } |
282 | 290 | ||