Support dynamic reconfiguration.

This commit is contained in:
Martin Mares 2000-04-25 21:58:17 +00:00
parent 41b26cfb55
commit 42532f0846
2 changed files with 15 additions and 4 deletions

View file

@ -47,7 +47,6 @@ void
bgp_start_timer(timer *t, int value)
{
/* FIXME: Randomize properly */
/* FIXME: Check if anybody uses tm_start directly */
if (value)
tm_start(t, value);
else
@ -432,7 +431,7 @@ bgp_check(struct bgp_config *c)
cf_error("Neighbor must be configured");
}
void
static void
bgp_get_status(struct proto *P, byte *buf)
{
struct bgp_proto *p = (struct bgp_proto *) P;
@ -440,6 +439,18 @@ bgp_get_status(struct proto *P, byte *buf)
strcpy(buf, bgp_state_names[MAX(p->incoming_conn.state, p->outgoing_conn.state)]);
}
static int
bgp_reconfigure(struct proto *P, struct proto_config *C)
{
struct bgp_config *new = (struct bgp_config *) C;
struct bgp_proto *p = (struct bgp_proto *) P;
struct bgp_config *old = p->cf;
return !memcmp(((byte *) old) + sizeof(struct proto_config),
((byte *) new) + sizeof(struct proto_config),
sizeof(struct bgp_config) - sizeof(struct proto_config));
}
struct protocol proto_bgp = {
name: "BGP",
template: "bgp%d",
@ -449,9 +460,9 @@ struct protocol proto_bgp = {
shutdown: bgp_shutdown,
get_status: bgp_get_status,
get_attr: bgp_get_attr,
reconfigure: bgp_reconfigure,
#if 0
dump: bgp_dump,
get_route_info: bgp_get_route_info,
/* FIXME: Reconfiguration */
#endif
};

View file

@ -326,7 +326,6 @@ bgp_rx_open(struct bgp_conn *conn, byte *pkt, int len)
prefix = ipa_and(prefix, ipa_mkmask(b)); \
pxlen = b; \
} while (0)
/* FIXME: Check validity of prefixes */
static void
bgp_rx_update(struct bgp_conn *conn, byte *pkt, int len)
@ -440,6 +439,7 @@ bgp_log_error(struct bgp_proto *p, char *msg, unsigned code, unsigned subcode, b
byte *t, argbuf[36];
unsigned i;
/* FIXME: Printing of cease messages */
bsprintf(namebuf, "%d.%d", code, subcode);
name = namebuf;
for (i=0; i < ARRAY_SIZE(bgp_msg_table); i++)