#include "eigrpd/eigrp_dump.h"
#include "eigrpd/eigrp_const.h"
+#ifndef VTYSH_EXTRACT_PL
+#include "eigrpd/eigrp_vty_clippy.c"
+#endif
+
static int config_write_network(struct vty *vty, struct eigrp *eigrp)
{
struct route_node *rn;
struct listnode *node;
for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, ei)) {
- vty_out(vty, "interface %s\n", ei->ifp->name);
+ vty_frame(vty, "interface %s\n", ei->ifp->name);
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type)
- == EIGRP_AUTH_TYPE_MD5) {
+ if (ei->params.auth_type == EIGRP_AUTH_TYPE_MD5) {
vty_out(vty, " ip authentication mode eigrp %d md5\n",
eigrp->AS);
}
- if ((IF_DEF_PARAMS(ei->ifp)->auth_type)
- == EIGRP_AUTH_TYPE_SHA256) {
+ if (ei->params.auth_type == EIGRP_AUTH_TYPE_SHA256) {
vty_out(vty,
" ip authentication mode eigrp %d hmac-sha-256\n",
eigrp->AS);
}
- if (IF_DEF_PARAMS(ei->ifp)->auth_keychain) {
+ if (ei->params.auth_keychain) {
vty_out(vty,
" ip authentication key-chain eigrp %d %s\n",
- eigrp->AS,
- IF_DEF_PARAMS(ei->ifp)->auth_keychain);
+ eigrp->AS, ei->params.auth_keychain);
}
- if ((IF_DEF_PARAMS(ei->ifp)->v_hello)
- != EIGRP_HELLO_INTERVAL_DEFAULT) {
+ if (ei->params.v_hello != EIGRP_HELLO_INTERVAL_DEFAULT) {
vty_out(vty, " ip hello-interval eigrp %d\n",
- IF_DEF_PARAMS(ei->ifp)->v_hello);
+ ei->params.v_hello);
}
- if ((IF_DEF_PARAMS(ei->ifp)->v_wait)
- != EIGRP_HOLD_INTERVAL_DEFAULT) {
+ if (ei->params.v_wait != EIGRP_HOLD_INTERVAL_DEFAULT) {
vty_out(vty, " ip hold-time eigrp %d\n",
- IF_DEF_PARAMS(ei->ifp)->v_wait);
+ ei->params.v_wait);
}
/*Separate this EIGRP interface configuration from the others*/
- vty_out(vty, "!\n");
+ vty_endframe(vty, "!\n");
}
return 0;
static int eigrp_write_interface(struct vty *vty)
{
- struct listnode *node;
+ struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
struct interface *ifp;
+ struct eigrp_interface *ei;
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(VRF_DEFAULT), node, ifp)) {
- vty_out(vty, "interface %s\n", ifp->name);
+ FOR_ALL_INTERFACES (vrf, ifp) {
+ ei = ifp->info;
+ if (!ei)
+ continue;
+
+ vty_frame(vty, "interface %s\n", ifp->name);
if (ifp->desc)
vty_out(vty, " description %s\n", ifp->desc);
- if (IF_DEF_PARAMS(ifp)->bandwidth != EIGRP_BANDWIDTH_DEFAULT)
- vty_out(vty, " bandwidth %u\n",
- IF_DEF_PARAMS(ifp)->bandwidth);
- if (IF_DEF_PARAMS(ifp)->delay != EIGRP_DELAY_DEFAULT)
- vty_out(vty, " delay %u\n", IF_DEF_PARAMS(ifp)->delay);
- if (IF_DEF_PARAMS(ifp)->v_hello != EIGRP_HELLO_INTERVAL_DEFAULT)
+ if (ei->params.bandwidth != EIGRP_BANDWIDTH_DEFAULT)
+ vty_out(vty, " bandwidth %u\n", ei->params.bandwidth);
+ if (ei->params.delay != EIGRP_DELAY_DEFAULT)
+ vty_out(vty, " delay %u\n", ei->params.delay);
+ if (ei->params.v_hello != EIGRP_HELLO_INTERVAL_DEFAULT)
vty_out(vty, " ip hello-interval eigrp %u\n",
- IF_DEF_PARAMS(ifp)->v_hello);
- if (IF_DEF_PARAMS(ifp)->v_wait != EIGRP_HOLD_INTERVAL_DEFAULT)
+ ei->params.v_hello);
+ if (ei->params.v_wait != EIGRP_HOLD_INTERVAL_DEFAULT)
vty_out(vty, " ip hold-time eigrp %u\n",
- IF_DEF_PARAMS(ifp)->v_wait);
+ ei->params.v_wait);
- vty_out(vty, "!\n");
+ vty_endframe(vty, "!\n");
}
return 0;
char *ifname = argv[1]->arg;
for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, ei)) {
- if (strcmp(ifname, ei->ifp->name) == 0)
- SET_IF_PARAM(IF_DEF_PARAMS(ei->ifp), passive_interface);
+ if (strcmp(ifname, ei->ifp->name) == 0) {
+ ei->params.passive_interface = EIGRP_IF_PASSIVE;
+ return CMD_SUCCESS;
+ }
}
return CMD_SUCCESS;
}
char *ifname = argv[2]->arg;
for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, ei)) {
- if (strcmp(ifname, ei->ifp->name) == 0)
- UNSET_IF_PARAM(IF_DEF_PARAMS(ei->ifp),
- passive_interface);
+ if (strcmp(ifname, ei->ifp->name) == 0) {
+ ei->params.passive_interface = EIGRP_IF_ACTIVE;
+ return CMD_SUCCESS;
+ }
}
return CMD_SUCCESS;
"EIGRP network prefix\n")
{
VTY_DECLVAR_CONTEXT(eigrp, eigrp);
- struct prefix_ipv4 p;
+ struct prefix p;
int ret;
- str2prefix_ipv4(argv[1]->arg, &p);
+ (void)str2prefix(argv[1]->arg, &p);
ret = eigrp_network_set(eigrp, &p);
if (ret == 0) {
vty_out(vty, "There is already same network statement.\n");
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_WARNING;
}
return CMD_SUCCESS;
"EIGRP network prefix\n")
{
VTY_DECLVAR_CONTEXT(eigrp, eigrp);
- struct prefix_ipv4 p;
+ struct prefix p;
int ret;
- str2prefix_ipv4(argv[2]->arg, &p);
+ (void)str2prefix(argv[2]->arg, &p);
ret = eigrp_network_unset(eigrp, &p);
"Show all links in topology table\n")
{
struct eigrp *eigrp;
- struct listnode *node, *node2;
+ struct listnode *node;
struct eigrp_prefix_entry *tn;
- struct eigrp_neighbor_entry *te;
+ struct eigrp_nexthop_entry *te;
+ struct route_node *rn;
int first;
eigrp = eigrp_lookup();
show_ip_eigrp_topology_header(vty, eigrp);
- for (ALL_LIST_ELEMENTS_RO(eigrp->topology_table, node, tn)) {
+ for (rn = route_top(eigrp->topology_table); rn; rn = route_next(rn)) {
+ if (!rn->info)
+ continue;
+
+ tn = rn->info;
first = 1;
- for (ALL_LIST_ELEMENTS_RO(tn->entries, node2, te)) {
+ for (ALL_LIST_ELEMENTS_RO(tn->entries, node, te)) {
if (argc == 5
|| (((te->flags
- & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)
- == EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)
+ & EIGRP_NEXTHOP_ENTRY_SUCCESSOR_FLAG)
+ == EIGRP_NEXTHOP_ENTRY_SUCCESSOR_FLAG)
|| ((te->flags
- & EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG)
- == EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG))) {
- show_ip_eigrp_neighbor_entry(vty, eigrp, te,
- &first);
+ & EIGRP_NEXTHOP_ENTRY_FSUCCESSOR_FLAG)
+ == EIGRP_NEXTHOP_ENTRY_FSUCCESSOR_FLAG))) {
+ show_ip_eigrp_nexthop_entry(vty, eigrp, te,
+ &first);
first = 0;
}
}
"Throughput delay (tens of microseconds)\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
- u_int32_t delay;
+ uint32_t delay;
eigrp = eigrp_lookup();
if (eigrp == NULL) {
return CMD_SUCCESS;
}
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
delay = atoi(argv[1]->arg);
- IF_DEF_PARAMS(ifp)->delay = delay;
+ ei->params.delay = delay;
eigrp_if_reset(ifp);
return CMD_SUCCESS;
"Throughput delay (tens of microseconds)\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
return CMD_SUCCESS;
}
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
- IF_DEF_PARAMS(ifp)->delay = EIGRP_DELAY_DEFAULT;
+ ei->params.delay = EIGRP_DELAY_DEFAULT;
eigrp_if_reset(ifp);
return CMD_SUCCESS;
}
-DEFUN (eigrp_if_bandwidth,
+DEFPY (eigrp_if_bandwidth,
eigrp_if_bandwidth_cmd,
- "eigrp bandwidth (1-10000000)",
+ "eigrp bandwidth (1-10000000)$bw",
"EIGRP specific commands\n"
"Set bandwidth informational parameter\n"
"Bandwidth in kilobits\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- u_int32_t bandwidth;
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
return CMD_SUCCESS;
}
- bandwidth = atoi(argv[1]->arg);
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
- IF_DEF_PARAMS(ifp)->bandwidth = bandwidth;
+ ei->params.bandwidth = bw;
eigrp_if_reset(ifp);
return CMD_SUCCESS;
"Bandwidth in kilobits\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
return CMD_SUCCESS;
}
- IF_DEF_PARAMS(ifp)->bandwidth = EIGRP_BANDWIDTH_DEFAULT;
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
+
+ ei->params.bandwidth = EIGRP_BANDWIDTH_DEFAULT;
eigrp_if_reset(ifp);
return CMD_SUCCESS;
"Seconds between hello transmissions\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- u_int32_t hello;
+ struct eigrp_interface *ei = ifp->info;
+ uint32_t hello;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
return CMD_SUCCESS;
}
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
+
hello = atoi(argv[3]->arg);
- IF_DEF_PARAMS(ifp)->v_hello = hello;
+ ei->params.v_hello = hello;
return CMD_SUCCESS;
}
"Seconds between hello transmissions\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
- struct eigrp_interface *ei;
- struct listnode *node, *nnode;
eigrp = eigrp_lookup();
if (eigrp == NULL) {
return CMD_SUCCESS;
}
- IF_DEF_PARAMS(ifp)->v_hello = EIGRP_HELLO_INTERVAL_DEFAULT;
-
- for (ALL_LIST_ELEMENTS(eigrp->eiflist, node, nnode, ei)) {
- if (ei->ifp == ifp) {
- THREAD_TIMER_OFF(ei->t_hello);
- thread_add_timer(master, eigrp_hello_timer, ei, 1,
- &ei->t_hello);
- break;
- }
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
}
+ ei->params.v_hello = EIGRP_HELLO_INTERVAL_DEFAULT;
+
+ THREAD_TIMER_OFF(ei->t_hello);
+ thread_add_timer(master, eigrp_hello_timer, ei, 1, &ei->t_hello);
+
return CMD_SUCCESS;
}
"Seconds before neighbor is considered down\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- u_int32_t hold;
+ struct eigrp_interface *ei = ifp->info;
+ uint32_t hold;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
return CMD_SUCCESS;
}
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
+
hold = atoi(argv[3]->arg);
- IF_DEF_PARAMS(ifp)->v_wait = hold;
+ ei->params.v_wait = hold;
return CMD_SUCCESS;
}
"Summary <network>/<length>, e.g. 192.168.0.0/16\n")
{
// VTY_DECLVAR_CONTEXT(interface, ifp);
- // u_int32_t AS;
+ // uint32_t AS;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
"Summary <network>/<length>, e.g. 192.168.0.0/16\n")
{
// VTY_DECLVAR_CONTEXT(interface, ifp);
- // u_int32_t AS;
+ // uint32_t AS;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
DEFUN (no_eigrp_if_ip_holdinterval,
no_eigrp_if_ip_holdinterval_cmd,
"no ip hold-time eigrp",
- "No"
+ NO_STR
"Interface Internet Protocol config commands\n"
"Configures EIGRP hello interval\n"
- "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
- "Seconds before neighbor is considered down\n")
+ "Enhanced Interior Gateway Routing Protocol (EIGRP)\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
return CMD_SUCCESS;
}
- IF_DEF_PARAMS(ifp)->v_wait = EIGRP_HOLD_INTERVAL_DEFAULT;
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
+
+ ei->params.v_wait = EIGRP_HOLD_INTERVAL_DEFAULT;
return CMD_SUCCESS;
}
-static int str2auth_type(const char *str, struct interface *ifp)
+static int str2auth_type(const char *str, struct eigrp_interface *ei)
{
/* Sanity check. */
if (str == NULL)
return CMD_WARNING_CONFIG_FAILED;
if (strncmp(str, "md5", 3) == 0) {
- IF_DEF_PARAMS(ifp)->auth_type = EIGRP_AUTH_TYPE_MD5;
+ ei->params.auth_type = EIGRP_AUTH_TYPE_MD5;
return CMD_SUCCESS;
} else if (strncmp(str, "hmac-sha-256", 12) == 0) {
- IF_DEF_PARAMS(ifp)->auth_type = EIGRP_AUTH_TYPE_SHA256;
+ ei->params.auth_type = EIGRP_AUTH_TYPE_SHA256;
return CMD_SUCCESS;
}
"HMAC SHA256 algorithm \n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
return CMD_SUCCESS;
}
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
+
// if(strncmp(argv[2], "md5",3))
// IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_MD5;
// else if(strncmp(argv[2], "hmac-sha-256",12))
// IF_DEF_PARAMS (ifp)->auth_type = EIGRP_AUTH_TYPE_SHA256;
- return str2auth_type(argv[5]->arg, ifp);
+ return str2auth_type(argv[5]->arg, ei);
}
DEFUN (no_eigrp_authentication_mode,
"HMAC SHA256 algorithm \n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
eigrp = eigrp_lookup();
return CMD_SUCCESS;
}
- IF_DEF_PARAMS(ifp)->auth_type = EIGRP_AUTH_TYPE_NONE;
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
+
+ ei->params.auth_type = EIGRP_AUTH_TYPE_NONE;
return CMD_SUCCESS;
}
-DEFUN (eigrp_authentication_keychain,
+DEFPY (eigrp_authentication_keychain,
eigrp_authentication_keychain_cmd,
- "ip authentication key-chain eigrp (1-65535) WORD",
+ "[no] ip authentication key-chain eigrp (1-65535)$as WORD$name",
+ NO_STR
"Interface Internet Protocol config commands\n"
"Authentication subcommands\n"
"Key-chain\n"
"Name of key-chain\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
+ struct eigrp_interface *ei = ifp->info;
struct eigrp *eigrp;
struct keychain *keychain;
return CMD_SUCCESS;
}
- keychain = keychain_lookup(argv[4]->arg);
- if (keychain != NULL) {
- if (IF_DEF_PARAMS(ifp)->auth_keychain) {
- free(IF_DEF_PARAMS(ifp)->auth_keychain);
- IF_DEF_PARAMS(ifp)->auth_keychain =
- strdup(keychain->name);
- } else
- IF_DEF_PARAMS(ifp)->auth_keychain =
- strdup(keychain->name);
- } else
- vty_out(vty, "Key chain with specified name not found\n");
-
- return CMD_SUCCESS;
-}
-
-DEFUN (no_eigrp_authentication_keychain,
- no_eigrp_authentication_keychain_cmd,
- "no ip authentication key-chain eigrp (1-65535) WORD",
- "Disable\n"
- "Interface Internet Protocol config commands\n"
- "Authentication subcommands\n"
- "Key-chain\n"
- "Enhanced Interior Gateway Routing Protocol (EIGRP)\n"
- "Autonomous system number\n"
- "Name of key-chain\n")
-{
- VTY_DECLVAR_CONTEXT(interface, ifp);
- struct eigrp *eigrp;
+ if (!ei) {
+ vty_out(vty, " EIGRP not configured on this interface\n");
+ return CMD_SUCCESS;
+ }
- eigrp = eigrp_lookup();
- if (eigrp == NULL) {
- vty_out(vty, "EIGRP Routing Process not enabled\n");
+ if (no) {
+ if ((ei->params.auth_keychain != NULL)
+ && (strcmp(ei->params.auth_keychain, name) == 0)) {
+ free(ei->params.auth_keychain);
+ ei->params.auth_keychain = NULL;
+ } else
+ vty_out(vty,
+ "Key chain with specified name not configured on interface\n");
return CMD_SUCCESS;
}
- if ((IF_DEF_PARAMS(ifp)->auth_keychain != NULL)
- && (strcmp(IF_DEF_PARAMS(ifp)->auth_keychain, argv[5]->arg) == 0)) {
- free(IF_DEF_PARAMS(ifp)->auth_keychain);
- IF_DEF_PARAMS(ifp)->auth_keychain = NULL;
- } else
+ keychain = keychain_lookup(name);
+ if (keychain != NULL) {
+ if (ei->params.auth_keychain) {
+ free(ei->params.auth_keychain);
+ ei->params.auth_keychain = strdup(keychain->name);
+ } else
+ ei->params.auth_keychain = strdup(keychain->name);
+ } else {
vty_out(vty,
- "Key chain with specified name not configured on interface\n");
+ "Key chain with specified name not found\n");
+ return CMD_WARNING_CONFIG_FAILED;
+ }
return CMD_SUCCESS;
}
DEFUN (no_eigrp_redistribute_source_metric,
no_eigrp_redistribute_source_metric_cmd,
"no redistribute " FRR_REDIST_STR_EIGRPD
- " metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)",
+ " [metric (1-4294967295) (0-4294967295) (0-255) (1-255) (1-65535)]",
"Disable\n"
REDIST_STR
FRR_REDIST_HELP_STR_EIGRPD
"Metric variance multiplier\n")
{
struct eigrp *eigrp;
- u_char variance;
+ uint8_t variance;
eigrp = eigrp_lookup();
if (eigrp == NULL) {
"Number of paths\n")
{
struct eigrp *eigrp;
- u_char max;
+ uint8_t max;
eigrp = eigrp_lookup();
if (eigrp == NULL) {
struct eigrp_neighbor *nbr;
struct in_addr nbr_addr;
- inet_aton(argv[4]->arg, &nbr_addr);
+ if (!inet_aton(argv[4]->arg, &nbr_addr)) {
+ vty_out(vty, "Unable to parse %s", argv[4]->arg);
+ return CMD_WARNING;
+ }
/* Check if eigrp process is enabled */
eigrp = eigrp_lookup();
struct eigrp_neighbor *nbr;
struct in_addr nbr_addr;
- inet_aton(argv[4]->arg, &nbr_addr);
+ if (!inet_aton(argv[4]->arg, &nbr_addr)) {
+ vty_out(vty, "Unable to parse: %s", argv[4]->arg);
+ return CMD_WARNING;
+ }
/* Check if eigrp process is enabled */
eigrp = eigrp_lookup();
install_element(INTERFACE_NODE, &eigrp_authentication_mode_cmd);
install_element(INTERFACE_NODE, &no_eigrp_authentication_mode_cmd);
install_element(INTERFACE_NODE, &eigrp_authentication_keychain_cmd);
- install_element(INTERFACE_NODE, &no_eigrp_authentication_keychain_cmd);
/*EIGRP Summarization commands*/
install_element(INTERFACE_NODE, &eigrp_ip_summary_address_cmd);