mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-02 05:27:35 +00:00
eigrpd, ospfd: Cleanup inet_aton return code checking
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
dbfd865b05
commit
cc9b06ad5e
@ -1267,7 +1267,11 @@ DEFUN (clear_ip_eigrp_neighbors_IP,
|
||||
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();
|
||||
@ -1370,7 +1374,11 @@ DEFUN (clear_ip_eigrp_neighbors_IP_soft,
|
||||
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();
|
||||
|
@ -2306,7 +2306,10 @@ DEFUN (ospf_neighbor,
|
||||
unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
|
||||
unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT;
|
||||
|
||||
inet_aton(argv[idx_ipv4]->arg, &nbr_addr);
|
||||
if (!inet_aton(argv[idx_ipv4]->arg, &nbr_addr)) {
|
||||
vty_out(vty, "Please specify Neighbor ID by A.B.C.D\n");
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
}
|
||||
|
||||
if (argc > 2)
|
||||
priority = strtoul(argv[idx_pri]->arg, NULL, 10);
|
||||
@ -2343,7 +2346,10 @@ DEFUN (ospf_neighbor_poll_interval,
|
||||
unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
|
||||
unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT;
|
||||
|
||||
inet_aton(argv[idx_ipv4]->arg, &nbr_addr);
|
||||
if (!inet_aton(argv[idx_ipv4]->arg, &nbr_addr)) {
|
||||
vty_out(vty, "Please specify Neighbor ID by A.B.C.D\n");
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
}
|
||||
|
||||
interval = strtoul(argv[idx_poll]->arg, NULL, 10);
|
||||
|
||||
@ -2374,7 +2380,10 @@ DEFUN (no_ospf_neighbor,
|
||||
int idx_ipv4 = 2;
|
||||
struct in_addr nbr_addr;
|
||||
|
||||
inet_aton(argv[idx_ipv4]->arg, &nbr_addr);
|
||||
if (!inet_aton(argv[idx_ipv4]->arg, &nbr_addr)) {
|
||||
vty_out(vty, "Please specify Neighbor ID by A.B.C.D\n");
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
}
|
||||
|
||||
(void)ospf_nbr_nbma_unset(ospf, nbr_addr);
|
||||
|
||||
@ -2396,7 +2405,10 @@ DEFUN (no_ospf_neighbor_poll,
|
||||
int idx_ipv4 = 2;
|
||||
struct in_addr nbr_addr;
|
||||
|
||||
inet_aton(argv[idx_ipv4]->arg, &nbr_addr);
|
||||
if (!inet_aton(argv[idx_ipv4]->arg, &nbr_addr)) {
|
||||
vty_out(vty, "Please specify Neighbor ID by A.B.C.D\n");
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
}
|
||||
|
||||
(void)ospf_nbr_nbma_unset(ospf, nbr_addr);
|
||||
|
||||
@ -6958,7 +6970,10 @@ DEFUN (ip_ospf_area,
|
||||
|
||||
// Check if we have an address arg and proccess it
|
||||
if (argc == idx + 3) {
|
||||
inet_aton(argv[idx + 2]->arg, &addr);
|
||||
if (!inet_aton(argv[idx + 2]->arg, &addr)) {
|
||||
vty_out(vty, "Please specify Intf Address by A.B.C.D\n");
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
}
|
||||
// update/create address-level params
|
||||
params = ospf_get_if_params((ifp), (addr));
|
||||
if (OSPF_IF_PARAM_CONFIGURED(params, if_area)) {
|
||||
@ -7017,7 +7032,10 @@ DEFUN (no_ip_ospf_area,
|
||||
|
||||
// Check if we have an address arg and proccess it
|
||||
if (argc == idx + 3) {
|
||||
inet_aton(argv[idx + 2]->arg, &addr);
|
||||
if (!inet_aton(argv[idx + 2]->arg, &addr)) {
|
||||
vty_out(vty, "Please specify Intf Address by A.B.C.D\n");
|
||||
return CMD_WARNING_CONFIG_FAILED;
|
||||
}
|
||||
params = ospf_lookup_if_params(ifp, addr);
|
||||
if ((params) == NULL)
|
||||
return CMD_SUCCESS;
|
||||
|
Loading…
Reference in New Issue
Block a user