Commit 02f3d4ce authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parent 35ad9b9c
...@@ -519,10 +519,10 @@ static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu) ...@@ -519,10 +519,10 @@ static inline int sctp_frag_point(const struct sctp_association *asoc, int pmtu)
return frag; return frag;
} }
static inline void sctp_assoc_pending_pmtu(struct sctp_association *asoc) static inline void sctp_assoc_pending_pmtu(struct sock *sk, struct sctp_association *asoc)
{ {
sctp_assoc_sync_pmtu(asoc); sctp_assoc_sync_pmtu(sk, asoc);
asoc->pmtu_pending = 0; asoc->pmtu_pending = 0;
} }
......
...@@ -1091,7 +1091,7 @@ void sctp_transport_burst_limited(struct sctp_transport *); ...@@ -1091,7 +1091,7 @@ void sctp_transport_burst_limited(struct sctp_transport *);
void sctp_transport_burst_reset(struct sctp_transport *); void sctp_transport_burst_reset(struct sctp_transport *);
unsigned long sctp_transport_timeout(struct sctp_transport *); unsigned long sctp_transport_timeout(struct sctp_transport *);
void sctp_transport_reset(struct sctp_transport *); void sctp_transport_reset(struct sctp_transport *);
void sctp_transport_update_pmtu(struct sctp_transport *, u32); void sctp_transport_update_pmtu(struct sock *, struct sctp_transport *, u32);
void sctp_transport_immediate_rtx(struct sctp_transport *); void sctp_transport_immediate_rtx(struct sctp_transport *);
...@@ -2003,7 +2003,7 @@ void sctp_assoc_update(struct sctp_association *old, ...@@ -2003,7 +2003,7 @@ void sctp_assoc_update(struct sctp_association *old,
__u32 sctp_association_get_next_tsn(struct sctp_association *); __u32 sctp_association_get_next_tsn(struct sctp_association *);
void sctp_assoc_sync_pmtu(struct sctp_association *); void sctp_assoc_sync_pmtu(struct sock *, struct sctp_association *);
void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int); void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int);
void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int); void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int);
void sctp_assoc_set_primary(struct sctp_association *, void sctp_assoc_set_primary(struct sctp_association *,
......
...@@ -1360,7 +1360,7 @@ struct sctp_transport *sctp_assoc_choose_alter_transport( ...@@ -1360,7 +1360,7 @@ struct sctp_transport *sctp_assoc_choose_alter_transport(
/* Update the association's pmtu and frag_point by going through all the /* Update the association's pmtu and frag_point by going through all the
* transports. This routine is called when a transport's PMTU has changed. * transports. This routine is called when a transport's PMTU has changed.
*/ */
void sctp_assoc_sync_pmtu(struct sctp_association *asoc) void sctp_assoc_sync_pmtu(struct sock *sk, struct sctp_association *asoc)
{ {
struct sctp_transport *t; struct sctp_transport *t;
__u32 pmtu = 0; __u32 pmtu = 0;
...@@ -1372,7 +1372,7 @@ void sctp_assoc_sync_pmtu(struct sctp_association *asoc) ...@@ -1372,7 +1372,7 @@ void sctp_assoc_sync_pmtu(struct sctp_association *asoc)
list_for_each_entry(t, &asoc->peer.transport_addr_list, list_for_each_entry(t, &asoc->peer.transport_addr_list,
transports) { transports) {
if (t->pmtu_pending && t->dst) { if (t->pmtu_pending && t->dst) {
sctp_transport_update_pmtu(t, dst_mtu(t->dst)); sctp_transport_update_pmtu(sk, t, dst_mtu(t->dst));
t->pmtu_pending = 0; t->pmtu_pending = 0;
} }
if (!pmtu || (t->pathmtu < pmtu)) if (!pmtu || (t->pathmtu < pmtu))
......
...@@ -408,10 +408,10 @@ void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc, ...@@ -408,10 +408,10 @@ void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc,
if (t->param_flags & SPP_PMTUD_ENABLE) { if (t->param_flags & SPP_PMTUD_ENABLE) {
/* Update transports view of the MTU */ /* Update transports view of the MTU */
sctp_transport_update_pmtu(t, pmtu); sctp_transport_update_pmtu(sk, t, pmtu);
/* Update association pmtu. */ /* Update association pmtu. */
sctp_assoc_sync_pmtu(asoc); sctp_assoc_sync_pmtu(sk, asoc);
} }
/* Retransmit with the new pmtu setting. /* Retransmit with the new pmtu setting.
......
...@@ -410,7 +410,7 @@ int sctp_packet_transmit(struct sctp_packet *packet) ...@@ -410,7 +410,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
if (!sctp_transport_dst_check(tp)) { if (!sctp_transport_dst_check(tp)) {
sctp_transport_route(tp, NULL, sctp_sk(sk)); sctp_transport_route(tp, NULL, sctp_sk(sk));
if (asoc && (asoc->param_flags & SPP_PMTUD_ENABLE)) { if (asoc && (asoc->param_flags & SPP_PMTUD_ENABLE)) {
sctp_assoc_sync_pmtu(asoc); sctp_assoc_sync_pmtu(sk, asoc);
} }
} }
dst = dst_clone(tp->dst); dst = dst_clone(tp->dst);
......
...@@ -1853,7 +1853,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, ...@@ -1853,7 +1853,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
} }
if (asoc->pmtu_pending) if (asoc->pmtu_pending)
sctp_assoc_pending_pmtu(asoc); sctp_assoc_pending_pmtu(sk, asoc);
/* If fragmentation is disabled and the message length exceeds the /* If fragmentation is disabled and the message length exceeds the
* association fragmentation point, return EMSGSIZE. The I-D * association fragmentation point, return EMSGSIZE. The I-D
...@@ -2365,7 +2365,7 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params, ...@@ -2365,7 +2365,7 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params,
if ((params->spp_flags & SPP_PMTUD_DISABLE) && params->spp_pathmtu) { if ((params->spp_flags & SPP_PMTUD_DISABLE) && params->spp_pathmtu) {
if (trans) { if (trans) {
trans->pathmtu = params->spp_pathmtu; trans->pathmtu = params->spp_pathmtu;
sctp_assoc_sync_pmtu(asoc); sctp_assoc_sync_pmtu(sctp_opt2sk(sp), asoc);
} else if (asoc) { } else if (asoc) {
asoc->pathmtu = params->spp_pathmtu; asoc->pathmtu = params->spp_pathmtu;
sctp_frag_point(asoc, params->spp_pathmtu); sctp_frag_point(asoc, params->spp_pathmtu);
...@@ -2382,7 +2382,7 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params, ...@@ -2382,7 +2382,7 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params,
(trans->param_flags & ~SPP_PMTUD) | pmtud_change; (trans->param_flags & ~SPP_PMTUD) | pmtud_change;
if (update) { if (update) {
sctp_transport_pmtu(trans, sctp_opt2sk(sp)); sctp_transport_pmtu(trans, sctp_opt2sk(sp));
sctp_assoc_sync_pmtu(asoc); sctp_assoc_sync_pmtu(sctp_opt2sk(sp), asoc);
} }
} else if (asoc) { } else if (asoc) {
asoc->param_flags = asoc->param_flags =
......
...@@ -228,7 +228,7 @@ void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk) ...@@ -228,7 +228,7 @@ void sctp_transport_pmtu(struct sctp_transport *transport, struct sock *sk)
transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT; transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
} }
void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) void sctp_transport_update_pmtu(struct sock *sk, struct sctp_transport *t, u32 pmtu)
{ {
struct dst_entry *dst; struct dst_entry *dst;
...@@ -245,8 +245,16 @@ void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu) ...@@ -245,8 +245,16 @@ void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)
} }
dst = sctp_transport_dst_check(t); dst = sctp_transport_dst_check(t);
if (dst) if (!dst)
t->af_specific->get_dst(t, &t->saddr, &t->fl, sk);
if (dst) {
dst->ops->update_pmtu(dst, pmtu); dst->ops->update_pmtu(dst, pmtu);
dst = sctp_transport_dst_check(t);
if (!dst)
t->af_specific->get_dst(t, &t->saddr, &t->fl, sk);
}
} }
/* Caches the dst entry and source address for a transport's destination /* Caches the dst entry and source address for a transport's destination
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment