net: Fix endianness bug in link-local
authorJoe Hershberger <joe.hershberger@ni.com>
Mon, 5 Nov 2012 06:13:45 +0000 (06:13 +0000)
committerJoe Hershberger <joe.hershberger@ni.com>
Sat, 15 Dec 2012 18:28:23 +0000 (12:28 -0600)
The ip is stored in network order, so we can't test it in host order.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Kim Phillips <kim.phillips@freescale.com>
net/link_local.c

index d52f13adb45deca75d52cabaaecc592963b2ca5f..1ba796ebdf949999f8663ff30049c1c085d43f56 100644 (file)
@@ -103,7 +103,7 @@ static void configure_wait(void)
 void link_local_start(void)
 {
        ip = getenv_IPaddr("llipaddr");
-       if (ip != 0 && (ip & IN_CLASSB_NET) != LINKLOCAL_ADDR) {
+       if (ip != 0 && (ntohl(ip) & IN_CLASSB_NET) != LINKLOCAL_ADDR) {
                puts("invalid link address");
                net_set_state(NETLOOP_FAIL);
                return;