diff options
author | Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> | 2016-03-19 12:17:20 -0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-20 16:31:12 -0400 |
commit | 3822a5ff4bc32043fa9c7b6d6f125bcdca6da39c (patch) | |
tree | 681827ec62422bf2f212913f9a696db89eaa72a6 /net/sctp/input.c | |
parent | 31b055ef0c6116a27e9a787304ecf87a77d34764 (diff) | |
download | lwn-3822a5ff4bc32043fa9c7b6d6f125bcdca6da39c.tar.gz lwn-3822a5ff4bc32043fa9c7b6d6f125bcdca6da39c.zip |
sctp: align MTU to a word
SCTP is a protocol that is aligned to a word (4 bytes). Thus using bare
MTU can sometimes return values that are not aligned, like for loopback,
which is 65536 but ipv4_mtu() limits that to 65535. This mis-alignment
will cause the last non-aligned bytes to never be used and can cause
issues with congestion control.
So it's better to just consider a lower MTU and keep congestion control
calcs saner as they are based on PMTU.
Same applies to icmp frag needed messages, which is also fixed by this
patch.
One other effect of this is the inability to send MTU-sized packet
without queueing or fragmentation and without hitting Nagle. As the
check performed at sctp_packet_can_append_data():
if (chunk->skb->len + q->out_qlen >= transport->pathmtu - packet->overhead)
/* Enough data queued to fill a packet */
return SCTP_XMIT_OK;
with the above example of MTU, if there are no other messages queued,
one cannot send a packet that just fits one packet (65532 bytes) and
without causing DATA chunk fragmentation or a delay.
v2:
- Added WORD_TRUNC macro
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/input.c')
-rw-r--r-- | net/sctp/input.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/sctp/input.c b/net/sctp/input.c index db76f1ab4ac2..00b8445364e3 100644 --- a/net/sctp/input.c +++ b/net/sctp/input.c @@ -606,7 +606,8 @@ void sctp_v4_err(struct sk_buff *skb, __u32 info) /* PMTU discovery (RFC1191) */ if (ICMP_FRAG_NEEDED == code) { - sctp_icmp_frag_needed(sk, asoc, transport, info); + sctp_icmp_frag_needed(sk, asoc, transport, + WORD_TRUNC(info)); goto out_unlock; } else { if (ICMP_PROT_UNREACH == code) { |