summaryrefslogtreecommitdiff
path: root/lib/ip.h
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2012-03-18 17:32:30 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2012-03-18 17:32:30 +0100
commitaf582c4811175d9a27ed5d08a4f6d5eaa69ecec7 (patch)
tree3b2793cb9db3c67efddfb379e6c8adc16b143604 /lib/ip.h
parentfd087589f80a435a42cedb87b917c71363b11860 (diff)
Route Origin Authorization basics.
- ROA tables, which are used as a basic part for RPKI. - Commands for examining and modifying ROA tables. - Filter operators based on ROA tables consistent with RFC 6483.
Diffstat (limited to 'lib/ip.h')
-rw-r--r--lib/ip.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/ip.h b/lib/ip.h
index 5d74d21e..023c1064 100644
--- a/lib/ip.h
+++ b/lib/ip.h
@@ -15,7 +15,10 @@
#include "ipv6.h"
#endif
-#define ipa_in_net(x,n,p) (!ipa_nonzero(ipa_and(ipa_xor((n),(x)),ipa_mkmask(p))))
+#define ipa_zero(x) (!ipa_nonzero(x))
+#define ip_is_prefix(a,l) (!ipa_nonzero(ipa_and(a, ipa_not(ipa_mkmask(l)))))
+#define ipa_in_net(x,n,p) (ipa_zero(ipa_and(ipa_xor((n),(x)),ipa_mkmask(p))))
+#define net_in_net(n1,l1,n2,l2) (((l1) >= (l2)) && (ipa_zero(ipa_and(ipa_xor((n1),(n2)),ipa_mkmask(l2)))))
/*
* ip_classify() returns either a negative number for invalid addresses
@@ -50,9 +53,6 @@ struct prefix {
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); }