summaryrefslogtreecommitdiff
path: root/lib/ipv4.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>1999-04-27 16:03:17 +0000
committerMartin Mares <mj@ucw.cz>1999-04-27 16:03:17 +0000
commitec8b579e9c9703601bf745745b620103fe2e2477 (patch)
treedc882d9e3fc86c4d2860c3200b1df0955507e510 /lib/ipv4.c
parent59e2188cb7020e43e25c9d5bdcd011f341ddfc1d (diff)
Recognize site scope for IPv4 addresses (prefixes reserved for private
networks). Removed old #ifndef logic which was used to avoid IPv4/IPv6 clashes before conditionals in Modules lists were introduced.
Diffstat (limited to 'lib/ipv4.c')
-rw-r--r--lib/ipv4.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/ipv4.c b/lib/ipv4.c
index 04e15b05..186b36a8 100644
--- a/lib/ipv4.c
+++ b/lib/ipv4.c
@@ -6,8 +6,6 @@
* Can be freely distributed and used under the terms of the GNU GPL.
*/
-#ifndef IPV6
-
#include <string.h>
#include <stdlib.h>
@@ -24,6 +22,10 @@ ipv4_classify(u32 a)
{
if (b == 0x7f)
return IADDR_HOST | SCOPE_HOST;
+ else if (b == 0x0a ||
+ (a & 0xffff0000) == 0xc0a80000 ||
+ (a & 0xfff00000) == 0xac100000)
+ return IADDR_HOST | SCOPE_SITE;
else
return IADDR_HOST | SCOPE_UNIVERSE;
}
@@ -92,5 +94,3 @@ ip_pton(char *a, ip_addr *o)
*o = ipa_from_u32(ia);
return 1;
}
-
-#endif