summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
authorOndrej Zajicek (work) <santiago@crfreenet.org>2016-05-12 17:49:12 +0200
committerOndrej Zajicek (work) <santiago@crfreenet.org>2016-05-12 18:03:23 +0200
commitaf678af0d5c9ef3d8afdc0789b33dd0c40b6d6e5 (patch)
tree4d786cd3fecdbb370f1ceee5daecd3aa62fc205b /nest
parent286e2011d22ea6914d5f2db5de3f11911a1fb663 (diff)
parent8e433d6a529a883d566dc1d5a4afe0f1e2750baf (diff)
Merge remote-tracking branch 'origin/master' into int-new
Diffstat (limited to 'nest')
-rw-r--r--nest/config.Y1
-rw-r--r--nest/neighbor.c2
-rw-r--r--nest/proto-hooks.c1
-rw-r--r--nest/proto.c4
-rw-r--r--nest/protocol.h2
-rw-r--r--nest/route.h11
-rw-r--r--nest/rt-attr.c2
-rw-r--r--nest/rt-dev.c28
-rw-r--r--nest/rt-dev.h1
-rw-r--r--nest/rt-table.c8
10 files changed, 53 insertions, 7 deletions
diff --git a/nest/config.Y b/nest/config.Y
index 890a6d09..2961dafb 100644
--- a/nest/config.Y
+++ b/nest/config.Y
@@ -357,6 +357,7 @@ dev_proto:
| dev_proto proto_item ';'
| dev_proto proto_channel ';'
| dev_proto dev_iface_patt ';'
+ | dev_proto CHECK LINK bool ';' { DIRECT_CFG->check_link = $4; }
;
dev_iface_init:
diff --git a/nest/neighbor.c b/nest/neighbor.c
index 69f09423..2c7f9b84 100644
--- a/nest/neighbor.c
+++ b/nest/neighbor.c
@@ -340,7 +340,7 @@ neigh_if_link(struct iface *i)
/**
* neigh_ifa_update: notify neighbor cache about interface address add or remove event
- * @ifa: interface address in question
+ * @a: interface address in question
*
* Tell the neighbor cache that an address was added or removed.
*
diff --git a/nest/proto-hooks.c b/nest/proto-hooks.c
index 5923ff67..92863f8e 100644
--- a/nest/proto-hooks.c
+++ b/nest/proto-hooks.c
@@ -148,6 +148,7 @@ void get_route_info(rte *e, byte *buf, ea_list *attrs)
* get_attr - get attribute information
* @a: an extended attribute
* @buf: buffer to be filled with attribute information
+ * @buflen: a length of the @buf parameter
*
* The get_attr() hook is called by the core to obtain a user friendly
* representation of an extended route attribute. It can either leave
diff --git a/nest/proto.c b/nest/proto.c
index ce859f13..f2416748 100644
--- a/nest/proto.c
+++ b/nest/proto.c
@@ -1068,6 +1068,7 @@ graceful_restart_init(void)
/**
* graceful_restart_done - finalize graceful restart
+ * @t: unused
*
* When there are no locks on graceful restart, the functions finalizes the
* graceful restart recovery. Protocols postponing route export until the end of
@@ -1258,6 +1259,9 @@ protos_build(void)
proto_build(&proto_bfd);
bfd_init_all();
#endif
+#ifdef CONFIG_BABEL
+ proto_build(&proto_babel);
+#endif
proto_pool = rp_new(&root_pool, "Protocols");
proto_shutdown_timer = tm_new(proto_pool);
diff --git a/nest/protocol.h b/nest/protocol.h
index 2d640504..4b7bfdf3 100644
--- a/nest/protocol.h
+++ b/nest/protocol.h
@@ -81,7 +81,7 @@ void protos_dump_all(void);
extern struct protocol
proto_device, proto_radv, proto_rip, proto_static,
- proto_ospf, proto_pipe, proto_bgp, proto_bfd;
+ proto_ospf, proto_pipe, proto_bgp, proto_bfd, proto_babel;
/*
* Routing Protocol Instance
diff --git a/nest/route.h b/nest/route.h
index 865b0907..b5885ee3 100644
--- a/nest/route.h
+++ b/nest/route.h
@@ -229,6 +229,12 @@ typedef struct rte {
u8 suppressed; /* Used for deterministic MED comparison */
} bgp;
#endif
+#ifdef CONFIG_BABEL
+ struct {
+ u16 metric; /* Babel metric */
+ u64 router_id; /* Babel router id */
+ } babel;
+#endif
struct { /* Routes generated by krt sync (both temporary and inherited ones) */
s8 src; /* Alleged route source (see krt.h) */
u8 proto; /* Kernel source protocol ID */
@@ -377,6 +383,7 @@ typedef struct rta {
#define RTS_OSPF_EXT2 10 /* OSPF external route type 2 */
#define RTS_BGP 11 /* BGP route */
#define RTS_PIPE 12 /* Inter-table wormhole */
+#define RTS_BABEL 13 /* Babel route */
#define RTC_UNICAST 0
#define RTC_BROADCAST 1
@@ -425,7 +432,8 @@ typedef struct eattr {
#define EAP_RIP 2 /* RIP */
#define EAP_OSPF 3 /* OSPF */
#define EAP_KRT 4 /* Kernel route attributes */
-#define EAP_MAX 5
+#define EAP_BABEL 5 /* Babel attributes */
+#define EAP_MAX 6
#define EA_CODE(proto,id) (((proto) << 8) | (id))
#define EA_PROTO(ea) ((ea) >> 8)
@@ -550,6 +558,7 @@ extern struct protocol *attr_class_to_protocol[EAP_MAX];
#define DEF_PREF_DIRECT 240 /* Directly connected */
#define DEF_PREF_STATIC 200 /* Static route */
#define DEF_PREF_OSPF 150 /* OSPF intra-area, inter-area and type 1 external routes */
+#define DEF_PREF_BABEL 130 /* Babel */
#define DEF_PREF_RIP 120 /* RIP */
#define DEF_PREF_BGP 100 /* BGP */
#define DEF_PREF_INHERITED 10 /* Routes inherited from other routing daemons */
diff --git a/nest/rt-attr.c b/nest/rt-attr.c
index 7d9605c2..fb958f7e 100644
--- a/nest/rt-attr.c
+++ b/nest/rt-attr.c
@@ -353,7 +353,7 @@ ea_find(ea_list *e, unsigned id)
* for first occurrences of attributes with ID in specified interval from @id to
* (@id + @max - 1), returning pointers to found &eattr structures, storing its
* walk state in @s for subsequent calls.
-
+ *
* The function ea_walk() is supposed to be called in a loop, with initially
* zeroed walk state structure @s with filled the initial extended attribute
* list, returning one found attribute in each call or %NULL when no other
diff --git a/nest/rt-dev.c b/nest/rt-dev.c
index 098885b9..d98cd79f 100644
--- a/nest/rt-dev.c
+++ b/nest/rt-dev.c
@@ -68,6 +68,9 @@ dev_ifa_notify(struct proto *P, uint flags, struct ifa *ad)
DBG("dev_if_notify: %s:%I going up\n", ad->iface->name, ad->ip);
+ if (cf->check_link && !(ad->iface->flags & IF_LINK_UP))
+ return;
+
/* Use iface ID as local source ID */
struct rte_src *src = rt_get_source(P, ad->iface->index);
@@ -87,6 +90,25 @@ dev_ifa_notify(struct proto *P, uint flags, struct ifa *ad)
}
}
+static void
+dev_if_notify(struct proto *p, uint c, struct iface *iface)
+{
+ struct rt_dev_config *cf = (void *) p->cf;
+
+ if (c & (IF_CHANGE_UP | IF_CHANGE_DOWN))
+ return;
+
+ if ((c & IF_CHANGE_LINK) && cf->check_link)
+ {
+ uint ac = (iface->flags & IF_LINK_UP) ? IF_CHANGE_UP : IF_CHANGE_DOWN;
+
+ struct ifa *a;
+ WALK_LIST(a, iface->addrs)
+ dev_ifa_notify(p, ac, a);
+ }
+}
+
+
static struct proto *
dev_init(struct proto_config *CF)
{
@@ -97,6 +119,7 @@ dev_init(struct proto_config *CF)
proto_configure_channel(P, &p->ip4_channel, proto_cf_find_channel(CF, NET_IP4));
proto_configure_channel(P, &p->ip6_channel, proto_cf_find_channel(CF, NET_IP6));
+ P->if_notify = dev_if_notify;
P->ifa_notify = dev_ifa_notify;
return P;
@@ -109,7 +132,8 @@ dev_reconfigure(struct proto *P, struct proto_config *CF)
struct rt_dev_config *o = (void *) P->cf;
struct rt_dev_config *n = (void *) CF;
- if (!iface_patts_equal(&o->iface_list, &n->iface_list, NULL))
+ if (!iface_patts_equal(&o->iface_list, &n->iface_list, NULL) ||
+ (o->check_link != n->check_link))
return 0;
return
@@ -131,6 +155,8 @@ dev_copy_config(struct proto_config *dest, struct proto_config *src)
* old nodes cannot be modified (although they contain internal lists).
*/
cfg_copy_list(&d->iface_list, &s->iface_list, sizeof(struct iface_patt));
+
+ d->check_link = s->check_link;
}
struct protocol proto_device = {
diff --git a/nest/rt-dev.h b/nest/rt-dev.h
index c9012336..20b88a64 100644
--- a/nest/rt-dev.h
+++ b/nest/rt-dev.h
@@ -12,6 +12,7 @@
struct rt_dev_config {
struct proto_config c;
list iface_list; /* list of struct iface_patt */
+ int check_link;
};
struct rt_dev_proto {
diff --git a/nest/rt-table.c b/nest/rt-table.c
index 2329bb53..9e9d4c7a 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -834,16 +834,20 @@ rt_notify_merged(struct channel *c, net *net, rte *new_changed, rte *old_changed
* @net: network in question
* @new: the new route to be announced
* @old: the previous route for the same network
+ * @new_best: the new best route for the same network
+ * @old_best: the previous best route for the same network
+ * @before_old: The previous route before @old for the same network.
+ * If @before_old is NULL @old was the first.
*
* This function gets a routing table update and announces it
* to all protocols that acccepts given type of route announcement
* and are connected to the same table by their announcement hooks.
*
- * Route announcement of type RA_OPTIMAL si generated when optimal
+ * Route announcement of type %RA_OPTIMAL si generated when optimal
* route (in routing table @tab) changes. In that case @old stores the
* old optimal route.
*
- * Route announcement of type RA_ANY si generated when any route (in
+ * Route announcement of type %RA_ANY si generated when any route (in
* routing table @tab) changes In that case @old stores the old route
* from the same protocol.
*