Commit 02f3d4ce9e81434a365f4643020b0402f6fe3332

Authored by David S. Miller
1 parent 35ad9b9cf7

sctp: Adjust PMTU updates to accomodate route invalidation.

This adjusts the call to dst_ops->update_pmtu() so that we can
transparently handle the fact that, in the future, the dst itself can
be invalidated by the PMTU update (when we have non-host routes cached
in sockets).

Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 7 changed files with 22 additions and 14 deletions Side-by-side Diff

include/net/sctp/sctp.h
... ... @@ -519,10 +519,10 @@
519 519 return frag;
520 520 }
521 521  
522   -static inline void sctp_assoc_pending_pmtu(struct sctp_association *asoc)
  522 +static inline void sctp_assoc_pending_pmtu(struct sock *sk, struct sctp_association *asoc)
523 523 {
524 524  
525   - sctp_assoc_sync_pmtu(asoc);
  525 + sctp_assoc_sync_pmtu(sk, asoc);
526 526 asoc->pmtu_pending = 0;
527 527 }
528 528  
include/net/sctp/structs.h
... ... @@ -1091,7 +1091,7 @@
1091 1091 void sctp_transport_burst_reset(struct sctp_transport *);
1092 1092 unsigned long sctp_transport_timeout(struct sctp_transport *);
1093 1093 void sctp_transport_reset(struct sctp_transport *);
1094   -void sctp_transport_update_pmtu(struct sctp_transport *, u32);
  1094 +void sctp_transport_update_pmtu(struct sock *, struct sctp_transport *, u32);
1095 1095 void sctp_transport_immediate_rtx(struct sctp_transport *);
1096 1096  
1097 1097  
... ... @@ -2003,7 +2003,7 @@
2003 2003  
2004 2004 __u32 sctp_association_get_next_tsn(struct sctp_association *);
2005 2005  
2006   -void sctp_assoc_sync_pmtu(struct sctp_association *);
  2006 +void sctp_assoc_sync_pmtu(struct sock *, struct sctp_association *);
2007 2007 void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int);
2008 2008 void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int);
2009 2009 void sctp_assoc_set_primary(struct sctp_association *,
net/sctp/associola.c
... ... @@ -1360,7 +1360,7 @@
1360 1360 /* Update the association's pmtu and frag_point by going through all the
1361 1361 * transports. This routine is called when a transport's PMTU has changed.
1362 1362 */
1363   -void sctp_assoc_sync_pmtu(struct sctp_association *asoc)
  1363 +void sctp_assoc_sync_pmtu(struct sock *sk, struct sctp_association *asoc)
1364 1364 {
1365 1365 struct sctp_transport *t;
1366 1366 __u32 pmtu = 0;
... ... @@ -1372,7 +1372,7 @@
1372 1372 list_for_each_entry(t, &asoc->peer.transport_addr_list,
1373 1373 transports) {
1374 1374 if (t->pmtu_pending && t->dst) {
1375   - sctp_transport_update_pmtu(t, dst_mtu(t->dst));
  1375 + sctp_transport_update_pmtu(sk, t, dst_mtu(t->dst));
1376 1376 t->pmtu_pending = 0;
1377 1377 }
1378 1378 if (!pmtu || (t->pathmtu < pmtu))
... ... @@ -408,10 +408,10 @@
408 408  
409 409 if (t->param_flags & SPP_PMTUD_ENABLE) {
410 410 /* Update transports view of the MTU */
411   - sctp_transport_update_pmtu(t, pmtu);
  411 + sctp_transport_update_pmtu(sk, t, pmtu);
412 412  
413 413 /* Update association pmtu. */
414   - sctp_assoc_sync_pmtu(asoc);
  414 + sctp_assoc_sync_pmtu(sk, asoc);
415 415 }
416 416  
417 417 /* Retransmit with the new pmtu setting.
... ... @@ -410,7 +410,7 @@
410 410 if (!sctp_transport_dst_check(tp)) {
411 411 sctp_transport_route(tp, NULL, sctp_sk(sk));
412 412 if (asoc && (asoc->param_flags & SPP_PMTUD_ENABLE)) {
413   - sctp_assoc_sync_pmtu(asoc);
  413 + sctp_assoc_sync_pmtu(sk, asoc);
414 414 }
415 415 }
416 416 dst = dst_clone(tp->dst);
... ... @@ -1853,7 +1853,7 @@
1853 1853 }
1854 1854  
1855 1855 if (asoc->pmtu_pending)
1856   - sctp_assoc_pending_pmtu(asoc);
  1856 + sctp_assoc_pending_pmtu(sk, asoc);
1857 1857  
1858 1858 /* If fragmentation is disabled and the message length exceeds the
1859 1859 * association fragmentation point, return EMSGSIZE. The I-D
... ... @@ -2365,7 +2365,7 @@
2365 2365 if ((params->spp_flags & SPP_PMTUD_DISABLE) && params->spp_pathmtu) {
2366 2366 if (trans) {
2367 2367 trans->pathmtu = params->spp_pathmtu;
2368   - sctp_assoc_sync_pmtu(asoc);
  2368 + sctp_assoc_sync_pmtu(sctp_opt2sk(sp), asoc);
2369 2369 } else if (asoc) {
2370 2370 asoc->pathmtu = params->spp_pathmtu;
2371 2371 sctp_frag_point(asoc, params->spp_pathmtu);
... ... @@ -2382,7 +2382,7 @@
2382 2382 (trans->param_flags & ~SPP_PMTUD) | pmtud_change;
2383 2383 if (update) {
2384 2384 sctp_transport_pmtu(trans, sctp_opt2sk(sp));
2385   - sctp_assoc_sync_pmtu(asoc);
  2385 + sctp_assoc_sync_pmtu(sctp_opt2sk(sp), asoc);
2386 2386 }
2387 2387 } else if (asoc) {
2388 2388 asoc->param_flags =
net/sctp/transport.c
... ... @@ -228,7 +228,7 @@
228 228 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
229 229 }
230 230  
231   -void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)
  231 +void sctp_transport_update_pmtu(struct sock *sk, struct sctp_transport *t, u32 pmtu)
232 232 {
233 233 struct dst_entry *dst;
234 234  
235 235  
... ... @@ -245,8 +245,16 @@
245 245 }
246 246  
247 247 dst = sctp_transport_dst_check(t);
248   - if (dst)
  248 + if (!dst)
  249 + t->af_specific->get_dst(t, &t->saddr, &t->fl, sk);
  250 +
  251 + if (dst) {
249 252 dst->ops->update_pmtu(dst, pmtu);
  253 +
  254 + dst = sctp_transport_dst_check(t);
  255 + if (!dst)
  256 + t->af_specific->get_dst(t, &t->saddr, &t->fl, sk);
  257 + }
250 258 }
251 259  
252 260 /* Caches the dst entry and source address for a transport's destination