summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2018-09-18 17:29:00 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2018-09-18 17:50:45 +0200
commitc0fc3e67185c1e0ff2d083572c6ad3983ba4ef25 (patch)
tree9fe17603f4fec18b7f9fbd8d8efc1f13a9bef8ee /lib
parentafa14f1868f2c753efdc81ce8e2c2d44e6bdd80e (diff)
The MRT protocol
The new MRT protocol is responsible for periodic RIB table dumps in the MRT format (RFC 6396). Also the existing code for BGP4MP MRT dumps is refactored and splitted between BGP to MRT protocols, will be more integrated into MRT in the future. Example: protocol mrt { table "*"; filename "%N_%F_%T.mrt"; period 60; } It is partially based on the old MRT code from Pavel Tvrdik.
Diffstat (limited to 'lib')
-rw-r--r--lib/event.h9
-rw-r--r--lib/ip.h2
-rw-r--r--lib/unaligned.h6
3 files changed, 17 insertions, 0 deletions
diff --git a/lib/event.h b/lib/event.h
index d5975222..14a54730 100644
--- a/lib/event.h
+++ b/lib/event.h
@@ -36,5 +36,14 @@ ev_active(event *e)
return e->n.next != NULL;
}
+static inline event*
+ev_new_set(pool *p, void (*hook)(void *), void *data)
+{
+ event *e = ev_new(p);
+ e->hook = hook;
+ e->data = data;
+ return e;
+}
+
#endif
diff --git a/lib/ip.h b/lib/ip.h
index d876a707..4fbe4407 100644
--- a/lib/ip.h
+++ b/lib/ip.h
@@ -99,6 +99,7 @@ typedef ip6_addr ip_addr;
#define ipa_to_u32(x) ip4_to_u32(ipa_to_ip4(x))
#define ipa_is_ip4(a) ip6_is_v4mapped(a)
+#define ipa_is_ip6(a) (! ip6_is_v4mapped(a))
#else
@@ -115,6 +116,7 @@ typedef ip4_addr ip_addr;
#define ipa_to_u32(x) ip4_to_u32(ipa_to_ip4(x))
#define ipa_is_ip4(a) 1
+#define ipa_is_ip6(a) 0
#endif
diff --git a/lib/unaligned.h b/lib/unaligned.h
index dc777fbf..b02bc6fe 100644
--- a/lib/unaligned.h
+++ b/lib/unaligned.h
@@ -45,6 +45,12 @@ get_u64(const void *p)
}
static inline void
+put_u8(void *p, u8 x)
+{
+ memcpy(p, &x, 1);
+}
+
+static inline void
put_u16(void *p, u16 x)
{
x = htons(x);