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] [day] [month] [year] [list]
Message-ID: <CALx6S37k2s11vR05GhGwUsW8Ehkxp8-ZUSVoNddV0puHTuGTtQ@mail.gmail.com>
Date:	Tue, 7 Apr 2015 15:07:54 -0700
From:	Tom Herbert <tom@...bertland.com>
To:	Cong Wang <xiyou.wangcong@...il.com>
Cc:	Linux Kernel Network Developers <netdev@...r.kernel.org>,
	Tom Herbert <therbert@...gle.com>
Subject: Re: [Patch net-next 3/5] fou: fix byte order of udp_config.local_udp_port

On Tue, Apr 7, 2015 at 2:57 PM, Cong Wang <xiyou.wangcong@...il.com> wrote:
> On Tue, Apr 7, 2015 at 2:47 PM, Tom Herbert <tom@...bertland.com> wrote:
>> On Tue, Apr 7, 2015 at 2:11 PM, Cong Wang <xiyou.wangcong@...il.com> wrote:
>>> On Mon, Apr 6, 2015 at 11:09 PM, Tom Herbert <tom@...bertland.com> wrote:
>>>> On Mon, Apr 6, 2015 at 4:41 PM, Cong Wang <xiyou.wangcong@...il.com> wrote:
>>>>> diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c
>>>>> index ad0ee82..cf606fc 100644
>>>>> --- a/net/ipv4/fou.c
>>>>> +++ b/net/ipv4/fou.c
>>>>> @@ -468,7 +468,7 @@ static int fou_create(struct net *net, struct fou_cfg *cfg,
>>>>>         sk = sock->sk;
>>>>>
>>>>>         fou->flags = cfg->flags;
>>>>> -       fou->port = cfg->udp_config.local_udp_port;
>>>>> +       fou->port = ntohs(cfg->udp_config.local_udp_port);
>>>>>
>>>> Cong, I don't think this is right. Port should always be nbo, probably
>>>> should be using __b16 instead of u16 for defines. Did you test these
>>>> changes?
>>>>
>>>
>>> Yeah, fou->port is u16 which should be host order, however
>>> we only save and compare it with be16, so the original code
>>> is not mis-behaving (otherwise should go to -net), just reads odd.
>>>
>>> I tested it together with the whole patchset. And I agree we can
>>> change fou->port to be16 too.
>>
>> Hmm,I don't understand how this could have worked with the ntohs() added.
>>
>
> I must miss something here.
>
> Why converting be16 to u16 with ntohs() doesn't work? After this
> patch, all u16 ports have host order, all be16 ports have network order
> and we don't mix them.
>
> fou->port is used as a key to lookup all fou's in fou_list and fou_list
> is not exposed.

It should be okay to use nbo for that also.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ