diff mbox series

[net] sctp: do not update transport pathmtu if SPP_PMTUD_ENABLE is not set

Message ID a0a956bbb2142d8de933d20a7a01e8ce66d048c0.1626883705.git.lucien.xin@gmail.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net] sctp: do not update transport pathmtu if SPP_PMTUD_ENABLE is not set | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers fail 1 blamed authors not CCed: nhorman@tuxdriver.com; 2 maintainers not CCed: vyasevich@gmail.com nhorman@tuxdriver.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit fail Errors and warnings before: 1 this patch: 19
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/build_allmodconfig_warn fail Errors and warnings before: 1 this patch: 19
netdev/header_inline success Link

Commit Message

Xin Long July 21, 2021, 4:08 p.m. UTC
Currently, in sctp_packet_config(), sctp_transport_pmtu_check() is
called to update transport pathmtu with dst's mtu when dst's mtu
has been changed by non sctp stack like xfrm.

However, this should only happen when SPP_PMTUD_ENABLE is set, no
matter where dst's mtu changed. This patch is to fix by checking
SPP_PMTUD_ENABLE flag before calling sctp_transport_pmtu_check().

Thanks Jacek for reporting and looking into this issue.

Fixes: 69fec325a643 ('Revert "sctp: remove sctp_transport_pmtu_check"')
Reported-by: Jacek Szafraniec <jacek.szafraniec@nokia.com>
Tested-by: Jacek Szafraniec <jacek.szafraniec@nokia.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/sctp/output.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

kernel test robot July 21, 2021, 6:29 p.m. UTC | #1
Hi Xin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net/master]

url:    https://github.com/0day-ci/linux/commits/Xin-Long/sctp-do-not-update-transport-pathmtu-if-SPP_PMTUD_ENABLE-is-not-set/20210722-001121
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git e9a72f874d5b95cef0765bafc56005a50f72c5fe
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/e6927d4d69af5f40d7884a7ccc70737bf3da2771
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Xin-Long/sctp-do-not-update-transport-pathmtu-if-SPP_PMTUD_ENABLE-is-not-set/20210722-001121
        git checkout e6927d4d69af5f40d7884a7ccc70737bf3da2771
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash net/sctp/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   net/sctp/output.c:112:2: error: expected identifier or '(' before 'if'
     112 |  if (asoc->pmtu_pending) {
         |  ^~
   net/sctp/output.c:121:2: error: expected identifier or '(' before 'if'
     121 |  if (ecn_capable) {
         |  ^~
   net/sctp/output.c:128:2: error: expected identifier or '(' before 'if'
     128 |  if (!tp->dst)
         |  ^~
>> net/sctp/output.c:132:2: warning: data definition has no type or storage class
     132 |  rcu_read_lock();
         |  ^~~~~~~~~~~~~
   net/sctp/output.c:132:2: error: type defaults to 'int' in declaration of 'rcu_read_lock' [-Werror=implicit-int]
   net/sctp/output.c:132:2: error: function declaration isn't a prototype [-Werror=strict-prototypes]
   net/sctp/output.c:132:2: error: conflicting types for 'rcu_read_lock'
   In file included from include/linux/rbtree.h:22,
                    from include/linux/mm_types.h:10,
                    from include/linux/mmzone.h:21,
                    from include/linux/gfp.h:6,
                    from include/linux/mm.h:10,
                    from include/linux/bvec.h:14,
                    from include/linux/skbuff.h:17,
                    from include/linux/ip.h:16,
                    from net/sctp/output.c:28:
   include/linux/rcupdate.h:683:29: note: previous definition of 'rcu_read_lock' was here
     683 | static __always_inline void rcu_read_lock(void)
         |                             ^~~~~~~~~~~~~
   net/sctp/output.c:133:2: error: expected identifier or '(' before 'if'
     133 |  if (__sk_dst_get(sk) != tp->dst) {
         |  ^~
   net/sctp/output.c:137:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
     137 |  packet->max_size = sk_can_gso(sk) ? tp->dst->dev->gso_max_size
         |        ^~
   net/sctp/output.c:139:2: warning: data definition has no type or storage class
     139 |  rcu_read_unlock();
         |  ^~~~~~~~~~~~~~~
   net/sctp/output.c:139:2: error: type defaults to 'int' in declaration of 'rcu_read_unlock' [-Werror=implicit-int]
   net/sctp/output.c:139:2: error: function declaration isn't a prototype [-Werror=strict-prototypes]
   net/sctp/output.c:139:2: error: conflicting types for 'rcu_read_unlock'
   In file included from include/linux/rbtree.h:22,
                    from include/linux/mm_types.h:10,
                    from include/linux/mmzone.h:21,
                    from include/linux/gfp.h:6,
                    from include/linux/mm.h:10,
                    from include/linux/bvec.h:14,
                    from include/linux/skbuff.h:17,
                    from include/linux/ip.h:16,
                    from net/sctp/output.c:28:
   include/linux/rcupdate.h:714:20: note: previous definition of 'rcu_read_unlock' was here
     714 | static inline void rcu_read_unlock(void)
         |                    ^~~~~~~~~~~~~~~
   net/sctp/output.c:140:1: error: expected identifier or '(' before '}' token
     140 | }
         | ^
   cc1: some warnings being treated as errors


vim +132 net/sctp/output.c

be2971438dec2e Wei Yongjun             2009-09-04   69  
^1da177e4c3f41 Linus Torvalds          2005-04-16   70  /* Config a packet.
^1da177e4c3f41 Linus Torvalds          2005-04-16   71   * This appears to be a followup set of initializations.
^1da177e4c3f41 Linus Torvalds          2005-04-16   72   */
66b91d2cd0344c Marcelo Ricardo Leitner 2016-12-28   73  void sctp_packet_config(struct sctp_packet *packet, __u32 vtag,
66b91d2cd0344c Marcelo Ricardo Leitner 2016-12-28   74  			int ecn_capable)
^1da177e4c3f41 Linus Torvalds          2005-04-16   75  {
90017accff61ae Marcelo Ricardo Leitner 2016-06-02   76  	struct sctp_transport *tp = packet->transport;
90017accff61ae Marcelo Ricardo Leitner 2016-06-02   77  	struct sctp_association *asoc = tp->asoc;
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26   78  	struct sctp_sock *sp = NULL;
df2729c3238ed8 Xin Long                2017-04-01   79  	struct sock *sk;
^1da177e4c3f41 Linus Torvalds          2005-04-16   80  
bb33381d0c97cd Daniel Borkmann         2013-06-28   81  	pr_debug("%s: packet:%p vtag:0x%x\n", __func__, packet, vtag);
^1da177e4c3f41 Linus Torvalds          2005-04-16   82  	packet->vtag = vtag;
^1da177e4c3f41 Linus Torvalds          2005-04-16   83  
df2729c3238ed8 Xin Long                2017-04-01   84  	/* do the following jobs only once for a flush schedule */
df2729c3238ed8 Xin Long                2017-04-01   85  	if (!sctp_packet_empty(packet))
df2729c3238ed8 Xin Long                2017-04-01   86  		return;
90017accff61ae Marcelo Ricardo Leitner 2016-06-02   87  
b7e10c25b839c0 Richard Haines          2018-02-24   88  	/* set packet max_size with pathmtu, then calculate overhead */
90017accff61ae Marcelo Ricardo Leitner 2016-06-02   89  	packet->max_size = tp->pathmtu;
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26   90  
b7e10c25b839c0 Richard Haines          2018-02-24   91  	if (asoc) {
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26   92  		sk = asoc->base.sk;
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26   93  		sp = sctp_sk(sk);
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26   94  	}
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26   95  	packet->overhead = sctp_mtu_payload(sp, 0, 0);
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26   96  	packet->size = packet->overhead;
b7e10c25b839c0 Richard Haines          2018-02-24   97  
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26   98  	if (!asoc)
df2729c3238ed8 Xin Long                2017-04-01   99  		return;
90017accff61ae Marcelo Ricardo Leitner 2016-06-02  100  
df2729c3238ed8 Xin Long                2017-04-01  101  	/* update dst or transport pathmtu if in need */
df2729c3238ed8 Xin Long                2017-04-01  102  	if (!sctp_transport_dst_check(tp)) {
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26  103  		sctp_transport_route(tp, NULL, sp);
df2729c3238ed8 Xin Long                2017-04-01  104  		if (asoc->param_flags & SPP_PMTUD_ENABLE)
3ebfdf082184d0 Xin Long                2017-04-04  105  			sctp_assoc_sync_pmtu(asoc);
7307e4fa4d295f Xin Long                2021-06-22  106  	} else if (!sctp_transport_pl_enabled(tp) &&
e6927d4d69af5f Xin Long                2021-07-21  107  		   asoc->param_flags & SPP_PMTUD_ENABLE)
e6927d4d69af5f Xin Long                2021-07-21  108  		if (!sctp_transport_pmtu_check(tp))
69fec325a64383 Xin Long                2018-11-18  109  			sctp_assoc_sync_pmtu(asoc);
df2729c3238ed8 Xin Long                2017-04-01  110  	}
^1da177e4c3f41 Linus Torvalds          2005-04-16  111  
d805397c3822d5 Xin Long                2018-10-15  112  	if (asoc->pmtu_pending) {
d805397c3822d5 Xin Long                2018-10-15  113  		if (asoc->param_flags & SPP_PMTUD_ENABLE)
d805397c3822d5 Xin Long                2018-10-15  114  			sctp_assoc_sync_pmtu(asoc);
d805397c3822d5 Xin Long                2018-10-15  115  		asoc->pmtu_pending = 0;
d805397c3822d5 Xin Long                2018-10-15  116  	}
d805397c3822d5 Xin Long                2018-10-15  117  
^1da177e4c3f41 Linus Torvalds          2005-04-16  118  	/* If there a is a prepend chunk stick it on the list before
^1da177e4c3f41 Linus Torvalds          2005-04-16  119  	 * any other chunks get appended.
^1da177e4c3f41 Linus Torvalds          2005-04-16  120  	 */
df2729c3238ed8 Xin Long                2017-04-01  121  	if (ecn_capable) {
df2729c3238ed8 Xin Long                2017-04-01  122  		struct sctp_chunk *chunk = sctp_get_ecne_prepend(asoc);
df2729c3238ed8 Xin Long                2017-04-01  123  
^1da177e4c3f41 Linus Torvalds          2005-04-16  124  		if (chunk)
^1da177e4c3f41 Linus Torvalds          2005-04-16  125  			sctp_packet_append_chunk(packet, chunk);
^1da177e4c3f41 Linus Torvalds          2005-04-16  126  	}
df2729c3238ed8 Xin Long                2017-04-01  127  
df2729c3238ed8 Xin Long                2017-04-01  128  	if (!tp->dst)
df2729c3238ed8 Xin Long                2017-04-01  129  		return;
df2729c3238ed8 Xin Long                2017-04-01  130  
df2729c3238ed8 Xin Long                2017-04-01  131  	/* set packet max_size with gso_max_size if gso is enabled*/
df2729c3238ed8 Xin Long                2017-04-01 @132  	rcu_read_lock();
df2729c3238ed8 Xin Long                2017-04-01  133  	if (__sk_dst_get(sk) != tp->dst) {
df2729c3238ed8 Xin Long                2017-04-01  134  		dst_hold(tp->dst);
df2729c3238ed8 Xin Long                2017-04-01  135  		sk_setup_caps(sk, tp->dst);
df2729c3238ed8 Xin Long                2017-04-01  136  	}
df2729c3238ed8 Xin Long                2017-04-01  137  	packet->max_size = sk_can_gso(sk) ? tp->dst->dev->gso_max_size
df2729c3238ed8 Xin Long                2017-04-01  138  					  : asoc->pathmtu;
df2729c3238ed8 Xin Long                2017-04-01  139  	rcu_read_unlock();
^1da177e4c3f41 Linus Torvalds          2005-04-16  140  }
^1da177e4c3f41 Linus Torvalds          2005-04-16  141  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Marcelo Ricardo Leitner July 21, 2021, 6:42 p.m. UTC | #2
On Wed, Jul 21, 2021 at 12:08:25PM -0400, Xin Long wrote:
> Currently, in sctp_packet_config(), sctp_transport_pmtu_check() is
> called to update transport pathmtu with dst's mtu when dst's mtu
> has been changed by non sctp stack like xfrm.
> 
> However, this should only happen when SPP_PMTUD_ENABLE is set, no
> matter where dst's mtu changed. This patch is to fix by checking
> SPP_PMTUD_ENABLE flag before calling sctp_transport_pmtu_check().
> 
> Thanks Jacek for reporting and looking into this issue.
> 
> Fixes: 69fec325a643 ('Revert "sctp: remove sctp_transport_pmtu_check"')
> Reported-by: Jacek Szafraniec <jacek.szafraniec@nokia.com>
> Tested-by: Jacek Szafraniec <jacek.szafraniec@nokia.com>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
>  net/sctp/output.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sctp/output.c b/net/sctp/output.c
> index 9032ce60d50e..8d5708dd2a1f 100644
> --- a/net/sctp/output.c
> +++ b/net/sctp/output.c
> @@ -104,8 +104,8 @@ void sctp_packet_config(struct sctp_packet *packet, __u32 vtag,
>  		if (asoc->param_flags & SPP_PMTUD_ENABLE)
>  			sctp_assoc_sync_pmtu(asoc);
>  	} else if (!sctp_transport_pl_enabled(tp) &&
> -		   !sctp_transport_pmtu_check(tp)) {
> -		if (asoc->param_flags & SPP_PMTUD_ENABLE)
> +		   asoc->param_flags & SPP_PMTUD_ENABLE)

Lacks a '{' here at the end of the line.

Other than that:
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>

(please add it on the v2)

> +		if (!sctp_transport_pmtu_check(tp))
>  			sctp_assoc_sync_pmtu(asoc);
>  	}
>  
> -- 
> 2.27.0
>
Xin Long July 21, 2021, 6:49 p.m. UTC | #3
On Wed, Jul 21, 2021 at 2:42 PM Marcelo Ricardo Leitner
<marcelo.leitner@gmail.com> wrote:
>
> On Wed, Jul 21, 2021 at 12:08:25PM -0400, Xin Long wrote:
> > Currently, in sctp_packet_config(), sctp_transport_pmtu_check() is
> > called to update transport pathmtu with dst's mtu when dst's mtu
> > has been changed by non sctp stack like xfrm.
> >
> > However, this should only happen when SPP_PMTUD_ENABLE is set, no
> > matter where dst's mtu changed. This patch is to fix by checking
> > SPP_PMTUD_ENABLE flag before calling sctp_transport_pmtu_check().
> >
> > Thanks Jacek for reporting and looking into this issue.
> >
> > Fixes: 69fec325a643 ('Revert "sctp: remove sctp_transport_pmtu_check"')
> > Reported-by: Jacek Szafraniec <jacek.szafraniec@nokia.com>
> > Tested-by: Jacek Szafraniec <jacek.szafraniec@nokia.com>
> > Signed-off-by: Xin Long <lucien.xin@gmail.com>
> > ---
> >  net/sctp/output.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/net/sctp/output.c b/net/sctp/output.c
> > index 9032ce60d50e..8d5708dd2a1f 100644
> > --- a/net/sctp/output.c
> > +++ b/net/sctp/output.c
> > @@ -104,8 +104,8 @@ void sctp_packet_config(struct sctp_packet *packet, __u32 vtag,
> >               if (asoc->param_flags & SPP_PMTUD_ENABLE)
> >                       sctp_assoc_sync_pmtu(asoc);
> >       } else if (!sctp_transport_pl_enabled(tp) &&
> > -                !sctp_transport_pmtu_check(tp)) {
> > -             if (asoc->param_flags & SPP_PMTUD_ENABLE)
> > +                asoc->param_flags & SPP_PMTUD_ENABLE)
>
> Lacks a '{' here at the end of the line.
ah, right, sorry, reposted.

>
> Other than that:
> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
>
> (please add it on the v2)
>
> > +             if (!sctp_transport_pmtu_check(tp))
> >                       sctp_assoc_sync_pmtu(asoc);
> >       }
> >
> > --
> > 2.27.0
> >
kernel test robot July 21, 2021, 7:26 p.m. UTC | #4
Hi Xin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net/master]

url:    https://github.com/0day-ci/linux/commits/Xin-Long/sctp-do-not-update-transport-pathmtu-if-SPP_PMTUD_ENABLE-is-not-set/20210722-001121
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git e9a72f874d5b95cef0765bafc56005a50f72c5fe
config: x86_64-randconfig-r012-20210720 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project c781eb153bfbd1b52b03efe34f56bbeccbb8aba6)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://github.com/0day-ci/linux/commit/e6927d4d69af5f40d7884a7ccc70737bf3da2771
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Xin-Long/sctp-do-not-update-transport-pathmtu-if-SPP_PMTUD_ENABLE-is-not-set/20210722-001121
        git checkout e6927d4d69af5f40d7884a7ccc70737bf3da2771
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=x86_64 SHELL=/bin/bash net/sctp/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   net/sctp/output.c:112:2: error: expected identifier or '('
           if (asoc->pmtu_pending) {
           ^
   net/sctp/output.c:121:2: error: expected identifier or '('
           if (ecn_capable) {
           ^
   net/sctp/output.c:128:2: error: expected identifier or '('
           if (!tp->dst)
           ^
>> net/sctp/output.c:132:2: warning: declaration specifier missing, defaulting to 'int'
           rcu_read_lock();
           ^
           int
   net/sctp/output.c:132:15: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
           rcu_read_lock();
                        ^
                         void
   net/sctp/output.c:132:2: error: conflicting types for 'rcu_read_lock'
           rcu_read_lock();
           ^
   include/linux/rcupdate.h:683:29: note: previous definition is here
   static __always_inline void rcu_read_lock(void)
                               ^
   net/sctp/output.c:133:2: error: expected identifier or '('
           if (__sk_dst_get(sk) != tp->dst) {
           ^
   net/sctp/output.c:137:2: error: unknown type name 'packet'
           packet->max_size = sk_can_gso(sk) ? tp->dst->dev->gso_max_size
           ^
   net/sctp/output.c:137:8: error: expected identifier or '('
           packet->max_size = sk_can_gso(sk) ? tp->dst->dev->gso_max_size
                 ^
   net/sctp/output.c:139:2: warning: declaration specifier missing, defaulting to 'int'
           rcu_read_unlock();
           ^
           int
   net/sctp/output.c:139:17: error: this function declaration is not a prototype [-Werror,-Wstrict-prototypes]
           rcu_read_unlock();
                          ^
                           void
   net/sctp/output.c:139:2: error: conflicting types for 'rcu_read_unlock'
           rcu_read_unlock();
           ^
   include/linux/rcupdate.h:714:20: note: previous definition is here
   static inline void rcu_read_unlock(void)
                      ^
   net/sctp/output.c:140:1: error: extraneous closing brace ('}')
   }
   ^
   2 warnings and 11 errors generated.


vim +/int +132 net/sctp/output.c

be2971438dec2e Wei Yongjun             2009-09-04   69  
^1da177e4c3f41 Linus Torvalds          2005-04-16   70  /* Config a packet.
^1da177e4c3f41 Linus Torvalds          2005-04-16   71   * This appears to be a followup set of initializations.
^1da177e4c3f41 Linus Torvalds          2005-04-16   72   */
66b91d2cd0344c Marcelo Ricardo Leitner 2016-12-28   73  void sctp_packet_config(struct sctp_packet *packet, __u32 vtag,
66b91d2cd0344c Marcelo Ricardo Leitner 2016-12-28   74  			int ecn_capable)
^1da177e4c3f41 Linus Torvalds          2005-04-16   75  {
90017accff61ae Marcelo Ricardo Leitner 2016-06-02   76  	struct sctp_transport *tp = packet->transport;
90017accff61ae Marcelo Ricardo Leitner 2016-06-02   77  	struct sctp_association *asoc = tp->asoc;
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26   78  	struct sctp_sock *sp = NULL;
df2729c3238ed8 Xin Long                2017-04-01   79  	struct sock *sk;
^1da177e4c3f41 Linus Torvalds          2005-04-16   80  
bb33381d0c97cd Daniel Borkmann         2013-06-28   81  	pr_debug("%s: packet:%p vtag:0x%x\n", __func__, packet, vtag);
^1da177e4c3f41 Linus Torvalds          2005-04-16   82  	packet->vtag = vtag;
^1da177e4c3f41 Linus Torvalds          2005-04-16   83  
df2729c3238ed8 Xin Long                2017-04-01   84  	/* do the following jobs only once for a flush schedule */
df2729c3238ed8 Xin Long                2017-04-01   85  	if (!sctp_packet_empty(packet))
df2729c3238ed8 Xin Long                2017-04-01   86  		return;
90017accff61ae Marcelo Ricardo Leitner 2016-06-02   87  
b7e10c25b839c0 Richard Haines          2018-02-24   88  	/* set packet max_size with pathmtu, then calculate overhead */
90017accff61ae Marcelo Ricardo Leitner 2016-06-02   89  	packet->max_size = tp->pathmtu;
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26   90  
b7e10c25b839c0 Richard Haines          2018-02-24   91  	if (asoc) {
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26   92  		sk = asoc->base.sk;
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26   93  		sp = sctp_sk(sk);
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26   94  	}
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26   95  	packet->overhead = sctp_mtu_payload(sp, 0, 0);
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26   96  	packet->size = packet->overhead;
b7e10c25b839c0 Richard Haines          2018-02-24   97  
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26   98  	if (!asoc)
df2729c3238ed8 Xin Long                2017-04-01   99  		return;
90017accff61ae Marcelo Ricardo Leitner 2016-06-02  100  
df2729c3238ed8 Xin Long                2017-04-01  101  	/* update dst or transport pathmtu if in need */
df2729c3238ed8 Xin Long                2017-04-01  102  	if (!sctp_transport_dst_check(tp)) {
feddd6c1af30ab Marcelo Ricardo Leitner 2018-04-26  103  		sctp_transport_route(tp, NULL, sp);
df2729c3238ed8 Xin Long                2017-04-01  104  		if (asoc->param_flags & SPP_PMTUD_ENABLE)
3ebfdf082184d0 Xin Long                2017-04-04  105  			sctp_assoc_sync_pmtu(asoc);
7307e4fa4d295f Xin Long                2021-06-22  106  	} else if (!sctp_transport_pl_enabled(tp) &&
e6927d4d69af5f Xin Long                2021-07-21  107  		   asoc->param_flags & SPP_PMTUD_ENABLE)
e6927d4d69af5f Xin Long                2021-07-21  108  		if (!sctp_transport_pmtu_check(tp))
69fec325a64383 Xin Long                2018-11-18  109  			sctp_assoc_sync_pmtu(asoc);
df2729c3238ed8 Xin Long                2017-04-01  110  	}
^1da177e4c3f41 Linus Torvalds          2005-04-16  111  
d805397c3822d5 Xin Long                2018-10-15  112  	if (asoc->pmtu_pending) {
d805397c3822d5 Xin Long                2018-10-15  113  		if (asoc->param_flags & SPP_PMTUD_ENABLE)
d805397c3822d5 Xin Long                2018-10-15  114  			sctp_assoc_sync_pmtu(asoc);
d805397c3822d5 Xin Long                2018-10-15  115  		asoc->pmtu_pending = 0;
d805397c3822d5 Xin Long                2018-10-15  116  	}
d805397c3822d5 Xin Long                2018-10-15  117  
^1da177e4c3f41 Linus Torvalds          2005-04-16  118  	/* If there a is a prepend chunk stick it on the list before
^1da177e4c3f41 Linus Torvalds          2005-04-16  119  	 * any other chunks get appended.
^1da177e4c3f41 Linus Torvalds          2005-04-16  120  	 */
df2729c3238ed8 Xin Long                2017-04-01  121  	if (ecn_capable) {
df2729c3238ed8 Xin Long                2017-04-01  122  		struct sctp_chunk *chunk = sctp_get_ecne_prepend(asoc);
df2729c3238ed8 Xin Long                2017-04-01  123  
^1da177e4c3f41 Linus Torvalds          2005-04-16  124  		if (chunk)
^1da177e4c3f41 Linus Torvalds          2005-04-16  125  			sctp_packet_append_chunk(packet, chunk);
^1da177e4c3f41 Linus Torvalds          2005-04-16  126  	}
df2729c3238ed8 Xin Long                2017-04-01  127  
df2729c3238ed8 Xin Long                2017-04-01  128  	if (!tp->dst)
df2729c3238ed8 Xin Long                2017-04-01  129  		return;
df2729c3238ed8 Xin Long                2017-04-01  130  
df2729c3238ed8 Xin Long                2017-04-01  131  	/* set packet max_size with gso_max_size if gso is enabled*/
df2729c3238ed8 Xin Long                2017-04-01 @132  	rcu_read_lock();
df2729c3238ed8 Xin Long                2017-04-01  133  	if (__sk_dst_get(sk) != tp->dst) {
df2729c3238ed8 Xin Long                2017-04-01  134  		dst_hold(tp->dst);
df2729c3238ed8 Xin Long                2017-04-01  135  		sk_setup_caps(sk, tp->dst);
df2729c3238ed8 Xin Long                2017-04-01  136  	}
df2729c3238ed8 Xin Long                2017-04-01  137  	packet->max_size = sk_can_gso(sk) ? tp->dst->dev->gso_max_size
df2729c3238ed8 Xin Long                2017-04-01  138  					  : asoc->pathmtu;
df2729c3238ed8 Xin Long                2017-04-01  139  	rcu_read_unlock();
^1da177e4c3f41 Linus Torvalds          2005-04-16  140  }
^1da177e4c3f41 Linus Torvalds          2005-04-16  141  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/net/sctp/output.c b/net/sctp/output.c
index 9032ce60d50e..8d5708dd2a1f 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -104,8 +104,8 @@  void sctp_packet_config(struct sctp_packet *packet, __u32 vtag,
 		if (asoc->param_flags & SPP_PMTUD_ENABLE)
 			sctp_assoc_sync_pmtu(asoc);
 	} else if (!sctp_transport_pl_enabled(tp) &&
-		   !sctp_transport_pmtu_check(tp)) {
-		if (asoc->param_flags & SPP_PMTUD_ENABLE)
+		   asoc->param_flags & SPP_PMTUD_ENABLE)
+		if (!sctp_transport_pmtu_check(tp))
 			sctp_assoc_sync_pmtu(asoc);
 	}