summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2013-06-12 08:02:56 (GMT)
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-06-12 12:53:41 (GMT)
commit5f5910b81a640032f3c1520ff5329c014cbc1827 (patch)
tree7a791191051a79a309c5f7f80957309867d58965
parent58ec105e1501e57ee4e88ae59441210caebbc041 (diff)
downloadconnman-5f5910b81a640032f3c1520ff5329c014cbc1827.zip
connman-5f5910b81a640032f3c1520ff5329c014cbc1827.tar.gz
connman-5f5910b81a640032f3c1520ff5329c014cbc1827.tar.bz2
ippool: Private address check was incorrect
Fixes BMC#25993
-rw-r--r--src/ippool.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/ippool.c b/src/ippool.c
index 52446ce..531745e 100644
--- a/src/ippool.c
+++ b/src/ippool.c
@@ -223,21 +223,13 @@ static struct address_info *lookup_info(int index, uint32_t start)
static connman_bool_t is_private_address(uint32_t address)
{
- uint32_t val;
+ unsigned int a, b;
- if ((address & 0xff000000) == block_24_bits)
- return TRUE;
-
- if ((address & 0xffff0000) == block_20_bits) {
- val = (address & 0x00ff0000) >> 16;
-
- if (val < 16 || val > 31)
- return FALSE;
-
- return TRUE;
- }
+ a = (address & 0xff000000) >> 24;
+ b = (address & 0x00ff0000) >> 16;
- if ((address & 0xffffff00) == block_16_bits)
+ if (a == 10 || (a == 192 && b == 168) ||
+ (a == 172 && (b >= 16 && b <= 31)))
return TRUE;
return FALSE;