diff options
-rw-r--r-- | babeld/babel_interface.c | 34 | ||||
-rw-r--r-- | babeld/babel_interface.h | 4 | ||||
-rw-r--r-- | babeld/babel_main.c | 35 | ||||
-rw-r--r-- | babeld/babel_main.h | 4 | ||||
-rw-r--r-- | babeld/message.c | 43 | ||||
-rw-r--r-- | babeld/resend.c | 4 | ||||
-rw-r--r-- | babeld/resend.h | 2 | ||||
-rw-r--r-- | babeld/route.c | 2 |
8 files changed, 32 insertions, 96 deletions
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index 42a9e0ea..0f254ecc 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -467,38 +467,6 @@ DEFUN (no_babel_passive_interface, return CMD_SUCCESS; } - -int -interface_idle(babel_interface_nfo *babel_ifp) -{ - return (idle_hello_interval > 0 && - babel_ifp->activity_time < babel_now.tv_sec - idle_time); -} - -int -update_hello_interval(struct interface *ifp) -{ - int rc = 0; - unsigned short interval; - struct babel_interface *babel_ifp = babel_get_if_nfo(ifp); - - if(interface_idle(babel_ifp)) - interval = idle_hello_interval; - else if(IF_CONF(ifp, hello_interval) > 0) - interval = IF_CONF(ifp, hello_interval); - else if((ifp->flags & BABEL_IF_WIRED)) - interval = wired_hello_interval; - else - interval = wireless_hello_interval; - - if(babel_ifp->hello_interval != interval) { - babel_ifp->hello_interval = interval; - rc = 1; - } - - return rc; -} - /* This should be no more than half the hello interval, so that hellos aren't sent late. The result is in milliseconds. */ unsigned @@ -577,7 +545,6 @@ interface_recalculate(struct interface *ifp) babel_ifp->flags |= BABEL_IF_LQ; } - babel_ifp->activity_time = babel_now.tv_sec; /* Since the interface was marked as active above, the idle_hello_interval cannot be the one being used here. */ babel_ifp->update_interval = babel_ifp->hello_interval * 4; @@ -1004,7 +971,6 @@ babel_interface_allocate (void) /* Here are set the default values for an interface. */ memset(babel_ifp, 0, sizeof(babel_interface_nfo)); /* All flags are unset */ - babel_ifp->activity_time = babel_now.tv_sec; babel_ifp->bucket_time = babel_now.tv_sec; babel_ifp->bucket = BUCKET_TOKENS_MAX; babel_ifp->hello_seqno = (random() & 0xFFFF); diff --git a/babeld/babel_interface.h b/babeld/babel_interface.h index ec69bff4..579dc043 100644 --- a/babeld/babel_interface.h +++ b/babeld/babel_interface.h @@ -71,7 +71,6 @@ struct babel_interface { int update_bufsize; time_t bucket_time; unsigned int bucket; - time_t activity_time; time_t last_update_time; unsigned short hello_seqno; unsigned hello_interval; @@ -142,9 +141,6 @@ int babel_interface_delete (int, struct zclient *, zebra_size_t); int babel_interface_address_add (int, struct zclient *, zebra_size_t); int babel_interface_address_delete (int, struct zclient *, zebra_size_t); -/* others functions */ -int interface_idle(babel_interface_nfo *); -int update_hello_interval(struct interface *ifp); unsigned jitter(babel_interface_nfo *, int); unsigned update_jitter(babel_interface_nfo *babel_ifp, int urgent); /* return "true" if "address" is one of our ipv6 addresses */ diff --git a/babeld/babel_main.c b/babeld/babel_main.c index a75171e0..f2db0b37 100644 --- a/babeld/babel_main.c +++ b/babeld/babel_main.c @@ -79,10 +79,9 @@ struct timeval babel_now; /* current time */ unsigned char myid[8]; /* unique id (mac address of an interface) */ int debug = BABEL_DEBUG_COMMON; -int idle_time = 320; -int wireless_hello_interval = -1; -int wired_hello_interval = -1; -int idle_hello_interval = -1; +int default_wireless_hello_interval = -1; +int default_wired_hello_interval = -1; +int resend_delay = -1; static const char *pidfile = PATH_BABELD_PID; const unsigned char zeroes[16] = {0}; @@ -259,17 +258,19 @@ babel_init(int argc, char **argv) vty_init (master); memory_init (); - /* babeld inits (default options) */ - /* set default interval's values */ - if(wireless_hello_interval <= 0) - wireless_hello_interval = 4000; - wireless_hello_interval = MAX(wireless_hello_interval, 5); + if(default_wireless_hello_interval <= 0) + default_wireless_hello_interval = 4000; + default_wireless_hello_interval = MAX(default_wireless_hello_interval, 5); - if(wired_hello_interval <= 0) - wired_hello_interval = 4000; - wired_hello_interval = MAX(wired_hello_interval, 5); + if(default_wired_hello_interval <= 0) + default_wired_hello_interval = 4000; + default_wired_hello_interval = MAX(default_wired_hello_interval, 5); + + resend_delay = 2000; + resend_delay = MIN(resend_delay, default_wireless_hello_interval / 2); + resend_delay = MIN(resend_delay, default_wired_hello_interval / 2); + resend_delay = MAX(resend_delay, 20); - /* an assertion */ if(parasitic && allow_duplicates >= 0) { /* Too difficult to get right. */ zlog_err("Sorry, -P and -A are incompatible."); @@ -561,10 +562,6 @@ show_babel_main_configuration (struct vty *vty) "vty address = %s%s" "vty port = %d%s" "id = %s%s" - "idle time = %d%s" - "wireless hello interval = %d%s" - "wired hello interval = %d%s" - "idle hello interval = %d%s" "parasitic = %s%s" "split-horizon = %s%s" "allow_duplicates = %s%s" @@ -580,10 +577,6 @@ show_babel_main_configuration (struct vty *vty) VTY_NEWLINE, babel_vty_port, VTY_NEWLINE, format_eui64(myid), VTY_NEWLINE, - idle_time, VTY_NEWLINE, - wireless_hello_interval, VTY_NEWLINE, - wired_hello_interval, VTY_NEWLINE, - idle_hello_interval, VTY_NEWLINE, format_bool(parasitic), VTY_NEWLINE, format_bool(split_horizon), VTY_NEWLINE, format_bool(allow_duplicates), VTY_NEWLINE, diff --git a/babeld/babel_main.h b/babeld/babel_main.h index 2afebc9e..4c08e181 100644 --- a/babeld/babel_main.h +++ b/babeld/babel_main.h @@ -41,8 +41,8 @@ THE SOFTWARE. extern struct timeval babel_now; /* current time */ extern struct thread_master *master; /* quagga's threads handler */ extern int debug; -extern int wireless_hello_interval, wired_hello_interval, idle_hello_interval; -extern int idle_time; +extern int default_wireless_hello_interval, default_wired_hello_interval; +extern int resend_delay; extern unsigned char myid[8]; diff --git a/babeld/message.c b/babeld/message.c index 8cd1db63..e86b4325 100644 --- a/babeld/message.c +++ b/babeld/message.c @@ -282,7 +282,6 @@ parse_packet(const unsigned char *from, struct interface *ifp, debugf(BABEL_DEBUG_COMMON,"Received hello %d (%d) from %s on %s.", seqno, interval, format_address(from), ifp->name); - babel_get_if_nfo(ifp)->activity_time = babel_now.tv_sec; changed = update_neighbour(neigh, seqno, interval); update_neighbour_metric(neigh, changed); if(interval > 0) @@ -466,7 +465,8 @@ parse_packet(const unsigned char *from, struct interface *ifp, update storm. Ignore a wildcard request that happens shortly after we sent a full update. */ if(babel_ifp->last_update_time < - babel_now.tv_sec - MAX(babel_ifp->hello_interval / 100, 1)) + (time_t)(babel_now.tv_sec - + MAX(babel_ifp->hello_interval / 100, 1))) send_update(neigh->ifp, 0, NULL, 0); } else { send_update(neigh->ifp, 0, prefix, plen); @@ -755,12 +755,10 @@ send_hello_noupdate(struct interface *ifp, unsigned interval) void send_hello(struct interface *ifp) { - int changed; - changed = update_hello_interval(ifp); babel_interface_nfo *babel_ifp = babel_get_if_nfo(ifp); send_hello_noupdate(ifp, (babel_ifp->hello_interval + 9) / 10); /* Send full IHU every 3 hellos, and marginal IHU each time */ - if(changed || babel_ifp->hello_seqno % 3 == 0) + if(babel_ifp->hello_seqno % 3 == 0) send_ihu(NULL, ifp); else send_marginal_ihu(ifp); @@ -1161,13 +1159,11 @@ send_update(struct interface *ifp, int urgent, buffer_update(ifp, prefix, plen); } } else { - if(!interface_idle(babel_ifp)) { - send_self_update(ifp); - if(!parasitic) { - debugf(BABEL_DEBUG_COMMON,"Sending update to %s for any.", - ifp->name); - for_all_installed_routes(buffer_update_callback, ifp); - } + send_self_update(ifp); + if(!parasitic) { + debugf(BABEL_DEBUG_COMMON,"Sending update to %s for any.", + ifp->name); + for_all_installed_routes(buffer_update_callback, ifp); } set_timeout(&babel_ifp->update_timeout, babel_ifp->update_interval); babel_ifp->last_update_time = babel_now.tv_sec; @@ -1179,17 +1175,10 @@ void send_update_resend(struct interface *ifp, const unsigned char *prefix, unsigned char plen) { - int delay; - assert(prefix != NULL); send_update(ifp, 1, prefix, plen); - - delay = 2000; - delay = MIN(delay, wireless_hello_interval / 2); - delay = MIN(delay, wired_hello_interval / 2); - delay = MAX(delay, 10); - record_resend(RESEND_UPDATE, prefix, plen, 0, 0, NULL, delay); + record_resend(RESEND_UPDATE, prefix, plen, 0, 0, NULL, resend_delay); } void @@ -1249,10 +1238,8 @@ send_self_update(struct interface *ifp) return; } - if(!interface_idle(babel_get_if_nfo(ifp))) { - debugf(BABEL_DEBUG_COMMON,"Sending self update to %s.", ifp->name); - for_all_xroutes(send_xroute_update_callback, ifp); - } + debugf(BABEL_DEBUG_COMMON,"Sending self update to %s.", ifp->name); + for_all_xroutes(send_xroute_update_callback, ifp); } void @@ -1501,19 +1488,13 @@ send_request_resend(struct neighbour *neigh, const unsigned char *prefix, unsigned char plen, unsigned short seqno, unsigned char *id) { - int delay; - if(neigh) send_unicast_multihop_request(neigh, prefix, plen, seqno, id, 127); else send_multihop_request(NULL, prefix, plen, seqno, id, 127); - delay = 2000; - delay = MIN(delay, wireless_hello_interval / 2); - delay = MIN(delay, wired_hello_interval / 2); - delay = MAX(delay, 10); record_resend(RESEND_REQUEST, prefix, plen, seqno, id, - neigh ? neigh->ifp : NULL, delay); + neigh ? neigh->ifp : NULL, resend_delay); } void diff --git a/babeld/resend.c b/babeld/resend.c index 5a786fcd..1cc6290e 100644 --- a/babeld/resend.c +++ b/babeld/resend.c @@ -123,7 +123,7 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen, else if(delay) resend->delay = delay; resend->time = babel_now; - resend->max = kind == RESEND_REQUEST ? 128 : UPDATE_MAX; + resend->max = RESEND_MAX; if(id && memcmp(resend->id, id, 8) == 0 && seqno_compare(resend->seqno, seqno) > 0) { return 0; @@ -140,7 +140,7 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen, if(resend == NULL) return -1; resend->kind = kind; - resend->max = kind == RESEND_REQUEST ? 128 : UPDATE_MAX; + resend->max = RESEND_MAX; resend->delay = delay; memcpy(resend->prefix, prefix, 16); resend->plen = plen; diff --git a/babeld/resend.h b/babeld/resend.h index fdb57300..a6755c0e 100644 --- a/babeld/resend.h +++ b/babeld/resend.h @@ -37,7 +37,7 @@ THE SOFTWARE. */ #define REQUEST_TIMEOUT 65000 -#define UPDATE_MAX 4 +#define RESEND_MAX 3 #define RESEND_REQUEST 1 #define RESEND_UPDATE 2 diff --git a/babeld/route.c b/babeld/route.c index a9ffc5d9..fe2b9ceb 100644 --- a/babeld/route.c +++ b/babeld/route.c @@ -682,7 +682,7 @@ update_route(const unsigned char *router_id, int hold_time = MAX((4 * interval) / 100 + interval / 50, 15); if(memcmp(router_id, myid, 8) == 0) - return NULL; /* I have announced the route */ + return NULL; if(martian_prefix(prefix, plen)) { zlog_err("Rejecting martian route to %s through %s.", |