mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 14:04:32 +00:00
2005-10-21 Paul Jakma <paul.jakma@sun.com>
* (general) OSPF fast, sub-second hello and 1s dead-interval support. A warning fix. Millisec support for ospf_timer_dump. Change auto-cost ref-bandwidth to add a comment to write out of config, rather than printing annoying messages to vty on startup. * ospf_dump.c: (ospf_timer_dump) Print out milliseconds too. Callers typically specify a length of 9, so most see millisecs unless they specify the additional length. * ospf_interface.h: (struct ospf_interface) new interface param, fast_hello. * ospf_interface.c: (ospf_if_table_lookup) add brackets, gcc warning fix. (ospf_new_if_params) Initialise fast_hello param. (ospf_free_if_params) Check whether fast_hello is configured. (ospf_if_new_hook) set fast_hello to default. * ospf_ism.h: Wrap OSPF_ISM_TIMER_ON inside do {} while (0) to prevent funny side-effects from its if statement when this macro is used conditionally by other macros. (OSPF_ISM_TIMER_MSEC_ON) new macro, set in milliseconds. (OSPF_HELLO_TIMER_ON) new macro to set hello timer according to whether fast_hello is set. * ospf_ism.c: Update all setting of the hello timer to use either OSPF_ISM_TIMER_MSEC_ON or OSPF_HELLO_TIMER_ON. The former is used when hello is to be sent immediately. * ospf_nsm.c: ditto * ospf_packet.c: (ospf_hello) hello-interval is not checked for mismatch if fast_hello is set. (ospf_read) Annoying nit, fix "no ospf_interface" to be debug rather than a warning, as it can be perfectly normal to receive packets when logical subnets are used. (ospf_make_hello) Set hello-interval to 0 if fast-hellos are configured. * ospf_vty.c: (ospf_auto_cost_reference_bandwidth) annoying nit, don't vty_out if this command is given, it gets tired quick. (show_ip_ospf_interface_sub) Print the hello-interval according to whether fast-hello is set or not. Print the extra 5 millisec characters from (ospf_timer_dump) if fast-hello is configured. (ospf_vty_dead_interval_set) new function, common to all forms of dead-interval command, to set dead-interval and fast-hello correctly. If a dead-interval is given, unset fast-hello, else if a hello-multiplier is set, set dead-interval to 1 and fast-hello to given multiplier. (ip_ospf_dead_interval_addr_cmd) use ospf_vty_dead_interval_set(). (ip_ospf_dead_interval_minimal_addr_cmd) ditto. (no_ip_ospf_dead_interval) Unset fast-hello. (no_ip_ospf_hello_interval) Bug-fix, unset of hello-interval should set it to OSPF_HELLO_INTERVAL_DEFAULT, not OSPF_ROUTER_DEAD_INTERVAL_DEFAULT. (config_write_interface) Write out fast-hello. (ospf_config_write) Write a comment about "auto-cost reference-bandwidth" having to be equal on all routers. Hopefully just as noticeable as old practice of writing to vty, but less annoying. (ospf_vty_if_init) install the two new dead-interval commands. * ospfd.h: Add defines for OSPF_ROUTER_DEAD_INTERVAL_MINIMAL and OSPF_FAST_HELLO_DEFAULT.
This commit is contained in:
parent
24065a3d4a
commit
f9ad937f53
@ -1,3 +1,63 @@
|
|||||||
|
2005-10-21 Paul Jakma <paul.jakma@sun.com>
|
||||||
|
|
||||||
|
* (general) OSPF fast, sub-second hello and 1s dead-interval
|
||||||
|
support.
|
||||||
|
* ospf_dump.c: (ospf_timer_dump) Print out milliseconds too.
|
||||||
|
Callers typically specify a length of 9, so most see
|
||||||
|
millisecs unless they specify the additional length.
|
||||||
|
* ospf_interface.h: (struct ospf_interface) new interface param,
|
||||||
|
fast_hello.
|
||||||
|
* ospf_interface.c: (ospf_if_table_lookup) add brackets,
|
||||||
|
gcc warning fix.
|
||||||
|
(ospf_new_if_params) Initialise fast_hello param.
|
||||||
|
(ospf_free_if_params) Check whether fast_hello is configured.
|
||||||
|
(ospf_if_new_hook) set fast_hello to default.
|
||||||
|
* ospf_ism.h: Wrap OSPF_ISM_TIMER_ON inside do {} while (0) to
|
||||||
|
prevent funny side-effects from its if statement when this
|
||||||
|
macro is used conditionally by other macros.
|
||||||
|
(OSPF_ISM_TIMER_MSEC_ON) new macro, set in milliseconds.
|
||||||
|
(OSPF_HELLO_TIMER_ON) new macro to set hello timer according
|
||||||
|
to whether fast_hello is set.
|
||||||
|
* ospf_ism.c: Update all setting of the hello timer to use
|
||||||
|
either OSPF_ISM_TIMER_MSEC_ON or OSPF_HELLO_TIMER_ON. The
|
||||||
|
former is used when hello is to be sent immediately.
|
||||||
|
* ospf_nsm.c: ditto
|
||||||
|
* ospf_packet.c: (ospf_hello) hello-interval is not checked
|
||||||
|
for mismatch if fast_hello is set.
|
||||||
|
(ospf_read) Annoying nit, fix "no ospf_interface" to be debug
|
||||||
|
rather than a warning, as it can be perfectly normal to
|
||||||
|
receive packets when logical subnets are used.
|
||||||
|
(ospf_make_hello) Set hello-interval to 0 if fast-hellos are
|
||||||
|
configured.
|
||||||
|
* ospf_vty.c: (ospf_auto_cost_reference_bandwidth) annoying
|
||||||
|
nit, don't vty_out if this command is given, it gets tired
|
||||||
|
quick.
|
||||||
|
(show_ip_ospf_interface_sub) Print the hello-interval
|
||||||
|
according to whether fast-hello is set or not.
|
||||||
|
Print the extra 5 millisec characters from (ospf_timer_dump)
|
||||||
|
if fast-hello is configured.
|
||||||
|
(ospf_vty_dead_interval_set) new function, common to all
|
||||||
|
forms of dead-interval command, to set dead-interval and
|
||||||
|
fast-hello correctly. If a dead-interval is given, unset
|
||||||
|
fast-hello, else if a hello-multiplier is set, set
|
||||||
|
dead-interval to 1 and fast-hello to given multiplier.
|
||||||
|
(ip_ospf_dead_interval_addr_cmd) use
|
||||||
|
ospf_vty_dead_interval_set().
|
||||||
|
(ip_ospf_dead_interval_minimal_addr_cmd) ditto.
|
||||||
|
(no_ip_ospf_dead_interval) Unset fast-hello.
|
||||||
|
(no_ip_ospf_hello_interval) Bug-fix, unset of hello-interval
|
||||||
|
should set it to OSPF_HELLO_INTERVAL_DEFAULT, not
|
||||||
|
OSPF_ROUTER_DEAD_INTERVAL_DEFAULT.
|
||||||
|
(config_write_interface) Write out fast-hello.
|
||||||
|
(ospf_config_write) Write a comment about
|
||||||
|
"auto-cost reference-bandwidth" having to be equal on all
|
||||||
|
routers. Hopefully just as noticeable as old practice of
|
||||||
|
writing to vty, but less annoying.
|
||||||
|
(ospf_vty_if_init) install the two new dead-interval
|
||||||
|
commands.
|
||||||
|
* ospfd.h: Add defines for OSPF_ROUTER_DEAD_INTERVAL_MINIMAL
|
||||||
|
and OSPF_FAST_HELLO_DEFAULT.
|
||||||
|
|
||||||
2005-10-18 Paul Jakma <paul.jakma@sun.com>
|
2005-10-18 Paul Jakma <paul.jakma@sun.com>
|
||||||
|
|
||||||
* (general) SPF memory management cleanup and fix for rare
|
* (general) SPF memory management cleanup and fix for rare
|
||||||
|
@ -232,31 +232,39 @@ ospf_nbr_state_message (struct ospf_neighbor *nbr, char *buf, size_t size)
|
|||||||
const char *
|
const char *
|
||||||
ospf_timer_dump (struct thread *t, char *buf, size_t size)
|
ospf_timer_dump (struct thread *t, char *buf, size_t size)
|
||||||
{
|
{
|
||||||
struct timeval now;
|
struct timeval now, result;
|
||||||
unsigned long h, m, s;
|
unsigned long h, m, s, ms;
|
||||||
|
|
||||||
if (!t)
|
if (!t)
|
||||||
return "inactive";
|
return "inactive";
|
||||||
|
|
||||||
h = m = s = 0;
|
h = m = s = ms = 0;
|
||||||
memset (buf, 0, size);
|
memset (buf, 0, size);
|
||||||
|
|
||||||
gettimeofday (&now, NULL);
|
gettimeofday (&now, NULL);
|
||||||
|
|
||||||
s = t->u.sands.tv_sec - now.tv_sec;
|
timersub (&t->u.sands, &now, &result);
|
||||||
if (s >= 3600)
|
|
||||||
|
ms = result.tv_usec / 1000;
|
||||||
|
|
||||||
|
if (ms >= 1000)
|
||||||
{
|
{
|
||||||
h = s / 3600;
|
result.tv_sec = ms / 1000;
|
||||||
s -= h * 3600;
|
ms =- result.tv_sec * 1000;
|
||||||
|
}
|
||||||
|
if (result.tv_sec >= 3600)
|
||||||
|
{
|
||||||
|
h = result.tv_sec / 3600;
|
||||||
|
result.tv_sec -= h * 3600;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (s >= 60)
|
if (result.tv_sec >= 60)
|
||||||
{
|
{
|
||||||
m = s / 60;
|
m = result.tv_sec / 60;
|
||||||
s -= m * 60;
|
result.tv_sec -= m * 60;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf (buf, size, "%02ld:%02ld:%02ld", h, m, s);
|
snprintf (buf, size, "%02ld:%02ld:%02ld.%03ld", h, m, result.tv_sec, ms);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ ospf_if_table_lookup (struct interface *ifp, struct prefix *prefix)
|
|||||||
p.prefixlen = IPV4_MAX_PREFIXLEN;
|
p.prefixlen = IPV4_MAX_PREFIXLEN;
|
||||||
|
|
||||||
/* route_node_get implicitely locks */
|
/* route_node_get implicitely locks */
|
||||||
if (rn = route_node_lookup (IF_OIFS (ifp), &p))
|
if ((rn = route_node_lookup (IF_OIFS (ifp), &p)))
|
||||||
{
|
{
|
||||||
rninfo = (struct ospf_interface *) rn->info;
|
rninfo = (struct ospf_interface *) rn->info;
|
||||||
route_unlock_node (rn);
|
route_unlock_node (rn);
|
||||||
@ -559,6 +559,7 @@ ospf_new_if_params (void)
|
|||||||
UNSET_IF_PARAM (oip, retransmit_interval);
|
UNSET_IF_PARAM (oip, retransmit_interval);
|
||||||
UNSET_IF_PARAM (oip, passive_interface);
|
UNSET_IF_PARAM (oip, passive_interface);
|
||||||
UNSET_IF_PARAM (oip, v_hello);
|
UNSET_IF_PARAM (oip, v_hello);
|
||||||
|
UNSET_IF_PARAM (oip, fast_hello);
|
||||||
UNSET_IF_PARAM (oip, v_wait);
|
UNSET_IF_PARAM (oip, v_wait);
|
||||||
UNSET_IF_PARAM (oip, priority);
|
UNSET_IF_PARAM (oip, priority);
|
||||||
UNSET_IF_PARAM (oip, type);
|
UNSET_IF_PARAM (oip, type);
|
||||||
@ -600,6 +601,7 @@ ospf_free_if_params (struct interface *ifp, struct in_addr addr)
|
|||||||
!OSPF_IF_PARAM_CONFIGURED (oip, retransmit_interval) &&
|
!OSPF_IF_PARAM_CONFIGURED (oip, retransmit_interval) &&
|
||||||
!OSPF_IF_PARAM_CONFIGURED (oip, passive_interface) &&
|
!OSPF_IF_PARAM_CONFIGURED (oip, passive_interface) &&
|
||||||
!OSPF_IF_PARAM_CONFIGURED (oip, v_hello) &&
|
!OSPF_IF_PARAM_CONFIGURED (oip, v_hello) &&
|
||||||
|
!OSPF_IF_PARAM_CONFIGURED (oip, fast_hello) &&
|
||||||
!OSPF_IF_PARAM_CONFIGURED (oip, v_wait) &&
|
!OSPF_IF_PARAM_CONFIGURED (oip, v_wait) &&
|
||||||
!OSPF_IF_PARAM_CONFIGURED (oip, priority) &&
|
!OSPF_IF_PARAM_CONFIGURED (oip, priority) &&
|
||||||
!OSPF_IF_PARAM_CONFIGURED (oip, type) &&
|
!OSPF_IF_PARAM_CONFIGURED (oip, type) &&
|
||||||
@ -700,6 +702,9 @@ ospf_if_new_hook (struct interface *ifp)
|
|||||||
SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_hello);
|
SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_hello);
|
||||||
IF_DEF_PARAMS (ifp)->v_hello = OSPF_HELLO_INTERVAL_DEFAULT;
|
IF_DEF_PARAMS (ifp)->v_hello = OSPF_HELLO_INTERVAL_DEFAULT;
|
||||||
|
|
||||||
|
SET_IF_PARAM (IF_DEF_PARAMS (ifp), fast_hello);
|
||||||
|
IF_DEF_PARAMS (ifp)->fast_hello = OSPF_FAST_HELLO_DEFAULT;
|
||||||
|
|
||||||
SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_wait);
|
SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_wait);
|
||||||
IF_DEF_PARAMS (ifp)->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
|
IF_DEF_PARAMS (ifp)->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
|
||||||
|
|
||||||
|
@ -56,6 +56,9 @@ struct ospf_if_params
|
|||||||
/* MTU mismatch check (see RFC2328, chap 10.6) */
|
/* MTU mismatch check (see RFC2328, chap 10.6) */
|
||||||
DECLARE_IF_PARAM (u_char, mtu_ignore);
|
DECLARE_IF_PARAM (u_char, mtu_ignore);
|
||||||
|
|
||||||
|
/* Fast-Hellos */
|
||||||
|
DECLARE_IF_PARAM (u_char, fast_hello);
|
||||||
|
|
||||||
/* Authentication data. */
|
/* Authentication data. */
|
||||||
u_char auth_simple[OSPF_AUTH_SIMPLE_SIZE + 1]; /* Simple password. */
|
u_char auth_simple[OSPF_AUTH_SIMPLE_SIZE + 1]; /* Simple password. */
|
||||||
u_char auth_simple__config:1;
|
u_char auth_simple__config:1;
|
||||||
|
@ -263,8 +263,7 @@ ospf_hello_timer (struct thread *thread)
|
|||||||
ospf_hello_send (oi);
|
ospf_hello_send (oi);
|
||||||
|
|
||||||
/* Hello timer set. */
|
/* Hello timer set. */
|
||||||
OSPF_ISM_TIMER_ON (oi->t_hello, ospf_hello_timer,
|
OSPF_HELLO_TIMER_ON (oi);
|
||||||
OSPF_IF_PARAM (oi, v_hello));
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -313,7 +312,7 @@ ism_timer_set (struct ospf_interface *oi)
|
|||||||
/* The router is trying to determine the identity of DRouter and
|
/* The router is trying to determine the identity of DRouter and
|
||||||
BDRouter. The router begin to receive and send Hello Packets. */
|
BDRouter. The router begin to receive and send Hello Packets. */
|
||||||
/* send first hello immediately */
|
/* send first hello immediately */
|
||||||
OSPF_ISM_TIMER_ON (oi->t_hello, ospf_hello_timer, 1);
|
OSPF_ISM_TIMER_MSEC_ON (oi->t_hello, ospf_hello_timer, 1);
|
||||||
OSPF_ISM_TIMER_ON (oi->t_wait, ospf_wait_timer,
|
OSPF_ISM_TIMER_ON (oi->t_wait, ospf_wait_timer,
|
||||||
OSPF_IF_PARAM (oi, v_wait));
|
OSPF_IF_PARAM (oi, v_wait));
|
||||||
OSPF_ISM_TIMER_OFF (oi->t_ls_ack);
|
OSPF_ISM_TIMER_OFF (oi->t_ls_ack);
|
||||||
@ -323,8 +322,7 @@ ism_timer_set (struct ospf_interface *oi)
|
|||||||
virtual link. The router attempts to form an adjacency with
|
virtual link. The router attempts to form an adjacency with
|
||||||
neighboring router. Hello packets are also sent. */
|
neighboring router. Hello packets are also sent. */
|
||||||
/* send first hello immediately */
|
/* send first hello immediately */
|
||||||
OSPF_ISM_TIMER_ON (oi->t_hello, ospf_hello_timer, 1);
|
OSPF_ISM_TIMER_MSEC_ON (oi->t_hello, ospf_hello_timer, 1);
|
||||||
|
|
||||||
OSPF_ISM_TIMER_OFF (oi->t_wait);
|
OSPF_ISM_TIMER_OFF (oi->t_wait);
|
||||||
OSPF_ISM_TIMER_ON (oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack);
|
OSPF_ISM_TIMER_ON (oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack);
|
||||||
break;
|
break;
|
||||||
@ -332,24 +330,21 @@ ism_timer_set (struct ospf_interface *oi)
|
|||||||
/* The network type of the interface is broadcast or NBMA network,
|
/* The network type of the interface is broadcast or NBMA network,
|
||||||
and the router itself is neither Designated Router nor
|
and the router itself is neither Designated Router nor
|
||||||
Backup Designated Router. */
|
Backup Designated Router. */
|
||||||
OSPF_ISM_TIMER_ON (oi->t_hello, ospf_hello_timer,
|
OSPF_HELLO_TIMER_ON (oi);
|
||||||
OSPF_IF_PARAM (oi, v_hello));
|
|
||||||
OSPF_ISM_TIMER_OFF (oi->t_wait);
|
OSPF_ISM_TIMER_OFF (oi->t_wait);
|
||||||
OSPF_ISM_TIMER_ON (oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack);
|
OSPF_ISM_TIMER_ON (oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack);
|
||||||
break;
|
break;
|
||||||
case ISM_Backup:
|
case ISM_Backup:
|
||||||
/* The network type of the interface is broadcast os NBMA network,
|
/* The network type of the interface is broadcast os NBMA network,
|
||||||
and the router is Backup Designated Router. */
|
and the router is Backup Designated Router. */
|
||||||
OSPF_ISM_TIMER_ON (oi->t_hello, ospf_hello_timer,
|
OSPF_HELLO_TIMER_ON (oi);
|
||||||
OSPF_IF_PARAM (oi, v_hello));
|
|
||||||
OSPF_ISM_TIMER_OFF (oi->t_wait);
|
OSPF_ISM_TIMER_OFF (oi->t_wait);
|
||||||
OSPF_ISM_TIMER_ON (oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack);
|
OSPF_ISM_TIMER_ON (oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack);
|
||||||
break;
|
break;
|
||||||
case ISM_DR:
|
case ISM_DR:
|
||||||
/* The network type of the interface is broadcast or NBMA network,
|
/* The network type of the interface is broadcast or NBMA network,
|
||||||
and the router is Designated Router. */
|
and the router is Designated Router. */
|
||||||
OSPF_ISM_TIMER_ON (oi->t_hello, ospf_hello_timer,
|
OSPF_HELLO_TIMER_ON (oi);
|
||||||
OSPF_IF_PARAM (oi, v_hello));
|
|
||||||
OSPF_ISM_TIMER_OFF (oi->t_wait);
|
OSPF_ISM_TIMER_OFF (oi->t_wait);
|
||||||
OSPF_ISM_TIMER_ON (oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack);
|
OSPF_ISM_TIMER_ON (oi->t_ls_ack, ospf_ls_ack_timer, oi->v_ls_ack);
|
||||||
break;
|
break;
|
||||||
|
@ -65,8 +65,28 @@
|
|||||||
|
|
||||||
/* Macro for OSPF ISM timer turn on. */
|
/* Macro for OSPF ISM timer turn on. */
|
||||||
#define OSPF_ISM_TIMER_ON(T,F,V) \
|
#define OSPF_ISM_TIMER_ON(T,F,V) \
|
||||||
|
do { \
|
||||||
if (!(T)) \
|
if (!(T)) \
|
||||||
(T) = thread_add_timer (master, (F), oi, (V))
|
(T) = thread_add_timer (master, (F), oi, (V)); \
|
||||||
|
} while (0)
|
||||||
|
#define OSPF_ISM_TIMER_MSEC_ON(T,F,V) \
|
||||||
|
do { \
|
||||||
|
if (!(T)) \
|
||||||
|
(T) = thread_add_timer_msec (master, (F), oi, (V)); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
/* convenience macro to set hello timer correctly, according to
|
||||||
|
* whether fast-hello is set or not
|
||||||
|
*/
|
||||||
|
#define OSPF_HELLO_TIMER_ON(O) \
|
||||||
|
do { \
|
||||||
|
if (OSPF_IF_PARAM ((O), fast_hello)) \
|
||||||
|
OSPF_ISM_TIMER_MSEC_ON ((O)->t_hello, ospf_hello_timer, \
|
||||||
|
1000 / OSPF_IF_PARAM ((O), fast_hello)); \
|
||||||
|
else \
|
||||||
|
OSPF_ISM_TIMER_ON ((O)->t_hello, ospf_hello_timer, \
|
||||||
|
OSPF_IF_PARAM ((O), v_hello)); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/* Macro for OSPF ISM timer turn off. */
|
/* Macro for OSPF ISM timer turn off. */
|
||||||
#define OSPF_ISM_TIMER_OFF(X) \
|
#define OSPF_ISM_TIMER_OFF(X) \
|
||||||
|
@ -826,7 +826,7 @@ nsm_change_state (struct ospf_neighbor *nbr, int state)
|
|||||||
if (state == NSM_Init)
|
if (state == NSM_Init)
|
||||||
{
|
{
|
||||||
OSPF_ISM_TIMER_OFF (oi->t_hello);
|
OSPF_ISM_TIMER_OFF (oi->t_hello);
|
||||||
OSPF_ISM_TIMER_ON (oi->t_hello, ospf_hello_timer, 1);
|
OSPF_ISM_TIMER_MSEC_ON (oi->t_hello, ospf_hello_timer, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Preserve old status? */
|
/* Preserve old status? */
|
||||||
|
@ -789,14 +789,6 @@ ospf_hello (struct ip *iph, struct ospf_header *ospfh,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compare Hello Interval. */
|
|
||||||
if (OSPF_IF_PARAM (oi, v_hello) != ntohs (hello->hello_interval))
|
|
||||||
{
|
|
||||||
zlog_warn ("Packet %s [Hello:RECV]: HelloInterval mismatch.",
|
|
||||||
inet_ntoa (ospfh->router_id));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Compare Router Dead Interval. */
|
/* Compare Router Dead Interval. */
|
||||||
if (OSPF_IF_PARAM (oi, v_wait) != ntohl (hello->dead_interval))
|
if (OSPF_IF_PARAM (oi, v_wait) != ntohl (hello->dead_interval))
|
||||||
{
|
{
|
||||||
@ -805,6 +797,17 @@ ospf_hello (struct ip *iph, struct ospf_header *ospfh,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Compare Hello Interval - ignored if fast-hellos are set. */
|
||||||
|
if (OSPF_IF_PARAM (oi, fast_hello) == 0)
|
||||||
|
{
|
||||||
|
if (OSPF_IF_PARAM (oi, v_hello) != ntohs (hello->hello_interval))
|
||||||
|
{
|
||||||
|
zlog_warn ("Packet %s [Hello:RECV]: HelloInterval mismatch.",
|
||||||
|
inet_ntoa (ospfh->router_id));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (IS_DEBUG_OSPF_EVENT)
|
if (IS_DEBUG_OSPF_EVENT)
|
||||||
zlog_debug ("Packet %s [Hello:RECV]: Options %s",
|
zlog_debug ("Packet %s [Hello:RECV]: Options %s",
|
||||||
inet_ntoa (ospfh->router_id),
|
inet_ntoa (ospfh->router_id),
|
||||||
@ -2356,7 +2359,7 @@ ospf_read (struct thread *thread)
|
|||||||
{
|
{
|
||||||
if ((oi = ospf_associate_packet_vl (ospf, ifp, iph, ospfh)) == NULL)
|
if ((oi = ospf_associate_packet_vl (ospf, ifp, iph, ospfh)) == NULL)
|
||||||
{
|
{
|
||||||
zlog_warn ("Packet from [%s] received on link %s"
|
zlog_debug ("Packet from [%s] received on link %s"
|
||||||
" but no ospf_interface",
|
" but no ospf_interface",
|
||||||
inet_ntoa (iph->ip_src), ifp->name);
|
inet_ntoa (iph->ip_src), ifp->name);
|
||||||
return 0;
|
return 0;
|
||||||
@ -2576,7 +2579,10 @@ ospf_make_hello (struct ospf_interface *oi, struct stream *s)
|
|||||||
stream_put_ipv4 (s, mask.s_addr);
|
stream_put_ipv4 (s, mask.s_addr);
|
||||||
|
|
||||||
/* Set Hello Interval. */
|
/* Set Hello Interval. */
|
||||||
|
if (OSPF_IF_PARAM (oi, fast_hello) == 0)
|
||||||
stream_putw (s, OSPF_IF_PARAM (oi, v_hello));
|
stream_putw (s, OSPF_IF_PARAM (oi, v_hello));
|
||||||
|
else
|
||||||
|
stream_putw (s, 0); /* hello-interval of 0 for fast-hellos */
|
||||||
|
|
||||||
if (IS_DEBUG_OSPF_EVENT)
|
if (IS_DEBUG_OSPF_EVENT)
|
||||||
zlog_debug ("make_hello: options: %x, int: %s",
|
zlog_debug ("make_hello: options: %x, int: %s",
|
||||||
|
140
ospfd/ospf_vty.c
140
ospfd/ospf_vty.c
@ -2353,9 +2353,6 @@ DEFUN (ospf_auto_cost_reference_bandwidth,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
ospf->ref_bandwidth = refbw * 1000;
|
ospf->ref_bandwidth = refbw * 1000;
|
||||||
vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE);
|
|
||||||
vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE);
|
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp))
|
for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp))
|
||||||
ospf_if_recalculate_output_cost (ifp);
|
ospf_if_recalculate_output_cost (ifp);
|
||||||
|
|
||||||
@ -2697,15 +2694,29 @@ show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf,
|
|||||||
vty_out (vty, "%s", VTY_NEWLINE);
|
vty_out (vty, "%s", VTY_NEWLINE);
|
||||||
|
|
||||||
vty_out (vty, " Timer intervals configured,");
|
vty_out (vty, " Timer intervals configured,");
|
||||||
vty_out (vty, " Hello %d, Dead %d, Wait %d, Retransmit %d%s",
|
vty_out (vty, " Hello ");
|
||||||
OSPF_IF_PARAM (oi, v_hello), OSPF_IF_PARAM (oi, v_wait),
|
if (OSPF_IF_PARAM (oi, fast_hello) == 0)
|
||||||
|
vty_out (vty, "%ds,", OSPF_IF_PARAM (oi, v_hello));
|
||||||
|
else
|
||||||
|
vty_out (vty, "%dms,", 1000 / OSPF_IF_PARAM (oi, fast_hello));
|
||||||
|
vty_out (vty, " Dead %ds, Wait %ds, Retransmit %d%s",
|
||||||
|
OSPF_IF_PARAM (oi, v_wait),
|
||||||
OSPF_IF_PARAM (oi, v_wait),
|
OSPF_IF_PARAM (oi, v_wait),
|
||||||
OSPF_IF_PARAM (oi, retransmit_interval),
|
OSPF_IF_PARAM (oi, retransmit_interval),
|
||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
|
|
||||||
if (OSPF_IF_PARAM (oi, passive_interface) == OSPF_IF_ACTIVE)
|
if (OSPF_IF_PARAM (oi, passive_interface) == OSPF_IF_ACTIVE)
|
||||||
|
{
|
||||||
|
int timer_slen = 9; /* length of "hh:mm:ss(nul)" */
|
||||||
|
|
||||||
|
/* for fast hello we also want to see the .XXXX ms part */
|
||||||
|
if (OSPF_IF_PARAM (oi, fast_hello))
|
||||||
|
timer_slen += 5;
|
||||||
|
|
||||||
vty_out (vty, " Hello due in %s%s",
|
vty_out (vty, " Hello due in %s%s",
|
||||||
ospf_timer_dump (oi->t_hello, buf, 9), VTY_NEWLINE);
|
ospf_timer_dump (oi->t_hello, buf, timer_slen),
|
||||||
|
VTY_NEWLINE);
|
||||||
|
}
|
||||||
else /* OSPF_IF_PASSIVE is set */
|
else /* OSPF_IF_PASSIVE is set */
|
||||||
vty_out (vty, " No Hellos (Passive interface)%s", VTY_NEWLINE);
|
vty_out (vty, " No Hellos (Passive interface)%s", VTY_NEWLINE);
|
||||||
|
|
||||||
@ -4583,17 +4594,14 @@ ospf_nbr_timer_update (struct ospf_interface *oi)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (ip_ospf_dead_interval,
|
static int
|
||||||
ip_ospf_dead_interval_addr_cmd,
|
ospf_vty_dead_interval_set (struct vty *vty, const char *interval_str,
|
||||||
"ip ospf dead-interval <1-65535> A.B.C.D",
|
const char *nbr_str,
|
||||||
"IP Information\n"
|
const char *fast_hello_str)
|
||||||
"OSPF interface commands\n"
|
|
||||||
"Interval after which a neighbor is declared dead\n"
|
|
||||||
"Seconds\n"
|
|
||||||
"Address of interface")
|
|
||||||
{
|
{
|
||||||
struct interface *ifp = vty->index;
|
struct interface *ifp = vty->index;
|
||||||
u_int32_t seconds;
|
u_int32_t seconds;
|
||||||
|
u_char hellomult;
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
int ret;
|
int ret;
|
||||||
struct ospf_if_params *params;
|
struct ospf_if_params *params;
|
||||||
@ -4605,18 +4613,9 @@ DEFUN (ip_ospf_dead_interval,
|
|||||||
|
|
||||||
params = IF_DEF_PARAMS (ifp);
|
params = IF_DEF_PARAMS (ifp);
|
||||||
|
|
||||||
seconds = strtol (argv[0], NULL, 10);
|
if (nbr_str)
|
||||||
|
|
||||||
/* dead_interval range is <1-65535>. */
|
|
||||||
if (seconds < 1 || seconds > 65535)
|
|
||||||
{
|
{
|
||||||
vty_out (vty, "Router Dead Interval is invalid%s", VTY_NEWLINE);
|
ret = inet_aton(nbr_str, &addr);
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc == 2)
|
|
||||||
{
|
|
||||||
ret = inet_aton(argv[1], &addr);
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
vty_out (vty, "Please specify interface address by A.B.C.D%s",
|
vty_out (vty, "Please specify interface address by A.B.C.D%s",
|
||||||
@ -4628,11 +4627,36 @@ DEFUN (ip_ospf_dead_interval,
|
|||||||
ospf_if_update_params (ifp, addr);
|
ospf_if_update_params (ifp, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (interval_str)
|
||||||
|
{
|
||||||
|
VTY_GET_INTEGER_RANGE ("Router Dead Interval", seconds, interval_str,
|
||||||
|
1, 65535);
|
||||||
|
|
||||||
|
/* reset fast_hello too, just to be sure */
|
||||||
|
UNSET_IF_PARAM (params, fast_hello);
|
||||||
|
params->fast_hello = OSPF_FAST_HELLO_DEFAULT;
|
||||||
|
}
|
||||||
|
else if (fast_hello_str)
|
||||||
|
{
|
||||||
|
VTY_GET_INTEGER_RANGE ("Hello Multiplier", hellomult, fast_hello_str,
|
||||||
|
1, 10);
|
||||||
|
/* 1s dead-interval with sub-second hellos desired */
|
||||||
|
seconds = OSPF_ROUTER_DEAD_INTERVAL_MINIMAL;
|
||||||
|
SET_IF_PARAM (params, fast_hello);
|
||||||
|
params->fast_hello = hellomult;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vty_out (vty, "Please specify dead-interval or hello-multiplier%s",
|
||||||
|
VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
SET_IF_PARAM (params, v_wait);
|
SET_IF_PARAM (params, v_wait);
|
||||||
params->v_wait = seconds;
|
params->v_wait = seconds;
|
||||||
|
|
||||||
/* Update timer values in neighbor structure. */
|
/* Update timer values in neighbor structure. */
|
||||||
if (argc == 2)
|
if (nbr_str)
|
||||||
{
|
{
|
||||||
if (ospf)
|
if (ospf)
|
||||||
{
|
{
|
||||||
@ -4651,6 +4675,22 @@ DEFUN (ip_ospf_dead_interval,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DEFUN (ip_ospf_dead_interval,
|
||||||
|
ip_ospf_dead_interval_addr_cmd,
|
||||||
|
"ip ospf dead-interval <1-65535> A.B.C.D",
|
||||||
|
"IP Information\n"
|
||||||
|
"OSPF interface commands\n"
|
||||||
|
"Interval after which a neighbor is declared dead\n"
|
||||||
|
"Seconds\n"
|
||||||
|
"Address of interface\n")
|
||||||
|
{
|
||||||
|
if (argc == 2)
|
||||||
|
return ospf_vty_dead_interval_set (vty, argv[0], argv[1], NULL);
|
||||||
|
else
|
||||||
|
return ospf_vty_dead_interval_set (vty, argv[0], NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
ALIAS (ip_ospf_dead_interval,
|
ALIAS (ip_ospf_dead_interval,
|
||||||
ip_ospf_dead_interval_cmd,
|
ip_ospf_dead_interval_cmd,
|
||||||
"ip ospf dead-interval <1-65535>",
|
"ip ospf dead-interval <1-65535>",
|
||||||
@ -4666,6 +4706,33 @@ ALIAS (ip_ospf_dead_interval,
|
|||||||
"Interval after which a neighbor is declared dead\n"
|
"Interval after which a neighbor is declared dead\n"
|
||||||
"Seconds\n")
|
"Seconds\n")
|
||||||
|
|
||||||
|
DEFUN (ip_ospf_dead_interval_minimal,
|
||||||
|
ip_ospf_dead_interval_minimal_addr_cmd,
|
||||||
|
"ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D",
|
||||||
|
"IP Information\n"
|
||||||
|
"OSPF interface commands\n"
|
||||||
|
"Interval after which a neighbor is declared dead\n"
|
||||||
|
"Minimal 1s dead-interval with fast sub-second hellos\n"
|
||||||
|
"Hello multiplier factor\n"
|
||||||
|
"Number of Hellos to send each second\n"
|
||||||
|
"Address of interface\n")
|
||||||
|
{
|
||||||
|
if (argc == 2)
|
||||||
|
return ospf_vty_dead_interval_set (vty, NULL, argv[1], argv[0]);
|
||||||
|
else
|
||||||
|
return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
ALIAS (ip_ospf_dead_interval_minimal,
|
||||||
|
ip_ospf_dead_interval_minimal_cmd,
|
||||||
|
"ip ospf dead-interval minimal hello-multiplier <1-10>",
|
||||||
|
"IP Information\n"
|
||||||
|
"OSPF interface commands\n"
|
||||||
|
"Interval after which a neighbor is declared dead\n"
|
||||||
|
"Minimal 1s dead-interval with fast sub-second hellos\n"
|
||||||
|
"Hello multiplier factor\n"
|
||||||
|
"Number of Hellos to send each second\n")
|
||||||
|
|
||||||
DEFUN (no_ip_ospf_dead_interval,
|
DEFUN (no_ip_ospf_dead_interval,
|
||||||
no_ip_ospf_dead_interval_addr_cmd,
|
no_ip_ospf_dead_interval_addr_cmd,
|
||||||
"no ip ospf dead-interval A.B.C.D",
|
"no ip ospf dead-interval A.B.C.D",
|
||||||
@ -4706,6 +4773,9 @@ DEFUN (no_ip_ospf_dead_interval,
|
|||||||
UNSET_IF_PARAM (params, v_wait);
|
UNSET_IF_PARAM (params, v_wait);
|
||||||
params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
|
params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
|
||||||
|
|
||||||
|
UNSET_IF_PARAM (params, fast_hello);
|
||||||
|
params->fast_hello = OSPF_FAST_HELLO_DEFAULT;
|
||||||
|
|
||||||
if (params != IF_DEF_PARAMS (ifp))
|
if (params != IF_DEF_PARAMS (ifp))
|
||||||
{
|
{
|
||||||
ospf_free_if_params (ifp, addr);
|
ospf_free_if_params (ifp, addr);
|
||||||
@ -4841,7 +4911,7 @@ DEFUN (no_ip_ospf_hello_interval,
|
|||||||
}
|
}
|
||||||
|
|
||||||
UNSET_IF_PARAM (params, v_hello);
|
UNSET_IF_PARAM (params, v_hello);
|
||||||
params->v_hello = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
|
params->v_hello = OSPF_HELLO_INTERVAL_DEFAULT;
|
||||||
|
|
||||||
if (params != IF_DEF_PARAMS (ifp))
|
if (params != IF_DEF_PARAMS (ifp))
|
||||||
{
|
{
|
||||||
@ -6994,7 +7064,15 @@ config_write_interface (struct vty *vty)
|
|||||||
if (OSPF_IF_PARAM_CONFIGURED (params, v_wait) &&
|
if (OSPF_IF_PARAM_CONFIGURED (params, v_wait) &&
|
||||||
params->v_wait != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT)
|
params->v_wait != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT)
|
||||||
{
|
{
|
||||||
vty_out (vty, " ip ospf dead-interval %u", params->v_wait);
|
vty_out (vty, " ip ospf dead-interval ");
|
||||||
|
|
||||||
|
/* fast hello ? */
|
||||||
|
if (OSPF_IF_PARAM_CONFIGURED (params, fast_hello))
|
||||||
|
vty_out (vty, "minimal hello-multiplier %d",
|
||||||
|
params->fast_hello);
|
||||||
|
else
|
||||||
|
vty_out (vty, "%u", params->v_wait);
|
||||||
|
|
||||||
if (params != IF_DEF_PARAMS (ifp))
|
if (params != IF_DEF_PARAMS (ifp))
|
||||||
vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
|
vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
|
||||||
vty_out (vty, "%s", VTY_NEWLINE);
|
vty_out (vty, "%s", VTY_NEWLINE);
|
||||||
@ -7435,8 +7513,12 @@ ospf_config_write (struct vty *vty)
|
|||||||
|
|
||||||
/* auto-cost reference-bandwidth configuration. */
|
/* auto-cost reference-bandwidth configuration. */
|
||||||
if (ospf->ref_bandwidth != OSPF_DEFAULT_REF_BANDWIDTH)
|
if (ospf->ref_bandwidth != OSPF_DEFAULT_REF_BANDWIDTH)
|
||||||
|
{
|
||||||
|
vty_out (vty, "! Important: ensure reference bandwidth "
|
||||||
|
"is consistent across all routers%s", VTY_NEWLINE);
|
||||||
vty_out (vty, " auto-cost reference-bandwidth %d%s",
|
vty_out (vty, " auto-cost reference-bandwidth %d%s",
|
||||||
ospf->ref_bandwidth / 1000, VTY_NEWLINE);
|
ospf->ref_bandwidth / 1000, VTY_NEWLINE);
|
||||||
|
}
|
||||||
|
|
||||||
/* SPF timers print. */
|
/* SPF timers print. */
|
||||||
if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT ||
|
if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT ||
|
||||||
@ -7601,6 +7683,8 @@ ospf_vty_if_init (void)
|
|||||||
/* "ip ospf dead-interval" commands. */
|
/* "ip ospf dead-interval" commands. */
|
||||||
install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd);
|
install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd);
|
||||||
install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd);
|
install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd);
|
||||||
|
install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_addr_cmd);
|
||||||
|
install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_cmd);
|
||||||
install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd);
|
install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd);
|
||||||
install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd);
|
install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd);
|
||||||
|
|
||||||
|
@ -94,6 +94,7 @@
|
|||||||
/* OSPF interface default values. */
|
/* OSPF interface default values. */
|
||||||
#define OSPF_OUTPUT_COST_DEFAULT 10
|
#define OSPF_OUTPUT_COST_DEFAULT 10
|
||||||
#define OSPF_ROUTER_DEAD_INTERVAL_DEFAULT 40
|
#define OSPF_ROUTER_DEAD_INTERVAL_DEFAULT 40
|
||||||
|
#define OSPF_ROUTER_DEAD_INTERVAL_MINIMAL 1
|
||||||
#define OSPF_HELLO_INTERVAL_DEFAULT 10
|
#define OSPF_HELLO_INTERVAL_DEFAULT 10
|
||||||
#define OSPF_ROUTER_PRIORITY_DEFAULT 1
|
#define OSPF_ROUTER_PRIORITY_DEFAULT 1
|
||||||
#define OSPF_RETRANSMIT_INTERVAL_DEFAULT 5
|
#define OSPF_RETRANSMIT_INTERVAL_DEFAULT 5
|
||||||
@ -106,6 +107,7 @@
|
|||||||
#define OSPF_NEIGHBOR_PRIORITY_DEFAULT 0
|
#define OSPF_NEIGHBOR_PRIORITY_DEFAULT 0
|
||||||
|
|
||||||
#define OSPF_MTU_IGNORE_DEFAULT 0
|
#define OSPF_MTU_IGNORE_DEFAULT 0
|
||||||
|
#define OSPF_FAST_HELLO_DEFAULT 0
|
||||||
|
|
||||||
/* OSPF options. */
|
/* OSPF options. */
|
||||||
#define OSPF_OPTION_T 0x01 /* TOS. */
|
#define OSPF_OPTION_T 0x01 /* TOS. */
|
||||||
|
Loading…
Reference in New Issue
Block a user