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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 6 Apr 2015 23:09:09 -0700
From:	Tom Herbert <tom@...bertland.com>
To:	Cong Wang <xiyou.wangcong@...il.com>
Cc:	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 Mon, Apr 6, 2015 at 4:41 PM, Cong Wang <xiyou.wangcong@...il.com> wrote:
> udp_config.local_udp_port is be16. And iproute2 passes
> network order for FOU_ATTR_PORT.
>
> Cc: Tom Herbert <therbert@...gle.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@...il.com>
> ---
>  net/ipv4/fou.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> 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?

>         /* Initial for fou type */
>         switch (cfg->type) {
> @@ -523,7 +523,7 @@ static int fou_create(struct net *net, struct fou_cfg *cfg,
>  static int fou_destroy(struct net *net, struct fou_cfg *cfg)
>  {
>         struct fou *fou;
> -       u16 port = cfg->udp_config.local_udp_port;
> +       u16 port = ntohs(cfg->udp_config.local_udp_port);
>         int err = -EINVAL;
>
>         spin_lock(&fou_lock);
> @@ -573,7 +573,7 @@ static int parse_nl_config(struct genl_info *info,
>         }
>
>         if (info->attrs[FOU_ATTR_PORT]) {
> -               u16 port = nla_get_u16(info->attrs[FOU_ATTR_PORT]);
> +               __be16 port = nla_get_be16(info->attrs[FOU_ATTR_PORT]);
>
>                 cfg->udp_config.local_udp_port = port;
>         }
> --
> 1.8.3.1
>
> --
> 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
--
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