aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/sctp/structs.h1
-rw-r--r--net/sctp/input.c16
-rw-r--r--net/sctp/transport.c41
3 files changed, 44 insertions, 14 deletions
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 5e81984b8478..dc0e70cb0f8b 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -1006,6 +1006,7 @@ void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32);
1006void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t); 1006void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t);
1007unsigned long sctp_transport_timeout(struct sctp_transport *); 1007unsigned long sctp_transport_timeout(struct sctp_transport *);
1008void sctp_transport_reset(struct sctp_transport *); 1008void sctp_transport_reset(struct sctp_transport *);
1009void sctp_transport_update_pmtu(struct sctp_transport *, u32);
1009 1010
1010 1011
1011/* This is the structure we use to queue packets as they come into 1012/* This is the structure we use to queue packets as they come into
diff --git a/net/sctp/input.c b/net/sctp/input.c
index 885109fb3dda..45d6a644cf06 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -371,20 +371,8 @@ void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc,
371 return; 371 return;
372 372
373 if (t->param_flags & SPP_PMTUD_ENABLE) { 373 if (t->param_flags & SPP_PMTUD_ENABLE) {
374 if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) { 374 /* Update transports view of the MTU */
375 printk(KERN_WARNING "%s: Reported pmtu %d too low, " 375 sctp_transport_update_pmtu(t, pmtu);
376 "using default minimum of %d\n",
377 __FUNCTION__, pmtu,
378 SCTP_DEFAULT_MINSEGMENT);
379 /* Use default minimum segment size and disable
380 * pmtu discovery on this transport.
381 */
382 t->pathmtu = SCTP_DEFAULT_MINSEGMENT;
383 t->param_flags = (t->param_flags & ~SPP_PMTUD) |
384 SPP_PMTUD_DISABLE;
385 } else {
386 t->pathmtu = pmtu;
387 }
388 376
389 /* Update association pmtu. */ 377 /* Update association pmtu. */
390 sctp_assoc_sync_pmtu(asoc); 378 sctp_assoc_sync_pmtu(asoc);
diff --git a/net/sctp/transport.c b/net/sctp/transport.c
index 961df275d5b9..e14c271cf28b 100644
--- a/net/sctp/transport.c
+++ b/net/sctp/transport.c
@@ -241,6 +241,47 @@ void sctp_transport_pmtu(struct sctp_transport *transport)
241 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT; 241 transport->pathmtu = SCTP_DEFAULT_MAXSEGMENT;
242} 242}
243 243
244/* this is a complete rip-off from __sk_dst_check
245 * the cookie is always 0 since this is how it's used in the
246 * pmtu code
247 */
248static struct dst_entry *sctp_transport_dst_check(struct sctp_transport *t)
249{
250 struct dst_entry *dst = t->dst;
251
252 if (dst && dst->obsolete && dst->ops->check(dst, 0) == NULL) {
253 dst_release(t->dst);
254 t->dst = NULL;
255 return NULL;
256 }
257
258 return dst;
259}
260
261void sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)
262{
263 struct dst_entry *dst;
264
265 if (unlikely(pmtu < SCTP_DEFAULT_MINSEGMENT)) {
266 printk(KERN_WARNING "%s: Reported pmtu %d too low, "
267 "using default minimum of %d\n",
268 __FUNCTION__, pmtu,
269 SCTP_DEFAULT_MINSEGMENT);
270 /* Use default minimum segment size and disable
271 * pmtu discovery on this transport.
272 */
273 t->pathmtu = SCTP_DEFAULT_MINSEGMENT;
274 t->param_flags = (t->param_flags & ~SPP_PMTUD) |
275 SPP_PMTUD_DISABLE;
276 } else {
277 t->pathmtu = pmtu;
278 }
279
280 dst = sctp_transport_dst_check(t);
281 if (dst)
282 dst->ops->update_pmtu(dst, pmtu);
283}
284
244/* Caches the dst entry and source address for a transport's destination 285/* Caches the dst entry and source address for a transport's destination
245 * address. 286 * address.
246 */ 287 */