diff options
Diffstat (limited to 'sharpd/sharp_vty.c')
| -rw-r--r-- | sharpd/sharp_vty.c | 87 |
1 files changed, 70 insertions, 17 deletions
diff --git a/sharpd/sharp_vty.c b/sharpd/sharp_vty.c index 48220d1c9b..d390ea8192 100644 --- a/sharpd/sharp_vty.c +++ b/sharpd/sharp_vty.c @@ -131,8 +131,8 @@ DEFPY(sharp_nht_data_dump, sharp_nht_data_dump_cmd, "sharp data nexthop", "Sharp routing Protocol\n" - "Nexthop information\n" - "Data Dump\n") + "Data about what is going on\n" + "Nexthop information\n") { sharp_nh_tracker_dump(vty); @@ -278,7 +278,8 @@ DEFPY (install_routes, if (backup) { /* Set flag and index in primary nexthop */ SET_FLAG(sg.r.nhop.flags, NEXTHOP_FLAG_HAS_BACKUP); - sg.r.nhop.backup_idx = 0; + sg.r.nhop.backup_num = 1; + sg.r.nhop.backup_idx[0] = 0; if (backup_nexthop4.s_addr != INADDR_ANY) { sg.r.backup_nhop.gate.ipv4 = backup_nexthop4; @@ -393,27 +394,31 @@ DEFUN_NOSH (show_debugging_sharpd, return CMD_SUCCESS; } -DEFPY(sharp_lsp_prefix_v4, sharp_lsp_prefix_v4_cmd, - "sharp lsp (0-100000)$inlabel\ +DEFPY (sharp_lsp_prefix_v4, sharp_lsp_prefix_v4_cmd, + "sharp lsp [update]$update (0-100000)$inlabel\ nexthop-group NHGNAME$nhgname\ [prefix A.B.C.D/M$pfx\ " FRR_IP_REDIST_STR_ZEBRA "$type_str [instance (0-255)$instance]]", - "Sharp Routing Protocol\n" - "Add an LSP\n" - "The ingress label to use\n" - "Use nexthops from a nexthop-group\n" - "The nexthop-group name\n" - "Label a prefix\n" - "The v4 prefix to label\n" - FRR_IP_REDIST_HELP_STR_ZEBRA - "Instance to use\n" - "Instance\n") + "Sharp Routing Protocol\n" + "Add an LSP\n" + "Update an LSP\n" + "The ingress label to use\n" + "Use nexthops from a nexthop-group\n" + "The nexthop-group name\n" + "Label a prefix\n" + "The v4 prefix to label\n" + FRR_IP_REDIST_HELP_STR_ZEBRA + "Instance to use\n" + "Instance\n") { struct nexthop_group_cmd *nhgc = NULL; struct nexthop_group_cmd *backup_nhgc = NULL; struct nexthop_group *backup_nhg = NULL; struct prefix p = {}; int type = 0; + bool update_p; + + update_p = (update != NULL); /* We're offered a v4 prefix */ if (pfx->family > 0 && type_str) { @@ -457,7 +462,8 @@ DEFPY(sharp_lsp_prefix_v4, sharp_lsp_prefix_v4_cmd, backup_nhg = &(backup_nhgc->nhg); } - if (sharp_install_lsps_helper(true, pfx->family > 0 ? &p : NULL, + if (sharp_install_lsps_helper(true /*install*/, update_p, + pfx->family > 0 ? &p : NULL, type, instance, inlabel, &(nhgc->nhg), backup_nhg) == 0) return CMD_SUCCESS; @@ -522,7 +528,8 @@ DEFPY(sharp_remove_lsp_prefix_v4, sharp_remove_lsp_prefix_v4_cmd, nhg = &(nhgc->nhg); } - if (sharp_install_lsps_helper(false, pfx->family > 0 ? &p : NULL, + if (sharp_install_lsps_helper(false /*!install*/, false, + pfx->family > 0 ? &p : NULL, type, instance, inlabel, nhg, NULL) == 0) return CMD_SUCCESS; else { @@ -642,6 +649,51 @@ DEFPY (send_opaque_reg, return CMD_SUCCESS; } +DEFPY (neigh_discover, + neigh_discover_cmd, + "sharp neigh discover [vrf NAME$vrf_name] <A.B.C.D$dst4|X:X::X:X$dst6> IFNAME$ifname", + SHARP_STR + "Discover neighbours\n" + "Send an ARP/NDP request\n" + VRF_CMD_HELP_STR + "v4 Destination address\n" + "v6 Destination address\n" + "Interface name\n") +{ + struct vrf *vrf; + struct interface *ifp; + struct prefix prefix; + + memset(&prefix, 0, sizeof(prefix)); + + if (dst4.s_addr != 0) { + prefix.family = AF_INET; + prefix.prefixlen = 32; + prefix.u.prefix4 = dst4; + } else { + prefix.family = AF_INET6; + prefix.prefixlen = 128; + prefix.u.prefix6 = dst6; + } + + vrf = vrf_lookup_by_name(vrf_name ? vrf_name : VRF_DEFAULT_NAME); + if (!vrf) { + vty_out(vty, "The vrf NAME specified: %s does not exist\n", + vrf_name ? vrf_name : VRF_DEFAULT_NAME); + return CMD_WARNING; + } + + ifp = if_lookup_by_name_vrf(ifname, vrf); + if (ifp == NULL) { + vty_out(vty, "%% Can't find interface %s\n", ifname); + return CMD_WARNING; + } + + sharp_zebra_send_arp(ifp, &prefix); + + return CMD_SUCCESS; +} + void sharp_vty_init(void) { install_element(ENABLE_NODE, &install_routes_data_dump_cmd); @@ -659,6 +711,7 @@ void sharp_vty_init(void) install_element(ENABLE_NODE, &send_opaque_cmd); install_element(ENABLE_NODE, &send_opaque_unicast_cmd); install_element(ENABLE_NODE, &send_opaque_reg_cmd); + install_element(ENABLE_NODE, &neigh_discover_cmd); install_element(VIEW_NODE, &show_debugging_sharpd_cmd); |
