summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2009-09-08 13:45:02 +0200
committerOndrej Zajicek <santiago@crfreenet.org>2009-09-08 13:45:02 +0200
commitbe862406627da3bd1facea9309b3f32e67422eab (patch)
treea1463c4feca6145d4a2e36b39c893a7253316b73 /lib
parentf9c799a00e705b1420b214628c2bb2a30bf491d9 (diff)
downloadbird-be862406627da3bd1facea9309b3f32e67422eab.tar
bird-be862406627da3bd1facea9309b3f32e67422eab.zip
Temporary OSPFv3 development commit.
Finally, it is working.
Diffstat (limited to 'lib')
-rw-r--r--lib/ipv4.h6
-rw-r--r--lib/ipv6.h6
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/ipv4.h b/lib/ipv4.h
index b64d9b2..5c8c390 100644
--- a/lib/ipv4.h
+++ b/lib/ipv4.h
@@ -54,6 +54,7 @@ typedef u32 ip_addr;
#define ipa_hton(x) x = _MI(htonl(_I(x)))
#define ipa_ntoh(x) x = _MI(ntohl(_I(x)))
#define ipa_classify(x) ipv4_classify(_I(x))
+#define ipa_has_link_scope(x) ipv4_has_link_scope(_I(x))
#define ipa_opposite(x,len) _MI(_I(x) ^ (len == 30 ? 3 : 1))
#define ipa_class_mask(x) _MI(ipv4_class_mask(_I(x)))
#define ipa_from_u32(x) _MI(x)
@@ -69,6 +70,11 @@ int ipv4_classify(u32);
u32 ipv4_class_mask(u32);
byte *ipv4_skip_header(byte *, int *);
+static inline int ipv4_has_link_scope(u32 a)
+{
+ return 0;
+}
+
static inline unsigned ipv4_hash(u32 a)
{
/* Returns a 16-bit value */
diff --git a/lib/ipv6.h b/lib/ipv6.h
index 592e57c..53888ff 100644
--- a/lib/ipv6.h
+++ b/lib/ipv6.h
@@ -60,6 +60,7 @@ typedef struct ipv6_addr {
#define ipa_hton(x) ipv6_hton(&(x))
#define ipa_ntoh(x) ipv6_ntoh(&(x))
#define ipa_classify(x) ipv6_classify(&(x))
+#define ipa_has_link_scope(x) ipv6_has_link_scope(&(x))
/* ipa_opposite and ipa_class_mask don't make sense with IPv6 */
/* ipa_from_u32 and ipa_to_u32 replaced by ipa_build */
#define ipa_build(a,b,c,d) _MI(a,b,c,d)
@@ -81,6 +82,11 @@ int ipv6_compare(ip_addr, ip_addr);
int ipv4_pton_u32(char *, u32 *);
void ipv6_absolutize(ip_addr *, ip_addr *);
+static inline int ipv6_has_link_scope(ip_addr *a)
+{
+ return ((a->addr[0] & 0xffc00000) == 0xfe800000);
+}
+
/*
* This hash function looks well, but once IPv6 enters
* mainstream use, we need to check that it has good