return i;
}
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "router ospf <1-65535>",
- * "Enable a routing process\n"
- * "Start OSPF configuration\n"
- * "Instance ID\n"
- *
- */
DEFUN (router_ospf,
router_ospf_cmd,
- "router ospf",
+ "router ospf [(1-65535)]",
"Enable a routing process\n"
- "Start OSPF configuration\n")
+ "Start OSPF configuration\n"
+ "Instance ID\n")
{
struct ospf *ospf;
u_short instance = 0;
vty->node = OSPF_NODE;
- if (argc)
- VTY_GET_INTEGER ("Instance", instance, argv[0]);
+ if (argc > 2)
+ VTY_GET_INTEGER ("Instance", instance, argv[2]->arg);
/* The following logic to set the vty->index is in place to be able
to ignore the commands which dont belong to this instance. */
return CMD_SUCCESS;
}
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no router ospf <1-65535>",
- * NO_STR
- * "Enable a routing process\n"
- * "Start OSPF configuration\n"
- * "Instance ID\n"
- *
- */
DEFUN (no_router_ospf,
no_router_ospf_cmd,
- "no router ospf",
+ "no router ospf [(1-65535)]",
NO_STR
"Enable a routing process\n"
- "Start OSPF configuration\n")
+ "Start OSPF configuration\n"
+ "Instance ID\n")
{
struct ospf *ospf;
u_short instance = 0;
- if (argc)
+ if (argc > 3)
VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
if ((ospf = ospf_lookup_instance (instance)) == NULL)
"router-id for the OSPF process\n"
"OSPF router-id in IP address format\n")
{
+ int idx_ipv4 = 2;
struct ospf *ospf = vty->index;
struct listnode *node;
struct ospf_area *area;
if (!ospf)
return CMD_SUCCESS;
- ret = inet_aton (argv[2]->arg, &router_id);
+ ret = inet_aton (argv[idx_ipv4]->arg, &router_id);
if (!ret)
{
vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE);
return CMD_SUCCESS;
}
-ALIAS_HIDDEN (ospf_router_id,
+DEFUN_HIDDEN (ospf_router_id_old,
ospf_router_id_old_cmd,
"router-id A.B.C.D",
"router-id for the OSPF process\n"
"OSPF router-id in IP address format\n")
+{
+ int idx_ipv4 = 1;
+ struct ospf *ospf = vty->index;
+ struct listnode *node;
+ struct ospf_area *area;
+ struct in_addr router_id;
+ int ret;
+
+ if (!ospf)
+ return CMD_SUCCESS;
+
+ ret = inet_aton (argv[idx_ipv4]->arg, &router_id);
+ if (!ret)
+ {
+ vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ ospf->router_id_static = router_id;
+
+ for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
+ if (area->full_nbrs)
+ {
+ vty_out (vty, "For this router-id change to take effect,"
+ " save config and restart ospfd%s", VTY_NEWLINE);
+ return CMD_SUCCESS;
+ }
+
+ ospf_router_id_update (ospf);
+
+ return CMD_SUCCESS;
+}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ospf router-id A.B.C.D",
- * NO_STR
- * "OSPF specific commands\n"
- * "router-id for the OSPF process\n"
- * "OSPF router-id in IP address format\n"
- *
- */
DEFUN (no_ospf_router_id,
no_ospf_router_id_cmd,
- "no ospf router-id",
+ "no ospf router-id [A.B.C.D]",
NO_STR
"OSPF specific commands\n"
- "router-id for the OSPF process\n")
+ "router-id for the OSPF process\n"
+ "OSPF router-id in IP address format\n")
{
struct ospf *ospf = vty->index;
struct listnode *node;
}
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "passive-interface IFNAME",
- * "Suppress routing updates on an interface\n"
- * "Interface's name\n"
- *
- * "passive-interface default",
- * "Suppress routing updates on an interface\n"
- * "Suppress routing updates on interfaces by default\n"
- *
- */
DEFUN (ospf_passive_interface,
ospf_passive_interface_addr_cmd,
- "passive-interface IFNAME A.B.C.D",
+ "passive-interface <IFNAME [A.B.C.D]|default>",
"Suppress routing updates on an interface\n"
- "Interface's name\n")
+ "Interface's name\n"
+ "Suppress routing updates on interfaces by default\n")
{
+ int idx_ipv4 = 2;
struct interface *ifp;
struct in_addr addr = { .s_addr = INADDR_ANY };
int ret;
if (!ospf)
return CMD_SUCCESS;
- if (argc == 0)
+ if (strcmp (argv[1]->text, "default") == 0)
{
ospf_passive_interface_default (ospf, OSPF_IF_PASSIVE);
return CMD_SUCCESS;
}
- ifp = if_get_by_name (argv[2]->arg);
+ ifp = if_get_by_name (argv[1]->arg);
params = IF_DEF_PARAMS (ifp);
- if (argc == 2)
+ if (argc == 3)
{
- ret = inet_aton(argv[1], &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
return CMD_SUCCESS;
}
-
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no passive-interface default",
- * NO_STR
- * "Allow routing updates on an interface\n"
- * "Allow routing updates on interfaces by default\n"
- *
- * "no passive-interface IFNAME",
- * NO_STR
- * "Allow routing updates on an interface\n"
- * "Interface's name\n"
- *
- */
DEFUN (no_ospf_passive_interface,
no_ospf_passive_interface_addr_cmd,
- "no passive-interface IFNAME A.B.C.D",
+ "no passive-interface <IFNAME [A.B.C.D]|default>",
NO_STR
"Allow routing updates on an interface\n"
- "Interface's name\n")
+ "Interface's name\n"
+ "Allow routing updates on interfaces by default\n")
{
+ int idx_ipv4 = 3;
struct interface *ifp;
struct in_addr addr = { .s_addr = INADDR_ANY };
struct ospf_if_params *params;
if (!ospf)
return CMD_SUCCESS;
- if (argc == 0)
+ if (strcmp (argv[2]->text, "default") == 0)
{
ospf_passive_interface_default (ospf, OSPF_IF_ACTIVE);
return CMD_SUCCESS;
}
- ifp = if_get_by_name (argv[3]->arg);
+ ifp = if_get_by_name (argv[2]->arg);
params = IF_DEF_PARAMS (ifp);
- if (argc == 2)
+ if (argc == 4)
{
- ret = inet_aton(argv[1], &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
"OSPF area ID in IP address format\n"
"OSPF area ID as a decimal value\n")
{
+ int idx_ipv4_prefixlen = 1;
+ int idx_ipv4_number = 3;
struct ospf *ospf= vty->index;
struct prefix_ipv4 p;
struct in_addr area_id;
}
/* Get network prefix and Area ID. */
- VTY_GET_IPV4_PREFIX ("network prefix", p, argv[1]->arg);
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[3]->arg);
+ VTY_GET_IPV4_PREFIX ("network prefix", p, argv[idx_ipv4_prefixlen]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
ret = ospf_network_set (ospf, &p, area_id);
if (ret == 0)
"OSPF area ID in IP address format\n"
"OSPF area ID as a decimal value\n")
{
+ int idx_ipv4_prefixlen = 2;
+ int idx_ipv4_number = 4;
struct ospf *ospf = (struct ospf *) vty->index;
struct prefix_ipv4 p;
struct in_addr area_id;
}
/* Get network prefix and Area ID. */
- VTY_GET_IPV4_PREFIX ("network prefix", p, argv[2]->arg);
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[4]->arg);
+ VTY_GET_IPV4_PREFIX ("network prefix", p, argv[idx_ipv4_prefixlen]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
ret = ospf_network_unset (ospf, &p, area_id);
if (ret == 0)
return CMD_SUCCESS;
}
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise",
- * "OSPF area parameters\n"
- * "OSPF area ID in IP address format\n"
- * "OSPF area ID as a decimal value\n"
- * "OSPF area range for route advertise (default)\n"
- * "Area range prefix\n"
- * "Advertise this range (default)\n"
- *
- * "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
- * "OSPF area parameters\n"
- * "OSPF area ID in IP address format\n"
- * "OSPF area ID as a decimal value\n"
- * "Summarize routes matching address/mask (border routers only)\n"
- * "Area range prefix\n"
- * "User specified metric for this range\n"
- * "Advertised metric for this range\n"
- *
- * "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
- * "OSPF area parameters\n"
- * "OSPF area ID in IP address format\n"
- * "OSPF area ID as a decimal value\n"
- * "Summarize routes matching address/mask (border routers only)\n"
- * "Area range prefix\n"
- * "Advertise this range (default)\n"
- * "User specified metric for this range\n"
- * "Advertised metric for this range\n"
- *
- */
DEFUN (ospf_area_range,
ospf_area_range_cmd,
- "area <A.B.C.D|(0-4294967295)> range A.B.C.D/M",
+ "area <A.B.C.D|(0-4294967295)> range A.B.C.D/M [advertise [cost (0-16777215)]]",
"OSPF area parameters\n"
"OSPF area ID in IP address format\n"
"OSPF area ID as a decimal value\n"
"Summarize routes matching address/mask (border routers only)\n"
- "Area range prefix\n")
+ "Area range prefix\n"
+ "Advertise this range (default)\n"
+ "User specified metric for this range\n"
+ "Advertised metric for this range\n")
{
+ int idx_ipv4_number = 1;
+ int idx_ipv4_prefixlen = 3;
+ int idx_cost = 6;
struct ospf *ospf = vty->index;
struct prefix_ipv4 p;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg);
- VTY_GET_IPV4_PREFIX ("area range", p, argv[3]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
+ VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE);
- if (argc > 2)
+ if (argc > 5)
{
- VTY_GET_INTEGER ("range cost", cost, argv[2]);
+ VTY_GET_INTEGER ("range cost", cost, argv[idx_cost]->arg);
ospf_area_range_cost_set (ospf, area_id, &p, cost);
}
return CMD_SUCCESS;
}
+DEFUN (ospf_area_range_cost,
+ ospf_area_range_cost_cmd,
+ "area <A.B.C.D|(0-4294967295)> range A.B.C.D/M cost (0-16777215)",
+ "OSPF area parameters\n"
+ "OSPF area ID in IP address format\n"
+ "OSPF area ID as a decimal value\n"
+ "Summarize routes matching address/mask (border routers only)\n"
+ "Area range prefix\n"
+ "User specified metric for this range\n"
+ "Advertised metric for this range\n")
+{
+ int idx_ipv4_number = 1;
+ int idx_ipv4_prefixlen = 3;
+ int idx_cost = 5;
+ struct ospf *ospf = vty->index;
+ struct prefix_ipv4 p;
+ struct in_addr area_id;
+ int format;
+ u_int32_t cost;
+
+ if (!ospf)
+ return CMD_SUCCESS;
+
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
+ VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
+
+ ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE);
+ VTY_GET_INTEGER ("range cost", cost, argv[idx_cost]->arg);
+ ospf_area_range_cost_set (ospf, area_id, &p, cost);
+ return CMD_SUCCESS;
+}
DEFUN (ospf_area_range_not_advertise,
ospf_area_range_not_advertise_cmd,
"Area range prefix\n"
"DoNotAdvertise this range\n")
{
+ int idx_ipv4_number = 1;
+ int idx_ipv4_prefixlen = 3;
struct ospf *ospf = vty->index;
struct prefix_ipv4 p;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg);
- VTY_GET_IPV4_PREFIX ("area range", p, argv[3]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
+ VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
ospf_area_range_set (ospf, area_id, &p, 0);
return CMD_SUCCESS;
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)",
- * NO_STR
- * "OSPF area parameters\n"
- * "OSPF area ID in IP address format\n"
- * "OSPF area ID as a decimal value\n"
- * "Summarize routes matching address/mask (border routers only)\n"
- * "Area range prefix\n"
- * "Advertise this range (default)\n"
- * "DoNotAdvertise this range\n"
- *
- * "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
- * NO_STR
- * "OSPF area parameters\n"
- * "OSPF area ID in IP address format\n"
- * "OSPF area ID as a decimal value\n"
- * "Summarize routes matching address/mask (border routers only)\n"
- * "Area range prefix\n"
- * "Advertise this range (default)\n"
- * "User specified metric for this range\n"
- * "Advertised metric for this range\n"
- *
- * "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
- * NO_STR
- * "OSPF area parameters\n"
- * "OSPF area ID in IP address format\n"
- * "OSPF area ID as a decimal value\n"
- * "Summarize routes matching address/mask (border routers only)\n"
- * "Area range prefix\n"
- * "User specified metric for this range\n"
- * "Advertised metric for this range\n"
- *
- */
DEFUN (no_ospf_area_range,
no_ospf_area_range_cmd,
- "no area <A.B.C.D|(0-4294967295)> range A.B.C.D/M",
+ "no area <A.B.C.D|(0-4294967295)> range A.B.C.D/M [<cost (0-16777215)|advertise [cost (0-16777215)] | not-advertise>]",
NO_STR
"OSPF area parameters\n"
"OSPF area ID in IP address format\n"
"OSPF area ID as a decimal value\n"
"Summarize routes matching address/mask (border routers only)\n"
- "Area range prefix\n")
+ "Area range prefix\n"
+ "Advertise this range (default)\n"
+ "DoNotAdvertise this range\n")
{
+ int idx_ipv4_number = 2;
+ int idx_ipv4_prefixlen = 4;
struct ospf *ospf = vty->index;
struct prefix_ipv4 p;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg);
- VTY_GET_IPV4_PREFIX ("area range", p, argv[4]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
+ VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
ospf_area_range_unset (ospf, area_id, &p);
return CMD_SUCCESS;
}
-
-
-
DEFUN (ospf_area_range_substitute,
ospf_area_range_substitute_cmd,
"area <A.B.C.D|(0-4294967295)> range A.B.C.D/M substitute A.B.C.D/M",
"Announce area range as another prefix\n"
"Network prefix to be announced instead of range\n")
{
+ int idx_ipv4_number = 1;
+ int idx_ipv4_prefixlen = 3;
+ int idx_ipv4_prefixlen_2 = 5;
struct ospf *ospf = vty->index;
struct prefix_ipv4 p, s;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg);
- VTY_GET_IPV4_PREFIX ("area range", p, argv[3]->arg);
- VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[5]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
+ VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
+ VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[idx_ipv4_prefixlen_2]->arg);
ospf_area_range_substitute_set (ospf, area_id, &p, &s);
"Announce area range as another prefix\n"
"Network prefix to be announced instead of range\n")
{
+ int idx_ipv4_number = 2;
+ int idx_ipv4_prefixlen = 4;
+ int idx_ipv4_prefixlen_2 = 6;
struct ospf *ospf = vty->index;
struct prefix_ipv4 p, s;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg);
- VTY_GET_IPV4_PREFIX ("area range", p, argv[4]->arg);
- VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[6]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
+ VTY_GET_IPV4_PREFIX ("area range", p, argv[idx_ipv4_prefixlen]->arg);
+ VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[idx_ipv4_prefixlen_2]->arg);
ospf_area_range_substitute_unset (ospf, area_id, &p);
Wed, 21 Feb 2001 15:13:52 +1300
*/
-
/* Configuration data for virtual links
*/
struct ospf_vl_config_data {
ospf_vl_set_timers (struct ospf_vl_data *vl_data,
struct ospf_vl_config_data *vl_config)
{
- struct interface *ifp = ifp = vl_data->vl_oi->ifp;
+ struct interface *ifp = vl_data->vl_oi->ifp;
/* Virtual Link data initialised to defaults, so only set
if a value given */
if (vl_config->hello_interval)
}
-
/* The business end of all of the above */
static int
ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config)
"Time between HELLO packets\n" \
"Time between retransmitting lost link state advertisements\n" \
"Link state transmit delay\n" \
- "Interval after which a neighbor is declared dead\n"
+ "Interval time after which a neighbor is declared down\n"
#define VLINK_HELPSTR_TIME_PARAM \
VLINK_HELPSTR_TIME_PARAM_NOSECS \
"Use MD5 algorithm\n" \
"The OSPF password (key)"
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(authentication|) (message-digest|null) "
- * "(authentication-key|) AUTH_KEY",
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_AUTHTYPE_ALL
- * VLINK_HELPSTR_AUTH_SIMPLE
- *
- * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(authentication|) "
- * "(authentication-key|) AUTH_KEY",
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_AUTHTYPE_SIMPLE
- * VLINK_HELPSTR_AUTH_SIMPLE
- *
- * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_TIME_PARAM
- * VLINK_HELPSTR_TIME_PARAM
- *
- * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_TIME_PARAM
- * VLINK_HELPSTR_TIME_PARAM
- * VLINK_HELPSTR_TIME_PARAM
- *
- * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_TIME_PARAM
- * VLINK_HELPSTR_TIME_PARAM
- * VLINK_HELPSTR_TIME_PARAM
- * VLINK_HELPSTR_TIME_PARAM
- *
- * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_TIME_PARAM
- *
- * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(authentication|) (message-digest|null)",
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_AUTHTYPE_ALL
- *
- * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(message-digest-key|) <1-255> md5 KEY",
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_AUTH_MD5
- *
- * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(authentication|) "
- * "(message-digest-key|) <1-255> md5 KEY",
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_AUTHTYPE_SIMPLE
- * VLINK_HELPSTR_AUTH_MD5
- *
- * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(authentication|) (message-digest|null) "
- * "(message-digest-key|) <1-255> md5 KEY",
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_AUTHTYPE_ALL
- * VLINK_HELPSTR_AUTH_MD5
- *
- * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(authentication|)",
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_AUTHTYPE_SIMPLE
- *
- * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(authentication-key|) AUTH_KEY",
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_AUTH_SIMPLE
- *
- */
DEFUN (ospf_area_vlink,
ospf_area_vlink_cmd,
- "area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D",
- VLINK_HELPSTR_IPADDR)
+ "area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D [authentication] [<message-digest|null>] [<message-digest-key (1-255) md5 KEY|authentication-key AUTH_KEY>]",
+ VLINK_HELPSTR_IPADDR
+ "Enable authentication on this virtual link\n" \
+ "Use null authentication\n" \
+ "Use message-digest authentication\n"
+ "Message digest authentication password (key)\n" \
+ "Key ID\n" \
+ "Use MD5 algorithm\n" \
+ "The OSPF password (key)")
{
+ int idx_ipv4_number = 1;
+ int idx_ipv4 = 3;
struct ospf *ospf = vty->index;
struct ospf_vl_config_data vl_config;
char auth_key[OSPF_AUTH_SIMPLE_SIZE+1];
ospf_vl_config_data_init(&vl_config, vty);
/* Read off first 2 parameters and check them */
- ret = ospf_str2area_id (argv[1]->arg, &vl_config.area_id, &vl_config.format);
+ ret = ospf_str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &vl_config.format);
if (ret < 0)
{
vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
return CMD_WARNING;
}
- ret = inet_aton (argv[3]->arg, &vl_config.vl_peer);
+ ret = inet_aton (argv[idx_ipv4]->arg, &vl_config.vl_peer);
if (! ret)
{
vty_out (vty, "Please specify valid Router ID as a.b.c.d%s",
return CMD_WARNING;
}
- if (argc <=2)
+ if (argc <=4)
{
/* Thats all folks! - BUGS B. strikes again!!!*/
}
/* Deal with other parameters */
- for (i=2; i < argc; i++)
+ for (i=5; i < argc; i++)
{
- /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
+ /* vty_out (vty, "argv[%d]->arg - %s%s", i, argv[i]->text, VTY_NEWLINE); */
- switch (argv[i][0])
+ switch (argv[i]->arg[0])
{
case 'a':
- if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0)
+ if (i >5 || strncmp (argv[i]->arg, "authentication-", 15) == 0)
{
/* authentication-key - this option can occur anywhere on
command line. At start of command line
must check for authentication option. */
memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
- strncpy (auth_key, argv[i+1], OSPF_AUTH_SIMPLE_SIZE);
+ strncpy (auth_key, argv[i+1]->text, OSPF_AUTH_SIMPLE_SIZE);
vl_config.auth_key = auth_key;
i++;
}
- else if (strncmp (argv[i], "authentication", 14) == 0)
+ else if (strncmp (argv[i]->arg, "authentication", 14) == 0)
{
/* authentication - this option can only occur at start
of command line */
vl_config.auth_type = OSPF_AUTH_SIMPLE;
if ((i+1) < argc)
{
- if (strncmp (argv[i+1], "n", 1) == 0)
+ if (strncmp (argv[i+1]->arg, "n", 1) == 0)
{
/* "authentication null" */
vl_config.auth_type = OSPF_AUTH_NULL;
i++;
}
- else if (strncmp (argv[i+1], "m", 1) == 0
- && strcmp (argv[i+1], "message-digest-") != 0)
+ else if (strncmp (argv[i+1]->arg, "m", 1) == 0
+ && strcmp (argv[i+1]->arg, "message-digest-") != 0)
{
/* "authentication message-digest" */
vl_config.auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
case 'm':
/* message-digest-key */
i++;
- vl_config.crypto_key_id = strtol (argv[i], NULL, 10);
+ vl_config.crypto_key_id = strtol (argv[i]->arg, NULL, 10);
if (vl_config.crypto_key_id < 0)
return CMD_WARNING;
i++;
memset(md5_key, 0, OSPF_AUTH_MD5_SIZE+1);
- strncpy (md5_key, argv[i], OSPF_AUTH_MD5_SIZE);
+ strncpy (md5_key, argv[i]->arg, OSPF_AUTH_MD5_SIZE);
vl_config.md5_key = md5_key;
break;
- case 'h':
- /* Hello interval */
- i++;
- vl_config.hello_interval = strtol (argv[i], NULL, 10);
- if (vl_config.hello_interval < 0)
- return CMD_WARNING;
- break;
-
- case 'r':
- /* Retransmit Interval */
- i++;
- vl_config.retransmit_interval = strtol (argv[i], NULL, 10);
- if (vl_config.retransmit_interval < 0)
- return CMD_WARNING;
- break;
-
- case 't':
- /* Transmit Delay */
- i++;
- vl_config.transmit_delay = strtol (argv[i], NULL, 10);
- if (vl_config.transmit_delay < 0)
- return CMD_WARNING;
- break;
-
- case 'd':
- /* Dead Interval */
- i++;
- vl_config.dead_interval = strtol (argv[i], NULL, 10);
- if (vl_config.dead_interval < 0)
- return CMD_WARNING;
- break;
}
}
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
- * NO_STR
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_TIME_PARAM
- * VLINK_HELPSTR_TIME_PARAM
- * VLINK_HELPSTR_TIME_PARAM
- *
- * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(authentication|) "
- * "(message-digest-key|) <1-255> md5 KEY",
- * NO_STR
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_AUTHTYPE_SIMPLE
- * VLINK_HELPSTR_AUTH_MD5
- *
- * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
- * NO_STR
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_TIME_PARAM
- * VLINK_HELPSTR_TIME_PARAM
- *
- * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
- * NO_STR
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_TIME_PARAM
- * VLINK_HELPSTR_TIME_PARAM
- * VLINK_HELPSTR_TIME_PARAM
- * VLINK_HELPSTR_TIME_PARAM
- *
- * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
- * NO_STR
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_TIME_PARAM
- *
- * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(message-digest-key|) <1-255> md5 KEY",
- * NO_STR
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_AUTH_MD5
- *
- * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(authentication|)",
- * NO_STR
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_AUTHTYPE_SIMPLE
- *
- * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(authentication|) (message-digest|null) "
- * "(message-digest-key|) <1-255> md5 KEY",
- * NO_STR
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_AUTHTYPE_ALL
- * VLINK_HELPSTR_AUTH_MD5
- *
- * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(authentication|) "
- * "(authentication-key|) AUTH_KEY",
- * NO_STR
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_AUTHTYPE_SIMPLE
- * VLINK_HELPSTR_AUTH_SIMPLE
- *
- * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(authentication-key|) AUTH_KEY",
- * NO_STR
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_AUTH_SIMPLE
- *
- * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(authentication|) (message-digest|null)",
- * NO_STR
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_AUTHTYPE_ALL
- *
- * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
- * "(authentication|) (message-digest|null) "
- * "(authentication-key|) AUTH_KEY",
- * NO_STR
- * VLINK_HELPSTR_IPADDR
- * VLINK_HELPSTR_AUTHTYPE_ALL
- * VLINK_HELPSTR_AUTH_SIMPLE
- *
- */
+DEFUN (ospf_area_vlink_intervals,
+ ospf_area_vlink_intervals_cmd,
+ "area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D"
+ "<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)"
+ "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)"
+ "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)"
+ "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)"
+ "]]]",
+ VLINK_HELPSTR_IPADDR
+ VLINK_HELPSTR_TIME_PARAM
+ VLINK_HELPSTR_TIME_PARAM
+ VLINK_HELPSTR_TIME_PARAM
+ VLINK_HELPSTR_TIME_PARAM)
+{
+ struct ospf *ospf = vty->index;
+ struct ospf_vl_config_data vl_config;
+ int ret = 0;
+
+ if (!ospf)
+ return CMD_SUCCESS;
+
+ ospf_vl_config_data_init(&vl_config, vty);
+
+ char *area_id = argv[1]->arg;
+ char *router_id = argv[3]->arg;
+
+ ret = ospf_str2area_id (area_id, &vl_config.area_id, &vl_config.format);
+ if (ret < 0)
+ {
+ vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+
+ ret = inet_aton (router_id, &vl_config.vl_peer);
+ if (! ret)
+ {
+ vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ for (unsigned int i = 0; i < 4; i++)
+ {
+ int idx = 0;
+ if (argv_find (argv, argc, "hello-interval", &idx))
+ vl_config.hello_interval = strtol(argv[idx+1]->arg, NULL, 10);
+ else if (argv_find (argv, argc, "retransmit-interval", &idx))
+ vl_config.retransmit_interval = strtol(argv[idx+1]->arg, NULL, 10);
+ else if (argv_find (argv, argc, "transmit-delay", &idx))
+ vl_config.transmit_delay = strtol(argv[idx+1]->arg, NULL, 10);
+ else if (argv_find (argv, argc, "dead-interval", &idx))
+ vl_config.dead_interval = strtol(argv[idx+1]->arg, NULL, 10);
+ }
+
+ /* Action configuration */
+ return ospf_vl_set (ospf, &vl_config);
+}
+
DEFUN (no_ospf_area_vlink,
no_ospf_area_vlink_cmd,
- "no area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D",
+ "no area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D [authentication] [<message-digest|null>] [<message-digest-key (1-255) md5 KEY|authentication-key AUTH_KEY>]",
NO_STR
- VLINK_HELPSTR_IPADDR)
+ VLINK_HELPSTR_IPADDR
+ "Enable authentication on this virtual link\n" \
+ "Use null authentication\n" \
+ "Use message-digest authentication\n"
+ "Message digest authentication password (key)\n" \
+ "Key ID\n" \
+ "Use MD5 algorithm\n" \
+ "The OSPF password (key)")
{
+ int idx_ipv4_number = 2;
+ int idx_ipv4 = 4;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct ospf_vl_config_data vl_config;
ospf_vl_config_data_init(&vl_config, vty);
- ret = ospf_str2area_id (argv[2]->arg, &vl_config.area_id, &format);
+ ret = ospf_str2area_id (argv[idx_ipv4_number]->arg, &vl_config.area_id, &format);
if (ret < 0)
{
vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
return CMD_WARNING;
}
- ret = inet_aton (argv[4]->arg, &vl_config.vl_peer);
+ ret = inet_aton (argv[idx_ipv4]->arg, &vl_config.vl_peer);
if (! ret)
{
vty_out (vty, "Please specify valid Router ID as a.b.c.d%s",
return CMD_WARNING;
}
- if (argc <=2)
+ if (argc <=5)
{
/* Basic VLink no command */
/* Thats all folks! - BUGS B. strikes again!!!*/
ospf_vl_delete (ospf, vl_data);
ospf_area_check_free (ospf, vl_config.area_id);
-
+
return CMD_SUCCESS;
}
/* If we are down here, we are reseting parameters */
/* Deal with other parameters */
- for (i=2; i < argc; i++)
+ for (i=6; argc; i++)
{
/* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
- switch (argv[i][0])
+ switch (argv[i]->arg[0])
{
case 'a':
- if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0)
+ if (i > 2 || strncmp (argv[i]->text, "authentication-", 15) == 0)
{
/* authentication-key - this option can occur anywhere on
command line. At start of command line
memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
vl_config.auth_key = auth_key;
}
- else if (strncmp (argv[i], "authentication", 14) == 0)
+ else if (strncmp (argv[i]->text, "authentication", 14) == 0)
{
/* authentication - this option can only occur at start
of command line */
/* message-digest-key */
/* Delete one key */
i++;
- vl_config.crypto_key_id = strtol (argv[i], NULL, 10);
+ vl_config.crypto_key_id = strtol (argv[i]->arg, NULL, 10);
if (vl_config.crypto_key_id < 0)
return CMD_WARNING;
vl_config.md5_key = NULL;
break;
- case 'h':
- /* Hello interval */
- vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT;
- break;
-
- case 'r':
- /* Retransmit Interval */
- vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
- break;
-
- case 't':
- /* Transmit Delay */
- vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
- break;
-
- case 'd':
- /* Dead Interval */
- i++;
- vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
- break;
}
}
return ospf_vl_set (ospf, &vl_config);
}
+DEFUN (no_ospf_area_vlink_intervals,
+ no_ospf_area_vlink_intervals_cmd,
+ "no area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D"
+ "<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)"
+ "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)"
+ "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)"
+ "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)"
+ "]]]",
+ VLINK_HELPSTR_IPADDR
+ VLINK_HELPSTR_TIME_PARAM
+ VLINK_HELPSTR_TIME_PARAM
+ VLINK_HELPSTR_TIME_PARAM
+ VLINK_HELPSTR_TIME_PARAM)
+{
+ struct ospf *ospf = vty->index;
+ struct ospf_vl_config_data vl_config;
+ int ret = 0;
+ if (!ospf)
+ return CMD_SUCCESS;
+ ospf_vl_config_data_init(&vl_config, vty);
+ char *area_id = argv[2]->arg;
+ char *router_id = argv[4]->arg;
+ ret = ospf_str2area_id (area_id, &vl_config.area_id, &vl_config.format);
+ if (ret < 0)
+ {
+ vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ ret = inet_aton (router_id, &vl_config.vl_peer);
+ if (! ret)
+ {
+ vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ for (unsigned int i = 0; i < 4; i++)
+ {
+ int idx = 0;
+ if (argv_find (argv, argc, "hello-interval", &idx))
+ vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT;
+ else if (argv_find (argv, argc, "retransmit-interval", &idx))
+ vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
+ else if (argv_find (argv, argc, "transmit-delay", &idx))
+ vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
+ else if (argv_find (argv, argc, "dead-interval", &idx))
+ vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
+ }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ /* Action configuration */
+ return ospf_vl_set (ospf, &vl_config);
+}
DEFUN (ospf_area_shortcut,
ospf_area_shortcut_cmd,
"Enable shortcutting through the area\n"
"Disable shortcutting through the area\n")
{
+ int idx_ipv4_number = 1;
+ int idx_enable_disable = 3;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[1]->arg);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_get (ospf, area_id, format);
- if (strncmp (argv[3]->arg, "de", 2) == 0)
+ if (strncmp (argv[idx_enable_disable]->arg, "de", 2) == 0)
mode = OSPF_SHORTCUT_DEFAULT;
- else if (strncmp (argv[3]->arg, "di", 2) == 0)
+ else if (strncmp (argv[idx_enable_disable]->arg, "di", 2) == 0)
mode = OSPF_SHORTCUT_DISABLE;
- else if (strncmp (argv[3]->arg, "e", 1) == 0)
+ else if (strncmp (argv[idx_enable_disable]->arg, "e", 1) == 0)
mode = OSPF_SHORTCUT_ENABLE;
else
return CMD_WARNING;
"Deconfigure enabled shortcutting through the area\n"
"Deconfigure disabled shortcutting through the area\n")
{
+ int idx_ipv4_number = 2;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[2]->arg);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_lookup_by_area_id (ospf, area_id);
if (!area)
"OSPF area ID as a decimal value\n"
"Configure OSPF area as stub\n")
{
+ int idx_ipv4_number = 1;
struct ospf *ospf = vty->index;
struct in_addr area_id;
int ret, format;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[1]->arg);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[idx_ipv4_number]->arg);
ret = ospf_area_stub_set (ospf, area_id);
if (ret == 0)
"Configure OSPF area as stub\n"
"Do not inject inter-area routes into stub\n")
{
+ int idx_ipv4_number = 1;
struct ospf *ospf = vty->index;
struct in_addr area_id;
int ret, format;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[1]->arg);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[idx_ipv4_number]->arg);
ret = ospf_area_stub_set (ospf, area_id);
if (ret == 0)
"OSPF area ID as a decimal value\n"
"Configure OSPF area as stub\n")
{
+ int idx_ipv4_number = 2;
struct ospf *ospf = vty->index;
struct in_addr area_id;
int format;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[2]->arg);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[idx_ipv4_number]->arg);
ospf_area_stub_unset (ospf, area_id);
ospf_area_no_summary_unset (ospf, area_id);
"Configure OSPF area as stub\n"
"Do not inject inter-area routes into area\n")
{
+ int idx_ipv4_number = 2;
struct ospf *ospf = vty->index;
struct in_addr area_id;
int format;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[2]->arg);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[idx_ipv4_number]->arg);
ospf_area_no_summary_unset (ospf, area_id);
return CMD_SUCCESS;
}
static int
-ospf_area_nssa_cmd_handler (struct vty *vty, int argc, const char *argv[],
+ospf_area_nssa_cmd_handler (struct vty *vty, int argc, struct cmd_token **argv,
int nosum)
{
struct ospf *ospf = vty->index;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[1]->arg);
ret = ospf_area_nssa_set (ospf, area_id);
if (ret == 0)
if (argc > 1)
{
- if (strncmp (argv[1], "translate-c", 11) == 0)
+ if (strncmp (argv[3]->text, "translate-c", 11) == 0)
ospf_area_nssa_translator_role_set (ospf, area_id,
OSPF_NSSA_ROLE_CANDIDATE);
- else if (strncmp (argv[1], "translate-n", 11) == 0)
+ else if (strncmp (argv[3]->text, "translate-n", 11) == 0)
ospf_area_nssa_translator_role_set (ospf, area_id,
OSPF_NSSA_ROLE_NEVER);
- else if (strncmp (argv[1], "translate-a", 11) == 0)
+ else if (strncmp (argv[3]->text, "translate-a", 11) == 0)
ospf_area_nssa_translator_role_set (ospf, area_id,
OSPF_NSSA_ROLE_ALWAYS);
}
return ospf_area_nssa_cmd_handler (vty, argc, argv, 1);
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always|) {no-summary}",
- * NO_STR
- * "OSPF area parameters\n"
- * "OSPF area ID in IP address format\n"
- * "OSPF area ID as a decimal value\n"
- * "Configure OSPF area as nssa\n"
- * "Configure NSSA-ABR for translate election (default)\n"
- * "Configure NSSA-ABR to never translate\n"
- * "Configure NSSA-ABR to always translate\n"
- * "Do not inject inter-area routes into nssa\n"
- *
- */
DEFUN (no_ospf_area_nssa,
no_ospf_area_nssa_cmd,
- "no area <A.B.C.D|(0-4294967295)> nssa",
+ "no area <A.B.C.D|(0-4294967295)> nssa [<translate-candidate|translate-never|translate-always> [no-summary]]",
NO_STR
"OSPF area parameters\n"
"OSPF area ID in IP address format\n"
"OSPF area ID as a decimal value\n"
- "Configure OSPF area as nssa\n")
+ "Configure OSPF area as nssa\n"
+ "Configure NSSA-ABR for translate election (default)\n"
+ "Configure NSSA-ABR to never translate\n"
+ "Configure NSSA-ABR to always translate\n"
+ "Do not inject inter-area routes into nssa\n")
{
+ int idx_ipv4_number = 2;
struct ospf *ospf = vty->index;
struct in_addr area_id;
int format;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[2]->arg);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[idx_ipv4_number]->arg);
ospf_area_nssa_unset (ospf, area_id);
ospf_area_no_summary_unset (ospf, area_id);
"Set the summary-default cost of a NSSA or stub area\n"
"Stub's advertised default summary cost\n")
{
+ int idx_ipv4_number = 1;
+ int idx_number = 3;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[1]->arg);
- VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[3]->arg, 0, 16777215);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[idx_ipv4_number]->arg);
+ VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[idx_number]->arg, 0, 16777215);
area = ospf_area_get (ospf, area_id, format);
"Set the summary-default cost of a NSSA or stub area\n"
"Stub's advertised default summary cost\n")
{
+ int idx_ipv4_number = 2;
+ int idx_number = 4;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[2]->arg);
- VTY_CHECK_INTEGER_RANGE ("stub default cost", argv[4]->arg, 0, OSPF_LS_INFINITY);
+ VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[idx_ipv4_number]->arg);
+ VTY_CHECK_INTEGER_RANGE ("stub default cost", argv[idx_number]->arg, 0, OSPF_LS_INFINITY);
area = ospf_area_lookup_by_area_id (ospf, area_id);
if (area == NULL)
"Set the filter for networks announced to other areas\n"
"Name of the access-list\n")
{
+ int idx_ipv4_number = 1;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_get (ospf, area_id, format);
- ospf_area_export_list_set (ospf, area, argv[1]);
+ ospf_area_export_list_set (ospf, area, argv[3]->arg);
return CMD_SUCCESS;
}
"Unset the filter for networks announced to other areas\n"
"Name of the access-list\n")
{
+ int idx_ipv4_number = 2;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_lookup_by_area_id (ospf, area_id);
if (area == NULL)
"Set the filter for networks from other areas announced to the specified one\n"
"Name of the access-list\n")
{
+ int idx_ipv4_number = 1;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_get (ospf, area_id, format);
- ospf_area_import_list_set (ospf, area, argv[1]);
+ ospf_area_import_list_set (ospf, area, argv[3]->arg);
return CMD_SUCCESS;
}
"Unset the filter for networks announced to other areas\n"
"Name of the access-list\n")
{
+ int idx_ipv4_number = 2;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_lookup_by_area_id (ospf, area_id);
if (area == NULL)
"Filter networks sent to this area\n"
"Filter networks sent from this area\n")
{
+ int idx_ipv4_number = 1;
+ int idx_word = 4;
+ int idx_in_out = 5;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_get (ospf, area_id, format);
- plist = prefix_list_lookup (AFI_IP, argv[4]->arg);
- if (strncmp (argv[5]->arg, "in", 2) == 0)
+ plist = prefix_list_lookup (AFI_IP, argv[idx_word]->arg);
+ if (strncmp (argv[idx_in_out]->arg, "in", 2) == 0)
{
PREFIX_LIST_IN (area) = plist;
if (PREFIX_NAME_IN (area))
free (PREFIX_NAME_IN (area));
- PREFIX_NAME_IN (area) = strdup (argv[4]->arg);
+ PREFIX_NAME_IN (area) = strdup (argv[idx_word]->arg);
ospf_schedule_abr_task (ospf);
}
else
if (PREFIX_NAME_OUT (area))
free (PREFIX_NAME_OUT (area));
- PREFIX_NAME_OUT (area) = strdup (argv[4]->arg);
+ PREFIX_NAME_OUT (area) = strdup (argv[idx_word]->arg);
ospf_schedule_abr_task (ospf);
}
"Filter networks sent to this area\n"
"Filter networks sent from this area\n")
{
+ int idx_ipv4_number = 2;
+ int idx_word = 5;
+ int idx_in_out = 6;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
if ((area = ospf_area_lookup_by_area_id (ospf, area_id)) == NULL)
return CMD_SUCCESS;
- if (strncmp (argv[6]->arg, "in", 2) == 0)
+ if (strncmp (argv[idx_in_out]->arg, "in", 2) == 0)
{
if (PREFIX_NAME_IN (area))
- if (strcmp (PREFIX_NAME_IN (area), argv[5]->arg) != 0)
+ if (strcmp (PREFIX_NAME_IN (area), argv[idx_word]->arg) != 0)
return CMD_SUCCESS;
PREFIX_LIST_IN (area) = NULL;
else
{
if (PREFIX_NAME_OUT (area))
- if (strcmp (PREFIX_NAME_OUT (area), argv[5]->arg) != 0)
+ if (strcmp (PREFIX_NAME_OUT (area), argv[idx_word]->arg) != 0)
return CMD_SUCCESS;
PREFIX_LIST_OUT (area) = NULL;
"Enable authentication\n"
"Use message-digest authentication\n")
{
+ int idx_ipv4_number = 1;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_get (ospf, area_id, format);
area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
"OSPF area ID as a decimal value\n"
"Enable authentication\n")
{
+ int idx_ipv4_number = 1;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_get (ospf, area_id, format);
area->auth_type = OSPF_AUTH_SIMPLE;
"OSPF area ID as a decimal value\n"
"Enable authentication\n")
{
+ int idx_ipv4_number = 2;
struct ospf *ospf = vty->index;
struct ospf_area *area;
struct in_addr area_id;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_OSPF_AREA_ID (area_id, format, argv[2]->arg);
+ VTY_GET_OSPF_AREA_ID (area_id, format, argv[idx_ipv4_number]->arg);
area = ospf_area_lookup_by_area_id (ospf, area_id);
if (area == NULL)
"Shortcut ABR\n"
"Standard behavior (RFC2328)\n")
{
+ int idx_vendor = 2;
struct ospf *ospf = vty->index;
u_char abr_type = OSPF_ABR_UNKNOWN;
if (!ospf)
return CMD_SUCCESS;
- if (strncmp (argv[2]->arg, "c", 1) == 0)
+ if (strncmp (argv[idx_vendor]->arg, "c", 1) == 0)
abr_type = OSPF_ABR_CISCO;
- else if (strncmp (argv[2]->arg, "i", 1) == 0)
+ else if (strncmp (argv[idx_vendor]->arg, "i", 1) == 0)
abr_type = OSPF_ABR_IBM;
- else if (strncmp (argv[2]->arg, "sh", 2) == 0)
+ else if (strncmp (argv[idx_vendor]->arg, "sh", 2) == 0)
abr_type = OSPF_ABR_SHORTCUT;
- else if (strncmp (argv[2]->arg, "st", 2) == 0)
+ else if (strncmp (argv[idx_vendor]->arg, "st", 2) == 0)
abr_type = OSPF_ABR_STAND;
else
return CMD_WARNING;
"Alternative ABR, IBM implementation\n"
"Shortcut ABR\n")
{
+ int idx_vendor = 3;
struct ospf *ospf = vty->index;
u_char abr_type = OSPF_ABR_UNKNOWN;
if (!ospf)
return CMD_SUCCESS;
- if (strncmp (argv[3]->arg, "c", 1) == 0)
+ if (strncmp (argv[idx_vendor]->arg, "c", 1) == 0)
abr_type = OSPF_ABR_CISCO;
- else if (strncmp (argv[3]->arg, "i", 1) == 0)
+ else if (strncmp (argv[idx_vendor]->arg, "i", 1) == 0)
abr_type = OSPF_ABR_IBM;
- else if (strncmp (argv[3]->arg, "sh", 2) == 0)
+ else if (strncmp (argv[idx_vendor]->arg, "sh", 2) == 0)
abr_type = OSPF_ABR_SHORTCUT;
- else if (strncmp (argv[3]->arg, "st", 2) == 0)
+ else if (strncmp (argv[idx_vendor]->arg, "st", 2) == 0)
abr_type = OSPF_ABR_STAND;
else
return CMD_WARNING;
return CMD_SUCCESS;
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "ospf rfc1583compatibility",
- * "OSPF specific commands\n"
- * "Enable the RFC1583Compatibility flag\n"
- *
- */
DEFUN (ospf_compatible_rfc1583,
ospf_compatible_rfc1583_cmd,
"compatible rfc1583",
return CMD_SUCCESS;
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ospf rfc1583compatibility",
- * NO_STR
- * "OSPF specific commands\n"
- * "Disable the RFC1583Compatibility flag\n"
- *
- */
DEFUN (no_ospf_compatible_rfc1583,
no_ospf_compatible_rfc1583_cmd,
"no compatible rfc1583",
return CMD_SUCCESS;
}
+ALIAS (ospf_compatible_rfc1583,
+ ospf_rfc1583_flag_cmd,
+ "ospf rfc1583compatibility",
+ "OSPF specific commands\n"
+ "Enable the RFC1583Compatibility flag\n")
+ALIAS (no_ospf_compatible_rfc1583,
+ no_ospf_rfc1583_flag_cmd,
+ "no ospf rfc1583compatibility",
+ NO_STR
+ "OSPF specific commands\n"
+ "Disable the RFC1583Compatibility flag\n")
static int
ospf_timers_spf_set (struct vty *vty, unsigned int delay,
"All LSA types\n"
"Delay (msec) between sending LSAs\n")
{
+ int idx_number = 4;
struct ospf *ospf = vty->index;
unsigned int interval;
return CMD_WARNING;
}
- VTY_GET_INTEGER ("LSA interval", interval, argv[4]->arg);
+ VTY_GET_INTEGER ("LSA interval", interval, argv[idx_number]->arg);
ospf->min_ls_interval = interval;
return CMD_SUCCESS;
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no timers throttle lsa all <0-5000>",
- * NO_STR
- * "Adjust routing timers\n"
- * "Throttling adaptive timer\n"
- * "LSA delay between transmissions\n"
- * "All LSA types\n"
- * "Delay (msec) between sending LSAs\n"
- *
- */
DEFUN (no_ospf_timers_min_ls_interval,
no_ospf_timers_min_ls_interval_cmd,
- "no timers throttle lsa all",
+ "no timers throttle lsa all [(0-5000)]",
NO_STR
"Adjust routing timers\n"
"Throttling adaptive timer\n"
"LSA delay between transmissions\n"
- "All LSA types\n")
+ "All LSA types\n"
+ "Delay (msec) between sending LSAs\n")
{
struct ospf *ospf = vty->index;
ospf->min_ls_interval = OSPF_MIN_LS_INTERVAL;
"OSPF minimum arrival interval delay\n"
"Delay (msec) between accepted LSAs\n")
{
+ int idx_number = 3;
struct ospf *ospf = vty->index;
unsigned int arrival;
return CMD_WARNING;
}
- VTY_GET_INTEGER_RANGE ("minimum LSA inter-arrival time", arrival, argv[3]->arg, 0, 1000);
+ VTY_GET_INTEGER_RANGE ("minimum LSA inter-arrival time", arrival, argv[idx_number]->arg, 0, 1000);
ospf->min_ls_arrival = arrival;
return CMD_SUCCESS;
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no timers lsa arrival <0-1000>",
- * NO_STR
- * "Adjust routing timers\n"
- * "Throttling link state advertisement delays\n"
- * "OSPF minimum arrival interval delay\n"
- * "Delay (msec) between accepted LSAs\n"
- *
- */
DEFUN (no_ospf_timers_min_ls_arrival,
no_ospf_timers_min_ls_arrival_cmd,
- "no timers lsa arrival",
+ "no timers lsa arrival [(0-1000)]",
NO_STR
"Adjust routing timers\n"
"Throttling link state advertisement delays\n"
- "OSPF minimum arrival interval delay\n")
+ "OSPF minimum arrival interval delay\n"
+ "Delay (msec) between accepted LSAs\n")
{
struct ospf *ospf = vty->index;
"Initial hold time (msec) between consecutive SPF calculations\n"
"Maximum hold time (msec)\n")
{
+ int idx_number = 3;
+ int idx_number_2 = 4;
+ int idx_number_3 = 5;
unsigned int delay, hold, max;
if (argc != 3)
return CMD_WARNING;
}
- VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[3]->arg, 0, 600000);
- VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[4]->arg, 0, 600000);
- VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[5]->arg, 0, 600000);
+ VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[idx_number]->arg, 0, 600000);
+ VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[idx_number_2]->arg, 0, 600000);
+ VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[idx_number_3]->arg, 0, 600000);
return ospf_timers_spf_set (vty, delay, hold, max);
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no timers throttle spf <0-600000> <0-600000> <0-600000>",
- * NO_STR
- * "Adjust routing timers\n"
- * "Throttling adaptive timer\n"
- * "OSPF SPF timers\n"
- * "Delay (msec) from first change received till SPF calculation\n"
- * "Initial hold time (msec) between consecutive SPF calculations\n"
- * "Maximum hold time (msec)\n"
- *
- */
DEFUN (no_ospf_timers_throttle_spf,
no_ospf_timers_throttle_spf_cmd,
- "no timers throttle spf",
+ "no timers throttle spf [(0-600000)(0-600000)(0-600000)]",
NO_STR
"Adjust routing timers\n"
"Throttling adaptive timer\n"
- "OSPF SPF timers\n")
+ "OSPF SPF timers\n"
+ "Delay (msec) from first change received till SPF calculation\n"
+ "Initial hold time (msec) between consecutive SPF calculations\n"
+ "Maximum hold time (msec)\n")
{
return ospf_timers_spf_set (vty,
OSPF_SPF_DELAY_DEFAULT,
"Minimum delay in receiving new version of a LSA\n"
"Delay in milliseconds\n")
{
+ int idx_number = 3;
unsigned int minarrival;
struct ospf *ospf = vty->index;
return CMD_WARNING;
}
- VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[3]->arg);
+ VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[idx_number]->arg);
ospf->min_ls_arrival = minarrival;
return CMD_SUCCESS;
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "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 (no_ospf_timers_lsa,
no_ospf_timers_lsa_cmd,
- "no timers lsa min-arrival",
+ "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")
+ "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)
+ if (argc > 4)
{
- VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[0]);
+ VTY_GET_INTEGER ("LSA min-arrival", minarrival, argv[4]->arg);
if (ospf->min_ls_arrival != minarrival ||
minarrival == OSPF_MIN_LS_ARRIVAL)
return CMD_SUCCESS;
}
-
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
- * NEIGHBOR_STR
- * "Neighbor IP address\n"
- * "Neighbor Priority\n"
- * "Priority\n"
- * "Dead Neighbor Polling interval\n"
- * "Seconds\n"
- *
- * "neighbor A.B.C.D priority <0-255>",
- * NEIGHBOR_STR
- * "Neighbor IP address\n"
- * "Neighbor Priority\n"
- * "Seconds\n"
- *
- */
DEFUN (ospf_neighbor,
ospf_neighbor_cmd,
- "neighbor A.B.C.D",
+ "neighbor A.B.C.D [priority (0-255) [poll-interval (1-65535)]]",
NEIGHBOR_STR
- "Neighbor IP address\n")
-{
+ "Neighbor IP address\n"
+ "Neighbor Priority\n"
+ "Priority\n"
+ "Dead Neighbor Polling interval\n"
+ "Seconds\n")
+{
+ int idx_ipv4 = 1;
+ int idx_pri = 3;
+ int idx_poll = 5;
struct ospf *ospf = vty->index;
struct in_addr nbr_addr;
unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[1]->arg);
-
- if (argc > 1)
- VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255);
+ VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg);
if (argc > 2)
- VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[2], 1, 65535);
+ VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[idx_pri]->arg, 0, 255);
+
+ if (argc > 4)
+ VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[idx_poll]->arg, 1, 65535);
ospf_nbr_nbma_set (ospf, nbr_addr);
- if (argc > 1)
- ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority);
+
if (argc > 2)
+ ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority);
+
+ if (argc > 4)
ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval);
return CMD_SUCCESS;
}
-
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>",
- * NEIGHBOR_STR
- * "Neighbor address\n"
- * "OSPF dead-router polling interval\n"
- * "Seconds\n"
- * "OSPF priority of non-broadcast neighbor\n"
- * "Priority\n"
- *
- */
DEFUN (ospf_neighbor_poll_interval,
ospf_neighbor_poll_interval_cmd,
- "neighbor A.B.C.D poll-interval (1-65535)",
+ "neighbor A.B.C.D poll-interval (1-65535) [priority (0-255)]",
NEIGHBOR_STR
"Neighbor IP address\n"
"Dead Neighbor Polling interval\n"
- "Seconds\n")
+ "Seconds\n"
+ "OSPF priority of non-broadcast neighbor\n"
+ "Priority\n")
{
+ int idx_ipv4 = 1;
+ int idx_poll = 3;
+ int idx_pri = 5;
struct ospf *ospf = vty->index;
struct in_addr nbr_addr;
unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[1]->arg);
+ VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg);
- if (argc > 1)
- VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[3]->arg, 1, 65535);
+ VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[idx_poll]->arg, 1, 65535);
- if (argc > 2)
- VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255);
+ if (argc > 4)
+ VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[idx_pri]->arg, 0, 255);
ospf_nbr_nbma_set (ospf, nbr_addr);
- if (argc > 1)
- ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval);
- if (argc > 2)
+ ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval);
+
+ if (argc > 4)
ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority);
return CMD_SUCCESS;
}
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
- * NO_STR
- * NEIGHBOR_STR
- * "Neighbor IP address\n"
- * "Neighbor Priority\n"
- * "Priority\n"
- * "Dead Neighbor Polling interval\n"
- * "Seconds\n"
- *
- * "no neighbor A.B.C.D priority <0-255>",
- * NO_STR
- * NEIGHBOR_STR
- * "Neighbor IP address\n"
- * "Neighbor Priority\n"
- * "Priority\n"
- *
- * "no neighbor A.B.C.D poll-interval <1-65535>",
- * NO_STR
- * NEIGHBOR_STR
- * "Neighbor IP address\n"
- * "Dead Neighbor Polling interval\n"
- * "Seconds\n"
- *
- * "no neighbor A.B.C.D poll-interval <1-65535> priority <0-255>",
- * NO_STR
- * NEIGHBOR_STR
- * "Neighbor IP address\n"
- * "Dead Neighbor Polling interval\n"
- * "Seconds\n"
- * "OSPF priority of non-broadcast neighbor\n"
- * "Priority\n"
- *
- */
DEFUN (no_ospf_neighbor,
no_ospf_neighbor_cmd,
- "no neighbor A.B.C.D",
+ "no neighbor A.B.C.D [priority (0-255) [poll-interval (1-65525)]]",
NO_STR
NEIGHBOR_STR
- "Neighbor IP address\n")
+ "Neighbor IP address\n"
+ "Neighbor Priority\n"
+ "Priority\n"
+ "Dead Neighbor Polling interval\n"
+ "Seconds\n")
{
+ int idx_ipv4 = 2;
struct ospf *ospf = vty->index;
struct in_addr nbr_addr;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[2]->arg);
+ VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg);
(void)ospf_nbr_nbma_unset (ospf, nbr_addr);
return CMD_SUCCESS;
}
+DEFUN (no_ospf_neighbor_poll,
+ no_ospf_neighbor_poll_cmd,
+ "no neighbor A.B.C.D poll-interval (1-65535) [priority (0-255)]",
+ NO_STR
+ NEIGHBOR_STR
+ "Neighbor IP address\n"
+ "Dead Neighbor Polling interval\n"
+ "Seconds\n"
+ "Neighbor Priority\n"
+ "Priority\n")
+{
+ int idx_ipv4 = 2;
+ struct ospf *ospf = vty->index;
+ struct in_addr nbr_addr;
+
+ if (!ospf)
+ return CMD_SUCCESS;
+ VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[idx_ipv4]->arg);
+ (void)ospf_nbr_nbma_unset (ospf, nbr_addr);
+ return CMD_SUCCESS;
+}
DEFUN (ospf_refresh_timer,
ospf_refresh_timer_cmd,
"Set refresh timer\n"
"Timer value in seconds\n")
{
+ int idx_number = 2;
struct ospf *ospf = vty->index;
unsigned int interval;
if (!ospf)
return CMD_SUCCESS;
- VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[2]->arg, 10, 1800);
+ VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[idx_number]->arg, 10, 1800);
interval = (interval / OSPF_LSA_REFRESHER_GRANULARITY) * OSPF_LSA_REFRESHER_GRANULARITY;
ospf_timers_refresh_set (ospf, interval);
return CMD_SUCCESS;
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no refresh timer",
- * "Adjust refresh parameters\n"
- * "Unset refresh timer\n"
- *
- */
DEFUN (no_ospf_refresh_timer,
no_ospf_refresh_timer_val_cmd,
- "no refresh timer (10-1800)",
+ "no refresh timer [(10-1800)]",
"Adjust refresh parameters\n"
"Unset refresh timer\n"
"Timer value in seconds\n")
{
+ int idx_number = 3;
struct ospf *ospf = vty->index;
unsigned int interval;
if (argc == 1)
{
- VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[3]->arg, 10, 1800);
+ VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[idx_number]->arg, 10, 1800);
if (ospf->lsa_refresh_interval != interval ||
interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT)
"Use reference bandwidth method to assign OSPF cost\n"
"The reference bandwidth in terms of Mbits per second\n")
{
+ int idx_number = 2;
struct ospf *ospf = vty->index;
u_int32_t refbw;
struct listnode *node;
if (!ospf)
return CMD_SUCCESS;
- refbw = strtol (argv[2]->arg, NULL, 10);
+ refbw = strtol (argv[idx_number]->arg, NULL, 10);
if (refbw < 1 || refbw > 4294967)
{
vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE);
return CMD_SUCCESS;
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no auto-cost reference-bandwidth <1-4294967>",
- * NO_STR
- * "Calculate OSPF interface cost according to bandwidth\n"
- * "Use reference bandwidth method to assign OSPF cost\n"
- * "The reference bandwidth in terms of Mbits per second\n"
- *
- */
DEFUN (no_ospf_auto_cost_reference_bandwidth,
no_ospf_auto_cost_reference_bandwidth_cmd,
- "no auto-cost reference-bandwidth",
+ "no auto-cost reference-bandwidth [(1-4294967)]",
NO_STR
"Calculate OSPF interface cost according to bandwidth\n"
- "Use reference bandwidth method to assign OSPF cost\n")
+ "Use reference bandwidth method to assign OSPF cost\n"
+ "The reference bandwidth in terms of Mbits per second\n")
{
struct ospf *ospf = vty->index;
struct listnode *node, *nnode;
return CMD_SUCCESS;
}
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "write-multiplier <1-100>",
- * "Write multiplier\n"
- * "Maximum number of interface serviced per write\n"
- *
- */
DEFUN (ospf_write_multiplier,
ospf_write_multiplier_cmd,
"ospf write-multiplier (1-100)",
"Write multiplier\n"
"Maximum number of interface serviced per write\n")
{
+ int idx_number;
struct ospf *ospf = vty->index;
u_int32_t write_oi_count;
if (!ospf)
return CMD_SUCCESS;
- write_oi_count = strtol (argv[2]->arg, NULL, 10);
+ if (argc == 3)
+ idx_number = 2;
+ else
+ idx_number = 1;
+
+ write_oi_count = strtol (argv[idx_number]->arg, NULL, 10);
if (write_oi_count < 1 || write_oi_count > 100)
{
vty_out (vty, "write-multiplier value is invalid%s", VTY_NEWLINE);
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")
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no write-multiplier",
- * NO_STR
- * "Write multiplier\n"
- *
- * "no write-multiplier <1-100>",
- * NO_STR
- * "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 (1-100)",
return CMD_SUCCESS;
}
-
+ALIAS (no_ospf_write_multiplier,
+ no_write_multiplier_cmd,
+ "no write-multiplier (1-100)",
+ NO_STR
+ "Write multiplier\n"
+ "Maximum number of interface serviced per write\n")
const char *ospf_abr_type_descr_str[] =
{
json_object *json_areas = NULL;
if (use_json)
- json = json_object_new_object();
- json_areas = json_object_new_object();
+ {
+ json = json_object_new_object();
+ json_areas = json_object_new_object();
+ }
if (ospf->instance)
{
if (use_json)
{
json_object_object_add(json, "areas", json_areas);
- vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
json_object_free(json);
}
else
"Instance ID\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
static int
show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc,
- const char **argv, int iface_argv, u_char use_json)
+ struct cmd_token **argv, int iface_argv, u_char use_json)
{
struct interface *ifp;
struct listnode *node;
}
}
}
- else if (argv[iface_argv] && strcmp(argv[iface_argv], "json") == 0)
+ else if (argv[iface_argv] && strcmp(argv[iface_argv]->arg, "json") == 0)
{
if (!use_json)
{
else
{
/* Interface name is specified. */
- if ((ifp = if_lookup_by_name (argv[iface_argv])) == NULL)
+ if ((ifp = if_lookup_by_name (argv[iface_argv]->arg)) == NULL)
{
if (use_json)
json_object_boolean_true_add(json, "noSuchIface");
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
json_object_free(json);
}
else
"Interface name\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
json_object_free(json);
}
else
"Neighbor list\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
json_object_free(json);
}
else
"include down status neighbor\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
static int
show_ip_ospf_neighbor_int_common (struct vty *vty, struct ospf *ospf, int arg_base,
- const char **argv, u_char use_json)
+ struct cmd_token **argv, u_char use_json)
{
struct interface *ifp;
struct route_node *rn;
VTY_NEWLINE, VTY_NEWLINE);
}
- ifp = if_lookup_by_name (argv[arg_base]);
+ ifp = if_lookup_by_name (argv[arg_base]->arg);
if (!ifp)
{
if (use_json)
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
json_object_free(json);
}
else
"Interface name\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
/* Show Router Dead interval timer. */
if (use_json)
{
- struct timeval res = tv_sub (nbr->t_inactivity->u.sands, recent_relative_time ());
- unsigned long time_store = 0;
- time_store = (1000 * res.tv_sec) + (res.tv_usec / 1000);
- json_object_int_add(json_sub, "routerDeadIntervalTimerDueMsec", time_store);
+ if (nbr->t_inactivity)
+ {
+ struct timeval res = tv_sub (nbr->t_inactivity->u.sands, recent_relative_time ());
+ unsigned long time_store = 0;
+ time_store = (1000 * res.tv_sec) + (res.tv_usec / 1000);
+ json_object_int_add(json_sub, "routerDeadIntervalTimerDueMsec", time_store);
+ }
+ else
+ json_object_int_add(json_sub, "routerDeadIntervalTimerDueMsec", -1);
}
else
vty_out (vty, " Dead timer due in %s%s",
static int
show_ip_ospf_neighbor_id_common (struct vty *vty, struct ospf *ospf,
- int arg_base, const char **argv, u_char use_json)
+ int arg_base, struct cmd_token **argv, u_char use_json)
{
struct listnode *node;
struct ospf_neighbor *nbr;
VTY_NEWLINE, VTY_NEWLINE);
}
- ret = inet_aton (argv[arg_base], &router_id);
+ ret = inet_aton (argv[arg_base]->arg, &router_id);
if (!ret)
{
if (!use_json)
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
json_object_free(json);
}
else
"Neighbor ID\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
json_object_free(json);
}
else
"detail of all neighbors\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
if ((nbr = rn->info))
if (nbr != oi->nbr_self)
- if (oi->type == OSPF_IFTYPE_NBMA && nbr->state != NSM_Down)
+ if (nbr->state != NSM_Down)
show_ip_ospf_neighbor_detail_sub (vty, oi, rn->info, use_json, json);
if (oi->type == OSPF_IFTYPE_NBMA)
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
json_object_free(json);
}
else
"include down status neighbor\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
static int
show_ip_ospf_neighbor_int_detail_common (struct vty *vty, struct ospf *ospf,
- int arg_base, const char **argv, u_char use_json)
+ int arg_base, struct cmd_token **argv, u_char use_json)
{
struct ospf_interface *oi;
struct interface *ifp;
VTY_NEWLINE, VTY_NEWLINE);
}
- ifp = if_lookup_by_name (argv[arg_base]);
+ ifp = if_lookup_by_name (argv[arg_base]->arg);
if (!ifp)
{
if (!use_json)
if (use_json)
{
- vty_out (vty, "%s%s", json_object_to_json_string(json), VTY_NEWLINE);
+ vty_out (vty, "%s%s", json_object_to_json_string_ext(json, JSON_C_TO_STRING_PRETTY), VTY_NEWLINE);
json_object_free(json);
}
else
"detail of all neighbors\n"
"JavaScript Object Notation\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
u_char uj = use_json(argc, argv);
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance(instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
vty_out (vty, " Forward Address: %s%s",
inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE);
- vty_out (vty, " External Route Tag: %lu%s%s",
- (u_long)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, " External Route Tag: %"ROUTE_TAG_PRI"%s%s",
+ (route_tag_t)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
}
return 0;
}
-
#if 0
static int
show_as_external_lsa_stdvty (struct ospf_lsa *lsa)
zlog_debug( " Forward Address: %s%s",
inet_ntoa (al->e[0].fwd_addr), "\n");
- zlog_debug( " External Route Tag: %u%s%s",
- ntohl (al->e[0].route_tag), "\n", "\n");
+ zlog_debug( " External Route Tag: %"ROUTE_TAG_PRI"%s%s",
+ (route_tag_t)ntohl (al->e[0].route_tag), "\n", "\n");
return 0;
}
#endif
-
/* Show AS-NSSA-LSA detail information. */
static int
show_as_nssa_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
vty_out (vty, " NSSA: Forward Address: %s%s",
inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE);
- vty_out (vty, " External Route Tag: %u%s%s",
- ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
+ vty_out (vty, " External Route Tag: %"ROUTE_TAG_PRI"%s%s",
+ (route_tag_t)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
}
return 0;
#define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n"
#define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as"
-#define OSPF_LSA_TYPES_CMD_STR \
- "asbr-summary|external|network|router|summary" \
- OSPF_LSA_TYPE_NSSA_CMD_STR \
- OSPF_LSA_TYPE_OPAQUE_CMD_STR
-
#define OSPF_LSA_TYPES_DESC \
"ASBR summary link states\n" \
"External link states\n" \
static int
show_ip_ospf_database_common (struct vty *vty, struct ospf *ospf,
- int arg_base, int argc, const char **argv)
+ int arg_base, int argc, struct cmd_token **argv)
{
+ int idx_type = 4;
int type, ret;
struct in_addr id, adv_router;
inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE);
/* Show all LSA. */
- if (argc == arg_base + 0)
+ if (argc == arg_base + 4)
{
show_ip_ospf_database_summary (vty, ospf, 0);
return CMD_SUCCESS;
}
/* Set database type to show. */
- if (strncmp (argv[arg_base + 0], "r", 1) == 0)
+ if (strncmp (argv[arg_base + idx_type]->text, "r", 1) == 0)
type = OSPF_ROUTER_LSA;
- else if (strncmp (argv[arg_base + 0], "ne", 2) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "ne", 2) == 0)
type = OSPF_NETWORK_LSA;
- else if (strncmp (argv[arg_base + 0], "ns", 2) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "ns", 2) == 0)
type = OSPF_AS_NSSA_LSA;
- else if (strncmp (argv[arg_base + 0], "su", 2) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "su", 2) == 0)
type = OSPF_SUMMARY_LSA;
- else if (strncmp (argv[arg_base + 0], "a", 1) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "a", 1) == 0)
type = OSPF_ASBR_SUMMARY_LSA;
- else if (strncmp (argv[arg_base + 0], "e", 1) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "e", 1) == 0)
type = OSPF_AS_EXTERNAL_LSA;
- else if (strncmp (argv[arg_base + 0], "se", 2) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "se", 2) == 0)
{
show_ip_ospf_database_summary (vty, ospf, 1);
return CMD_SUCCESS;
}
- else if (strncmp (argv[arg_base + 0], "m", 1) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "m", 1) == 0)
{
show_ip_ospf_database_maxage (vty, ospf);
return CMD_SUCCESS;
}
- else if (strncmp (argv[arg_base + 0], "opaque-l", 8) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "opaque-l", 8) == 0)
type = OSPF_OPAQUE_LINK_LSA;
- else if (strncmp (argv[arg_base + 0], "opaque-ar", 9) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "opaque-ar", 9) == 0)
type = OSPF_OPAQUE_AREA_LSA;
- else if (strncmp (argv[arg_base + 0], "opaque-as", 9) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "opaque-as", 9) == 0)
type = OSPF_OPAQUE_AS_LSA;
else
return CMD_WARNING;
/* `show ip ospf database LSA'. */
- if (argc == arg_base + 1)
+ if (argc == arg_base + 5)
show_lsa_detail (vty, ospf, type, NULL, NULL);
- else if (argc >= arg_base + 2)
+ else if (argc >= arg_base + 6)
{
- ret = inet_aton (argv[arg_base + 1], &id);
+ ret = inet_aton (argv[arg_base + 5]->arg, &id);
if (!ret)
return CMD_WARNING;
/* `show ip ospf database LSA ID'. */
- if (argc == arg_base + 2)
+ if (argc == arg_base + 6)
show_lsa_detail (vty, ospf, type, &id, NULL);
/* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */
- else if (argc == arg_base + 3)
+ else if (argc == arg_base + 7)
{
- if (strncmp (argv[arg_base + 2], "s", 1) == 0)
+ if (strncmp (argv[arg_base + 6]->text, "s", 1) == 0)
adv_router = ospf->router_id;
else
{
- ret = inet_aton (argv[arg_base + 2], &adv_router);
+ ret = inet_aton (argv[arg_base + 7]->arg, &adv_router);
if (!ret)
return CMD_WARNING;
}
return CMD_SUCCESS;
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D",
- * SHOW_STR
- * IP_STR
- * "OSPF information\n"
- * "Database summary\n"
- * OSPF_LSA_TYPES_DESC
- * "Link State ID (as an IP address)\n"
- *
- * "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)",
- * SHOW_STR
- * IP_STR
- * "OSPF information\n"
- * "Database summary\n"
- * OSPF_LSA_TYPES_DESC
- * "Link State ID (as an IP address)\n"
- * "Self-originated link states\n"
- * "\n"
- *
- * "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D",
- * SHOW_STR
- * IP_STR
- * "OSPF information\n"
- * "Database summary\n"
- * OSPF_LSA_TYPES_DESC
- * "Link State ID (as an IP address)\n"
- * "Advertising Router link states\n"
- * "Advertising Router (as an IP address)\n"
- *
- * "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)",
- * SHOW_STR
- * IP_STR
- * "OSPF information\n"
- * "Database summary\n"
- * OSPF_LSA_TYPES_DESC
- * "LSAs in MaxAge list\n"
- * "Self-originated link states\n"
- *
- */
DEFUN (show_ip_ospf_database,
show_ip_ospf_database_cmd,
- "show ip ospf database",
+ "show ip ospf database [<asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> [A.B.C.D [<self-originate|adv-router A.B.C.D>]]]",
SHOW_STR
IP_STR
"OSPF information\n"
- "Database summary\n")
+ "Database summary\n"
+ OSPF_LSA_TYPES_DESC
+ "Link State ID (as an IP address)\n"
+ "Self-originated link states\n"
+ "Advertising Router link states\n"
+ "Advertising Router (as an IP address)\n")
{
struct ospf *ospf;
return (show_ip_ospf_database_common(vty, ospf, 0, argc, argv));
}
+DEFUN (show_ip_ospf_database_max,
+ show_ip_ospf_database_max_cmd,
+ "show ip ospf database <max-age|self-originate>",
+ SHOW_STR
+ IP_STR
+ "OSPF information\n"
+ "Database summary\n"
+ "LSAs in MaxAge list\n"
+ "Self-originated link states\n")
+{
+ struct ospf *ospf;
+ if ((ospf = ospf_lookup()) == NULL || !ospf->oi_running)
+ return CMD_SUCCESS;
+ return (show_ip_ospf_database_common(vty, ospf, 0, argc, argv));
+}
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D",
- * SHOW_STR
- * IP_STR
- * "OSPF information\n"
- * "Instance ID\n"
- * "Database summary\n"
- * OSPF_LSA_TYPES_DESC
- * "Link State ID (as an IP address)\n"
- * "Advertising Router link states\n"
- * "Advertising Router (as an IP address)\n"
- *
- * "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D",
- * SHOW_STR
- * IP_STR
- * "OSPF information\n"
- * "Instance ID\n"
- * "Database summary\n"
- * OSPF_LSA_TYPES_DESC
- * "Link State ID (as an IP address)\n"
- *
- * "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)",
- * SHOW_STR
- * IP_STR
- * "OSPF information\n"
- * "Instance ID\n"
- * "Database summary\n"
- * OSPF_LSA_TYPES_DESC
- * "Link State ID (as an IP address)\n"
- * "Self-originated link states\n"
- * "\n"
- *
- * "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)",
- * SHOW_STR
- * IP_STR
- * "OSPF information\n"
- * "Instance ID\n"
- * "Database summary\n"
- * OSPF_LSA_TYPES_DESC
- * "LSAs in MaxAge list\n"
- * "Self-originated link states\n"
- *
- */
DEFUN (show_ip_ospf_instance_database,
show_ip_ospf_instance_database_cmd,
- "show ip ospf (1-65535) database",
+ "show ip ospf (1-65535) database [<asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> [A.B.C.D [<self-originate|adv-router A.B.C.D>]]]",
SHOW_STR
IP_STR
"OSPF information\n"
"Instance ID\n"
- "Database summary\n")
+ "Database summary\n"
+ OSPF_LSA_TYPES_DESC
+ "Link State ID (as an IP address)\n"
+ "Self-originated link states\n"
+ "Advertising Router link states\n"
+ "Advertising Router (as an IP address)\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return (show_ip_ospf_database_common(vty, ospf, 1, argc, argv));
}
+DEFUN (show_ip_ospf_instance_database_max,
+ show_ip_ospf_instance_database_max_cmd,
+ "show ip ospf (1-65535) database <max-age|self-originate>",
+ SHOW_STR
+ IP_STR
+ "OSPF information\n"
+ "Instance ID\n"
+ "Database summary\n"
+ "LSAs in MaxAge list\n"
+ "Self-originated link states\n")
+{
+ int idx_number = 3;
+ struct ospf *ospf;
+ u_short instance = 0;
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
+ if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
+ return CMD_SUCCESS;
+ return (show_ip_ospf_database_common(vty, ospf, 1, argc, argv));
+}
static int
show_ip_ospf_database_type_adv_router_common (struct vty *vty, struct ospf *ospf,
- int arg_base, int argc, const char **argv)
+ int arg_base, int argc, struct cmd_token **argv)
{
+ int idx_type = 4;
int type, ret;
struct in_addr adv_router;
vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE,
inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE);
- if (argc != arg_base + 2)
+ if (argc != arg_base + 7)
return CMD_WARNING;
/* Set database type to show. */
- if (strncmp (argv[arg_base + 0], "r", 1) == 0)
+ if (strncmp (argv[arg_base + idx_type]->text, "r", 1) == 0)
type = OSPF_ROUTER_LSA;
- else if (strncmp (argv[arg_base + 0], "ne", 2) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "ne", 2) == 0)
type = OSPF_NETWORK_LSA;
- else if (strncmp (argv[arg_base + 0], "ns", 2) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "ns", 2) == 0)
type = OSPF_AS_NSSA_LSA;
- else if (strncmp (argv[arg_base + 0], "s", 1) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "s", 1) == 0)
type = OSPF_SUMMARY_LSA;
- else if (strncmp (argv[arg_base + 0], "a", 1) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "a", 1) == 0)
type = OSPF_ASBR_SUMMARY_LSA;
- else if (strncmp (argv[arg_base + 0], "e", 1) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "e", 1) == 0)
type = OSPF_AS_EXTERNAL_LSA;
- else if (strncmp (argv[arg_base + 0], "opaque-l", 8) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "opaque-l", 8) == 0)
type = OSPF_OPAQUE_LINK_LSA;
- else if (strncmp (argv[arg_base + 0], "opaque-ar", 9) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "opaque-ar", 9) == 0)
type = OSPF_OPAQUE_AREA_LSA;
- else if (strncmp (argv[arg_base + 0], "opaque-as", 9) == 0)
+ else if (strncmp (argv[arg_base + idx_type]->text, "opaque-as", 9) == 0)
type = OSPF_OPAQUE_AS_LSA;
else
return CMD_WARNING;
/* `show ip ospf database LSA adv-router ADV_ROUTER'. */
- if (strncmp (argv[arg_base + 1], "s", 1) == 0)
+ if (strncmp (argv[arg_base + 5]->text, "s", 1) == 0)
adv_router = ospf->router_id;
else
{
- ret = inet_aton (argv[arg_base + 1], &adv_router);
+ ret = inet_aton (argv[arg_base + 6]->arg, &adv_router);
if (!ret)
return CMD_WARNING;
}
return CMD_SUCCESS;
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)",
- * SHOW_STR
- * IP_STR
- * "OSPF information\n"
- * "Database summary\n"
- * OSPF_LSA_TYPES_DESC
- * "Self-originated link states\n"
- *
- */
DEFUN (show_ip_ospf_database_type_adv_router,
show_ip_ospf_database_type_adv_router_cmd,
- "show ip ospf database <" OSPF_LSA_TYPES_CMD_STR "> adv-router A.B.C.D",
+ "show ip ospf database <asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> <adv-router A.B.C.D|self-originate>",
SHOW_STR
IP_STR
"OSPF information\n"
"Database summary\n"
OSPF_LSA_TYPES_DESC
"Advertising Router link states\n"
- "Advertising Router (as an IP address)\n")
+ "Advertising Router (as an IP address)\n"
+ "Self-originated link states\n")
{
struct ospf *ospf;
return (show_ip_ospf_database_type_adv_router_common(vty, ospf, 0, argc, argv));
}
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)",
- * SHOW_STR
- * IP_STR
- * "OSPF information\n"
- * "Instance ID\n"
- * "Database summary\n"
- * OSPF_LSA_TYPES_DESC
- * "Self-originated link states\n"
- *
- */
DEFUN (show_ip_ospf_instance_database_type_adv_router,
show_ip_ospf_instance_database_type_adv_router_cmd,
- "show ip ospf (1-65535) database <" OSPF_LSA_TYPES_CMD_STR "> adv-router A.B.C.D",
+ "show ip ospf (1-65535) database <asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> <adv-router A.B.C.D|self-originate>",
SHOW_STR
IP_STR
"OSPF information\n"
"Advertising Router link states\n"
"Advertising Router (as an IP address)\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
return (show_ip_ospf_database_type_adv_router_common(vty, ospf, 1, argc, argv));
}
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "ip ospf authentication (null|message-digest)",
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Enable authentication on this interface\n"
- * "Use null authentication\n"
- * "Use message-digest authentication\n"
- *
- */
DEFUN (ip_ospf_authentication_args,
ip_ospf_authentication_args_addr_cmd,
- "ip ospf authentication <null|message-digest> A.B.C.D",
+ "ip ospf authentication <null|message-digest> [A.B.C.D]",
"IP Information\n"
"OSPF interface commands\n"
"Enable authentication on this interface\n"
"Use null authentication\n"
"Use message-digest authentication\n"
- "Address of interface")
+ "Address of interface\n")
{
+ int idx_encryption = 3;
+ int idx_ipv4 = 4;
struct interface *ifp;
struct in_addr addr;
int ret;
ifp = vty->index;
params = IF_DEF_PARAMS (ifp);
- if (argc == 2)
+ if (argc == 5)
{
- ret = inet_aton(argv[4]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
}
/* Handle null authentication */
- if ( argv[3]->arg[0] == 'n' )
+ if ( argv[idx_encryption]->arg[0] == 'n' )
{
SET_IF_PARAM (params, auth_type);
params->auth_type = OSPF_AUTH_NULL;
}
/* Handle message-digest authentication */
- if ( argv[3]->arg[0] == 'm' )
+ if ( argv[idx_encryption]->arg[0] == 'm' )
{
SET_IF_PARAM (params, auth_type);
params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
return CMD_WARNING;
}
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "ip ospf authentication",
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Enable authentication on this interface\n"
- *
- */
DEFUN (ip_ospf_authentication,
ip_ospf_authentication_addr_cmd,
- "ip ospf authentication A.B.C.D",
+ "ip ospf authentication [A.B.C.D]",
"IP Information\n"
"OSPF interface commands\n"
"Enable authentication on this interface\n"
"Address of interface")
{
+ int idx_ipv4 = 3;
struct interface *ifp;
struct in_addr addr;
int ret;
ifp = vty->index;
params = IF_DEF_PARAMS (ifp);
- if (argc == 1)
+ if (argc == 4)
{
- ret = inet_aton(argv[3]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
return CMD_SUCCESS;
}
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ip ospf authentication (null|message-digest)",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Enable authentication on this interface\n"
- * "Use null authentication\n"
- * "Use message-digest authentication\n"
- *
- */
DEFUN (no_ip_ospf_authentication_args,
no_ip_ospf_authentication_args_addr_cmd,
- "no ip ospf authentication <null|message-digest> A.B.C.D",
+ "no ip ospf authentication <null|message-digest> [A.B.C.D]",
NO_STR
"IP Information\n"
"OSPF interface commands\n"
"Use message-digest authentication\n"
"Address of interface")
{
+ int idx_encryption = 4;
+ int idx_ipv4 = 5;
struct interface *ifp;
struct in_addr addr;
int ret;
ifp = vty->index;
params = IF_DEF_PARAMS (ifp);
- if (argc == 2)
+ if (argc == 6)
{
- ret = inet_aton(argv[5]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
}
else
{
- if ( argv[4]->arg[0] == 'n' )
+ if ( argv[idx_encryption]->arg[0] == 'n' )
{
auth_type = OSPF_AUTH_NULL;
}
- else if ( argv[4]->arg[0] == 'm' )
+ else if ( argv[idx_encryption]->arg[0] == 'm' )
{
auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
}
return CMD_SUCCESS;
}
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ip ospf authentication",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Enable authentication on this interface\n"
- *
- */
DEFUN (no_ip_ospf_authentication,
no_ip_ospf_authentication_addr_cmd,
- "no ip ospf authentication A.B.C.D",
+ "no ip ospf authentication [A.B.C.D]",
NO_STR
"IP Information\n"
"OSPF interface commands\n"
"Enable authentication on this interface\n"
"Address of interface")
{
+ int idx_ipv4 = 4;
struct interface *ifp;
struct in_addr addr;
int ret;
ifp = vty->index;
params = IF_DEF_PARAMS (ifp);
- if (argc == 1)
+ if (argc == 5)
{
- ret = inet_aton(argv[4]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "ip ospf authentication-key AUTH_KEY",
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Authentication password (key)\n"
- * "The OSPF password (key)"
- *
- */
DEFUN (ip_ospf_authentication_key,
ip_ospf_authentication_key_addr_cmd,
- "ip ospf authentication-key AUTH_KEY A.B.C.D",
+ "ip ospf authentication-key AUTH_KEY [A.B.C.D]",
"IP Information\n"
"OSPF interface commands\n"
"Authentication password (key)\n"
"The OSPF password (key)\n"
"Address of interface")
{
+ int idx = 0;
struct interface *ifp;
struct in_addr addr;
- int ret;
struct ospf_if_params *params;
ifp = vty->index;
params = IF_DEF_PARAMS (ifp);
- if (argc == 2)
+ if (argv_find (argv, argc, "A.B.C.D", &idx))
{
- ret = inet_aton(argv[1], &addr);
- if (!ret)
+ if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
VTY_NEWLINE);
}
memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
- strncpy ((char *) params->auth_simple, argv[4]->arg, OSPF_AUTH_SIMPLE_SIZE);
+ strncpy ((char *) params->auth_simple, argv[3]->arg, OSPF_AUTH_SIMPLE_SIZE);
SET_IF_PARAM (params, auth_simple);
return CMD_SUCCESS;
}
-
-ALIAS_HIDDEN (ip_ospf_authentication_key,
+DEFUN_HIDDEN (ospf_authentication_key,
ospf_authentication_key_cmd,
- "ospf authentication-key AUTH_KEY",
+ "ospf authentication-key AUTH_KEY [A.B.C.D]",
"OSPF interface commands\n"
"Authentication password (key)\n"
- "The OSPF password (key)")
+ "The OSPF password (key)\n"
+ "Address of interface\n")
+{
+ return ip_ospf_authentication_key (self, vty, argc, argv);
+}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ospf authentication-key AUTH_KEY A.B.C.D",
- * NO_STR
- * "OSPF interface commands\n"
- * "Authentication password (key)\n"
- * "The OSPF password (key)\n"
- * "Address of interface"
- *
- * "no ospf authentication-key AUTH_KEY",
- * NO_STR
- * "OSPF interface commands\n"
- * "Authentication password (key)\n"
- * "The OSPF password (key)\n"
- *
- * "no ip ospf authentication-key",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Authentication password (key)\n"
- *
- * "no ip ospf authentication-key AUTH_KEY",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Authentication password (key)\n"
- *
- * "no ospf authentication-key",
- * NO_STR
- * "OSPF interface commands\n"
- * "Authentication password (key)\n"
- *
- */
DEFUN (no_ip_ospf_authentication_key,
no_ip_ospf_authentication_key_authkey_addr_cmd,
- "no ip ospf authentication-key AUTH_KEY A.B.C.D",
+ "no ip ospf authentication-key [AUTH_KEY [A.B.C.D]]",
NO_STR
"IP Information\n"
"OSPF interface commands\n"
"Authentication password (key)\n"
"The OSPF password (key)")
{
+ int idx = 0;
struct interface *ifp;
struct in_addr addr;
struct ospf_if_params *params;
- int ret;
-
ifp = vty->index;
params = IF_DEF_PARAMS (ifp);
- if (argc == 2)
+ if (argv_find (argv, argc, "A.B.C.D", &idx))
{
- ret = inet_aton(argv[1], &addr);
- if (!ret)
+ if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
VTY_NEWLINE);
memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE);
UNSET_IF_PARAM (params, auth_simple);
-
+
if (params != IF_DEF_PARAMS (ifp))
{
ospf_free_if_params (ifp, addr);
ospf_if_update_params (ifp, addr);
}
-
+
return CMD_SUCCESS;
}
+DEFUN_HIDDEN (no_ospf_authentication_key,
+ no_ospf_authentication_key_authkey_addr_cmd,
+ "no ospf authentication-key [AUTH_KEY [A.B.C.D]]",
+ NO_STR
+ "OSPF interface commands\n"
+ "Authentication password (key)\n"
+ "The OSPF password (key)")
+{
+ return no_ip_ospf_authentication_key (self, vty, argc, argv);
+}
-
-
-
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "ip ospf message-digest-key <1-255> md5 KEY",
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Message digest authentication password (key)\n"
- * "Key ID\n"
- * "Use MD5 algorithm\n"
- * "The OSPF password (key)"
- *
- */
DEFUN (ip_ospf_message_digest_key,
- ip_ospf_message_digest_key_addr_cmd,
- "ip ospf message-digest-key (1-255) md5 KEY A.B.C.D",
+ ip_ospf_message_digest_key_cmd,
+ "ip ospf message-digest-key (1-255) md5 KEY [A.B.C.D]",
"IP Information\n"
"OSPF interface commands\n"
"Message digest authentication password (key)\n"
"Key ID\n"
"Use MD5 algorithm\n"
- "The OSPF password (key)"
- "Address of interface")
+ "The OSPF password (key)\n"
+ "Address of interface\n")
{
struct interface *ifp;
struct crypt_key *ck;
u_char key_id;
struct in_addr addr;
- int ret;
struct ospf_if_params *params;
ifp = vty->index;
params = IF_DEF_PARAMS (ifp);
+ int idx = 0;
- if (argc == 3)
+ argv_find (argv, argc, "(1-255)", &idx);
+ char *keyid = argv[idx]->arg;
+ argv_find (argv, argc, "KEY", &idx);
+ char *cryptkey = argv[idx]->arg;
+
+ if (argv_find (argv, argc, "A.B.C.D", &idx))
{
- ret = inet_aton(argv[2], &addr);
- if (!ret)
+ if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
VTY_NEWLINE);
ospf_if_update_params (ifp, addr);
}
- key_id = strtol (argv[3]->arg, NULL, 10);
+ key_id = strtol (keyid, NULL, 10);
if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL)
{
vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE);
ck = ospf_crypt_key_new ();
ck->key_id = (u_char) key_id;
memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1);
- strncpy ((char *) ck->auth_key, argv[6]->arg, OSPF_AUTH_MD5_SIZE);
+ strncpy ((char *) ck->auth_key, cryptkey, OSPF_AUTH_MD5_SIZE);
ospf_crypt_key_add (params->auth_crypt, ck);
SET_IF_PARAM (params, auth_crypt);
return CMD_SUCCESS;
}
-
-ALIAS_HIDDEN (ip_ospf_message_digest_key,
+DEFUN_HIDDEN (ospf_message_digest_key,
ospf_message_digest_key_cmd,
- "ospf message-digest-key <1-255> md5 KEY",
+ "ospf message-digest-key (1-255) md5 KEY [A.B.C.D]",
"OSPF interface commands\n"
"Message digest authentication password (key)\n"
"Key ID\n"
"Use MD5 algorithm\n"
- "The OSPF password (key)")
+ "The OSPF password (key)\n"
+ "Address of interface\n")
+{
+ return ip_ospf_message_digest_key (self, vty, argc, argv);
+}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ip ospf message-digest-key <1-255> md5 KEY",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Message digest authentication password (key)\n"
- * "Key ID\n"
- * "Use MD5 algorithm\n"
- * "The OSPF password (key)"
- *
- */
-DEFUN (no_ip_ospf_message_digest_key_md5,
- no_ip_ospf_message_digest_key_md5_addr_cmd,
- "no ip ospf message-digest-key (1-255) md5 KEY A.B.C.D",
+DEFUN (no_ip_ospf_message_digest_key,
+ no_ip_ospf_message_digest_key_cmd,
+ "no ip ospf message-digest-key (1-255) [md5 KEY] [A.B.C.D]",
NO_STR
"IP Information\n"
"OSPF interface commands\n"
"Message digest authentication password (key)\n"
"Key ID\n"
"Use MD5 algorithm\n"
- "The OSPF password (key)"
- "Address of interface")
+ "The OSPF password (key)\n"
+ "Address of interface\n")
{
+ int idx = 0;
struct interface *ifp;
struct crypt_key *ck;
int key_id;
struct in_addr addr;
- int ret;
struct ospf_if_params *params;
-
ifp = vty->index;
params = IF_DEF_PARAMS (ifp);
- if (argc == 3)
+ argv_find (argv, argc, "(1-255)", &idx);
+ char *keyid = argv[idx]->arg;
+
+ if (argv_find (argv, argc, "A.B.C.D", &idx))
{
- ret = inet_aton(argv[2], &addr);
- if (!ret)
+ if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
VTY_NEWLINE);
return CMD_SUCCESS;
}
- key_id = strtol (argv[4]->arg, NULL, 10);
+ key_id = strtol (keyid, NULL, 10);
ck = ospf_crypt_key_lookup (params->auth_crypt, key_id);
if (ck == NULL)
{
return CMD_SUCCESS;
}
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ip ospf message-digest-key <1-255>",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Message digest authentication password (key)\n"
- * "Key ID\n"
- *
- * "no ospf message-digest-key <1-255>",
- * NO_STR
- * "OSPF interface commands\n"
- * "Message digest authentication password (key)\n"
- * "Key ID\n"
- *
- */
-DEFUN (no_ip_ospf_message_digest_key,
- no_ip_ospf_message_digest_key_addr_cmd,
- "no ip ospf message-digest-key (1-255) A.B.C.D",
- NO_STR
- "IP Information\n"
- "OSPF interface commands\n"
- "Message digest authentication password (key)\n"
- "Key ID\n"
- "Address of interface")
+DEFUN_HIDDEN (no_ospf_message_digest_key,
+ no_ospf_message_digest_key_cmd,
+ "no ospf message-digest-key (1-255) [md5 KEY] [A.B.C.D]",
+ NO_STR
+ "OSPF interface commands\n"
+ "Message digest authentication password (key)\n"
+ "Key ID\n"
+ "Address of interface")
{
- struct interface *ifp;
- struct crypt_key *ck;
- int key_id;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
-
- if (argc == 2)
- {
- ret = inet_aton(argv[5]->arg, &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- params = ospf_lookup_if_params (ifp, addr);
- if (params == NULL)
- return CMD_SUCCESS;
- }
-
- key_id = strtol (argv[4]->arg, NULL, 10);
- ck = ospf_crypt_key_lookup (params->auth_crypt, key_id);
- if (ck == NULL)
- {
- vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- ospf_crypt_key_delete (params->auth_crypt, key_id);
-
- if (params != IF_DEF_PARAMS (ifp))
- {
- ospf_free_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
-
- return CMD_SUCCESS;
+ return no_ip_ospf_message_digest_key (self, vty, argc, argv);
}
-
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "ip ospf cost <1-65535>",
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Interface cost\n"
- * "Cost"
- *
- */
DEFUN (ip_ospf_cost,
- ip_ospf_cost_u32_inet4_cmd,
- "ip ospf cost (1-65535) A.B.C.D",
+ ip_ospf_cost_cmd,
+ "ip ospf cost (1-65535) [A.B.C.D]",
"IP Information\n"
"OSPF interface commands\n"
"Interface cost\n"
"Cost\n"
- "Address of interface")
+ "Address of interface\n")
{
+ int idx = 0;
struct interface *ifp = vty->index;
u_int32_t cost;
struct in_addr addr;
- int ret;
struct ospf_if_params *params;
-
params = IF_DEF_PARAMS (ifp);
- cost = strtol (argv[3]->arg, NULL, 10);
+ // get arguments
+ char *coststr = NULL, *ifaddr = NULL;
+ coststr = argv_find (argv, argc, "(1-65535)", &idx) ? argv[idx]->arg : NULL;
+ ifaddr = argv_find (argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL;
- /* cost range is <1-65535>. */
- if (cost < 1 || cost > 65535)
- {
- vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
+ cost = strtol (coststr, NULL, 10);
- if (argc == 2)
+ if (ifaddr)
{
- ret = inet_aton(argv[4]->arg, &addr);
- if (!ret)
+ if(!inet_aton(ifaddr, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
VTY_NEWLINE);
params->output_cost_cmd = cost;
ospf_if_recalculate_output_cost (ifp);
-
+
return CMD_SUCCESS;
}
-
-ALIAS_HIDDEN (ip_ospf_cost,
- ospf_cost_u32_cmd,
- "ospf cost <1-65535>",
- "OSPF interface commands\n"
- "Interface cost\n"
- "Cost")
-
-ALIAS_HIDDEN (ip_ospf_cost,
- ospf_cost_u32_inet4_cmd,
- "ospf cost <1-65535> A.B.C.D",
+DEFUN_HIDDEN (ospf_cost,
+ ospf_cost_cmd,
+ "ospf cost (1-65535) [A.B.C.D]",
"OSPF interface commands\n"
"Interface cost\n"
"Cost\n"
- "Address of interface")
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ospf cost A.B.C.D",
- * NO_STR
- * "OSPF interface commands\n"
- * "Interface cost\n"
- * "Address of interface"
- *
- * "no ospf cost",
- * NO_STR
- * "OSPF interface commands\n"
- * "Interface cost\n"
- *
- * "no ip ospf cost",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Interface cost\n"
- *
- */
-DEFUN (no_ip_ospf_cost,
- no_ip_ospf_cost_inet4_cmd,
- "no ip ospf cost A.B.C.D",
- NO_STR
- "IP Information\n"
- "OSPF interface commands\n"
- "Interface cost\n"
- "Address of interface")
+ "Address of interface\n")
{
- struct interface *ifp = vty->index;
- struct in_addr addr;
- int ret;
- struct ospf_if_params *params;
-
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
-
- if (argc == 1)
- {
- ret = inet_aton(argv[4]->arg, &addr);
- if (!ret)
- {
- vty_out (vty, "Please specify interface address by A.B.C.D%s",
- VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- params = ospf_lookup_if_params (ifp, addr);
- if (params == NULL)
- return CMD_SUCCESS;
- }
-
- UNSET_IF_PARAM (params, output_cost_cmd);
-
- if (params != IF_DEF_PARAMS (ifp))
- {
- ospf_free_if_params (ifp, addr);
- ospf_if_update_params (ifp, addr);
- }
-
- ospf_if_recalculate_output_cost (ifp);
-
- return CMD_SUCCESS;
+ return ip_ospf_cost (self, vty, argc, argv);
}
-
-
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ospf cost <1-65535>",
- * NO_STR
- * "OSPF interface commands\n"
- * "Interface cost\n"
- * "Cost"
- *
- * "no ospf cost <1-65535> A.B.C.D",
- * NO_STR
- * "OSPF interface commands\n"
- * "Interface cost\n"
- * "Cost\n"
- * "Address of interface"
- *
- * "no ip ospf cost <1-65535> A.B.C.D",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Interface cost\n"
- * "Cost\n"
- * "Address of interface"
- *
- */
-DEFUN (no_ip_ospf_cost2,
- no_ip_ospf_cost_u32_cmd,
- "no ip ospf cost (1-65535)",
+DEFUN (no_ip_ospf_cost,
+ no_ip_ospf_cost_cmd,
+ "no ip ospf cost [(1-65535)] [A.B.C.D]",
NO_STR
- "IP Information\n"
"OSPF interface commands\n"
"Interface cost\n"
- "Cost")
+ "Address of interface")
{
+ int idx = 0;
struct interface *ifp = vty->index;
struct in_addr addr;
- u_int32_t cost;
- int ret;
struct ospf_if_params *params;
ifp = vty->index;
params = IF_DEF_PARAMS (ifp);
+ // get arguments
+ char *ifaddr = NULL;
+ ifaddr = argv_find (argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL;
+
/* According to the semantics we are mimicking "no ip ospf cost N" is
* always treated as "no ip ospf cost" regardless of the actual value
- * of N already configured for the interface. Thus the first argument
- * is always checked to be a number, but is ignored after that.
- */
- cost = strtol (argv[4]->arg, NULL, 10);
- if (cost < 1 || cost > 65535)
- {
- vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
+ * of N already configured for the interface. Thus ignore cost. */
- if (argc == 2)
+ if (ifaddr)
{
- ret = inet_aton(argv[1], &addr);
- if (!ret)
+ if (!inet_aton(ifaddr, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
VTY_NEWLINE);
return CMD_SUCCESS;
}
-
-
+DEFUN_HIDDEN (no_ospf_cost,
+ no_ospf_cost_cmd,
+ "no ospf cost [(1-65535)] [A.B.C.D]",
+ NO_STR
+ "OSPF interface commands\n"
+ "Interface cost\n"
+ "Cost\n"
+ "Address of interface\n")
+{
+ return no_ip_ospf_cost (self, vty, argc, argv);
+}
static void
ospf_nbr_timer_update (struct ospf_interface *oi)
return CMD_SUCCESS;
}
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "ip ospf dead-interval <1-65535>",
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Interval after which a neighbor is declared dead\n"
- * "Seconds\n"
- *
- */
DEFUN (ip_ospf_dead_interval,
- ip_ospf_dead_interval_addr_cmd,
- "ip ospf dead-interval (1-65535) A.B.C.D",
+ ip_ospf_dead_interval_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"
+ "Interval time after which a neighbor is declared down\n"
"Seconds\n"
"Address of interface\n")
{
- if (argc == 2)
- return ospf_vty_dead_interval_set (vty, argv[3]->arg, argv[4]->arg, NULL);
- else
- return ospf_vty_dead_interval_set (vty, argv[3]->arg, NULL, NULL);
+ int idx = 0;
+ char *interval = argv_find (argv, argc, "(1-65535)", &idx) ? argv[idx]->arg : NULL;
+ char *ifaddr = argv_find (argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL;
+ return ospf_vty_dead_interval_set (vty, interval, ifaddr, NULL);
}
-ALIAS_HIDDEN (ip_ospf_dead_interval,
+DEFUN_HIDDEN (ospf_dead_interval,
ospf_dead_interval_cmd,
- "ospf dead-interval <1-65535>",
+ "ospf dead-interval (1-65535) [A.B.C.D]",
"OSPF interface commands\n"
- "Interval after which a neighbor is declared dead\n"
- "Seconds\n")
+ "Interval time after which a neighbor is declared down\n"
+ "Seconds\n"
+ "Address of interface\n")
+{
+ return ip_ospf_dead_interval (self, vty, argc, argv);
+}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "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 (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 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"
+ "Interval time after which a neighbor is declared down\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[6]->arg, argv[5]->arg);
+ int idx_number = 5;
+ int idx_ipv4 = 6;
+ if (argc == 7)
+ return ospf_vty_dead_interval_set (vty, NULL, argv[idx_ipv4]->arg, argv[idx_number]->arg);
else
- return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[5]->arg);
+ return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[idx_number]->arg);
}
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ospf dead-interval",
- * NO_STR
- * "OSPF interface commands\n"
- * "Interval after which a neighbor is declared dead\n"
- *
- * "no ip ospf dead-interval minimal hello-multiplier <1-10>",
- * NO_STR
- * "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"
- *
- * "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"
- *
- * "no ip ospf dead-interval",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Interval after which a neighbor is declared dead\n"
- *
- * "no ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D",
- * NO_STR
- * "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"
- *
- */
DEFUN (no_ip_ospf_dead_interval,
- no_ip_ospf_dead_interval_addr_cmd,
- "no ip ospf dead-interval (1-65535) A.B.C.D",
+ no_ip_ospf_dead_interval_cmd,
+ "no ip ospf dead-interval [<(1-65535)|minimal hello-multiplier (1-10)> [A.B.C.D]]",
NO_STR
"IP Information\n"
"OSPF interface commands\n"
- "Interval after which a neighbor is declared dead\n"
+ "Interval time after which a neighbor is declared down\n"
"Seconds\n"
"Address of interface")
{
+ int idx_ipv4 = argc - 1;
struct interface *ifp = vty->index;
struct in_addr addr;
int ret;
ifp = vty->index;
params = IF_DEF_PARAMS (ifp);
- if (argc == 2)
+ if (argv[idx_ipv4]->type == IPV4_TKN)
{
- ret = inet_aton(argv[5]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
return CMD_SUCCESS;
}
+DEFUN_HIDDEN (no_ospf_dead_interval,
+ no_ospf_dead_interval_cmd,
+ "no ospf dead-interval [<(1-65535)|minimal hello-multiplier (1-10)> [A.B.C.D]]",
+ NO_STR
+ "OSPF interface commands\n"
+ "Interval time after which a neighbor is declared down\n"
+ "Seconds\n"
+ "Address of interface")
+{
+ return no_ip_ospf_dead_interval (self, vty, argc, argv);
+}
-
-
-
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "ip ospf hello-interval <1-65535>",
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Time between HELLO packets\n"
- * "Seconds\n"
- *
- */
DEFUN (ip_ospf_hello_interval,
- ip_ospf_hello_interval_addr_cmd,
- "ip ospf hello-interval (1-65535) A.B.C.D",
+ ip_ospf_hello_interval_cmd,
+ "ip ospf hello-interval (1-65535) [A.B.C.D]",
"IP Information\n"
"OSPF interface commands\n"
"Time between HELLO packets\n"
"Seconds\n"
- "Address of interface")
+ "Address of interface\n")
{
+ int idx = 0;
struct interface *ifp = vty->index;
- u_int32_t seconds;
struct in_addr addr;
- int ret;
struct ospf_if_params *params;
-
params = IF_DEF_PARAMS (ifp);
+ u_int32_t seconds = 0;
- seconds = strtol (argv[3]->arg, NULL, 10);
+ argv_find (argv, argc, "(1-65535)", &idx);
+ seconds = strtol (argv[idx]->arg, NULL, 10);
- /* HelloInterval range is <1-65535>. */
- if (seconds < 1 || seconds > 65535)
- {
- vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- if (argc == 2)
+ if (argv_find (argv, argc, "A.B.C.D", &idx))
{
- ret = inet_aton(argv[4]->arg, &addr);
- if (!ret)
+ if(!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
VTY_NEWLINE);
return CMD_SUCCESS;
}
-
-ALIAS_HIDDEN (ip_ospf_hello_interval,
+DEFUN_HIDDEN (ospf_hello_interval,
ospf_hello_interval_cmd,
- "ospf hello-interval <1-65535>",
+ "ospf hello-interval (1-65535) [A.B.C.D]",
"OSPF interface commands\n"
"Time between HELLO packets\n"
- "Seconds\n")
+ "Seconds\n"
+ "Address of interface\n")
+{
+ return ip_ospf_hello_interval (self, vty, argc, argv);
+}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ip ospf hello-interval <1-65535>",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Time between HELLO packets\n"
- * "Seconds\n"
- *
- * "no ip ospf hello-interval",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Time between HELLO packets\n"
- *
- * "no ospf hello-interval <1-65535>",
- * NO_STR
- * "OSPF interface commands\n"
- * "Time between HELLO packets\n"
- * "Seconds\n"
- *
- */
DEFUN (no_ip_ospf_hello_interval,
- no_ip_ospf_hello_interval_addr_cmd,
- "no ip ospf hello-interval (1-65535) A.B.C.D",
+ no_ip_ospf_hello_interval_cmd,
+ "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"
+ "Time between HELLO packets\n" // ignored
"Seconds\n"
- "Address of interface")
+ "Address of interface\n")
{
+ int idx = 0;
struct interface *ifp = vty->index;
struct in_addr addr;
- int ret;
struct ospf_if_params *params;
-
- ifp = vty->index;
params = IF_DEF_PARAMS (ifp);
- if (argc == 2)
+ if (argv_find (argv, argc, "A.B.C.D", &idx))
{
- ret = inet_aton(argv[5]->arg, &addr);
- if (!ret)
+ if(!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
VTY_NEWLINE);
return CMD_SUCCESS;
}
-
-
+DEFUN_HIDDEN (no_ospf_hello_interval,
+ no_ospf_hello_interval_cmd,
+ "no ospf hello-interval [(1-65535) [A.B.C.D]]",
+ NO_STR
+ "OSPF interface commands\n"
+ "Time between HELLO packets\n" // ignored
+ "Seconds\n"
+ "Address of interface\n")
+{
+ return no_ip_ospf_hello_interval (self, vty, argc, argv);
+}
DEFUN (ip_ospf_network,
ip_ospf_network_cmd,
"Specify OSPF point-to-multipoint network\n"
"Specify OSPF point-to-point network\n")
{
+ int idx = 0;
struct interface *ifp = vty->index;
int old_type = IF_DEF_PARAMS (ifp)->type;
struct route_node *rn;
return CMD_WARNING;
}
- if (strncmp (argv[3]->arg, "b", 1) == 0)
+ if (argv_find (argv, argc, "broadcast", &idx))
IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
- else if (strncmp (argv[3]->arg, "n", 1) == 0)
+ else if (argv_find (argv, argc, "non-broadcast", &idx))
IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA;
- else if (strncmp (argv[3]->arg, "point-to-m", 10) == 0)
+ else if (argv_find (argv, argc, "point-to-multipoint", &idx))
IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT;
- else if (strncmp (argv[3]->arg, "point-to-p", 10) == 0)
+ else if (argv_find (argv, argc, "point-to-point", &idx))
IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT;
if (IF_DEF_PARAMS (ifp)->type == old_type)
return CMD_SUCCESS;
}
-ALIAS_HIDDEN (ip_ospf_network,
+DEFUN_HIDDEN (ospf_network,
ospf_network_cmd,
- "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
+ "ospf network <broadcast|non-broadcast|point-to-multipoint|point-to-point>",
"OSPF interface commands\n"
"Network type\n"
"Specify OSPF broadcast multi-access network\n"
"Specify OSPF NBMA network\n"
"Specify OSPF point-to-multipoint network\n"
"Specify OSPF point-to-point network\n")
+{
+ return ip_ospf_network (self, vty, argc, argv);
+}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
- * NO_STR
- * "OSPF interface commands\n"
- * "Network type\n"
- * "Specify OSPF broadcast multi-access network\n"
- * "Specify OSPF NBMA network\n"
- * "Specify OSPF point-to-multipoint network\n"
- * "Specify OSPF point-to-point network\n"
- *
- * "no ospf network",
- * NO_STR
- * "OSPF interface commands\n"
- * "Network type\n"
- *
- * "no ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Network type\n"
- * "Specify OSPF broadcast multi-access network\n"
- * "Specify OSPF NBMA network\n"
- * "Specify OSPF point-to-multipoint network\n"
- * "Specify OSPF point-to-point network\n"
- *
- */
DEFUN (no_ip_ospf_network,
no_ip_ospf_network_cmd,
- "no ip ospf network",
+ "no ip ospf network [<broadcast|non-broadcast|point-to-multipoint|point-to-point>]",
NO_STR
"IP Information\n"
"OSPF interface commands\n"
- "Network type\n")
+ "Network type\n"
+ "Specify OSPF broadcast multi-access network\n"
+ "Specify OSPF NBMA network\n"
+ "Specify OSPF point-to-multipoint network\n"
+ "Specify OSPF point-to-point network\n")
{
struct interface *ifp = vty->index;
int old_type = IF_DEF_PARAMS (ifp)->type;
if (!oi)
continue;
-
+
oi->type = IF_DEF_PARAMS (ifp)->type;
-
+
if (oi->state > ISM_Down)
{
OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown);
return CMD_SUCCESS;
}
+DEFUN_HIDDEN (no_ospf_network,
+ no_ospf_network_cmd,
+ "no ospf network [<broadcast|non-broadcast|point-to-multipoint|point-to-point>]",
+ NO_STR
+ "OSPF interface commands\n"
+ "Network type\n"
+ "Specify OSPF broadcast multi-access network\n"
+ "Specify OSPF NBMA network\n"
+ "Specify OSPF point-to-multipoint network\n"
+ "Specify OSPF point-to-point network\n")
+{
+ return no_ip_ospf_network (self, vty, argc, argv);
+}
-
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "ip ospf priority <0-255>",
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Router priority\n"
- * "Priority\n"
- *
- */
DEFUN (ip_ospf_priority,
- ip_ospf_priority_addr_cmd,
- "ip ospf priority (0-255) A.B.C.D",
+ ip_ospf_priority_cmd,
+ "ip ospf priority (0-255) [A.B.C.D]",
"IP Information\n"
"OSPF interface commands\n"
"Router priority\n"
"Priority\n"
"Address of interface")
{
+ int idx = 0;
struct interface *ifp = vty->index;
long priority;
struct route_node *rn;
struct in_addr addr;
- int ret;
struct ospf_if_params *params;
-
params = IF_DEF_PARAMS (ifp);
- priority = strtol (argv[3]->arg, NULL, 10);
-
- /* Router Priority range is <0-255>. */
- if (priority < 0 || priority > 255)
- {
- vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
+ argv_find (argv, argc, "(0-255)", &idx);
+ priority = strtol (argv[idx]->arg, NULL, 10);
- if (argc == 2)
+ if (argv_find (argv, argc, "A.B.C.D", &idx))
{
- ret = inet_aton(argv[4]->arg, &addr);
- if (!ret)
+ if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
VTY_NEWLINE);
params = ospf_get_if_params (ifp, addr);
ospf_if_update_params (ifp, addr);
}
-
+
SET_IF_PARAM (params, priority);
params->priority = priority;
for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
{
struct ospf_interface *oi = rn->info;
-
+
if (!oi)
continue;
-
if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority))
{
OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange);
}
}
-
+
return CMD_SUCCESS;
}
-
-ALIAS_HIDDEN (ip_ospf_priority,
+DEFUN_HIDDEN (ospf_priority,
ospf_priority_cmd,
- "ospf priority <0-255>",
+ "ospf priority (0-255) [A.B.C.D]",
"OSPF interface commands\n"
"Router priority\n"
"Priority\n")
+{
+ return ip_ospf_priority (self, vty, argc, argv);
+}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ip ospf priority",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Router priority\n"
- *
- * "no ip ospf priority <0-255>",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Router priority\n"
- * "Priority\n"
- *
- * "no ospf priority <0-255>",
- * NO_STR
- * "OSPF interface commands\n"
- * "Router priority\n"
- * "Priority\n"
- *
- */
DEFUN (no_ip_ospf_priority,
- no_ip_ospf_priority_addr_cmd,
- "no ip ospf priority (0-255) A.B.C.D",
+ no_ip_ospf_priority_cmd,
+ "no ip ospf priority [(0-255) [A.B.C.D]]",
NO_STR
"IP Information\n"
"OSPF interface commands\n"
- "Router priority\n"
+ "Router priority\n" // ignored
"Priority\n"
"Address of interface")
{
+ int idx = 0;
struct interface *ifp = vty->index;
struct route_node *rn;
struct in_addr addr;
- int ret;
struct ospf_if_params *params;
ifp = vty->index;
params = IF_DEF_PARAMS (ifp);
- if (argc == 2)
+ if (argv_find (argv, argc, "A.B.C.D", &idx))
{
- ret = inet_aton(argv[5]->arg, &addr);
- if (!ret)
+ if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
VTY_NEWLINE);
if (!oi)
continue;
-
if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority))
{
PRIORITY (oi) = OSPF_IF_PARAM (oi, priority);
return CMD_SUCCESS;
}
+DEFUN_HIDDEN (no_ospf_priority,
+ no_ospf_priority_cmd,
+ "no ospf priority [(0-255) [A.B.C.D]]",
+ NO_STR
+ "OSPF interface commands\n"
+ "Router priority\n"
+ "Priority\n"
+ "Address of interface")
+{
+ return no_ip_ospf_priority (self, vty, argc, argv);
+}
-
-
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "ip ospf retransmit-interval <3-65535>",
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Time between retransmitting lost link state advertisements\n"
- * "Seconds\n"
- *
- */
DEFUN (ip_ospf_retransmit_interval,
ip_ospf_retransmit_interval_addr_cmd,
- "ip ospf retransmit-interval (3-65535) A.B.C.D",
+ "ip ospf retransmit-interval (3-65535) [A.B.C.D]",
"IP Information\n"
"OSPF interface commands\n"
"Time between retransmitting lost link state advertisements\n"
"Seconds\n"
"Address of interface")
{
+ int idx = 0;
struct interface *ifp = vty->index;
u_int32_t seconds;
struct in_addr addr;
- int ret;
struct ospf_if_params *params;
-
params = IF_DEF_PARAMS (ifp);
- seconds = strtol (argv[3]->arg, NULL, 10);
-
- /* Retransmit Interval range is <3-65535>. */
- if (seconds < 3 || seconds > 65535)
- {
- vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
+ argv_find (argv, argc, "(3-65535)", &idx);
+ seconds = strtol (argv[idx]->arg, NULL, 10);
- if (argc == 2)
+ if (argv_find (argv, argc, "A.B.C.D", &idx))
{
- ret = inet_aton(argv[4]->arg, &addr);
- if (!ret)
+ if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
VTY_NEWLINE);
return CMD_SUCCESS;
}
-
-ALIAS_HIDDEN (ip_ospf_retransmit_interval,
+DEFUN_HIDDEN (ospf_retransmit_interval,
ospf_retransmit_interval_cmd,
- "ospf retransmit-interval <3-65535>",
+ "ospf retransmit-interval (3-65535) [A.B.C.D]",
"OSPF interface commands\n"
"Time between retransmitting lost link state advertisements\n"
"Seconds\n")
+{
+ return ip_ospf_retransmit_interval (self, vty, argc, argv);
+}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ip ospf retransmit-interval <3-65535> A.B.C.D",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Time between retransmitting lost link state advertisements\n"
- * "Seconds\n"
- * "Address of interface"
- *
- * "no ip ospf retransmit-interval",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Time between retransmitting lost link state advertisements\n"
- *
- * "no ospf retransmit-interval",
- * NO_STR
- * "OSPF interface commands\n"
- * "Time between retransmitting lost link state advertisements\n"
- *
- */
DEFUN (no_ip_ospf_retransmit_interval,
no_ip_ospf_retransmit_interval_addr_cmd,
- "no ip ospf retransmit-interval A.B.C.D",
+ "no ip ospf retransmit-interval [(3-65535)] [A.B.C.D]",
NO_STR
"IP Information\n"
"OSPF interface commands\n"
- "Time between retransmitting lost link state advertisements\n"
- "Address of interface")
+ "Time between retransmitting lost link state advertisements\n" //ignored
+ "Address of interface\n")
{
+ int idx = 0;
struct interface *ifp = vty->index;
struct in_addr addr;
- int ret;
struct ospf_if_params *params;
- int addr_index;
-
+
ifp = vty->index;
params = IF_DEF_PARAMS (ifp);
- if (argc >= 1)
+ if (argv_find (argv, argc, "A.B.C.D", &idx))
{
- if (argc == 1)
- addr_index = 0;
- else
- addr_index = 1;
-
- ret = inet_aton(argv[addr_index], &addr);
- if (!ret)
+ if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
VTY_NEWLINE);
return CMD_SUCCESS;
}
-
-
-
-DEFUN (no_ip_ospf_retransmit_interval_sec,
- no_ip_ospf_retransmit_interval_sec_cmd,
- "no ip ospf retransmit-interval (3-65535)",
+DEFUN_HIDDEN (no_ospf_retransmit_interval,
+ no_ospf_retransmit_interval_cmd,
+ "no ospf retransmit-interval [(3-65535)] [A.B.C.D]",
NO_STR
- "IP Information\n"
"OSPF interface commands\n"
- "Time between retransmitting lost link state advertisements\n"
- "Seconds\n")
+ "Time between retransmitting lost link state advertisements\n")
{
- struct interface *ifp = vty->index;
- struct ospf_if_params *params;
-
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
-
- UNSET_IF_PARAM (params, retransmit_interval);
- params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
-
- return CMD_SUCCESS;
+ return no_ip_ospf_retransmit_interval (self, vty, argc, argv);
}
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "ip ospf transmit-delay <1-65535>",
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Link state transmit delay\n"
- * "Seconds\n"
- *
- */
DEFUN (ip_ospf_transmit_delay,
ip_ospf_transmit_delay_addr_cmd,
- "ip ospf transmit-delay (1-65535) A.B.C.D",
+ "ip ospf transmit-delay (1-65535) [A.B.C.D]",
"IP Information\n"
"OSPF interface commands\n"
"Link state transmit delay\n"
"Seconds\n"
"Address of interface")
{
+ int idx = 0;
struct interface *ifp = vty->index;
u_int32_t seconds;
struct in_addr addr;
- int ret;
struct ospf_if_params *params;
-
- params = IF_DEF_PARAMS (ifp);
- seconds = strtol (argv[3]->arg, NULL, 10);
- /* Transmit Delay range is <1-65535>. */
- if (seconds < 1 || seconds > 65535)
- {
- vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
+ params = IF_DEF_PARAMS (ifp);
+ argv_find (argv, argc, "(1-65535)", &idx);
+ seconds = strtol (argv[idx]->arg, NULL, 10);
- if (argc == 2)
+ if (argv_find (argv, argc, "A.B.C.D", &idx))
{
- ret = inet_aton(argv[4]->arg, &addr);
- if (!ret)
+ if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
VTY_NEWLINE);
ospf_if_update_params (ifp, addr);
}
- SET_IF_PARAM (params, transmit_delay);
+ SET_IF_PARAM (params, transmit_delay);
params->transmit_delay = seconds;
return CMD_SUCCESS;
}
-
-ALIAS_HIDDEN (ip_ospf_transmit_delay,
+DEFUN_HIDDEN (ospf_transmit_delay,
ospf_transmit_delay_cmd,
- "ospf transmit-delay <1-65535>",
+ "ospf transmit-delay (1-65535) [A.B.C.D]",
"OSPF interface commands\n"
"Link state transmit delay\n"
"Seconds\n")
+{
+ return ip_ospf_transmit_delay (self, vty, argc, argv);
+}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ospf transmit-delay",
- * NO_STR
- * "OSPF interface commands\n"
- * "Link state transmit delay\n"
- *
- * "no ip ospf transmit-delay",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Link state transmit delay\n"
- *
- * "no ip ospf transmit-delay <1-65535> A.B.C.D",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Link state transmit delay\n"
- * "Seconds\n"
- * "Address of interface"
- *
- */
DEFUN (no_ip_ospf_transmit_delay,
no_ip_ospf_transmit_delay_addr_cmd,
- "no ip ospf transmit-delay A.B.C.D",
+ "no ip ospf transmit-delay [(1-65535)] [A.B.C.D]",
NO_STR
"IP Information\n"
"OSPF interface commands\n"
"Link state transmit delay\n"
"Address of interface")
{
+ int idx = 0;
struct interface *ifp = vty->index;
struct in_addr addr;
- int ret;
struct ospf_if_params *params;
- int addr_index;
ifp = vty->index;
params = IF_DEF_PARAMS (ifp);
- if (argc >= 1)
+ if (argv_find (argv, argc, "A.B.C.D", &idx))
{
- if (argc == 1)
- addr_index = 0;
- else
- addr_index = 1;
-
- ret = inet_aton(argv[addr_index], &addr);
- if (!ret)
+ if (!inet_aton(argv[idx]->arg, &addr))
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
VTY_NEWLINE);
}
-
-
-DEFUN (no_ip_ospf_transmit_delay_sec,
- no_ip_ospf_transmit_delay_sec_cmd,
- "no ip ospf transmit-delay (1-65535)",
- NO_STR
- "IP Information\n"
- "OSPF interface commands\n"
- "Link state transmit delay\n"
- "Seconds\n"
- "Address of interface")
+DEFUN_HIDDEN (no_ospf_transmit_delay,
+ no_ospf_transmit_delay_cmd,
+ "no ospf transmit-delay",
+ NO_STR
+ "OSPF interface commands\n"
+ "Link state transmit delay\n")
{
- struct interface *ifp = vty->index;
- struct ospf_if_params *params;
-
- ifp = vty->index;
- params = IF_DEF_PARAMS (ifp);
-
- UNSET_IF_PARAM (params, transmit_delay);
- params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
-
- return CMD_SUCCESS;
+ return no_ip_ospf_transmit_delay (self, vty, argc, argv);
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "ip ospf <1-65535> area (A.B.C.D|<0-4294967295>)",
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Instance ID\n"
- * "Enable OSPF on this interface\n"
- * "OSPF area ID in IP address format\n"
- * "OSPF area ID as a decimal value\n"
- *
- */
DEFUN (ip_ospf_area,
ip_ospf_area_cmd,
- "ip ospf area <A.B.C.D|(0-4294967295)>",
+ "ip ospf [(1-65535)] area <A.B.C.D|(0-4294967295)>",
"IP Information\n"
"OSPF interface commands\n"
+ "Instance ID\n"
"Enable OSPF on this interface\n"
"OSPF area ID in IP address format\n"
"OSPF area ID as a decimal value\n")
{
+ int idx = 0;
struct interface *ifp = vty->index;
int format, ret;
struct in_addr area_id;
struct route_node *rn;
u_short instance = 0;
- if (argc == 2)
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ if (argv_find (argv, argc, "(1-65535)", &idx))
+ instance = strtol (argv[idx]->arg, NULL, 10);
+ char *areaid = argv[argc - 1]->arg;
ospf = ospf_lookup_instance (instance);
if (ospf == NULL)
return CMD_SUCCESS;
}
- ret = ospf_str2area_id (argv[instance ? 1 : 0], &area_id, &format);
+ ret = ospf_str2area_id (areaid, &area_id, &format);
if (ret < 0)
{
vty_out (vty, "Please specify area by A.B.C.D|<0-4294967295>%s",
return CMD_SUCCESS;
}
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ip ospf area (A.B.C.D|<0-4294967295>)",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Disable OSPF on this interface\n"
- * "OSPF area ID in IP address format\n"
- * "OSPF area ID as a decimal value\n"
- *
- */
DEFUN (no_ip_ospf_area,
no_ip_ospf_area_cmd,
- "no ip ospf area",
- NO_STR
- "IP Information\n"
- "OSPF interface commands\n"
- "Disable OSPF on this interface\n")
-{
- struct interface *ifp = vty->index;
- struct ospf *ospf;
- struct ospf_if_params *params;
- u_short instance = 0;
-
- if ((ospf = ospf_lookup_instance (instance)) == NULL)
- return CMD_SUCCESS;
-
- params = IF_DEF_PARAMS (ifp);
- if (!OSPF_IF_PARAM_CONFIGURED(params, if_area))
- {
- vty_out (vty, "Can't find specified inteface area configuration.%s", VTY_NEWLINE);
- return CMD_WARNING;
- }
-
- ospf_interface_unset (ifp);
- ospf->if_ospf_cli_count--;
- return CMD_SUCCESS;
-}
-
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ip ospf <1-65535> area (A.B.C.D|<0-4294967295>)",
- * NO_STR
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Instance ID\n"
- * "Disable OSPF on this interface\n"
- * "OSPF area ID in IP address format\n"
- * "OSPF area ID as a decimal value\n"
- *
- */
-DEFUN (no_ip_ospf_instance_area,
- no_ip_ospf_instance_area_cmd,
- "no ip ospf (1-65535) area",
+ "no ip ospf [(1-65535)] area [<A.B.C.D|(0-4294967295)>]",
NO_STR
"IP Information\n"
"OSPF interface commands\n"
- "Instance ID\n"
- "Disable OSPF on this interface\n")
+ "Disable OSPF on this interface\n"
+ "OSPF area ID in IP address format\n"
+ "OSPF area ID as a decimal value\n")
{
+ int idx = 0;
struct interface *ifp = vty->index;
struct ospf *ospf;
struct ospf_if_params *params;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ if (argv_find (argv, argc, "(1-65535)", &idx))
+ instance = strtol (argv[idx]->arg, NULL, 10);
if ((ospf = ospf_lookup_instance (instance)) == NULL)
return CMD_SUCCESS;
params = IF_DEF_PARAMS (ifp);
if (!OSPF_IF_PARAM_CONFIGURED(params, if_area))
{
- vty_out (vty, "Can't find specified inteface area configuration.%s", VTY_NEWLINE);
+ vty_out (vty, "Can't find specified interface area configuration.%s", VTY_NEWLINE);
return CMD_WARNING;
}
return CMD_SUCCESS;
}
-
DEFUN (ospf_redistribute_source,
ospf_redistribute_source_cmd,
- "redistribute " QUAGGA_REDIST_STR_OSPFD " [metric (0-16777214)|metric-type <1|2>|route-map WORD]",
+ "redistribute <kernel|connected|static|rip|isis|bgp|pim|table> [<metric (0-16777214)|metric-type (1-2)|route-map WORD>]",
REDIST_STR
QUAGGA_REDIST_HELP_STR_OSPFD
"Metric for redistributed routes\n"
"Route map reference\n"
"Pointer to route-map entries\n")
{
+ int idx_protocol = 1;
+ int idx_redist_param = 2;
struct ospf *ospf = vty->index;
int source;
int type = -1;
return CMD_SUCCESS;
/* Get distribute source. */
- source = proto_redistnum(AFI_IP, argv[1]->arg);
+ source = proto_redistnum(AFI_IP, argv[idx_protocol]->arg);
if (source < 0 || source == ZEBRA_ROUTE_OSPF)
return CMD_WARNING;
/* Get metric value. */
- if (argv[2]->arg != NULL)
- if (!str2metric (argv[2]->arg, &metric))
+ if (strcmp (argv[idx_redist_param]->arg, "metric") == 0)
+ if (!str2metric (argv[idx_redist_param+1]->arg, &metric))
return CMD_WARNING;
/* Get metric type. */
- if (argv[2] != NULL)
- if (!str2metric_type (argv[2], &type))
+ if (strcmp (argv[idx_redist_param]->arg, "metric-type") == 0)
+ if (!str2metric_type (argv[idx_redist_param+1]->arg, &type))
return CMD_WARNING;
red = ospf_redist_add(ospf, source, 0);
- if (argv[3] != NULL)
- ospf_routemap_set (red, argv[3]);
+ if (strcmp (argv[idx_redist_param]->arg, "route-map") == 0)
+ ospf_routemap_set (red, argv[idx_redist_param+1]->arg);
else
ospf_routemap_unset (red);
DEFUN (no_ospf_redistribute_source,
no_ospf_redistribute_source_cmd,
- "no redistribute " QUAGGA_REDIST_STR_OSPFD " [metric (0-16777214)|metric-type <1|2>|route-map WORD]",
+ "no redistribute <kernel|connected|static|rip|isis|bgp|pim|table> [<metric (0-16777214)|metric-type (1-2)|route-map WORD>]",
NO_STR
REDIST_STR
QUAGGA_REDIST_HELP_STR_OSPFD
"Route map reference\n"
"Pointer to route-map entries\n")
{
+ int idx_protocol = 2;
struct ospf *ospf = vty->index;
int source;
struct ospf_redist *red;
if (!ospf)
return CMD_SUCCESS;
- source = proto_redistnum(AFI_IP, argv[2]->arg);
+ source = proto_redistnum(AFI_IP, argv[idx_protocol]->arg);
if (source < 0 || source == ZEBRA_ROUTE_OSPF)
return CMD_WARNING;
DEFUN (ospf_redistribute_instance_source,
ospf_redistribute_instance_source_cmd,
- "redistribute <ospf|table> (1-65535) [metric (0-16777214)|metric-type <1|2>|route-map WORD]",
+ "redistribute <ospf|table> (1-65535) [<metric (0-16777214)|metric-type (1-2)|route-map WORD>]",
REDIST_STR
"Open Shortest Path First\n"
"Non-main Kernel Routing Table\n"
"Route map reference\n"
"Pointer to route-map entries\n")
{
+ int idx_ospf_table = 1;
+ int idx_number = 2;
+ int idx_redist_param = 3;
struct ospf *ospf = vty->index;
int source;
int type = -1;
if (!ospf)
return CMD_SUCCESS;
- if (strncmp(argv[1]->arg, "o", 1) == 0)
+ if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
source = ZEBRA_ROUTE_OSPF;
else
source = ZEBRA_ROUTE_TABLE;
- VTY_GET_INTEGER ("Instance ID", instance, argv[2]->arg);
+ VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg);
if (!ospf)
return CMD_SUCCESS;
}
/* Get metric value. */
- if (argv[3]->arg != NULL)
- if (!str2metric (argv[3]->arg, &metric))
+ if (strcmp (argv[idx_redist_param]->arg, "metric") == 0)
+ if (!str2metric (argv[idx_redist_param+1]->arg, &metric))
return CMD_WARNING;
/* Get metric type. */
- if (argv[3] != NULL)
- if (!str2metric_type (argv[3], &type))
+ if (strcmp (argv[idx_redist_param]->arg, "metric-type") == 0)
+ if (!str2metric_type (argv[idx_redist_param+1]->arg, &type))
return CMD_WARNING;
red = ospf_redist_add(ospf, source, instance);
- if (argv[4] != NULL)
- ospf_routemap_set (red, argv[4]);
+
+ if (strcmp (argv[idx_redist_param]->arg, "route-map") == 0)
+ ospf_routemap_set (red, argv[idx_redist_param+1]->arg);
else
ospf_routemap_unset (red);
DEFUN (no_ospf_redistribute_instance_source,
no_ospf_redistribute_instance_source_cmd,
- "no redistribute <ospf|table> (1-65535) [metric (0-16777214)|metric-type <1|2>|route-map WORD]",
+ "no redistribute <ospf|table> (1-65535) [<metric (0-16777214)|metric-type (1-2)|route-map WORD>]",
NO_STR
REDIST_STR
"Open Shortest Path First\n"
"Route map reference\n"
"Pointer to route-map entries\n")
{
+ int idx_ospf_table = 2;
+ int idx_number = 3;
struct ospf *ospf = vty->index;
u_int instance;
struct ospf_redist *red;
if (!ospf)
return CMD_SUCCESS;
- if (strncmp(argv[2]->arg, "o", 1) == 0)
+ if (strncmp(argv[idx_ospf_table]->arg, "o", 1) == 0)
source = ZEBRA_ROUTE_OSPF;
else
source = ZEBRA_ROUTE_TABLE;
- VTY_GET_INTEGER ("Instance ID", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance ID", instance, argv[idx_number]->arg);
if ((source == ZEBRA_ROUTE_OSPF) && !ospf->instance)
{
DEFUN (ospf_distribute_list_out,
ospf_distribute_list_out_cmd,
- "distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD,
+ "distribute-list WORD out <kernel|connected|static|rip|isis|bgp|pim|table>",
"Filter networks in routing updates\n"
"Access-list name\n"
OUT_STR
QUAGGA_REDIST_HELP_STR_OSPFD)
{
+ int idx_word = 1;
struct ospf *ospf = vty->index;
int source;
if (source < 0 || source == ZEBRA_ROUTE_OSPF)
return CMD_WARNING;
- return ospf_distribute_list_out_set (ospf, source, argv[1]->arg);
+ return ospf_distribute_list_out_set (ospf, source, argv[idx_word]->arg);
}
DEFUN (no_ospf_distribute_list_out,
no_ospf_distribute_list_out_cmd,
- "no distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD,
+ "no distribute-list WORD out <kernel|connected|static|rip|isis|bgp|pim|table>",
NO_STR
"Filter networks in routing updates\n"
"Access-list name\n"
OUT_STR
QUAGGA_REDIST_HELP_STR_OSPFD)
{
+ int idx_word = 2;
struct ospf *ospf = vty->index;
int source;
if (source < 0 || source == ZEBRA_ROUTE_OSPF)
return CMD_WARNING;
- return ospf_distribute_list_out_unset (ospf, source, argv[2]->arg);
+ return ospf_distribute_list_out_unset (ospf, source, argv[idx_word]->arg);
}
/* Default information originate. */
DEFUN (ospf_default_information_originate,
ospf_default_information_originate_cmd,
- "default-information originate [always|metric (0-16777214)|metric-type <1|2>|route-map WORD]",
+ "default-information originate [<always|metric (0-16777214)|metric-type (1-2)|route-map WORD>]",
"Control distribution of default information\n"
"Distribute a default route\n"
"Always advertise default route\n"
"Route map reference\n"
"Pointer to route-map entries\n")
{
+ int idx_redist_param = 2;
struct ospf *ospf = vty->index;
int default_originate = DEFAULT_ORIGINATE_ZEBRA;
int type = -1;
return CMD_WARNING; /* this should not happen */
/* Check whether "always" was specified */
- if (argv[2]->arg != NULL)
+ if (argv[idx_redist_param]->arg != NULL)
default_originate = DEFAULT_ORIGINATE_ALWAYS;
red = ospf_redist_add(ospf, DEFAULT_ROUTE, 0);
/* Get metric value. */
- if (argv[1] != NULL)
- if (!str2metric (argv[1], &metric))
+ if (strcmp (argv[idx_redist_param]->arg, "metric") == 0)
+ if (!str2metric (argv[idx_redist_param+1]->arg, &metric))
return CMD_WARNING;
/* Get metric type. */
- if (argv[2] != NULL)
- if (!str2metric_type (argv[2], &type))
+ if (strcmp (argv[idx_redist_param]->arg, "metric-type") == 0)
+ if (!str2metric_type (argv[idx_redist_param+1]->arg, &type))
return CMD_WARNING;
- if (argv[3] != NULL)
- ospf_routemap_set (red, argv[3]);
+ if (strcmp (argv[idx_redist_param]->arg, "route-map") == 0)
+ ospf_routemap_set (red, argv[idx_redist_param+1]->arg);
else
ospf_routemap_unset (red);
DEFUN (no_ospf_default_information_originate,
no_ospf_default_information_originate_cmd,
- "no default-information originate [always|metric (0-16777214)|metric-type <1|2>|route-map WORD]",
+ "no default-information originate [<always|metric (0-16777214)|metric-type (1-2)|route-map WORD>]",
NO_STR
"Control distribution of default information\n"
"Distribute a default route\n"
"Set metric of redistributed routes\n"
"Default metric\n")
{
+ int idx_number = 1;
struct ospf *ospf = vty->index;
int metric = -1;
if (!ospf)
return CMD_SUCCESS;
- if (!str2metric (argv[1]->arg, &metric))
+ if (!str2metric (argv[idx_number]->arg, &metric))
return CMD_WARNING;
ospf->default_metric = metric;
return CMD_SUCCESS;
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no default-metric <0-16777214>",
- * NO_STR
- * "Set metric of redistributed routes\n"
- * "Default metric\n"
- *
- */
DEFUN (no_ospf_default_metric,
no_ospf_default_metric_cmd,
- "no default-metric",
+ "no default-metric [(0-16777214)]",
NO_STR
- "Set metric of redistributed routes\n")
+ "Set metric of redistributed routes\n"
+ "Default metric\n")
{
struct ospf *ospf = vty->index;
"Define an administrative distance\n"
"OSPF Administrative distance\n")
{
+ int idx_number = 1;
struct ospf *ospf = vty->index;
if (!ospf)
return CMD_SUCCESS;
- ospf->distance_all = atoi (argv[1]->arg);
+ ospf->distance_all = atoi (argv[idx_number]->arg);
return CMD_SUCCESS;
}
DEFUN (no_ospf_distance_ospf,
no_ospf_distance_ospf_cmd,
- "no distance ospf [intra-area (1-255)|inter-area (1-255)|external (1-255)]",
+ "no distance ospf [<intra-area (1-255)|inter-area (1-255)|external (1-255)>]",
NO_STR
"Define an administrative distance\n"
"OSPF Administrative distance\n"
"External routes\n"
"Distance for external routes\n")
{
+ int idx_area_distance = 3;
struct ospf *ospf = vty->index;
if (!ospf)
if (!ospf)
return CMD_SUCCESS;
- if (argv[3]->arg != NULL)
+ if (argv[idx_area_distance]->arg != NULL)
ospf->distance_intra = 0;
if (argv[1] != NULL)
if (argv[2] != NULL)
ospf->distance_external = 0;
- if (argv[3]->arg || argv[1] || argv[2])
+ if (argv[idx_area_distance]->arg || argv[1] || argv[2])
return CMD_SUCCESS;
/* If no arguments are given, clear all distance information */
DEFUN (ospf_distance_ospf,
ospf_distance_ospf_cmd,
- "distance ospf [intra-area (1-255)|inter-area (1-255)|external (1-255)]",
+ "distance ospf [<intra-area (1-255)|inter-area (1-255)|external (1-255)>]",
"Define an administrative distance\n"
"OSPF Administrative distance\n"
"Intra-area routes\n"
"External routes\n"
"Distance for external routes\n")
{
+ int idx_area_distance = 2;
struct ospf *ospf = vty->index;
if (!ospf)
if (argc < 3) /* should not happen */
return CMD_WARNING;
- if (!argv[2]->arg && !argv[1] && !argv[2])
+ if (!argv[idx_area_distance]->arg && !argv[1] && !argv[2])
{
vty_out(vty, "%% Command incomplete. (Arguments required)%s",
VTY_NEWLINE);
return CMD_WARNING;
}
- if (argv[2]->arg != NULL)
- ospf->distance_intra = atoi(argv[2]->arg);
+ if (strcmp (argv[idx_area_distance]->text, "intra") == 0)
+ ospf->distance_intra = atoi(argv[idx_area_distance+1]->arg);
- if (argv[1] != NULL)
- ospf->distance_inter = atoi(argv[1]);
+ if (strcmp (argv[idx_area_distance]->text, "inter") == 0)
+ ospf->distance_inter = atoi(argv[idx_area_distance+1]->arg);
- if (argv[2] != NULL)
- ospf->distance_external = atoi(argv[2]);
+ if (strcmp (argv[idx_area_distance]->text, "external") == 0)
+ ospf->distance_external = atoi(argv[idx_area_distance+1]->arg);
return CMD_SUCCESS;
}
+#if 0
DEFUN (ospf_distance_source,
ospf_distance_source_cmd,
"distance (1-255) A.B.C.D/M",
"Distance value\n"
"IP source prefix\n")
{
+ int idx_number = 1;
+ int idx_ipv4_prefixlen = 2;
struct ospf *ospf = vty->index;
if (!ospf)
return CMD_SUCCESS;
- ospf_distance_set (vty, ospf, argv[1]->arg, argv[2]->arg, NULL);
+ ospf_distance_set (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, NULL);
return CMD_SUCCESS;
}
"Distance value\n"
"IP source prefix\n")
{
+ int idx_number = 2;
+ int idx_ipv4_prefixlen = 3;
struct ospf *ospf = vty->index;
if (!ospf)
return CMD_SUCCESS;
- ospf_distance_unset (vty, ospf, argv[2]->arg, argv[3]->arg, NULL);
+ ospf_distance_unset (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, NULL);
return CMD_SUCCESS;
}
"IP source prefix\n"
"Access list name\n")
{
+ int idx_number = 1;
+ int idx_ipv4_prefixlen = 2;
+ int idx_word = 3;
struct ospf *ospf = vty->index;
if (!ospf)
return CMD_SUCCESS;
- ospf_distance_set (vty, ospf, argv[1]->arg, argv[2]->arg, argv[3]->arg);
+ ospf_distance_set (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, argv[idx_word]->arg);
return CMD_SUCCESS;
}
"IP source prefix\n"
"Access list name\n")
{
+ int idx_number = 2;
+ int idx_ipv4_prefixlen = 3;
+ int idx_word = 4;
struct ospf *ospf = vty->index;
if (!ospf)
return CMD_SUCCESS;
- ospf_distance_unset (vty, ospf, argv[2]->arg, argv[3]->arg, argv[4]->arg);
+ ospf_distance_unset (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, argv[idx_word]->arg);
return CMD_SUCCESS;
}
+#endif
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "ip ospf mtu-ignore",
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Disable mtu mismatch detection\n"
- *
- */
DEFUN (ip_ospf_mtu_ignore,
ip_ospf_mtu_ignore_addr_cmd,
- "ip ospf mtu-ignore A.B.C.D",
+ "ip ospf mtu-ignore [A.B.C.D]",
"IP Information\n"
"OSPF interface commands\n"
- "Disable mtu mismatch detection\n"
+ "Disable MTU mismatch detection on this interface\n"
"Address of interface")
{
+ int idx_ipv4 = 3;
struct interface *ifp = vty->index;
struct in_addr addr;
int ret;
struct ospf_if_params *params;
params = IF_DEF_PARAMS (ifp);
- if (argc == 1)
+ if (argc == 4)
{
- ret = inet_aton(argv[3]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
return CMD_SUCCESS;
}
-
-
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no ip ospf mtu-ignore",
- * "IP Information\n"
- * "OSPF interface commands\n"
- * "Disable mtu mismatch detection\n"
- *
- */
DEFUN (no_ip_ospf_mtu_ignore,
no_ip_ospf_mtu_ignore_addr_cmd,
- "no ip ospf mtu-ignore A.B.C.D",
+ "no ip ospf mtu-ignore [A.B.C.D]",
"IP Information\n"
"OSPF interface commands\n"
- "Disable mtu mismatch detection\n"
+ "Disable MTU mismatch detection on this interface\n"
"Address of interface")
{
+ int idx_ipv4 = 4;
struct interface *ifp = vty->index;
struct in_addr addr;
int ret;
struct ospf_if_params *params;
params = IF_DEF_PARAMS (ifp);
- if (argc == 1)
+ if (argc == 5)
{
- ret = inet_aton(argv[4]->arg, &addr);
+ ret = inet_aton(argv[idx_ipv4]->arg, &addr);
if (!ret)
{
vty_out (vty, "Please specify interface address by A.B.C.D%s",
"Automatically advertise stub Router-LSA on startup of OSPF\n"
"Time (seconds) to advertise self as stub-router\n")
{
+ int idx_number = 3;
unsigned int seconds;
struct ospf *ospf = vty->index;
return CMD_WARNING;
}
- VTY_GET_INTEGER ("stub-router startup period", seconds, argv[3]->arg);
+ VTY_GET_INTEGER ("stub-router startup period", seconds, argv[idx_number]->arg);
ospf->stub_router_startup_time = seconds;
return CMD_SUCCESS;
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no max-metric router-lsa on-startup",
- * NO_STR
- * "OSPF maximum / infinite-distance metric\n"
- * "Advertise own Router-LSA with infinite distance (stub router)\n"
- * "Automatically advertise stub Router-LSA on startup of OSPF\n"
- *
- */
DEFUN (no_ospf_max_metric_router_lsa_startup,
no_ospf_max_metric_router_lsa_startup_cmd,
- "no max-metric router-lsa on-startup (5-86400)",
+ "no max-metric router-lsa on-startup [(5-86400)]",
NO_STR
"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"
"Time (seconds) to wait till full shutdown\n")
{
+ int idx_number = 3;
unsigned int seconds;
struct ospf *ospf = vty->index;
return CMD_WARNING;
}
- VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[3]->arg);
+ VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[idx_number]->arg);
ospf->stub_router_shutdown_time = seconds;
return CMD_SUCCESS;
}
-/*
- * CHECK ME - The following ALIASes need to be implemented in this DEFUN
- * "no max-metric router-lsa on-shutdown",
- * NO_STR
- * "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");
- *
- * static void
- * config_write_stub_router (struct vty *vty, struct ospf *ospf
- *
- */
DEFUN (no_ospf_max_metric_router_lsa_shutdown,
no_ospf_max_metric_router_lsa_shutdown_cmd,
- "no max-metric router-lsa on-shutdown (5-100)",
+ "no max-metric router-lsa on-shutdown [(5-100)]",
NO_STR
"OSPF maximum / infinite-distance metric\n"
"Advertise own Router-LSA with infinite distance (stub router)\n"
return CMD_SUCCESS;
}
+static void
+config_write_stub_router (struct vty *vty, struct ospf *ospf)
{
struct listnode *ln;
struct ospf_area *area;
switch (er->path_type)
{
case OSPF_PATH_TYPE1_EXTERNAL:
- vty_out (vty, "N E1 %-18s [%d] tag: %u%s", buf1,
+ vty_out (vty, "N E1 %-18s [%d] tag: %"ROUTE_TAG_PRI"%s", buf1,
er->cost, er->u.ext.tag, VTY_NEWLINE);
break;
case OSPF_PATH_TYPE2_EXTERNAL:
- vty_out (vty, "N E2 %-18s [%d/%d] tag: %u%s", buf1, er->cost,
+ vty_out (vty, "N E2 %-18s [%d/%d] tag: %"ROUTE_TAG_PRI"%s", buf1, er->cost,
er->u.ext.type2_cost, er->u.ext.tag, VTY_NEWLINE);
break;
}
"Instance ID\n"
"Show all the ABR's and ASBR's\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
"Instance ID\n"
"OSPF routing table\n")
{
+ int idx_number = 3;
struct ospf *ospf;
u_short instance = 0;
- VTY_GET_INTEGER ("Instance", instance, argv[3]->arg);
+ VTY_GET_INTEGER ("Instance", instance, argv[idx_number]->arg);
if ((ospf = ospf_lookup_instance (instance)) == NULL || !ospf->oi_running)
return CMD_SUCCESS;
{
/* "show ip ospf" commands. */
install_element (VIEW_NODE, &show_ip_ospf_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_cmd);
install_element (VIEW_NODE, &show_ip_ospf_instance_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_instance_cmd);
/* "show ip ospf database" commands. */
install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd);
install_element (VIEW_NODE, &show_ip_ospf_database_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_database_type_adv_router_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_database_cmd);
+ install_element (VIEW_NODE, &show_ip_ospf_database_max_cmd);
install_element (VIEW_NODE, &show_ip_ospf_instance_database_type_adv_router_cmd);
install_element (VIEW_NODE, &show_ip_ospf_instance_database_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_instance_database_type_adv_router_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_instance_database_cmd);
+ install_element (VIEW_NODE, &show_ip_ospf_instance_database_max_cmd);
/* "show ip ospf interface" commands. */
install_element (VIEW_NODE, &show_ip_ospf_interface_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_interface_cmd);
install_element (VIEW_NODE, &show_ip_ospf_instance_interface_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_instance_interface_cmd);
/* "show ip ospf neighbor" commands. */
install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_detail_cmd);
install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_cmd);
install_element (VIEW_NODE, &show_ip_ospf_neighbor_cmd);
install_element (VIEW_NODE, &show_ip_ospf_neighbor_all_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_detail_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_neighbor_id_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_all_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_neighbor_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_neighbor_all_cmd);
install_element (VIEW_NODE, &show_ip_ospf_instance_neighbor_int_detail_cmd);
install_element (VIEW_NODE, &show_ip_ospf_instance_neighbor_int_cmd);
install_element (VIEW_NODE, &show_ip_ospf_instance_neighbor_detail_cmd);
install_element (VIEW_NODE, &show_ip_ospf_instance_neighbor_cmd);
install_element (VIEW_NODE, &show_ip_ospf_instance_neighbor_all_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_instance_neighbor_int_detail_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_instance_neighbor_int_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_instance_neighbor_id_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_instance_neighbor_detail_all_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_instance_neighbor_detail_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_instance_neighbor_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_instance_neighbor_all_cmd);
/* "show ip ospf route" commands. */
install_element (VIEW_NODE, &show_ip_ospf_route_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_route_cmd);
install_element (VIEW_NODE, &show_ip_ospf_border_routers_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_border_routers_cmd);
install_element (VIEW_NODE, &show_ip_ospf_instance_route_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_instance_route_cmd);
install_element (VIEW_NODE, &show_ip_ospf_instance_border_routers_cmd);
- install_element (ENABLE_NODE, &show_ip_ospf_instance_border_routers_cmd);
}
{
/* Install interface node. */
install_node (&interface_node, config_write_interface);
-
- install_element (CONFIG_NODE, &interface_cmd);
- install_element (CONFIG_NODE, &no_interface_cmd);
- install_default (INTERFACE_NODE);
-
- /* "description" commands. */
- install_element (INTERFACE_NODE, &interface_desc_cmd);
- install_element (INTERFACE_NODE, &no_interface_desc_cmd);
+ if_cmd_init ();
/* "ip ospf authentication" commands. */
install_element (INTERFACE_NODE, &ip_ospf_authentication_args_addr_cmd);
install_element (INTERFACE_NODE, &no_ip_ospf_authentication_addr_cmd);
install_element (INTERFACE_NODE, &ip_ospf_authentication_key_addr_cmd);
install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_authkey_addr_cmd);
+ install_element (INTERFACE_NODE, &no_ospf_authentication_key_authkey_addr_cmd);
/* "ip ospf message-digest-key" commands. */
- install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_md5_addr_cmd);
+ install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_cmd);
+ install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_cmd);
/* "ip ospf cost" commands. */
- install_element (INTERFACE_NODE, &ip_ospf_cost_u32_inet4_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_cost_u32_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_cost_inet4_cmd);
+ install_element (INTERFACE_NODE, &ip_ospf_cost_cmd);
+ install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd);
/* "ip ospf mtu-ignore" commands. */
install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_addr_cmd);
install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_addr_cmd);
/* "ip ospf dead-interval" commands. */
- 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_minimal_addr_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd);
+ install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd);
/* "ip ospf hello-interval" commands. */
- install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd);
+ install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd);
+ install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd);
/* "ip ospf network" commands. */
install_element (INTERFACE_NODE, &ip_ospf_network_cmd);
install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd);
/* "ip ospf priority" commands. */
- install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd);
+ install_element (INTERFACE_NODE, &ip_ospf_priority_cmd);
+ install_element (INTERFACE_NODE, &no_ip_ospf_priority_cmd);
/* "ip ospf retransmit-interval" commands. */
install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd);
install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_sec_cmd);
/* "ip ospf transmit-delay" commands. */
install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd);
install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_sec_cmd);
/* "ip ospf area" commands. */
install_element (INTERFACE_NODE, &ip_ospf_area_cmd);
install_element (INTERFACE_NODE, &no_ip_ospf_area_cmd);
- install_element (INTERFACE_NODE, &no_ip_ospf_instance_area_cmd);
/* These commands are compatibitliy for previous version. */
install_element (INTERFACE_NODE, &ospf_authentication_key_cmd);
install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd);
- install_element (INTERFACE_NODE, &ospf_cost_u32_cmd);
- install_element (INTERFACE_NODE, &ospf_cost_u32_inet4_cmd);
+ install_element (INTERFACE_NODE, &no_ospf_message_digest_key_cmd);
install_element (INTERFACE_NODE, &ospf_dead_interval_cmd);
+ install_element (INTERFACE_NODE, &no_ospf_dead_interval_cmd);
install_element (INTERFACE_NODE, &ospf_hello_interval_cmd);
+ install_element (INTERFACE_NODE, &no_ospf_hello_interval_cmd);
+ install_element (INTERFACE_NODE, &ospf_cost_cmd);
+ install_element (INTERFACE_NODE, &no_ospf_cost_cmd);
install_element (INTERFACE_NODE, &ospf_network_cmd);
+ install_element (INTERFACE_NODE, &no_ospf_network_cmd);
install_element (INTERFACE_NODE, &ospf_priority_cmd);
+ install_element (INTERFACE_NODE, &no_ospf_priority_cmd);
install_element (INTERFACE_NODE, &ospf_retransmit_interval_cmd);
+ install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd);
install_element (INTERFACE_NODE, &ospf_transmit_delay_cmd);
+ install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd);
}
static void
"Interface information\n"
"Interface name\n")
{
+ int idx_ifname = 4;
struct interface *ifp;
struct listnode *node;
- if (argc == 0) /* Clear all the ospfv2 interfaces. */
+ if (argc == 4) /* Clear all the ospfv2 interfaces. */
{
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), node, ifp))
ospf_interface_clear(ifp);
}
else /* Interface name is specified. */
{
- if ((ifp = if_lookup_by_name (argv[4]->arg)) == NULL)
+ if ((ifp = if_lookup_by_name (argv[idx_ifname]->text)) == NULL)
vty_out (vty, "No such interface name%s", VTY_NEWLINE);
else
ospf_interface_clear(ifp);
/* "ospf rfc1583-compatible" commands. */
install_element (OSPF_NODE, &ospf_compatible_rfc1583_cmd);
install_element (OSPF_NODE, &no_ospf_compatible_rfc1583_cmd);
+ install_element (OSPF_NODE, &ospf_rfc1583_flag_cmd);
+ install_element (OSPF_NODE, &no_ospf_rfc1583_flag_cmd);
/* "network area" commands. */
install_element (OSPF_NODE, &ospf_network_area_cmd);
/* "area range" commands. */
install_element (OSPF_NODE, &ospf_area_range_cmd);
+ install_element (OSPF_NODE, &ospf_area_range_cost_cmd);
install_element (OSPF_NODE, &ospf_area_range_not_advertise_cmd);
install_element (OSPF_NODE, &no_ospf_area_range_cmd);
install_element (OSPF_NODE, &ospf_area_range_substitute_cmd);
/* "area virtual-link" commands. */
install_element (OSPF_NODE, &ospf_area_vlink_cmd);
+ install_element (OSPF_NODE, &ospf_area_vlink_intervals_cmd);
install_element (OSPF_NODE, &no_ospf_area_vlink_cmd);
+ install_element (OSPF_NODE, &no_ospf_area_vlink_intervals_cmd);
install_element (OSPF_NODE, &ospf_neighbor_cmd);
install_element (OSPF_NODE, &ospf_neighbor_poll_interval_cmd);
install_element (OSPF_NODE, &no_ospf_neighbor_cmd);
+ install_element (OSPF_NODE, &no_ospf_neighbor_poll_cmd);
/* write multiplier commands */
install_element (OSPF_NODE, &ospf_write_multiplier_cmd);
+ install_element (OSPF_NODE, &write_multiplier_cmd);
install_element (OSPF_NODE, &no_ospf_write_multiplier_cmd);
+ install_element (OSPF_NODE, &no_write_multiplier_cmd);
/* Init interface related vty commands. */
ospf_vty_if_init ();