sctp: subtract sctphdr len in sctp_transport_pl_hlen
authorXin Long <lucien.xin@gmail.com>
Thu, 28 Oct 2021 09:36:03 +0000 (05:36 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 29 Oct 2021 11:21:23 +0000 (12:21 +0100)
commitcc4665ca646c96181a7c00198aa72c59e0c576e8
tree7d29f94ee37490e26afb25665c942fe7e3ce2d1f
parentc6ea04ea692fa0d8e7faeb133fcd28e3acf470a0
sctp: subtract sctphdr len in sctp_transport_pl_hlen

sctp_transport_pl_hlen() is called to calculate the outer header length
for PL. However, as the Figure in rfc8899#section-4.4:

   Any additional
     headers         .--- MPS -----.
            |        |             |
            v        v             v
     +------------------------------+
     | IP | ** | PL | protocol data |
     +------------------------------+

                <----- PLPMTU ----->
     <---------- PMTU -------------->

Outer header are IP + Any additional headers, which doesn't include
Packetization Layer itself header, namely sctphdr, whereas sctphdr
is counted by __sctp_mtu_payload().

The incorrect calculation caused the link pathmtu to be set larger
than expected by t->pl.pmtu + sctp_transport_pl_hlen(). This patch
is to fix it by subtracting sctphdr len in sctp_transport_pl_hlen().

Fixes: d9e2e410ae30 ("sctp: add the constants/variables and states and some APIs for transport")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sctp/sctp.h