net: link_local: Fix netmask endianness bug
authorAlexandre Messier <amessier@tycoint.com>
Tue, 14 Mar 2017 19:03:31 +0000 (15:03 -0400)
committerJoe Hershberger <joe.hershberger@ni.com>
Sun, 26 Mar 2017 14:58:19 +0000 (09:58 -0500)
The network mask must be stored in network order when in a
'struct in_addr'.

This fix removes the "gatewayip needed but not set" message on the
console when using a link-local IP setup.

Signed-off-by: Alexandre Messier <amessier@tycoint.com>
Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
net/link_local.c

index 27851b6b813b98b80607476381945402674dc1bd..dfd240dfbcfd90288de50fdf54c934bbe754549a 100644 (file)
@@ -111,7 +111,7 @@ void link_local_start(void)
                net_set_state(NETLOOP_FAIL);
                return;
        }
-       net_netmask.s_addr = IN_CLASSB_NET;
+       net_netmask.s_addr = htonl(IN_CLASSB_NET);
 
        seed = seed_mac();
        if (ip.s_addr == 0)