lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 19 Oct 2020 18:40:35 +0800
From:   Xin Long <lucien.xin@...il.com>
To:     Marcelo Ricardo Leitner <marcelo.leitner@...il.com>
Cc:     network dev <netdev@...r.kernel.org>, linux-sctp@...r.kernel.org,
        Neil Horman <nhorman@...driver.com>,
        Michael Tuexen <tuexen@...muenster.de>,
        davem <davem@...emloft.net>, Guillaume Nault <gnault@...hat.com>,
        Paolo Abeni <pabeni@...hat.com>,
        Willem de Bruijn <willemdebruijn.kernel@...il.com>
Subject: Re: [PATCHv3 net-next 16/16] sctp: enable udp tunneling socks

On Fri, Oct 16, 2020 at 3:08 PM Xin Long <lucien.xin@...il.com> wrote:
>
> On Fri, Oct 16, 2020 at 1:42 AM Marcelo Ricardo Leitner
> <marcelo.leitner@...il.com> wrote:
> >
> > Actually..
> >
> > On Tue, Oct 13, 2020 at 03:27:41PM +0800, Xin Long wrote:
> > ...
> > > Also add sysctl udp_port to allow changing the listening
> > > sock's port by users.
> > ...
> > > ---
> > >  net/sctp/protocol.c |  5 +++++
> > >  net/sctp/sysctl.c   | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
> > >  2 files changed, 55 insertions(+)
> >
> > Xin, sorry for not noticing this earlier, but we need a documentation
> > update here for this new sysctl. This is important. Please add its
> > entry in ip-sysctl.rst.
> no problem, I will add it.
>
> >
> > >
> > > diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
> > > index be002b7..79fb4b5 100644
> > > --- a/net/sctp/protocol.c
> > > +++ b/net/sctp/protocol.c
> > > @@ -1469,6 +1469,10 @@ static int __net_init sctp_ctrlsock_init(struct net *net)
> > >       if (status)
> > >               pr_err("Failed to initialize the SCTP control sock\n");
> > >
> > > +     status = sctp_udp_sock_start(net);
> > > +     if (status)
> > > +             pr_err("Failed to initialize the SCTP udp tunneling sock\n");
> >                                                       ^^^ upper case please.
> > Nit. There are other occurrences of this.
> You mean we can remove this log, as it's been handled well in
> sctp_udp_sock_start()?
This one is actually OK :D
I've updated 'udp' with 'UDP' for all code annotations in this patchset.

will post v4.

Thanks.


>
> >
> > > +
> > >       return status;
> > ...
> > > +     ret = proc_dointvec(&tbl, write, buffer, lenp, ppos);
> > > +     if (write && ret == 0) {
> > > +             struct sock *sk = net->sctp.ctl_sock;
> > > +
> > > +             if (new_value > max || new_value < min)
> > > +                     return -EINVAL;
> > > +
> > > +             net->sctp.udp_port = new_value;
> > > +             sctp_udp_sock_stop(net);
> >
> > So, if it would be disabling the encapsulation, it shouldn't be
> > calling _start() then, right? Like
> >
> >                 if (new_value)
> >                         ret = sctp_udp_sock_start(net);
> >
> > Otherwise _start() here will call ..._bind() with port 0, which then
> > will be a random one.
> right, somehow I thought it wouldn't bind with port 0.
>
> Thanks.
> >
> > > +             ret = sctp_udp_sock_start(net);
> > > +             if (ret)
> > > +                     net->sctp.udp_port = 0;
> > > +
> > > +             /* Update the value in the control socket */
> > > +             lock_sock(sk);
> > > +             sctp_sk(sk)->udp_port = htons(net->sctp.udp_port);
> > > +             release_sock(sk);
> > > +     }
> > > +
> > > +     return ret;
> > > +}
> > > +
> > >  int sctp_sysctl_net_register(struct net *net)
> > >  {
> > >       struct ctl_table *table;
> > > --
> > > 2.1.0
> > >

Powered by blists - more mailing lists