diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-05-20 03:04:07 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2015-05-20 03:04:07 +0200 |
commit | b69278752c25e86755fa8bf514e417e1bca03fec (patch) | |
tree | b431868c97539b846c37c6a9d63db4dfe8273f1a /ospfd | |
parent | Changing router-id inline isnt handled correctly in the current implementation. (diff) | |
download | frr-b69278752c25e86755fa8bf514e417e1bca03fec.tar.xz frr-b69278752c25e86755fa8bf514e417e1bca03fec.zip |
Command to adjust min-arrival value in Milliseconds.
timers lsa min-arrival <1-60000>
Signed-off-by: Vipin Kumar <vipin@cumulusnetworks.com>
Reviewed-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Diffstat (limited to 'ospfd')
-rw-r--r-- | ospfd/ospf_flood.c | 2 | ||||
-rw-r--r-- | ospfd/ospf_lsa.c | 11 | ||||
-rw-r--r-- | ospfd/ospf_lsa.h | 1 | ||||
-rw-r--r-- | ospfd/ospf_packet.c | 2 | ||||
-rw-r--r-- | ospfd/ospf_vty.c | 80 | ||||
-rw-r--r-- | ospfd/ospfd.c | 3 | ||||
-rw-r--r-- | ospfd/ospfd.h | 3 |
7 files changed, 99 insertions, 3 deletions
diff --git a/ospfd/ospf_flood.c b/ospfd/ospf_flood.c index bc4145428..9ab46b9c9 100644 --- a/ospfd/ospf_flood.c +++ b/ospfd/ospf_flood.c @@ -280,7 +280,7 @@ ospf_flood (struct ospf *ospf, struct ospf_neighbor *nbr, ; /* Accept this LSA for quick LSDB resynchronization. */ } else if (tv_cmp (tv_sub (recent_relative_time (), current->tv_recv), - int2tv (OSPF_MIN_LS_ARRIVAL)) < 0) + intms2tv (ospf->lsa_minarrival)) < 0) { if (IS_DEBUG_OSPF_EVENT) zlog_debug ("LSA[Flooding]: LSA is received recently."); diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index ebdb390ab..732496d9a 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -97,6 +97,17 @@ tv_floor (struct timeval a) } struct timeval +intms2tv (int a) +{ + struct timeval ret; + + ret.tv_sec = a/1000; + ret.tv_usec = (a%1000)*1000; + + return ret; +} + +struct timeval int2tv (int a) { struct timeval ret; diff --git a/ospfd/ospf_lsa.h b/ospfd/ospf_lsa.h index ef6bf88c9..0700d0d54 100644 --- a/ospfd/ospf_lsa.h +++ b/ospfd/ospf_lsa.h @@ -236,6 +236,7 @@ struct as_external_lsa extern struct timeval tv_adjust (struct timeval); extern int tv_ceil (struct timeval); extern int tv_floor (struct timeval); +extern struct timeval intms2tv (int); extern struct timeval int2tv (int); extern struct timeval tv_add (struct timeval, struct timeval); extern struct timeval tv_sub (struct timeval, struct timeval); diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 8f0d8537f..44ee806e3 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -2100,7 +2100,7 @@ ospf_ls_upd (struct ip *iph, struct ospf_header *ospfh, quagga_gettime (QUAGGA_CLK_MONOTONIC, &now); if (tv_cmp (tv_sub (now, current->tv_orig), - int2tv (OSPF_MIN_LS_ARRIVAL)) >= 0) + intms2tv (oi->ospf->lsa_minarrival)) >= 0) /* Trap NSSA type later.*/ ospf_ls_upd_send_lsa (nbr, current, OSPF_SEND_PACKET_DIRECT); DISCARD_LSA (lsa, 8); diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index c3bbccda2..aa22a9eed 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -2505,6 +2505,71 @@ ALIAS_DEPRECATED (no_ospf_timers_throttle_spf, "Adjust routing timers\n" "OSPF SPF timers\n") +DEFUN (ospf_timers_lsa, + ospf_timers_lsa_cmd, + "timers lsa min-arrival <0-600000>", + "Adjust routing timers\n" + "OSPF LSA timers\n" + "Minimum delay in receiving new version of a LSA\n" + "Delay in milliseconds\n") +{ + unsigned int minarrival; + struct ospf *ospf = vty->index; + + if (!ospf) + return CMD_SUCCESS; + + if (argc != 1) + { + vty_out (vty, "Insufficient number of arguments%s", VTY_NEWLINE); + return CMD_WARNING; + } + + VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[0]); + + ospf->lsa_minarrival = minarrival; + + return CMD_SUCCESS; +} + +DEFUN (no_ospf_timers_lsa, + no_ospf_timers_lsa_cmd, + "no timers lsa min-arrival", + NO_STR + "Adjust routing timers\n" + "OSPF LSA timers\n" + "Minimum delay in receiving new version of a LSA\n") +{ + unsigned int minarrival; + struct ospf *ospf = vty->index; + + if (!ospf) + return CMD_SUCCESS; + + if (argc) + { + VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[0]); + + if (ospf->lsa_minarrival != minarrival || + minarrival == OSPF_MIN_LS_ARRIVAL) + return CMD_SUCCESS; + } + + ospf->lsa_minarrival = OSPF_MIN_LS_ARRIVAL; + + return CMD_SUCCESS; +} + +ALIAS (no_ospf_timers_lsa, + no_ospf_timers_lsa_val_cmd, + "no timers lsa min-arrival <0-600000>", + NO_STR + "Adjust routing timers\n" + "OSPF LSA timers\n" + "Minimum delay in receiving new version of a LSA\n" + "Delay in milliseconds\n") + + DEFUN (ospf_neighbor, ospf_neighbor_cmd, "neighbor A.B.C.D", @@ -3031,6 +3096,9 @@ show_ip_ospf_common (struct vty *vty, struct ospf *ospf) ospf_timer_dump (ospf->t_spf_calc, timebuf, sizeof (timebuf)), VTY_NEWLINE); + vty_out (vty, " LSA minimum arrival %d msecs%s", + ospf->lsa_minarrival, VTY_NEWLINE); + /* Show write multiplier values */ vty_out (vty, " Write Multiplier set to %d %s", ospf->write_oi_count, VTY_NEWLINE); @@ -8403,7 +8471,12 @@ ospf_config_write (struct vty *vty) vty_out (vty, " timers throttle spf %d %d %d%s", ospf->spf_delay, ospf->spf_holdtime, ospf->spf_max_holdtime, VTY_NEWLINE); - + + /* LSA timers print. */ + if (ospf->lsa_minarrival != OSPF_MIN_LS_ARRIVAL) + vty_out (vty, " timers lsa min-arrival %d%s", + ospf->lsa_minarrival, VTY_NEWLINE); + /* Write multiplier print. */ if (ospf->write_oi_count != OSPF_WRITE_INTERFACE_COUNT_DEFAULT) vty_out (vty, " ospf write-multiplier %d%s", @@ -8919,6 +8992,11 @@ ospf_vty_init (void) install_element (OSPF_NODE, &ospf_timers_throttle_spf_cmd); install_element (OSPF_NODE, &no_ospf_timers_throttle_spf_cmd); + /* LSA timers commands */ + install_element (OSPF_NODE, &ospf_timers_lsa_cmd); + install_element (OSPF_NODE, &no_ospf_timers_lsa_cmd); + install_element (OSPF_NODE, &no_ospf_timers_lsa_val_cmd); + /* refresh timer commands */ install_element (OSPF_NODE, &ospf_refresh_timer_cmd); install_element (OSPF_NODE, &no_ospf_refresh_timer_val_cmd); diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 73a86c218..ff9a82c37 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -247,6 +247,9 @@ ospf_new (u_short instance) new->spf_max_holdtime = OSPF_SPF_MAX_HOLDTIME_DEFAULT; new->spf_hold_multiplier = 1; + /* LSA timers value init */ + new->lsa_minarrival = OSPF_MIN_LS_ARRIVAL; + /* MaxAge init. */ new->maxage_delay = OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT; new->maxage_lsa = route_table_init(); diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h index d3dba184a..a51e5674c 100644 --- a/ospfd/ospfd.h +++ b/ospfd/ospfd.h @@ -190,6 +190,9 @@ struct ospf unsigned int spf_max_holdtime; /* SPF maximum-holdtime */ unsigned int spf_hold_multiplier; /* Adaptive multiplier for hold time */ + /* LSA timer parameters */ + unsigned int lsa_minarrival; /* LSA minimum arrival in milliseconds. */ + int default_originate; /* Default information originate. */ #define DEFAULT_ORIGINATE_NONE 0 #define DEFAULT_ORIGINATE_ZEBRA 1 |