From 42532f084640645cfde9af7c0aa69a36b1de91ad Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 25 Apr 2000 21:58:17 +0000 Subject: Support dynamic reconfiguration. --- proto/bgp/bgp.c | 17 ++++++++++++++--- proto/bgp/packets.c | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'proto/bgp') diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index 403d858..cdbdf46 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -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 }; diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index 2f25a30..d17491b 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -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++) -- cgit v1.2.3