From 635f1e814e4e5a0d4f8356475dff32515e78f692 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 11 Oct 2012 10:11:51 +0300 Subject: gdhcp: Use host byte order internally Convert to network byte order just before sending the packet. --- gdhcp/ipv4ll.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdhcp/ipv4ll.c') diff --git a/gdhcp/ipv4ll.c b/gdhcp/ipv4ll.c index 4c095722..007ffe6b 100644 --- a/gdhcp/ipv4ll.c +++ b/gdhcp/ipv4ll.c @@ -36,7 +36,7 @@ #include "ipv4ll.h" /** - * Return a random link local IP + * Return a random link local IP (in host byte order) */ uint32_t ipv4ll_random_ip(int seed) { @@ -53,7 +53,7 @@ uint32_t ipv4ll_random_ip(int seed) tmp = rand(); tmp = tmp & IN_CLASSB_HOST; } while (tmp > (IN_CLASSB_HOST - 0x0200)); - return ((LINKLOCAL_ADDR + 0x0100) + tmp); + return ntohl(((LINKLOCAL_ADDR + 0x0100) + tmp)); } /** -- cgit v1.2.3