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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADvbK_cWfwSryOZLsW_CEkn5MJUHOhh8AmV2fn4OAUomHthQfA@mail.gmail.com>
Date:   Sat, 3 Oct 2020 15:41:39 +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>,
        Tom Herbert <therbert@...gle.com>, davem <davem@...emloft.net>
Subject: Re: [PATCH net-next 09/15] sctp: add SCTP_REMOTE_UDP_ENCAPS_PORT sockopt

On Sat, Oct 3, 2020 at 12:05 PM Marcelo Ricardo Leitner
<marcelo.leitner@...il.com> wrote:
>
> On Tue, Sep 29, 2020 at 09:49:01PM +0800, Xin Long wrote:
> ...
> > +struct sctp_udpencaps {
> > +     sctp_assoc_t sue_assoc_id;
> > +     struct sockaddr_storage sue_address;
> > +     uint16_t sue_port;
> > +};
> ...
> > +static int sctp_setsockopt_encap_port(struct sock *sk,
> > +                                   struct sctp_udpencaps *encap,
> > +                                   unsigned int optlen)
> > +{
> > +     struct sctp_association *asoc;
> > +     struct sctp_transport *t;
> > +
> > +     if (optlen != sizeof(*encap))
> > +             return -EINVAL;
> > +
> > +     /* If an address other than INADDR_ANY is specified, and
> > +      * no transport is found, then the request is invalid.
> > +      */
> > +     if (!sctp_is_any(sk, (union sctp_addr *)&encap->sue_address)) {
> > +             t = sctp_addr_id2transport(sk, &encap->sue_address,
> > +                                        encap->sue_assoc_id);
> > +             if (!t)
> > +                     return -EINVAL;
> > +
> > +             t->encap_port = encap->sue_port;
>                    ^^^^^^^^^^          ^^^^^^^^
>
> encap_port is defined as __u16 is previous patch, but from RFC:
>   sue_port:  The UDP port number in network byte order...
>
> asoc->peer.port is stored in host order, so it makes sense to follow
> it here. Then need a htons() here and its counter parts.  It is right
> in some parts of the patches already.
Good catch! thank you!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ