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]
Date:   Sat, 3 Oct 2020 01:05:50 -0300
From:   Marcelo Ricardo Leitner <marcelo.leitner@...il.com>
To:     Xin Long <lucien.xin@...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@...emloft.net
Subject: Re: [PATCH net-next 09/15] sctp: add SCTP_REMOTE_UDP_ENCAPS_PORT
 sockopt

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ