From 2dc027401f7e4f395498ec184365736f70d4b780 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Thu, 15 Oct 2009 14:05:35 +0000 Subject: [PATCH] Fixed bug #27704: autoip starts with wrong address: LWIP_AUTOIP_CREATE_SEED_ADDR() returned address in host byte order instead of network byte order --- CHANGELOG | 5 +++++ src/core/ipv4/autoip.c | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c8513d5f..0dcd903b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -43,6 +43,11 @@ HISTORY ++ Bugfixes: + 2009-10-15: Simon Goldschmidt + * autoip.c: Fixed bug #27704: autoip starts with wrong address + LWIP_AUTOIP_CREATE_SEED_ADDR() returned address in host byte order instead + of network byte order + 2009-10-11 Simon Goldschmidt (Jörg Kesten) * tcp_out.c: Fixed bug #27504: tcp_enqueue wrongly concatenates segments which are not consecutive when retransmitting unacked segments diff --git a/src/core/ipv4/autoip.c b/src/core/ipv4/autoip.c index 225db4b6..d40c49a8 100644 --- a/src/core/ipv4/autoip.c +++ b/src/core/ipv4/autoip.c @@ -100,7 +100,7 @@ */ #ifndef LWIP_AUTOIP_CREATE_SEED_ADDR #define LWIP_AUTOIP_CREATE_SEED_ADDR(netif) \ - (AUTOIP_RANGE_START + ((u32_t)(((u8_t)(netif->hwaddr[4])) | \ + htonl(AUTOIP_RANGE_START + ((u32_t)(((u8_t)(netif->hwaddr[4])) | \ ((u32_t)((u8_t)(netif->hwaddr[5]))) << 8))) #endif /* LWIP_AUTOIP_CREATE_SEED_ADDR */ @@ -108,7 +108,7 @@ static void autoip_handle_arp_conflict(struct netif *netif); /* creates a pseudo random LL IP-Address for a network interface */ -static void autoip_create_addr(struct netif *netif, struct ip_addr *IPAddr); +static void autoip_create_addr(struct netif *netif, struct ip_addr *ipaddr); /* sends an ARP probe */ static err_t autoip_arp_probe(struct netif *netif); @@ -171,7 +171,7 @@ autoip_handle_arp_conflict(struct netif *netif) * @param IPAddr ip address to initialize */ static void -autoip_create_addr(struct netif *netif, struct ip_addr *IPAddr) +autoip_create_addr(struct netif *netif, struct ip_addr *ipaddr) { /* Here we create an IP-Address out of range 169.254.1.0 to 169.254.254.255 * compliant to RFC 3927 Section 2.1 @@ -189,12 +189,12 @@ autoip_create_addr(struct netif *netif, struct ip_addr *IPAddr) addr -= AUTOIP_RANGE_END - AUTOIP_RANGE_START + 1; } LWIP_ASSERT("AUTOIP address not in range", (addr >= AUTOIP_RANGE_START) && - (addr <= AUTOIP_RANGE_END)); - IPAddr->addr = htonl(addr); + (addr <= AUTOIP_RANGE_END)); + ipaddr->addr = htonl(addr); LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE | 1, ("autoip_create_addr(): tried_llipaddr=%"U16_F", 0x%08"X32_F"\n", - (u16_t)(netif->autoip->tried_llipaddr), (u32_t)(IPAddr->addr))); + (u16_t)(netif->autoip->tried_llipaddr), (u32_t)(ipaddr->addr))); } /**