Skip to content

Commit cec6880

Browse files
committed
Merge branch 'sctp-plpmtud-fixes'
Xin Long says: ==================== sctp: a couple of fixes for PLPMTUD Four fixes included in this patchset: - fix the packet sending in Error state. - fix the timer stop when transport update dst. - fix the outer header len calculation. - fix the return value for toobig processing. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 411a44c + 75cf662 commit cec6880

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

include/net/sctp/sctp.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,8 @@ static inline __u32 sctp_min_frag_point(struct sctp_sock *sp, __u16 datasize)
626626

627627
static inline int sctp_transport_pl_hlen(struct sctp_transport *t)
628628
{
629-
return __sctp_mtu_payload(sctp_sk(t->asoc->base.sk), t, 0, 0);
629+
return __sctp_mtu_payload(sctp_sk(t->asoc->base.sk), t, 0, 0) -
630+
sizeof(struct sctphdr);
630631
}
631632

632633
static inline void sctp_transport_pl_reset(struct sctp_transport *t)
@@ -653,12 +654,10 @@ static inline void sctp_transport_pl_update(struct sctp_transport *t)
653654
if (t->pl.state == SCTP_PL_DISABLED)
654655
return;
655656

656-
if (del_timer(&t->probe_timer))
657-
sctp_transport_put(t);
658-
659657
t->pl.state = SCTP_PL_BASE;
660658
t->pl.pmtu = SCTP_BASE_PLPMTU;
661659
t->pl.probe_size = SCTP_BASE_PLPMTU;
660+
sctp_transport_reset_probe_timer(t);
662661
}
663662

664663
static inline bool sctp_transport_pl_enabled(struct sctp_transport *t)

net/sctp/output.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -581,13 +581,16 @@ int sctp_packet_transmit(struct sctp_packet *packet, gfp_t gfp)
581581
chunk = list_entry(packet->chunk_list.next, struct sctp_chunk, list);
582582
sk = chunk->skb->sk;
583583

584-
/* check gso */
585584
if (packet->size > tp->pathmtu && !packet->ipfragok && !chunk->pmtu_probe) {
586-
if (!sk_can_gso(sk)) {
587-
pr_err_once("Trying to GSO but underlying device doesn't support it.");
588-
goto out;
585+
if (tp->pl.state == SCTP_PL_ERROR) { /* do IP fragmentation if in Error state */
586+
packet->ipfragok = 1;
587+
} else {
588+
if (!sk_can_gso(sk)) { /* check gso */
589+
pr_err_once("Trying to GSO but underlying device doesn't support it.");
590+
goto out;
591+
}
592+
gso = 1;
589593
}
590-
gso = 1;
591594
}
592595

593596
/* alloc head skb */

net/sctp/transport.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ bool sctp_transport_pl_send(struct sctp_transport *t)
269269
if (t->pl.probe_size == SCTP_BASE_PLPMTU) { /* BASE_PLPMTU Confirmation Failed */
270270
t->pl.state = SCTP_PL_ERROR; /* Base -> Error */
271271

272-
t->pl.pmtu = SCTP_MIN_PLPMTU;
272+
t->pl.pmtu = SCTP_BASE_PLPMTU;
273273
t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
274274
sctp_assoc_sync_pmtu(t->asoc);
275275
}
@@ -366,8 +366,9 @@ static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu)
366366
if (pmtu >= SCTP_MIN_PLPMTU && pmtu < SCTP_BASE_PLPMTU) {
367367
t->pl.state = SCTP_PL_ERROR; /* Base -> Error */
368368

369-
t->pl.pmtu = SCTP_MIN_PLPMTU;
369+
t->pl.pmtu = SCTP_BASE_PLPMTU;
370370
t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
371+
return true;
371372
}
372373
} else if (t->pl.state == SCTP_PL_SEARCH) {
373374
if (pmtu >= SCTP_BASE_PLPMTU && pmtu < t->pl.pmtu) {
@@ -378,11 +379,10 @@ static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu)
378379
t->pl.probe_high = 0;
379380
t->pl.pmtu = SCTP_BASE_PLPMTU;
380381
t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
382+
return true;
381383
} else if (pmtu > t->pl.pmtu && pmtu < t->pl.probe_size) {
382384
t->pl.probe_size = pmtu;
383385
t->pl.probe_count = 0;
384-
385-
return false;
386386
}
387387
} else if (t->pl.state == SCTP_PL_COMPLETE) {
388388
if (pmtu >= SCTP_BASE_PLPMTU && pmtu < t->pl.pmtu) {
@@ -393,10 +393,11 @@ static bool sctp_transport_pl_toobig(struct sctp_transport *t, u32 pmtu)
393393
t->pl.probe_high = 0;
394394
t->pl.pmtu = SCTP_BASE_PLPMTU;
395395
t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
396+
return true;
396397
}
397398
}
398399

399-
return true;
400+
return false;
400401
}
401402

402403
bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)

0 commit comments

Comments
 (0)