Skip to content

Commit 7307e4f

Browse files
lxindavem330
authored andcommitted
sctp: enable PLPMTUD when the transport is ready
sctp_transport_pl_reset() is called whenever any of these 3 members in transport is changed: - probe_interval - param_flags & SPP_PMTUD_ENABLE - state == ACTIVE If all are true, start the PLPMTUD when it's not yet started. If any of these is false, stop the PLPMTUD when it's already running. sctp_transport_pl_update() is called when the transport dst has changed. It will restart the PLPMTUD probe. Again, the pathmtu won't change but use the dst's mtu until the Search phase is done. Note that after using PLPMTUD, the pathmtu is only initialized with the dst mtu when the transport dst changes. At other time it is updated by pl.pmtu. So sctp_transport_pmtu_check() will be called only when PLPMTUD is disabled in sctp_packet_config(). After this patch, the PLPMTUD feature from RFC8899 will be activated and can be used by users. Signed-off-by: Xin Long <[email protected]> Acked-by: Marcelo Ricardo Leitner <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8369640 commit 7307e4f

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

net/sctp/associola.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,8 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
716716
return NULL;
717717
}
718718

719+
sctp_transport_pl_reset(peer);
720+
719721
/* Attach the remote transport to our asoc. */
720722
list_add_tail_rcu(&peer->transports, &asoc->peer.transport_addr_list);
721723
asoc->peer.transport_count++;
@@ -814,6 +816,7 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
814816
spc_state = SCTP_ADDR_CONFIRMED;
815817

816818
transport->state = SCTP_ACTIVE;
819+
sctp_transport_pl_reset(transport);
817820
break;
818821

819822
case SCTP_TRANSPORT_DOWN:
@@ -823,6 +826,7 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
823826
*/
824827
if (transport->state != SCTP_UNCONFIRMED) {
825828
transport->state = SCTP_INACTIVE;
829+
sctp_transport_pl_reset(transport);
826830
spc_state = SCTP_ADDR_UNREACHABLE;
827831
} else {
828832
sctp_transport_dst_release(transport);

net/sctp/output.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ void sctp_packet_config(struct sctp_packet *packet, __u32 vtag,
103103
sctp_transport_route(tp, NULL, sp);
104104
if (asoc->param_flags & SPP_PMTUD_ENABLE)
105105
sctp_assoc_sync_pmtu(asoc);
106-
} else if (!sctp_transport_pmtu_check(tp)) {
106+
} else if (!sctp_transport_pl_enabled(tp) &&
107+
!sctp_transport_pmtu_check(tp)) {
107108
if (asoc->param_flags & SPP_PMTUD_ENABLE)
108109
sctp_assoc_sync_pmtu(asoc);
109110
}

net/sctp/socket.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2496,6 +2496,7 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params,
24962496
sctp_transport_pmtu(trans, sctp_opt2sk(sp));
24972497
sctp_assoc_sync_pmtu(asoc);
24982498
}
2499+
sctp_transport_pl_reset(trans);
24992500
} else if (asoc) {
25002501
asoc->param_flags =
25012502
(asoc->param_flags & ~SPP_PMTUD) | pmtud_change;
@@ -4506,6 +4507,7 @@ static int sctp_setsockopt_probe_interval(struct sock *sk,
45064507
return -EINVAL;
45074508

45084509
t->probe_interval = msecs_to_jiffies(probe_interval);
4510+
sctp_transport_pl_reset(t);
45094511
return 0;
45104512
}
45114513

@@ -4522,8 +4524,10 @@ static int sctp_setsockopt_probe_interval(struct sock *sk,
45224524
* each transport.
45234525
*/
45244526
if (asoc) {
4525-
list_for_each_entry(t, &asoc->peer.transport_addr_list, transports)
4527+
list_for_each_entry(t, &asoc->peer.transport_addr_list, transports) {
45264528
t->probe_interval = msecs_to_jiffies(probe_interval);
4529+
sctp_transport_pl_reset(t);
4530+
}
45274531

45284532
asoc->probe_interval = msecs_to_jiffies(probe_interval);
45294533
return 0;

net/sctp/transport.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk)
259259
transport->pathmtu = sctp_dst_mtu(transport->dst);
260260
else
261261
transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
262+
263+
sctp_transport_pl_update(transport);
262264
}
263265

264266
void sctp_transport_pl_send(struct sctp_transport *t)

0 commit comments

Comments
 (0)