Skip to content

Commit

Permalink
sctp: move transport pathmtu calc away of sctp_assoc_add_peer
Browse files Browse the repository at this point in the history
There was only one case that sctp_assoc_add_peer couldn't handle, which
is when SPP_PMTUD_DISABLE is set and pathmtu not initialized.
So add this situation to sctp_transport_route and reuse what was
already in there.

Signed-off-by: Marcelo Ricardo Leitner <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
marceloleitner authored and davem330 committed Apr 27, 2018
1 parent c45698f commit 800e00c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
9 changes: 1 addition & 8 deletions net/sctp/associola.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,15 +652,8 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
*/
peer->param_flags = asoc->param_flags;

sctp_transport_route(peer, NULL, sp);

/* Initialize the pmtu of the transport. */
if (peer->param_flags & SPP_PMTUD_DISABLE) {
if (asoc->pathmtu)
peer->pathmtu = asoc->pathmtu;
else
peer->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
}
sctp_transport_route(peer, NULL, sp);

/* If this is the first transport addr on this association,
* initialize the association PMTU to the peer's PMTU.
Expand Down
8 changes: 6 additions & 2 deletions net/sctp/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,15 @@ void sctp_transport_route(struct sctp_transport *transport,
* association's active path for getsockname().
*/
if (asoc && (!asoc->peer.primary_path ||
(transport == asoc->peer.active_path)))
(transport == asoc->peer.active_path)))
opt->pf->to_sk_saddr(&transport->saddr,
asoc->base.sk);
} else
} else if ((transport->param_flags & SPP_PMTUD_DISABLE) &&
asoc && asoc->pathmtu) {
transport->pathmtu = asoc->pathmtu;
} else {
transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
}
}

/* Hold a reference to a transport. */
Expand Down

0 comments on commit 800e00c

Please sign in to comment.