static pool *if_pool;
+u32 router_id;
+
/*
* Neighbor Cache
*
debug("Known network interfaces:\n");
WALK_LIST(i, iface_list)
if_dump(i);
- debug("\n");
+ debug("\nRouter ID: %08x\n\n", router_id);
}
static inline int
p->if_notify(p, IF_CHANGE_CREATE | ((i->flags & IF_UP) ? IF_CHANGE_UP : 0), NULL, i);
}
+void
+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 */
+ die("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);
+}
+
void
if_init(void)
{
void if_update(struct iface *);
void if_end_update(void);
void if_feed_baby(struct proto *);
+void auto_router_id(void);
/*
* Neighbor Cache. We hold (direct neighbor, protocol) pairs we've seen