summaryrefslogtreecommitdiff
path: root/nest
diff options
context:
space:
mode:
Diffstat (limited to 'nest')
-rw-r--r--nest/iface.c13
-rw-r--r--nest/iface.h1
2 files changed, 10 insertions, 4 deletions
diff --git a/nest/iface.c b/nest/iface.c
index a0d4fb3f..a3dff4af 100644
--- a/nest/iface.c
+++ b/nest/iface.c
@@ -13,9 +13,12 @@
#include "nest/protocol.h"
#include "lib/resource.h"
#include "lib/string.h"
+#include "conf/conf.h"
static pool *if_pool;
+static void auto_router_id(void);
+
/*
* Neighbor Cache
*
@@ -197,6 +200,7 @@ if_dump_all(void)
debug("Known network interfaces:\n");
WALK_LIST(i, iface_list)
if_dump(i);
+ debug("Router ID: %08x\n", config->router_id);
}
static inline int
@@ -301,6 +305,9 @@ if_end_update(void)
{
struct iface *i, j;
+ if (!config->router_id)
+ auto_router_id();
+
WALK_LIST(i, iface_list)
if (i->flags & IF_UPDATED)
i->flags &= ~IF_UPDATED;
@@ -324,7 +331,7 @@ if_feed_baby(struct proto *p)
p->if_notify(p, IF_CHANGE_CREATE | ((i->flags & IF_UP) ? IF_CHANGE_UP : 0), NULL, i);
}
-u32
+static void
auto_router_id(void) /* FIXME: What if we run IPv6??? */
{
struct iface *i, *j;
@@ -336,9 +343,9 @@ auto_router_id(void) /* FIXME: What if we run IPv6??? */
(!j || ipa_to_u32(i->ip) < ipa_to_u32(j->ip)))
j = i;
if (!j)
- return 0;
+ die("Cannot determine router ID (no suitable network interface found), please configure it manually");
debug("Guessed router ID %I (%s)\n", j->ip, j->name);
- return ipa_to_u32(j->ip);
+ config->router_id = ipa_to_u32(j->ip);
}
void
diff --git a/nest/iface.h b/nest/iface.h
index fd72bf41..83cbdb07 100644
--- a/nest/iface.h
+++ b/nest/iface.h
@@ -54,7 +54,6 @@ void if_dump_all(void);
void if_update(struct iface *);
void if_end_update(void);
void if_feed_baby(struct proto *);
-u32 auto_router_id(void);
/*
* Neighbor Cache. We hold (direct neighbor, protocol) pairs we've seen