Skip to content

Commit 02f3d4c

Browse files
committed
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>
1 parent 35ad9b9 commit 02f3d4c

File tree

7 files changed

+22
-14
lines changed

7 files changed

+22
-14
lines changed

include/net/sctp/sctp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,10 +519,10 @@ static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu)
519519
return frag;
520520
}
521521

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)
523523
{
524524

525-
sctp_assoc_sync_pmtu(asoc);
525+
sctp_assoc_sync_pmtu(sk, asoc);
526526
asoc->pmtu_pending = 0;
527527
}
528528

include/net/sctp/structs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ void sctp_transport_burst_limited(struct sctp_transport *);
10911091
void sctp_transport_burst_reset(struct sctp_transport *);
10921092
unsigned long sctp_transport_timeout(struct sctp_transport *);
10931093
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);
10951095
void sctp_transport_immediate_rtx(struct sctp_transport *);
10961096

10971097

@@ -2003,7 +2003,7 @@ void sctp_assoc_update(struct sctp_association *old,
20032003

20042004
__u32 sctp_association_get_next_tsn(struct sctp_association *);
20052005

2006-
void sctp_assoc_sync_pmtu(struct sctp_association *);
2006+
void sctp_assoc_sync_pmtu(struct sock *, struct sctp_association *);
20072007
void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int);
20082008
void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int);
20092009
void sctp_assoc_set_primary(struct sctp_association *,

net/sctp/associola.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ struct sctp_transport *sctp_assoc_choose_alter_transport(
13601360
/* Update the association's pmtu and frag_point by going through all the
13611361
* transports. This routine is called when a transport's PMTU has changed.
13621362
*/
1363-
void sctp_assoc_sync_pmtu(struct sctp_association *asoc)
1363+
void sctp_assoc_sync_pmtu(struct sock *sk, struct sctp_association *asoc)
13641364
{
13651365
struct sctp_transport *t;
13661366
__u32 pmtu = 0;
@@ -1372,7 +1372,7 @@ void sctp_assoc_sync_pmtu(struct sctp_association *asoc)
13721372
list_for_each_entry(t, &asoc->peer.transport_addr_list,
13731373
transports) {
13741374
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));
13761376
t->pmtu_pending = 0;
13771377
}
13781378
if (!pmtu || (t->pathmtu < pmtu))

net/sctp/input.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,10 +408,10 @@ void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc,
408408

409409
if (t->param_flags & SPP_PMTUD_ENABLE) {
410410
/* Update transports view of the MTU */
411-
sctp_transport_update_pmtu(t, pmtu);
411+
sctp_transport_update_pmtu(sk, t, pmtu);
412412

413413
/* Update association pmtu. */
414-
sctp_assoc_sync_pmtu(asoc);
414+
sctp_assoc_sync_pmtu(sk, asoc);
415415
}
416416

417417
/* Retransmit with the new pmtu setting.

net/sctp/output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
410410
if (!sctp_transport_dst_check(tp)) {
411411
sctp_transport_route(tp, NULL, sctp_sk(sk));
412412
if (asoc && (asoc->param_flags & SPP_PMTUD_ENABLE)) {
413-
sctp_assoc_sync_pmtu(asoc);
413+
sctp_assoc_sync_pmtu(sk, asoc);
414414
}
415415
}
416416
dst = dst_clone(tp->dst);

net/sctp/socket.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,7 +1853,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
18531853
}
18541854

18551855
if (asoc->pmtu_pending)
1856-
sctp_assoc_pending_pmtu(asoc);
1856+
sctp_assoc_pending_pmtu(sk, asoc);
18571857

18581858
/* If fragmentation is disabled and the message length exceeds the
18591859
* association fragmentation point, return EMSGSIZE. The I-D
@@ -2365,7 +2365,7 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params,
23652365
if ((params->spp_flags & SPP_PMTUD_DISABLE) && params->spp_pathmtu) {
23662366
if (trans) {
23672367
trans->pathmtu = params->spp_pathmtu;
2368-
sctp_assoc_sync_pmtu(asoc);
2368+
sctp_assoc_sync_pmtu(sctp_opt2sk(sp), asoc);
23692369
} else if (asoc) {
23702370
asoc->pathmtu = params->spp_pathmtu;
23712371
sctp_frag_point(asoc, params->spp_pathmtu);
@@ -2382,7 +2382,7 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params,
23822382
(trans->param_flags & ~SPP_PMTUD) | pmtud_change;
23832383
if (update) {
23842384
sctp_transport_pmtu(trans, sctp_opt2sk(sp));
2385-
sctp_assoc_sync_pmtu(asoc);
2385+
sctp_assoc_sync_pmtu(sctp_opt2sk(sp), asoc);
23862386
}
23872387
} else if (asoc) {
23882388
asoc->param_flags =

net/sctp/transport.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk)
228228
transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
229229
}
230230

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)
232232
{
233233
struct dst_entry *dst;
234234

@@ -245,8 +245,16 @@ void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)
245245
}
246246

247247
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) {
249252
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+
}
250258
}
251259

252260
/* Caches the dst entry and source address for a transport's destination

0 commit comments

Comments
 (0)