Skip to contentSkip to conversation

net: link_local: Fix netmask endianness bug

PATCH In review Sylvain Lemieux 3 participants 3 messages Mar 14, 2017 – Mar 27, 2017 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: link_local: Fix netmask endianness bug

From: Alexandre Messier <[email protected]>

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.

---
 net/link_local.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/link_local.c +1 -1
index 27851b6b81..dfd240dfbc 100644
@@ -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)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/1 net: link_local: Fix netmask endianness bug

Quoted 10 lines · Sylvain Lemieux

From: Alexandre Messier <[email protected]>

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.