]> git.baikalelectronics.ru Git - kernel.git/commit
sctp: add udphdr to overhead when udp_port is set
authorXin Long <lucien.xin@gmail.com>
Thu, 29 Oct 2020 07:05:04 +0000 (15:05 +0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 30 Oct 2020 22:24:21 +0000 (15:24 -0700)
commit9605dd976146b8af76133aa80f15dabfcb44710f
tree0f4916867d8f9041b025c4d8e804232de9b23b1a
parent8470b39407337bf331c26071349b9a7de0e59df4
sctp: add udphdr to overhead when udp_port is set

sctp_mtu_payload() is for calculating the frag size before making
chunks from a msg. So we should only add udphdr size to overhead
when udp socks are listening, as only then sctp can handle the
incoming sctp over udp packets and outgoing sctp over udp packets
will be possible.

Note that we can't do this according to transport->encap_port, as
different transports may be set to different values, while the
chunks were made before choosing the transport, we could not be
able to meet all rfc6951#section-5.6 recommends.

v1->v2:
  - Add udp_port for sctp_sock to avoid a potential race issue, it
    will be used in xmit path in the next patch.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/sctp/sctp.h
include/net/sctp/structs.h
net/sctp/socket.c