From 8b9c900bd1cc8e76d43b43bdc0c27dfbb5cb4b32 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 31 Oct 2016 08:54:35 -0400 Subject: [PATCH] pimd: Remove unused/unmaintained test commands The test commands are not being maintained and are not out of date with the rest of the system. There are better ways to test code and in addition these commands if entered by a user could seriously impact their running system. Signed-off-by: Donald Sharp --- pimd/pim_cmd.c | 738 ------------------------------------------------- 1 file changed, 738 deletions(-) diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 36ec541cea..35a991d8a7 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -5075,736 +5075,6 @@ DEFUN (show_debugging_pim, return CMD_SUCCESS; } -static struct igmp_sock *find_igmp_sock_by_fd(int fd) -{ - struct listnode *ifnode; - struct interface *ifp; - - /* scan all interfaces */ - for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { - struct pim_interface *pim_ifp; - struct igmp_sock *igmp; - - if (!ifp->info) - continue; - - pim_ifp = ifp->info; - - /* lookup igmp socket under current interface */ - igmp = igmp_sock_lookup_by_fd(pim_ifp->igmp_socket_list, fd); - if (igmp) - return igmp; - } - - return 0; -} - -DEFUN (test_igmp_receive_report, - test_igmp_receive_report_cmd, - "test igmp receive report (0-65535) A.B.C.D (1-6) LINE...", - "Test\n" - "Test IGMP protocol\n" - "Test IGMP message\n" - "Test IGMP report\n" - "Socket\n" - "IGMP group address\n" - "Record type\n" - "Sources\n") -{ - int idx_number = 4; - int idx_ipv4 = 5; - int idx_number_2 = 6; - int idx_line = 7; - char buf[1000]; - char *igmp_msg; - struct ip *ip_hdr; - size_t ip_hlen; /* ip header length in bytes */ - int ip_msg_len; - int igmp_msg_len; - const char *socket; - int socket_fd; - const char *grp_str; - struct in_addr grp_addr; - const char *record_type_str; - int record_type; - const char *src_str; - int result; - struct igmp_sock *igmp; - char *group_record; - int num_sources; - struct in_addr *sources; - struct in_addr *src_addr; - int argi; - - socket = argv[idx_number]->arg; - socket_fd = atoi(socket); - igmp = find_igmp_sock_by_fd(socket_fd); - if (!igmp) { - vty_out(vty, "Could not find IGMP socket %s: fd=%d%s", - socket, socket_fd, VTY_NEWLINE); - return CMD_WARNING; - } - - grp_str = argv[idx_ipv4]->arg; - result = inet_pton(AF_INET, grp_str, &grp_addr); - if (result <= 0) { - vty_out(vty, "Bad group address %s: errno=%d: %s%s", - grp_str, errno, safe_strerror(errno), VTY_NEWLINE); - return CMD_WARNING; - } - - record_type_str = argv[idx_number_2]->arg; - record_type = atoi(record_type_str); - - /* - Tweak IP header - */ - ip_hdr = (struct ip *) buf; - ip_hdr->ip_p = PIM_IP_PROTO_IGMP; - ip_hlen = PIM_IP_HEADER_MIN_LEN; /* ip header length in bytes */ - ip_hdr->ip_hl = ip_hlen >> 2; /* ip header length in 4-byte words */ - ip_hdr->ip_src = igmp->ifaddr; - ip_hdr->ip_dst = igmp->ifaddr; - - /* - Build IGMP v3 report message - */ - igmp_msg = buf + ip_hlen; - group_record = igmp_msg + IGMP_V3_REPORT_GROUPPRECORD_OFFSET; - *igmp_msg = PIM_IGMP_V3_MEMBERSHIP_REPORT; /* type */ - *(uint16_t *) (igmp_msg + IGMP_CHECKSUM_OFFSET) = 0; /* for computing checksum */ - *(uint16_t *) (igmp_msg + IGMP_V3_REPORT_NUMGROUPS_OFFSET) = htons(1); /* one group record */ - *(uint8_t *) (group_record + IGMP_V3_GROUP_RECORD_TYPE_OFFSET) = record_type; - memcpy(group_record + IGMP_V3_GROUP_RECORD_GROUP_OFFSET, &grp_addr, sizeof(struct in_addr)); - - /* Scan LINE sources */ - sources = (struct in_addr *) (group_record + IGMP_V3_GROUP_RECORD_SOURCE_OFFSET); - src_addr = sources; - for (argi = idx_line; argi < argc; ++argi,++src_addr) { - 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", - src_str, errno, safe_strerror(errno), VTY_NEWLINE); - return CMD_WARNING; - } - } - num_sources = src_addr - sources; - - *(uint16_t *)(group_record + IGMP_V3_GROUP_RECORD_NUMSOURCES_OFFSET) = htons(num_sources); - - igmp_msg_len = IGMP_V3_MSG_MIN_SIZE + (num_sources << 4); /* v3 report for one single group record */ - - /* compute checksum */ - *(uint16_t *)(igmp_msg + IGMP_CHECKSUM_OFFSET) = in_cksum(igmp_msg, igmp_msg_len); - - /* "receive" message */ - - ip_msg_len = ip_hlen + igmp_msg_len; - result = pim_igmp_packet(igmp, buf, ip_msg_len); - if (result) { - vty_out(vty, "pim_igmp_packet(len=%d) returned: %d%s", - ip_msg_len, result, VTY_NEWLINE); - return CMD_WARNING; - } - - return CMD_SUCCESS; -} - -static int hexval(uint8_t ch) -{ - return isdigit(ch) ? (ch - '0') : (10 + tolower(ch) - 'a'); -} - -DEFUN (test_pim_receive_dump, - test_pim_receive_dump_cmd, - "test pim receive dump INTERFACE A.B.C.D LINE...", - "Test\n" - "Test PIM protocol\n" - "Test PIM message reception\n" - "Test PIM packet dump reception from neighbor\n" - "Interface\n" - "Neighbor address\n" - "Packet dump\n") -{ - int idx_interface = 4; - int idx_ipv4 = 5; - int idx_line = 6; - uint8_t buf[1000]; - uint8_t *pim_msg; - struct ip *ip_hdr; - size_t ip_hlen; /* ip header length in bytes */ - int ip_msg_len; - int pim_msg_size; - const char *neigh_str; - struct in_addr neigh_addr; - const char *ifname; - struct interface *ifp; - int argi; - int result; - - /* Find interface */ - ifname = argv[idx_interface]->arg; - ifp = if_lookup_by_name(ifname); - if (!ifp) { - vty_out(vty, "No such interface name %s%s", - ifname, VTY_NEWLINE); - return CMD_WARNING; - } - - /* Neighbor address */ - neigh_str = argv[idx_ipv4]->arg; - result = inet_pton(AF_INET, neigh_str, &neigh_addr); - if (result <= 0) { - vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", - neigh_str, errno, safe_strerror(errno), VTY_NEWLINE); - return CMD_WARNING; - } - - /* - Tweak IP header - */ - ip_hdr = (struct ip *) buf; - ip_hdr->ip_p = PIM_IP_PROTO_PIM; - ip_hlen = PIM_IP_HEADER_MIN_LEN; /* ip header length in bytes */ - ip_hdr->ip_hl = ip_hlen >> 2; /* ip header length in 4-byte words */ - ip_hdr->ip_src = neigh_addr; - ip_hdr->ip_dst = qpim_all_pim_routers_addr; - - /* - Build PIM hello message - */ - pim_msg = buf + ip_hlen; - pim_msg_size = 0; - - /* Scan LINE dump into buffer */ - for (argi = idx_line; argi < argc; ++argi) { - const char *str = argv[argi]->arg; - int str_len = strlen(str); - int str_last = str_len - 1; - int i; - - if (str_len % 2) { - vty_out(vty, "%% Uneven hex array arg %d=%s%s", - argi, str, VTY_NEWLINE); - return CMD_WARNING; - } - - for (i = 0; i < str_last; i += 2) { - uint8_t octet; - int left; - uint8_t h1 = str[i]; - uint8_t h2 = str[i + 1]; - - if (!isxdigit(h1) || !isxdigit(h2)) { - vty_out(vty, "%% Non-hex octet %c%c at hex array arg %d=%s%s", - h1, h2, argi, str, VTY_NEWLINE); - return CMD_WARNING; - } - octet = (hexval(h1) << 4) + hexval(h2); - - left = sizeof(buf) - ip_hlen - pim_msg_size; - if (left < 1) { - vty_out(vty, "%% Overflow buf_size=%zu buf_left=%d at hex array arg %d=%s octet %02x%s", - sizeof(buf), left, argi, str, octet, VTY_NEWLINE); - return CMD_WARNING; - } - - pim_msg[pim_msg_size++] = octet; - } - } - - ip_msg_len = ip_hlen + pim_msg_size; - - vty_out(vty, "Receiving: buf_size=%zu ip_msg_size=%d pim_msg_size=%d%s", - sizeof(buf), ip_msg_len, pim_msg_size, VTY_NEWLINE); - - /* "receive" message */ - - result = pim_pim_packet(ifp, buf, ip_msg_len); - if (result) { - vty_out(vty, "%% pim_pim_packet(len=%d) returned failure: %d%s", - ip_msg_len, result, VTY_NEWLINE); - return CMD_WARNING; - } - - return CMD_SUCCESS; -} - -DEFUN (test_pim_receive_hello, - test_pim_receive_hello_cmd, - "test pim receive hello INTERFACE A.B.C.D (0-65535) (0-65535) (0-65535) (0-32767) (0-65535) (0-1) [LINE]", - "Test\n" - "Test PIM protocol\n" - "Test PIM message reception\n" - "Test PIM hello reception from neighbor\n" - "Interface\n" - "Neighbor address\n" - "Neighbor holdtime\n" - "Neighbor DR priority\n" - "Neighbor generation ID\n" - "Neighbor propagation delay (msec)\n" - "Neighbor override interval (msec)\n" - "Neighbor LAN prune delay T-bit\n" - "Neighbor secondary addresses\n") -{ - int idx_interface = 4; - int idx_ipv4 = 5; - int idx_number = 6; - int idx_number_2 = 7; - int idx_number_3 = 8; - int idx_number_4 = 9; - int idx_number_5 = 10; - int idx_number_6 = 11; - int idx_line = 12; - uint8_t buf[1000]; - uint8_t *pim_msg; - struct ip *ip_hdr; - size_t ip_hlen; /* ip header length in bytes */ - int ip_msg_len; - int pim_tlv_size; - int pim_msg_size; - const char *neigh_str; - struct in_addr neigh_addr; - const char *ifname; - struct interface *ifp; - uint16_t neigh_holdtime; - uint16_t neigh_propagation_delay; - uint16_t neigh_override_interval; - int neigh_can_disable_join_suppression; - uint32_t neigh_dr_priority; - uint32_t neigh_generation_id; - int argi; - int result; - - /* Find interface */ - ifname = argv[idx_interface]->arg; - ifp = if_lookup_by_name(ifname); - if (!ifp) { - vty_out(vty, "No such interface name %s%s", - ifname, VTY_NEWLINE); - return CMD_WARNING; - } - - /* Neighbor address */ - neigh_str = argv[idx_ipv4]->arg; - result = inet_pton(AF_INET, neigh_str, &neigh_addr); - if (result <= 0) { - vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", - neigh_str, errno, safe_strerror(errno), VTY_NEWLINE); - return CMD_WARNING; - } - - neigh_holdtime = atoi(argv[idx_number]->arg); - neigh_dr_priority = atoi(argv[idx_number_2]->arg); - neigh_generation_id = atoi(argv[idx_number_3]->arg); - neigh_propagation_delay = atoi(argv[idx_number_4]->arg); - neigh_override_interval = atoi(argv[idx_number_5]->arg); - neigh_can_disable_join_suppression = atoi(argv[idx_number_6]->arg); - - /* - Tweak IP header - */ - ip_hdr = (struct ip *) buf; - ip_hdr->ip_p = PIM_IP_PROTO_PIM; - ip_hlen = PIM_IP_HEADER_MIN_LEN; /* ip header length in bytes */ - ip_hdr->ip_hl = ip_hlen >> 2; /* ip header length in 4-byte words */ - ip_hdr->ip_src = neigh_addr; - ip_hdr->ip_dst = qpim_all_pim_routers_addr; - - /* - Build PIM hello message - */ - pim_msg = buf + ip_hlen; - - /* Scan LINE addresses */ - for (argi = idx_line; argi < argc; ++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) { - vty_out(vty, "Bad neighbor secondary address %s: errno=%d: %s%s", - sec_str, errno, safe_strerror(errno), VTY_NEWLINE); - return CMD_WARNING; - } - - vty_out(vty, - "FIXME WRITEME consider neighbor secondary address %s%s", - sec_str, VTY_NEWLINE); - } - - pim_tlv_size = pim_hello_build_tlv(ifp->name, - pim_msg + PIM_PIM_MIN_LEN, - sizeof(buf) - ip_hlen - PIM_PIM_MIN_LEN, - neigh_holdtime, - neigh_dr_priority, - neigh_generation_id, - neigh_propagation_delay, - neigh_override_interval, - neigh_can_disable_join_suppression, - 0 /* FIXME secondary address list */); - if (pim_tlv_size < 0) { - vty_out(vty, "pim_hello_build_tlv() returned failure: %d%s", - pim_tlv_size, VTY_NEWLINE); - return CMD_WARNING; - } - - pim_msg_size = pim_tlv_size + PIM_PIM_MIN_LEN; - - pim_msg_build_header(pim_msg, pim_msg_size, - PIM_MSG_TYPE_HELLO); - - /* "receive" message */ - - ip_msg_len = ip_hlen + pim_msg_size; - result = pim_pim_packet(ifp, buf, ip_msg_len); - if (result) { - vty_out(vty, "pim_pim_packet(len=%d) returned failure: %d%s", - ip_msg_len, result, VTY_NEWLINE); - return CMD_WARNING; - } - - return CMD_SUCCESS; -} - -DEFUN (test_pim_receive_assert, - test_pim_receive_assert_cmd, - "test pim receive assert INTERFACE A.B.C.D A.B.C.D A.B.C.D (0-65535) (0-65535) (0-1)", - "Test\n" - "Test PIM protocol\n" - "Test PIM message reception\n" - "Test reception of PIM assert\n" - "Interface\n" - "Neighbor address\n" - "Assert multicast group address\n" - "Assert unicast source address\n" - "Assert metric preference\n" - "Assert route metric\n" - "Assert RPT bit flag\n") -{ - int idx_interface = 4; - int idx_ipv4 = 5; - int idx_ipv4_2 = 6; - int idx_ipv4_3 = 7; - int idx_number = 8; - int idx_number_2 = 9; - int idx_number_3 = 10; - uint8_t buf[1000]; - uint8_t *buf_pastend = buf + sizeof(buf); - uint8_t *pim_msg; - struct ip *ip_hdr; - size_t ip_hlen; /* ip header length in bytes */ - int ip_msg_len; - int pim_msg_size; - const char *neigh_str; - struct in_addr neigh_addr; - const char *group_str; - struct in_addr group_addr; - const char *source_str; - struct in_addr source_addr; - const char *ifname; - struct interface *ifp; - uint32_t assert_metric_preference; - uint32_t assert_route_metric; - uint32_t assert_rpt_bit_flag; - int remain; - int result; - - /* Find interface */ - ifname = argv[idx_interface]->arg; - ifp = if_lookup_by_name(ifname); - if (!ifp) { - vty_out(vty, "No such interface name %s%s", - ifname, VTY_NEWLINE); - return CMD_WARNING; - } - - /* Neighbor address */ - neigh_str = argv[idx_ipv4]->arg; - result = inet_pton(AF_INET, neigh_str, &neigh_addr); - if (result <= 0) { - vty_out(vty, "Bad neighbor address %s: errno=%d: %s%s", - neigh_str, errno, safe_strerror(errno), VTY_NEWLINE); - return CMD_WARNING; - } - - /* Group address */ - group_str = argv[idx_ipv4_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", - group_str, errno, safe_strerror(errno), VTY_NEWLINE); - return CMD_WARNING; - } - - /* Source address */ - source_str = argv[idx_ipv4_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", - source_str, errno, safe_strerror(errno), VTY_NEWLINE); - return CMD_WARNING; - } - - assert_metric_preference = atoi(argv[idx_number]->arg); - assert_route_metric = atoi(argv[idx_number_2]->arg); - assert_rpt_bit_flag = atoi(argv[idx_number_3]->arg); - - remain = buf_pastend - buf; - if (remain < (int) sizeof(struct ip)) { - vty_out(vty, "No room for ip header: buf_size=%d < ip_header_size=%zu%s", - remain, sizeof(struct ip), VTY_NEWLINE); - return CMD_WARNING; - } - - /* - Tweak IP header - */ - ip_hdr = (struct ip *) buf; - ip_hdr->ip_p = PIM_IP_PROTO_PIM; - ip_hlen = PIM_IP_HEADER_MIN_LEN; /* ip header length in bytes */ - ip_hdr->ip_hl = ip_hlen >> 2; /* ip header length in 4-byte words */ - ip_hdr->ip_src = neigh_addr; - ip_hdr->ip_dst = qpim_all_pim_routers_addr; - - /* - Build PIM assert message - */ - pim_msg = buf + ip_hlen; /* skip ip header */ - - pim_msg_size = pim_assert_build_msg(pim_msg, buf_pastend - pim_msg, ifp, - group_addr, source_addr, - assert_metric_preference, - assert_route_metric, - assert_rpt_bit_flag); - if (pim_msg_size < 0) { - vty_out(vty, "Failure building PIM assert message: size=%d%s", - pim_msg_size, VTY_NEWLINE); - return CMD_WARNING; - } - - /* "receive" message */ - - ip_msg_len = ip_hlen + pim_msg_size; - result = pim_pim_packet(ifp, buf, ip_msg_len); - if (result) { - vty_out(vty, "pim_pim_packet(len=%d) returned failure: %d%s", - ip_msg_len, result, VTY_NEWLINE); - return CMD_WARNING; - } - - return CMD_SUCCESS; -} - -static int recv_joinprune(struct vty *vty, - struct cmd_token **argv, - int src_is_join) -{ - uint8_t buf[1000]; - const uint8_t *buf_pastend = buf + sizeof(buf); - uint8_t *pim_msg; - int pim_msg_size; - struct ip *ip_hdr; - size_t ip_hlen; /* ip header length in bytes */ - int ip_msg_len; - uint16_t neigh_holdtime; - const char *neigh_dst_str; - struct in_addr neigh_dst_addr; - const char *neigh_src_str; - struct in_addr neigh_src_addr; - const char *group_str; - struct in_addr group_addr; - const char *source_str; - struct in_addr source_addr; - const char *ifname; - struct interface *ifp; - int result; - - /* Find interface */ - ifname = argv[0]->arg; - ifp = if_lookup_by_name(ifname); - if (!ifp) { - vty_out(vty, "No such interface name %s%s", - ifname, VTY_NEWLINE); - return CMD_WARNING; - } - - neigh_holdtime = atoi(argv[1]->arg); - - /* Neighbor destination address */ - 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", - neigh_dst_str, errno, safe_strerror(errno), VTY_NEWLINE); - return CMD_WARNING; - } - - /* Neighbor source address */ - 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", - neigh_src_str, errno, safe_strerror(errno), VTY_NEWLINE); - return CMD_WARNING; - } - - /* Multicast group address */ - 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", - group_str, errno, safe_strerror(errno), VTY_NEWLINE); - return CMD_WARNING; - } - - /* Multicast source address */ - 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", - source_str, errno, safe_strerror(errno), VTY_NEWLINE); - return CMD_WARNING; - } - - /* - Tweak IP header - */ - ip_hdr = (struct ip *) buf; - ip_hdr->ip_p = PIM_IP_PROTO_PIM; - ip_hlen = PIM_IP_HEADER_MIN_LEN; /* ip header length in bytes */ - ip_hdr->ip_hl = ip_hlen >> 2; /* ip header length in 4-byte words */ - ip_hdr->ip_src = neigh_src_addr; - ip_hdr->ip_dst = qpim_all_pim_routers_addr; - - /* - Build PIM message - */ - pim_msg = buf + ip_hlen; - - pim_msg_size = pim_msg_join_prune_encode (pim_msg, buf_pastend - pim_msg, src_is_join, - source_addr, group_addr, neigh_dst_addr, - neigh_holdtime); - - /* - "Receive" message - */ - - ip_msg_len = ip_hlen + pim_msg_size; - result = pim_pim_packet(ifp, buf, ip_msg_len); - if (result) { - vty_out(vty, "pim_pim_packet(len=%d) returned failure: %d%s", - ip_msg_len, result, VTY_NEWLINE); - return CMD_WARNING; - } - - return CMD_SUCCESS; -} - -DEFUN (test_pim_receive_join, - test_pim_receive_join_cmd, - "test pim receive join INTERFACE (0-65535) A.B.C.D A.B.C.D A.B.C.D A.B.C.D", - "Test\n" - "Test PIM protocol\n" - "Test PIM message reception\n" - "Test PIM join reception from neighbor\n" - "Interface\n" - "Neighbor holdtime\n" - "Upstream neighbor unicast destination address\n" - "Downstream neighbor unicast source address\n" - "Multicast group address\n" - "Unicast source address\n") -{ - return recv_joinprune(vty, argv, 1 /* src_is_join=true */); -} - -DEFUN (test_pim_receive_prune, - test_pim_receive_prune_cmd, - "test pim receive prune INTERFACE (0-65535) A.B.C.D A.B.C.D A.B.C.D A.B.C.D", - "Test\n" - "Test PIM protocol\n" - "Test PIM message reception\n" - "Test PIM prune reception from neighbor\n" - "Interface\n" - "Neighbor holdtime\n" - "Upstream neighbor unicast destination address\n" - "Downstream neighbor unicast source address\n" - "Multicast group address\n" - "Unicast source address\n") -{ - return recv_joinprune(vty, argv, 0 /* src_is_join=false */); -} - -DEFUN (test_pim_receive_upcall, - test_pim_receive_upcall_cmd, - "test pim receive upcall (0-65535) A.B.C.D A.B.C.D", - "Test\n" - "Test PIM protocol\n" - "Test PIM message reception\n" - "Test reception of kernel upcall\n" - "NOCACHE kernel upcall\n" - "WRONGVIF kernel upcall\n" - "WHOLEPKT kernel upcall\n" - "Input interface vif index\n" - "Multicast group address\n" - "Multicast source address\n") -{ - int idx_type = 4; - int idx_number = 5; - int idx_ipv4 = 6; - int idx_ipv4_2 = 7; - struct igmpmsg msg; - const char *upcall_type; - const char *group_str; - const char *source_str; - int result; - - upcall_type = argv[idx_type]->arg; - - if (upcall_type[0] == 'n') - msg.im_msgtype = IGMPMSG_NOCACHE; - else if (upcall_type[1] == 'r') - msg.im_msgtype = IGMPMSG_WRONGVIF; - else if (upcall_type[1] == 'h') - msg.im_msgtype = IGMPMSG_WHOLEPKT; - else { - vty_out(vty, "Unknown kernel upcall type: %s%s", - upcall_type, VTY_NEWLINE); - return CMD_WARNING; - } - - msg.im_vif = atoi(argv[idx_number]->arg); - - /* Group address */ - group_str = argv[idx_ipv4]->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", - group_str, errno, safe_strerror(errno), VTY_NEWLINE); - return CMD_WARNING; - } - - /* Source address */ - source_str = argv[idx_ipv4_2]->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", - source_str, errno, safe_strerror(errno), VTY_NEWLINE); - return CMD_WARNING; - } - - msg.im_mbz = 0; /* Must be zero */ - - result = pim_mroute_msg(-1, (char *) &msg, sizeof(msg)); - if (result) { - vty_out(vty, "pim_mroute_msg(len=%zu) returned failure: %d%s", - sizeof(msg), result, VTY_NEWLINE); - return CMD_WARNING; - } - - return CMD_SUCCESS; -} - void pim_cmd_init() { install_node (&pim_global_node, pim_global_config_write); /* PIM_NODE */ @@ -5887,14 +5157,6 @@ void pim_cmd_init() install_element (ENABLE_NODE, &clear_ip_pim_interfaces_cmd); install_element (ENABLE_NODE, &clear_ip_pim_oil_cmd); - install_element (ENABLE_NODE, &test_igmp_receive_report_cmd); - install_element (ENABLE_NODE, &test_pim_receive_assert_cmd); - install_element (ENABLE_NODE, &test_pim_receive_dump_cmd); - install_element (ENABLE_NODE, &test_pim_receive_hello_cmd); - install_element (ENABLE_NODE, &test_pim_receive_join_cmd); - install_element (ENABLE_NODE, &test_pim_receive_prune_cmd); - install_element (ENABLE_NODE, &test_pim_receive_upcall_cmd); - install_element (ENABLE_NODE, &debug_igmp_cmd); install_element (ENABLE_NODE, &no_debug_igmp_cmd); install_element (ENABLE_NODE, &debug_igmp_events_cmd); -- 2.39.5