summaryrefslogtreecommitdiffstats
path: root/lib/ip.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ip.h')
-rw-r--r--lib/ip.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ip.h b/lib/ip.h
index 1cc74e8..e9923e2 100644
--- a/lib/ip.h
+++ b/lib/ip.h
@@ -46,10 +46,14 @@ char *ip_scope_text(unsigned);
struct prefix {
ip_addr addr;
- int len;
+ unsigned int len;
};
#define ip_is_prefix(a,l) (!ipa_nonzero(ipa_and(a, ipa_not(ipa_mkmask(l)))))
+#define ipa_zero(x) (!ipa_nonzero(x))
+
+static inline int ipa_classify_net(ip_addr a)
+{ return ipa_zero(a) ? (IADDR_HOST | SCOPE_UNIVERSE) : ipa_classify(a); }
/*
* Conversions between internal and string representation