0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 01:31:55 +00:00

config->router_id works again.

This commit is contained in:
Martin Mares 1999-02-13 18:42:00 +00:00
parent 67bd949a52
commit 4e9498cbb1
6 changed files with 15 additions and 21 deletions

15
TODO
View File

@ -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!!

View 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;

View 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 */

View File

@ -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

View 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

View 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);