linux-sctp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] sctp: do not update transport pathmtu if SPP_PMTUD_ENABLE is not set
@ 2021-07-21 16:08 Xin Long
  2021-07-21 18:42 ` Marcelo Ricardo Leitner
  2021-07-21 19:26 ` kernel test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Xin Long @ 2021-07-21 16:08 UTC (permalink / raw)
  To: network dev, davem, kuba, linux-sctp
  Cc: Marcelo Ricardo Leitner, Jacek Szafraniec

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)
+		if (!sctp_transport_pmtu_check(tp))
 			sctp_assoc_sync_pmtu(asoc);
 	}
 
-- 
2.27.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] sctp: do not update transport pathmtu if SPP_PMTUD_ENABLE is not set
  2021-07-21 16:08 [PATCH net] sctp: do not update transport pathmtu if SPP_PMTUD_ENABLE is not set Xin Long
@ 2021-07-21 18:42 ` Marcelo Ricardo Leitner
  2021-07-21 18:49   ` Xin Long
  2021-07-21 19:26 ` kernel test robot
  1 sibling, 1 reply; 4+ messages in thread
From: Marcelo Ricardo Leitner @ 2021-07-21 18:42 UTC (permalink / raw)
  To: Xin Long; +Cc: network dev, davem, kuba, linux-sctp, Jacek Szafraniec

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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] sctp: do not update transport pathmtu if SPP_PMTUD_ENABLE is not set
  2021-07-21 18:42 ` Marcelo Ricardo Leitner
@ 2021-07-21 18:49   ` Xin Long
  0 siblings, 0 replies; 4+ messages in thread
From: Xin Long @ 2021-07-21 18:49 UTC (permalink / raw)
  To: Marcelo Ricardo Leitner
  Cc: network dev, davem, Jakub Kicinski,
	linux-sctp @ vger . kernel . org, Jacek Szafraniec

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
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] sctp: do not update transport pathmtu if SPP_PMTUD_ENABLE is not set
  2021-07-21 16:08 [PATCH net] sctp: do not update transport pathmtu if SPP_PMTUD_ENABLE is not set Xin Long
  2021-07-21 18:42 ` Marcelo Ricardo Leitner
@ 2021-07-21 19:26 ` kernel test robot
  1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2021-07-21 19:26 UTC (permalink / raw)
  To: Xin Long, network dev, davem, kuba, linux-sctp
  Cc: clang-built-linux, kbuild-all, Marcelo Ricardo Leitner, Jacek Szafraniec

[-- Attachment #1: Type: text/plain, Size: 9635 bytes --]

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38652 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-21 19:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 16:08 [PATCH net] sctp: do not update transport pathmtu if SPP_PMTUD_ENABLE is not set Xin Long
2021-07-21 18:42 ` Marcelo Ricardo Leitner
2021-07-21 18:49   ` Xin Long
2021-07-21 19:26 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).