lkml.org 
[lkml]   [2021]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.15 544/917] sctp: subtract sctphdr len in sctp_transport_pl_hlen
    Date
    From: Xin Long <lucien.xin@gmail.com>

    [ Upstream commit cc4665ca646c96181a7c00198aa72c59e0c576e8 ]

    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>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    include/net/sctp/sctp.h | 3 ++-
    1 file changed, 2 insertions(+), 1 deletion(-)

    diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
    index bc00410223b03..189fdb9db1622 100644
    --- a/include/net/sctp/sctp.h
    +++ b/include/net/sctp/sctp.h
    @@ -626,7 +626,8 @@ static inline __u32 sctp_min_frag_point(struct sctp_sock *sp, __u16 datasize)

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

    static inline void sctp_transport_pl_reset(struct sctp_transport *t)
    --
    2.33.0


    \
     
     \ /
      Last update: 2021-11-16 01:10    [W:3.149 / U:0.252 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site