From 697de0a99339a264948fdcb67dc374034178bc04 Mon Sep 17 00:00:00 2001 From: Guillaume Zajac Date: Tue, 19 Jun 2012 15:21:24 +0200 Subject: ippool: Fix endless loop issue with 32 prefix length While trying to establish a DUN connection with oFono, an endless loop was found when requesting an IP block. The problem was on data connection activation its address with 32 length prefix was notified through ConnMann using __connman_ippool_newaddr() but mask address shifting with 32 bits was obsolete. So IP pool was considerating block 0.0.0.0 to 255.255.255.255 was in use. --- src/ippool.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ippool.c b/src/ippool.c index 58a0d281..52446cec 100644 --- a/src/ippool.c +++ b/src/ippool.c @@ -258,7 +258,11 @@ void __connman_ippool_newaddr(int index, const char *address, if (is_private_address(start) == FALSE) return; - mask = ~(0xffffffff >> prefixlen); + if (prefixlen >= 32) + mask = 0xffffffff; + else + mask = ~(0xffffffff >> prefixlen); + start = start & mask; end = start | ~mask; -- cgit v1.2.3