summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_vty.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2016-03-30 13:44:03 +0300
committerTimo Teräs <timo.teras@iki.fi>2016-03-30 14:29:40 +0300
commit8cb40c91cdfb00ddf04e88d3ecd40403890d90f7 (patch)
tree6d6a3de27525820abb740f1fa8347b6f03986bad /ospfd/ospf_vty.c
parent86c5d2ee68f7b9c00ae4aeb5c8b3c5d82c5ebffc (diff)
downloadquagga-8cb40c91cdfb00ddf04e88d3ecd40403890d90f7.tar.bz2
quagga-8cb40c91cdfb00ddf04e88d3ecd40403890d90f7.tar.xz
cumulus take-3cumulus-take-3
Diffstat (limited to 'ospfd/ospf_vty.c')
-rw-r--r--ospfd/ospf_vty.c199
1 files changed, 167 insertions, 32 deletions
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index fb17dff3..a49fdfce 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -2655,6 +2655,52 @@ DEFUN (no_ospf_auto_cost_reference_bandwidth,
return CMD_SUCCESS;
}
+DEFUN (ospf_write_multiplier,
+ ospf_write_multiplier_cmd,
+ "ospf write-multiplier <1-100>",
+ "OSPF specific commands\n"
+ "Write multiplier\n"
+ "Maximum number of interface serviced per write\n")
+{
+ struct ospf *ospf = vty->index;
+ u_int32_t write_oi_count;
+
+ write_oi_count = strtol (argv[0], NULL, 10);
+ if (write_oi_count < 1 || write_oi_count > 100)
+ {
+ vty_out (vty, "write-multiplier value is invalid%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ ospf->write_oi_count = write_oi_count;
+ return CMD_SUCCESS;
+}
+
+ALIAS (ospf_write_multiplier,
+ write_multiplier_cmd,
+ "write-multiplier <1-100>",
+ "Write multiplier\n"
+ "Maximum number of interface serviced per write\n")
+
+DEFUN (no_ospf_write_multiplier,
+ no_ospf_write_multiplier_cmd,
+ "no ospf write-multiplier",
+ NO_STR
+ "OSPF specific commands\n"
+ "Write multiplier\n")
+{
+ struct ospf *ospf = vty->index;
+
+ ospf->write_oi_count = OSPF_WRITE_INTERFACE_COUNT_DEFAULT;
+ return CMD_SUCCESS;
+}
+
+ALIAS (no_ospf_write_multiplier,
+ no_write_multiplier_cmd,
+ "no write-multiplier",
+ NO_STR
+ "Write multiplier\n")
+
const char *ospf_abr_type_descr_str[] =
{
"Unknown",
@@ -2878,6 +2924,10 @@ DEFUN (show_ip_ospf,
ospf_timer_dump (ospf->t_spf_calc, timebuf, sizeof (timebuf)),
VTY_NEWLINE);
+ /* Show write multiplier values */
+ vty_out (vty, " Write Multiplier set to %d %s",
+ ospf->write_oi_count, VTY_NEWLINE);
+
/* Show refresh parameters. */
vty_out (vty, " Refresh timer %d secs%s",
ospf->lsa_refresh_interval, VTY_NEWLINE);
@@ -2955,30 +3005,37 @@ show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf,
if (oi == NULL)
continue;
- /* Show OSPF interface information. */
- vty_out (vty, " Internet Address %s/%d,",
- inet_ntoa (oi->address->u.prefix4), oi->address->prefixlen);
-
- if (oi->connected->destination || oi->type == OSPF_IFTYPE_VIRTUALLINK)
+ if (CHECK_FLAG(oi->connected->flags, ZEBRA_IFA_UNNUMBERED))
{
- struct in_addr *dest;
- const char *dstr;
-
- if (CONNECTED_PEER(oi->connected)
- || oi->type == OSPF_IFTYPE_VIRTUALLINK)
- dstr = "Peer";
- else
- dstr = "Broadcast";
-
- /* For Vlinks, showing the peer address is probably more
- * informative than the local interface that is being used
- */
- if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
- dest = &oi->vl_data->peer_addr;
- else
- dest = &oi->connected->destination->u.prefix4;
-
- vty_out (vty, " %s %s,", dstr, inet_ntoa (*dest));
+ vty_out (vty, " This interface is UNNUMBERED,");
+ }
+ else
+ {
+ /* Show OSPF interface information. */
+ vty_out (vty, " Internet Address %s/%d,",
+ inet_ntoa (oi->address->u.prefix4), oi->address->prefixlen);
+
+ if (oi->connected->destination || oi->type == OSPF_IFTYPE_VIRTUALLINK)
+ {
+ struct in_addr *dest;
+ const char *dstr;
+
+ if (CONNECTED_PEER(oi->connected)
+ || oi->type == OSPF_IFTYPE_VIRTUALLINK)
+ dstr = "Peer";
+ else
+ dstr = "Broadcast";
+
+ /* For Vlinks, showing the peer address is probably more
+ * informative than the local interface that is being used
+ */
+ if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
+ dest = &oi->vl_data->peer_addr;
+ else
+ dest = &oi->connected->destination->u.prefix4;
+
+ vty_out (vty, " %s %s,", dstr, inet_ntoa (*dest));
+ }
}
vty_out (vty, " Area %s%s", ospf_area_desc_string (oi->area),
@@ -3030,7 +3087,7 @@ show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf,
inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE);
}
}
-
+
/* Next network-LSA sequence number we'll use, if we're elected DR */
if (oi->params && ntohl (oi->params->network_lsa_seqnum)
!= OSPF_INITIAL_SEQUENCE_NUMBER)
@@ -3117,7 +3174,7 @@ DEFUN (show_ip_ospf_interface,
static void
show_ip_ospf_neighbour_header (struct vty *vty)
{
- vty_out (vty, "%s%15s %3s %-15s %9s %-15s %-20s %5s %5s %5s%s",
+ vty_out (vty, "%s%-15s %3s %-15s %9s %-15s %-20s %5s %5s %5s%s",
VTY_NEWLINE,
"Neighbor ID", "Pri", "State", "Dead Time",
"Address", "Interface", "RXmtL", "RqstL", "DBsmL",
@@ -5184,11 +5241,12 @@ ALIAS (ip_ospf_dead_interval_minimal,
DEFUN (no_ip_ospf_dead_interval,
no_ip_ospf_dead_interval_addr_cmd,
- "no ip ospf dead-interval A.B.C.D",
+ "no ip ospf dead-interval <1-65535> A.B.C.D",
NO_STR
"IP Information\n"
"OSPF interface commands\n"
"Interval after which a neighbor is declared dead\n"
+ "Seconds\n"
"Address of interface")
{
struct interface *ifp = vty->index;
@@ -5201,9 +5259,9 @@ DEFUN (no_ip_ospf_dead_interval,
ifp = vty->index;
params = IF_DEF_PARAMS (ifp);
- if (argc == 1)
+ if (argc == 2)
{
- ret = inet_aton(argv[0], &addr);
+ ret = inet_aton(argv[1], &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
@@ -5251,6 +5309,15 @@ DEFUN (no_ip_ospf_dead_interval,
}
ALIAS (no_ip_ospf_dead_interval,
+ no_ip_ospf_dead_interval_seconds_cmd,
+ "no ip ospf dead-interval <1-65535>",
+ NO_STR
+ "IP Information\n"
+ "OSPF interface commands\n"
+ "Interval after which a neighbor is declared dead\n"
+ "Seconds\n")
+
+ALIAS (no_ip_ospf_dead_interval,
no_ip_ospf_dead_interval_cmd,
"no ip ospf dead-interval",
NO_STR
@@ -5328,11 +5395,12 @@ ALIAS (ip_ospf_hello_interval,
DEFUN (no_ip_ospf_hello_interval,
no_ip_ospf_hello_interval_addr_cmd,
- "no ip ospf hello-interval A.B.C.D",
+ "no ip ospf hello-interval <1-65535> A.B.C.D",
NO_STR
"IP Information\n"
"OSPF interface commands\n"
"Time between HELLO packets\n"
+ "Seconds\n"
"Address of interface")
{
struct interface *ifp = vty->index;
@@ -5343,9 +5411,9 @@ DEFUN (no_ip_ospf_hello_interval,
ifp = vty->index;
params = IF_DEF_PARAMS (ifp);
- if (argc == 1)
+ if (argc == 2)
{
- ret = inet_aton(argv[0], &addr);
+ ret = inet_aton(argv[1], &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
@@ -5371,6 +5439,15 @@ DEFUN (no_ip_ospf_hello_interval,
}
ALIAS (no_ip_ospf_hello_interval,
+ no_ip_ospf_hello_interval_seconds_cmd,
+ "no ip ospf hello-interval <1-65535>",
+ NO_STR
+ "IP Information\n"
+ "OSPF interface commands\n"
+ "Time between HELLO packets\n"
+ "Seconds\n")
+
+ALIAS (no_ip_ospf_hello_interval,
no_ip_ospf_hello_interval_cmd,
"no ip ospf hello-interval",
NO_STR
@@ -6525,7 +6602,7 @@ DEFUN (no_ospf_max_metric_router_lsa_startup,
DEFUN (ospf_max_metric_router_lsa_shutdown,
ospf_max_metric_router_lsa_shutdown_cmd,
- "max-metric router-lsa on-shutdown <5-86400>",
+ "max-metric router-lsa on-shutdown <5-100>",
"OSPF maximum / infinite-distance metric\n"
"Advertise own Router-LSA with infinite distance (stub router)\n"
"Advertise stub-router prior to full shutdown of OSPF\n"
@@ -7454,6 +7531,11 @@ ospf_config_write (struct vty *vty)
ospf->spf_delay, ospf->spf_holdtime,
ospf->spf_max_holdtime, VTY_NEWLINE);
+ /* Write multiplier print. */
+ if (ospf->write_oi_count != OSPF_WRITE_INTERFACE_COUNT_DEFAULT)
+ vty_out (vty, " ospf write-multiplier %d%s",
+ ospf->write_oi_count, VTY_NEWLINE);
+
/* Max-metric router-lsa print */
config_write_stub_router (vty, ospf);
@@ -7637,12 +7719,14 @@ ospf_vty_if_init (void)
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_cmd);
+ install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_seconds_cmd);
/* "ip ospf hello-interval" commands. */
install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd);
install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd);
install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd);
install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd);
+ install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_seconds_cmd);
/* "ip ospf network" commands. */
install_element (INTERFACE_NODE, &ip_ospf_network_cmd);
@@ -7730,6 +7814,51 @@ static struct cmd_node ospf_node =
1
};
+static void
+ospf_interface_clear (struct interface *ifp)
+{
+ if (!if_is_operative (ifp)) return;
+
+ if (IS_DEBUG_OSPF (ism, ISM_EVENTS))
+ zlog (NULL, LOG_DEBUG, "ISM[%s]: clear by reset", ifp->name);
+
+ ospf_if_reset(ifp);
+}
+
+DEFUN (clear_ip_ospf_interface,
+ clear_ip_ospf_interface_cmd,
+ "clear ip ospf interface [IFNAME]",
+ CLEAR_STR
+ IP_STR
+ "OSPF information\n"
+ "Interface information\n"
+ "Interface name\n")
+{
+ struct interface *ifp;
+ struct listnode *node;
+
+ if (argc == 0) /* Clear all the ospfv2 interfaces. */
+ {
+ for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
+ ospf_interface_clear(ifp);
+ }
+ else /* Interface name is specified. */
+ {
+ if ((ifp = if_lookup_by_name (argv[0])) == NULL)
+ vty_out (vty, "No such interface name%s", VTY_NEWLINE);
+ else
+ ospf_interface_clear(ifp);
+ }
+
+ return CMD_SUCCESS;
+}
+
+void
+ospf_vty_clear_init (void)
+{
+ install_element (ENABLE_NODE, &clear_ip_ospf_interface_cmd);
+}
+
/* Install OSPF related vty commands. */
void
@@ -7898,6 +8027,12 @@ ospf_vty_init (void)
install_element (OSPF_NODE, &no_ospf_neighbor_priority_cmd);
install_element (OSPF_NODE, &no_ospf_neighbor_poll_interval_cmd);
+ /* write multiplier commands */
+ install_element (OSPF_NODE, &ospf_write_multiplier_cmd);
+ install_element (OSPF_NODE, &no_ospf_write_multiplier_cmd);
+ install_element (OSPF_NODE, &write_multiplier_cmd);
+ install_element (OSPF_NODE, &no_write_multiplier_cmd);
+
/* Init interface related vty commands. */
ospf_vty_if_init ();