summaryrefslogtreecommitdiff
path: root/proto/babel/babel.h
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2018-02-13 16:39:36 +0100
committerOndrej Zajicek (work) <santiago@crfreenet.org>2018-02-13 16:40:14 +0100
commit185a0a51f8aed635eecac0cfbd837dd262a8add0 (patch)
tree87eddd9c194ba22c01d31f9c6a9471a58c541158 /proto/babel/babel.h
parentbe17805c0bbd37e865dc9b17b56e8e8d210c2c6c (diff)
Babel: Add source-specific routing support
This patch adds support for source-specific routing to the Babel protocol. It changes the protocol to support both NET_IP6 and NET_IP6_SADR channels for IPv6 addresses. If only a NET_IP6 channel is configured, source-specific updates are ignored. Otherwise, non-source-specific routes are simply treated as source-specific routes with SADR prefix 0. Thanks to Toke Hoiland-Jorgensen for the original patch. Minor changes by Ondrej Santiago Zajicek.
Diffstat (limited to 'proto/babel/babel.h')
-rw-r--r--proto/babel/babel.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/proto/babel/babel.h b/proto/babel/babel.h
index 1128d261..b194ce30 100644
--- a/proto/babel/babel.h
+++ b/proto/babel/babel.h
@@ -85,7 +85,10 @@ enum babel_tlv_type {
enum babel_subtlv_type {
BABEL_SUBTLV_PAD1 = 0,
- BABEL_SUBTLV_PADN = 1
+ BABEL_SUBTLV_PADN = 1,
+
+ /* Mandatory subtlvs */
+ BABEL_SUBTLV_SOURCE_PREFIX = 128,
};
enum babel_iface_type {
@@ -109,6 +112,9 @@ struct babel_config {
struct proto_config c;
list iface_list; /* List of iface configs (struct babel_iface_config) */
uint hold_time; /* Time to hold stale entries and unreachable routes */
+
+ struct channel_config *ip4_channel;
+ struct channel_config *ip6_channel;
};
struct babel_iface_config {
@@ -303,7 +309,10 @@ struct babel_msg_update {
u16 seqno;
u16 metric;
u64 router_id;
- net_addr net;
+ union {
+ net_addr net;
+ net_addr_ip6_sadr net_sadr;
+ };
ip_addr next_hop;
ip_addr sender;
};
@@ -311,7 +320,10 @@ struct babel_msg_update {
struct babel_msg_route_request {
u8 type;
u8 full;
- net_addr net;
+ union {
+ net_addr net;
+ net_addr_ip6_sadr net_sadr;
+ };
};
struct babel_msg_seqno_request {
@@ -319,7 +331,10 @@ struct babel_msg_seqno_request {
u8 hop_count;
u16 seqno;
u64 router_id;
- net_addr net;
+ union {
+ net_addr net;
+ net_addr_ip6_sadr net_sadr;
+ };
ip_addr sender;
};
@@ -339,6 +354,8 @@ struct babel_msg_node {
union babel_msg msg;
};
+static inline int babel_sadr_enabled(struct babel_proto *p)
+{ return p->ip6_rtable.addr_type == NET_IP6_SADR; }
/* babel.c */
void babel_handle_ack_req(union babel_msg *msg, struct babel_iface *ifa);