From 4e9498cbb171d52e2f3015d3e9d6c7b1b7205e27 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 13 Feb 1999 18:42:00 +0000 Subject: config->router_id works again. --- nest/iface.c | 13 ++++++++++--- nest/iface.h | 1 - 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'nest') diff --git a/nest/iface.c b/nest/iface.c index a0d4fb3..a3dff4a 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 fd72bf4..83cbdb0 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 -- cgit v1.2.3