DEFUN (set_ip_nexthop_peer,
set_ip_nexthop_peer_cmd,
- "set ip next-hop peer-address",
+ "[no] set ip next-hop peer-address",
+ NO_STR
SET_STR
IP_STR
"Next hop address\n"
"Use peer address (for BGP only)\n")
{
- return generic_set_add(vty, VTY_GET_CONTEXT(route_map_index),
- "ip next-hop", "peer-address");
+ int (*func)(struct vty *, struct route_map_index *, const char *,
+ const char *) = strmatch(argv[0]->text, "no")
+ ? generic_set_delete
+ : generic_set_add;
+
+ return func(vty, VTY_GET_CONTEXT(route_map_index), "ip next-hop",
+ "peer-address");
}
DEFUN (set_ip_nexthop_unchanged,
DEFUN (no_set_ip_nexthop,
no_set_ip_nexthop_cmd,
- "no set ip next-hop [<peer-address|A.B.C.D>]",
+ "no set ip next-hop [A.B.C.D]",
NO_STR
SET_STR
IP_STR
"Next hop address\n"
- "Use peer address (for BGP only)\n"
"IP address of next hop\n")
{
- int idx_peer = 4;
+ int idx;
VTY_DECLVAR_CONTEXT(route_map_index, index);
+ const char *arg = NULL;
- if (rmap_match_set_hook.no_set_ip_nexthop) {
- if (argc <= idx_peer)
- return rmap_match_set_hook.no_set_ip_nexthop(
- vty, index, "ip next-hop", NULL);
+ if (argv_find(argv, argc, "A.B.C.D", &idx))
+ arg = argv[idx]->arg;
+
+ if (rmap_match_set_hook.no_set_ip_nexthop)
return rmap_match_set_hook.no_set_ip_nexthop(
- vty, index, "ip next-hop", argv[idx_peer]->arg);
- }
+ vty, index, "ip next-hop", arg);
+
return CMD_SUCCESS;
}