pimd: Convert to the new way of working

This commit is contained in:
Donald Sharp 2016-09-20 23:35:51 -04:00
parent 5c94274ff7
commit 0564b02e43

View file

@ -1534,7 +1534,7 @@ DEFUN (pim_interface,
"Interface's name\n")
{
struct interface *ifp;
const char *ifname = argv[0];
const char *ifname = argv[0]->arg;
size_t sl;
sl = strlen(ifname);
@ -2374,7 +2374,7 @@ DEFUN (show_ip_rib,
char nexthop_addr_str[100];
int result;
addr_str = argv[0];
addr_str = argv[0]->arg;
result = inet_pton(AF_INET, addr_str, &addr);
if (result <= 0) {
vty_out(vty, "Bad unicast address %s: errno=%d: %s%s",
@ -2468,14 +2468,14 @@ DEFUN (ip_pim_rp,
{
int result;
result = inet_pton(AF_INET, argv[0], &qpim_rp.rpf_addr.s_addr);
result = inet_pton(AF_INET, argv[0]->arg, &qpim_rp.rpf_addr.s_addr);
if (result <= 0) {
vty_out(vty, "%% Bad RP address specified: %s", argv[0]);
vty_out(vty, "%% Bad RP address specified: %s", argv[0]->arg);
return CMD_WARNING;
}
if (pim_nexthop_lookup(&qpim_rp.source_nexthop, qpim_rp.rpf_addr, NULL) != 0) {
vty_out(vty, "%% No Path to RP address specified: %s", argv[0]);
vty_out(vty, "%% No Path to RP address specified: %s", argv[0]->arg);
return CMD_WARNING;
}
@ -2533,7 +2533,7 @@ DEFUN (ip_ssmpingd,
{
int result;
struct in_addr source_addr;
const char *source_str = (argc > 0) ? argv[0] : "0.0.0.0";
const char *source_str = (argc > 0) ? argv[0]->arg : "0.0.0.0";
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
@ -2562,7 +2562,7 @@ DEFUN (no_ip_ssmpingd,
{
int result;
struct in_addr source_addr;
const char *source_str = (argc > 0) ? argv[0] : "0.0.0.0";
const char *source_str = (argc > 0) ? argv[0]->arg : "0.0.0.0";
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
@ -2658,7 +2658,7 @@ DEFUN (interface_ip_igmp_join,
ifp = vty->index;
/* Group address */
group_str = argv[0];
group_str = argv[0]->arg;
result = inet_pton(AF_INET, group_str, &group_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@ -2667,7 +2667,7 @@ DEFUN (interface_ip_igmp_join,
}
/* Source address */
source_str = argv[1];
source_str = argv[1]->arg;
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s%s",
@ -2705,7 +2705,7 @@ DEFUN (interface_no_ip_igmp_join,
ifp = vty->index;
/* Group address */
group_str = argv[0];
group_str = argv[0]->arg;
result = inet_pton(AF_INET, group_str, &group_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@ -2714,7 +2714,7 @@ DEFUN (interface_no_ip_igmp_join,
}
/* Source address */
source_str = argv[1];
source_str = argv[1]->arg;
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s%s",
@ -2887,7 +2887,7 @@ DEFUN (interface_ip_igmp_query_interval,
return CMD_WARNING;
}
query_interval = atoi(argv[0]);
query_interval = atoi(argv[0]->arg);
query_interval_dsec = 10 * query_interval;
/*
@ -2981,7 +2981,7 @@ DEFUN (interface_ip_igmp_query_max_response_time,
return CMD_WARNING;
}
query_max_response_time = atoi(argv[0]);
query_max_response_time = atoi(argv[0]->arg);
/*
It seems we don't need to check bounds since command.c does it
@ -3075,7 +3075,7 @@ DEFUN (interface_ip_igmp_query_max_response_time_dsec,
return CMD_WARNING;
}
query_max_response_time_dsec = atoi(argv[0]);
query_max_response_time_dsec = atoi(argv[0]->arg);
/*
It seems we don't need to check bounds since command.c does it
@ -3166,7 +3166,7 @@ DEFUN (interface_ip_pim_drprio,
old_dr_prio = pim_ifp->pim_dr_priority;
pim_ifp->pim_dr_priority = strtol(argv[0], NULL, 10);
pim_ifp->pim_dr_priority = strtol(argv[0]->arg, NULL, 10);
if (old_dr_prio != pim_ifp->pim_dr_priority) {
if (pim_if_dr_election(ifp))
@ -3355,7 +3355,7 @@ DEFUN (interface_ip_mroute,
iif = vty->index;
oifname = argv[0];
oifname = argv[0]->arg;
oif = if_lookup_by_name(oifname);
if (!oif) {
vty_out(vty, "No such interface name %s%s",
@ -3363,7 +3363,7 @@ DEFUN (interface_ip_mroute,
return CMD_WARNING;
}
grp_str = argv[1];
grp_str = argv[1]->arg;
result = inet_pton(AF_INET, grp_str, &grp_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@ -3401,7 +3401,7 @@ DEFUN (interface_ip_mroute_source,
iif = vty->index;
oifname = argv[0];
oifname = argv[0]->arg;
oif = if_lookup_by_name(oifname);
if (!oif) {
vty_out(vty, "No such interface name %s%s",
@ -3409,7 +3409,7 @@ DEFUN (interface_ip_mroute_source,
return CMD_WARNING;
}
grp_str = argv[1];
grp_str = argv[1]->arg;
result = inet_pton(AF_INET, grp_str, &grp_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@ -3417,7 +3417,7 @@ DEFUN (interface_ip_mroute_source,
return CMD_WARNING;
}
src_str = argv[2];
src_str = argv[2]->arg;
result = inet_pton(AF_INET, src_str, &src_addr);
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s%s",
@ -3452,7 +3452,7 @@ DEFUN (interface_no_ip_mroute,
iif = vty->index;
oifname = argv[0];
oifname = argv[0]->arg;
oif = if_lookup_by_name(oifname);
if (!oif) {
vty_out(vty, "No such interface name %s%s",
@ -3460,7 +3460,7 @@ DEFUN (interface_no_ip_mroute,
return CMD_WARNING;
}
grp_str = argv[1];
grp_str = argv[1]->arg;
result = inet_pton(AF_INET, grp_str, &grp_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@ -3499,7 +3499,7 @@ DEFUN (interface_no_ip_mroute_source,
iif = vty->index;
oifname = argv[0];
oifname = argv[0]->arg;
oif = if_lookup_by_name(oifname);
if (!oif) {
vty_out(vty, "No such interface name %s%s",
@ -3507,7 +3507,7 @@ DEFUN (interface_no_ip_mroute_source,
return CMD_WARNING;
}
grp_str = argv[1];
grp_str = argv[1]->arg;
result = inet_pton(AF_INET, grp_str, &grp_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@ -3515,7 +3515,7 @@ DEFUN (interface_no_ip_mroute_source,
return CMD_WARNING;
}
src_str = argv[2];
src_str = argv[2]->arg;
result = inet_pton(AF_INET, src_str, &src_addr);
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s%s",
@ -3550,10 +3550,10 @@ DEFUN (interface_ip_pim_hello,
return CMD_WARNING;
}
pim_ifp->pim_hello_period = strtol(argv[0], NULL, 10);
pim_ifp->pim_hello_period = strtol(argv[0]->arg, NULL, 10);
if (argc == 2)
pim_ifp->pim_default_holdtime = strtol(argv[1], NULL, 10);
pim_ifp->pim_default_holdtime = strtol(argv[1]->arg, NULL, 10);
return CMD_SUCCESS;
}
@ -3856,12 +3856,12 @@ DEFUN (debug_pim_packets_filter,
DEBUG_PIM_HELLO_PACKETS_STR
DEBUG_PIM_J_P_PACKETS_STR)
{
if (strncmp(argv[0],"h",1) == 0)
if (strncmp(argv[0]->arg,"h",1) == 0)
{
PIM_DO_DEBUG_PIM_HELLO;
vty_out (vty, "PIM Hello debugging is on %s", VTY_NEWLINE);
}
else if (strncmp(argv[0],"j",1) == 0)
else if (strncmp(argv[0]->arg,"j",1) == 0)
{
PIM_DO_DEBUG_PIM_J_P;
vty_out (vty, "PIM Join/Prune debugging is on %s", VTY_NEWLINE);
@ -3894,12 +3894,12 @@ DEFUN (no_debug_pim_packets_filter,
DEBUG_PIM_HELLO_PACKETS_STR
DEBUG_PIM_J_P_PACKETS_STR)
{
if (strncmp(argv[0],"h",1) == 0)
if (strncmp(argv[0]->arg,"h",1) == 0)
{
PIM_DONT_DEBUG_PIM_HELLO;
vty_out (vty, "PIM Hello debugging is off %s", VTY_NEWLINE);
}
else if (strncmp(argv[0],"j",1) == 0)
else if (strncmp(argv[0]->arg,"j",1) == 0)
{
PIM_DONT_DEBUG_PIM_J_P;
vty_out (vty, "PIM Join/Prune debugging is off %s", VTY_NEWLINE);
@ -4138,7 +4138,7 @@ DEFUN (test_igmp_receive_report,
struct in_addr *src_addr;
int argi;
socket = argv[0];
socket = argv[0]->arg;
socket_fd = atoi(socket);
igmp = find_igmp_sock_by_fd(socket_fd);
if (!igmp) {
@ -4147,7 +4147,7 @@ DEFUN (test_igmp_receive_report,
return CMD_WARNING;
}
grp_str = argv[1];
grp_str = argv[1]->arg;
result = inet_pton(AF_INET, grp_str, &grp_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@ -4155,7 +4155,7 @@ DEFUN (test_igmp_receive_report,
return CMD_WARNING;
}
record_type_str = argv[2];
record_type_str = argv[2]->arg;
record_type = atoi(record_type_str);
/*
@ -4183,7 +4183,7 @@ DEFUN (test_igmp_receive_report,
sources = (struct in_addr *) (group_record + IGMP_V3_GROUP_RECORD_SOURCE_OFFSET);
src_addr = sources;
for (argi = 3; argi < argc; ++argi,++src_addr) {
src_str = argv[argi];
src_str = argv[argi]->arg;
result = inet_pton(AF_INET, src_str, src_addr);
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s%s",
@ -4243,7 +4243,7 @@ DEFUN (test_pim_receive_dump,
int result;
/* Find interface */
ifname = argv[0];
ifname = argv[0]->arg;
ifp = if_lookup_by_name(ifname);
if (!ifp) {
vty_out(vty, "No such interface name %s%s",
@ -4252,7 +4252,7 @@ DEFUN (test_pim_receive_dump,
}
/* Neighbor address */
neigh_str = argv[1];
neigh_str = argv[1]->arg;
result = inet_pton(AF_INET, neigh_str, &neigh_addr);
if (result <= 0) {
vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s",
@ -4278,7 +4278,7 @@ DEFUN (test_pim_receive_dump,
/* Scan LINE dump into buffer */
for (argi = 2; argi < argc; ++argi) {
const char *str = argv[argi];
const char *str = argv[argi]->arg;
int str_len = strlen(str);
int str_last = str_len - 1;
int i;
@ -4368,7 +4368,7 @@ DEFUN (test_pim_receive_hello,
int result;
/* Find interface */
ifname = argv[0];
ifname = argv[0]->arg;
ifp = if_lookup_by_name(ifname);
if (!ifp) {
vty_out(vty, "No such interface name %s%s",
@ -4377,7 +4377,7 @@ DEFUN (test_pim_receive_hello,
}
/* Neighbor address */
neigh_str = argv[1];
neigh_str = argv[1]->arg;
result = inet_pton(AF_INET, neigh_str, &neigh_addr);
if (result <= 0) {
vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s",
@ -4385,12 +4385,12 @@ DEFUN (test_pim_receive_hello,
return CMD_WARNING;
}
neigh_holdtime = atoi(argv[2]);
neigh_dr_priority = atoi(argv[3]);
neigh_generation_id = atoi(argv[4]);
neigh_propagation_delay = atoi(argv[5]);
neigh_override_interval = atoi(argv[6]);
neigh_can_disable_join_suppression = atoi(argv[7]);
neigh_holdtime = atoi(argv[2]->arg);
neigh_dr_priority = atoi(argv[3]->arg);
neigh_generation_id = atoi(argv[4]->arg);
neigh_propagation_delay = atoi(argv[5]->arg);
neigh_override_interval = atoi(argv[6]->arg);
neigh_can_disable_join_suppression = atoi(argv[7]->arg);
/*
Tweak IP header
@ -4409,7 +4409,7 @@ DEFUN (test_pim_receive_hello,
/* Scan LINE addresses */
for (argi = 8; argi < argc; ++argi) {
const char *sec_str = argv[argi];
const char *sec_str = argv[argi]->arg;
struct in_addr sec_addr;
result = inet_pton(AF_INET, sec_str, &sec_addr);
if (result <= 0) {
@ -4494,7 +4494,7 @@ DEFUN (test_pim_receive_assert,
int result;
/* Find interface */
ifname = argv[0];
ifname = argv[0]->arg;
ifp = if_lookup_by_name(ifname);
if (!ifp) {
vty_out(vty, "No such interface name %s%s",
@ -4503,7 +4503,7 @@ DEFUN (test_pim_receive_assert,
}
/* Neighbor address */
neigh_str = argv[1];
neigh_str = argv[1]->arg;
result = inet_pton(AF_INET, neigh_str, &neigh_addr);
if (result <= 0) {
vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s",
@ -4512,7 +4512,7 @@ DEFUN (test_pim_receive_assert,
}
/* Group address */
group_str = argv[2];
group_str = argv[2]->arg;
result = inet_pton(AF_INET, group_str, &group_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@ -4521,7 +4521,7 @@ DEFUN (test_pim_receive_assert,
}
/* Source address */
source_str = argv[3];
source_str = argv[3]->arg;
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s%s",
@ -4529,9 +4529,9 @@ DEFUN (test_pim_receive_assert,
return CMD_WARNING;
}
assert_metric_preference = atoi(argv[4]);
assert_route_metric = atoi(argv[5]);
assert_rpt_bit_flag = atoi(argv[6]);
assert_metric_preference = atoi(argv[4]->arg);
assert_route_metric = atoi(argv[5]->arg);
assert_rpt_bit_flag = atoi(argv[6]->arg);
remain = buf_pastend - buf;
if (remain < (int) sizeof(struct ip)) {
@ -4580,7 +4580,7 @@ DEFUN (test_pim_receive_assert,
}
static int recv_joinprune(struct vty *vty,
const char *argv[],
struct cmd_token *argv[],
int src_is_join)
{
uint8_t buf[1000];
@ -4608,7 +4608,7 @@ static int recv_joinprune(struct vty *vty,
uint16_t num_pruned;
/* Find interface */
ifname = argv[0];
ifname = argv[0]->arg;
ifp = if_lookup_by_name(ifname);
if (!ifp) {
vty_out(vty, "No such interface name %s%s",
@ -4616,10 +4616,10 @@ static int recv_joinprune(struct vty *vty,
return CMD_WARNING;
}
neigh_holdtime = atoi(argv[1]);
neigh_holdtime = atoi(argv[1]->arg);
/* Neighbor destination address */
neigh_dst_str = argv[2];
neigh_dst_str = argv[2]->arg;
result = inet_pton(AF_INET, neigh_dst_str, &neigh_dst_addr);
if (result <= 0) {
vty_out(vty, "Bad neighbor destination address %s: errno=%d: %s%s",
@ -4628,7 +4628,7 @@ static int recv_joinprune(struct vty *vty,
}
/* Neighbor source address */
neigh_src_str = argv[3];
neigh_src_str = argv[3]->arg;
result = inet_pton(AF_INET, neigh_src_str, &neigh_src_addr);
if (result <= 0) {
vty_out(vty, "Bad neighbor source address %s: errno=%d: %s%s",
@ -4637,7 +4637,7 @@ static int recv_joinprune(struct vty *vty,
}
/* Multicast group address */
group_str = argv[4];
group_str = argv[4]->arg;
result = inet_pton(AF_INET, group_str, &group_addr);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@ -4646,7 +4646,7 @@ static int recv_joinprune(struct vty *vty,
}
/* Multicast source address */
source_str = argv[5];
source_str = argv[5]->arg;
result = inet_pton(AF_INET, source_str, &source_addr);
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s%s",
@ -4819,7 +4819,7 @@ DEFUN (test_pim_receive_upcall,
const char *source_str;
int result;
upcall_type = argv[0];
upcall_type = argv[0]->arg;
if (upcall_type[0] == 'n')
msg.im_msgtype = IGMPMSG_NOCACHE;
@ -4833,10 +4833,10 @@ DEFUN (test_pim_receive_upcall,
return CMD_WARNING;
}
msg.im_vif = atoi(argv[1]);
msg.im_vif = atoi(argv[1]->arg);
/* Group address */
group_str = argv[2];
group_str = argv[2]->arg;
result = inet_pton(AF_INET, group_str, &msg.im_dst);
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s%s",
@ -4845,7 +4845,7 @@ DEFUN (test_pim_receive_upcall,
}
/* Source address */
source_str = argv[3];
source_str = argv[3]->arg;
result = inet_pton(AF_INET, source_str, &msg.im_src);
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s%s",