]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
config->router_id works again.
authorMartin Mares <mj@ucw.cz>
Sat, 13 Feb 1999 18:42:00 +0000 (18:42 +0000)
committerMartin Mares <mj@ucw.cz>
Sat, 13 Feb 1999 18:42:00 +0000 (18:42 +0000)
TODO
conf/conf.c
conf/conf.h
nest/iface.c
nest/iface.h
sysdep/unix/sync-if.c

diff --git a/TODO b/TODO
index f681997ccc31ed7b6bc239daec8f29cbb5bad0e2..5efbdefe40a93aee39639f66f01ffff9e098b4df 100644 (file)
--- a/TODO
+++ b/TODO
@@ -5,17 +5,14 @@ Core
 * cleanup debugging calls
 * logging and tracing; use appropriate log levels
 * check log calls for trailing newlines
-
-* Fix router ID calculation
-* debug dump: dump router ID as well
+* replace all NUM's by expr's
 
 - TOS not supported by kernel -> automatically drop routes with TOS<>0
+- config: executable config files
 
 - fake multipath?
-- replace all NUM's by expr's
 - config file: define ipaddr constants?
 - counters (according to SNMP MIB?)
-- ifdef out some debugging code?
 - better memory allocators
 - default preferences of protocols: prefer BGP over OSPF/RIP external routes?
 - secondary addresses -> subinterfaces
@@ -23,7 +20,6 @@ Core
 
 - better default protocol names
 - config: comments at end of line -> explicit ';' needed?
-- remove post-config hooks?
 - command-line arguments: name of config file
 
 - static: check validity of route destination?
@@ -32,13 +28,10 @@ Core
 - device: configuration of interface patterns
 
 - filter: logging of dropped routes (?)
-- limitation of memory consumption: per-process and total (?)
 - adding of route: check whether all bits not covered by masklen are zero
-- switch: generate default route only if at least one BGP connection exists (?)
-
+- switch: generate default route only if at least one BGP connection exists (aggregate engine?)
 - route recalculation timing + flap dampening (?)
-
-- "generate default route" switch for all IGP's
+- "generate default route" switch for all IGP's (via generic aggregate engine?)
 
 - Check incoming packets and log errors!!
 
index 06cd3d199e3d43512d17eee3deb0b4dbc1c57aa9..dd8573586bfaeeef76a6dd9ddc1abd5543212d8f 100644 (file)
@@ -50,10 +50,6 @@ config_parse(struct config *c)
   cf_lex_init_tables();
   protos_preconfig(c);
   cf_parse();
-#if 0                                  /* FIXME: We don't have interface list yet :( */
-  if (!c->router_id && !(c->router_id = auto_router_id()))
-    cf_error("Cannot determine router ID (no suitable network interface found), please configure it manually");
-#endif
   filters_postconfig();                        /* FIXME: Do we really need this? */
   protos_postconfig(c);
   return 1;
index 54f5d5ebd3726f09e773a4a91a5717f6d22f5a3b..69f4a02e5868bf92cf89c75a927a3dda2c1b699d 100644 (file)
@@ -18,7 +18,6 @@ struct config {
   linpool *mem;                                /* Linear pool containing configuration data */
   list protos;                         /* Configured protocol instances (struct proto_config) */
   u32 router_id;                       /* Our Router ID */
-  u16 this_as;                         /* Our Autonomous System Number */
   char *err_msg;                       /* Parser error message */
   int err_lino;                                /* Line containing error */
   char *file_name;                     /* Name of configuration file */
index a0d4fb3fc4742a061318e9baff8639bbbde4776c..a3dff4af1cf68bea9d75df8942177198f1187d33 100644 (file)
 #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
index fd72bf41b1058a323ebc8d97ace918d2c4d9f205..83cbdb07bc656c40f5aafda730dcac736499da8e 100644 (file)
@@ -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
index cec3e864cf917557210e925b559fa80252ae823a..077cb94a7350f88aaa53b01cce440eb7380177fc 100644 (file)
@@ -40,7 +40,7 @@ scan_ifs(struct ifreq *r, int cnt)
   for (cnt /= sizeof(struct ifreq); cnt; cnt--, r++)
     {
       bzero(&i, sizeof(i));
-      debug("%s\n", r->ifr_ifrn.ifrn_name);
+      DBG("%s\n", r->ifr_ifrn.ifrn_name);
       strncpy(i.name, r->ifr_ifrn.ifrn_name, sizeof(i.name) - 1);
       i.name[sizeof(i.name) - 1] = 0;
       get_sockaddr((struct sockaddr_in *) &r->ifr_addr, &i.ip, NULL);