From 31b3e1bbf5bc823ec5cf6d88931132f00e6c52b9 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 5 Feb 1999 21:37:34 +0000 Subject: Implemented new configuration/reconfiguration interface and defined protocol state machines. Full explanation will follow soon. --- nest/iface.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'nest/iface.c') diff --git a/nest/iface.c b/nest/iface.c index ce638d2..2b2af91 100644 --- a/nest/iface.c +++ b/nest/iface.c @@ -1,7 +1,7 @@ /* * BIRD -- Management of Interfaces and Neighbor Cache * - * (c) 1998 Martin Mares + * (c) 1998--1999 Martin Mares * * Can be freely distributed and used under the terms of the GNU GPL. */ @@ -16,8 +16,6 @@ static pool *if_pool; -u32 router_id; - /* * Neighbor Cache * @@ -103,7 +101,7 @@ neigh_dump(neighbor *n) debug("%s ", n->iface->name); else debug("[] "); - debug("%s %p", n->proto->name, n->data); + debug("%s %p", n->proto->cf->name, n->data); if (n->flags & NEF_STICKY) debug(" STICKY"); debug("\n"); @@ -199,7 +197,6 @@ if_dump_all(void) debug("Known network interfaces:\n"); WALK_LIST(i, iface_list) if_dump(i); - debug("\nRouter ID: %08x\n\n", router_id); } static inline int @@ -322,28 +319,26 @@ if_feed_baby(struct proto *p) if (!p->if_notify) return; - debug("Announcing interfaces to new protocol %s\n", p->name); + debug("Announcing interfaces to new protocol %s\n", p->cf->name); WALK_LIST(i, iface_list) p->if_notify(p, IF_CHANGE_CREATE | ((i->flags & IF_UP) ? IF_CHANGE_UP : 0), NULL, i); } -void +u32 auto_router_id(void) /* FIXME: What if we run IPv6??? */ { struct iface *i, *j; - if (router_id) - return; j = NULL; WALK_LIST(i, iface_list) if ((i->flags & IF_UP) && !(i->flags & (IF_UNNUMBERED | IF_LOOPBACK | IF_IGNORE)) && (!j || ipa_to_u32(i->ip) < ipa_to_u32(j->ip))) j = i; - if (!j) /* FIXME: allow configuration or running without RID */ - bug("Cannot determine router ID, please configure manually"); - router_id = ipa_to_u32(j->ip); - debug("Router ID set to %08x (%s)\n", router_id, j->name); + if (!j) + return 0; + debug("Guessed router ID %I (%s)\n", j->ip, j->name); + return ipa_to_u32(j->ip); } void -- cgit v1.2.3