]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib, bgpd: fix `set ip next-hop peer-address`
authorQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 10 Aug 2017 16:31:47 +0000 (12:31 -0400)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 10 Aug 2017 16:31:47 +0000 (12:31 -0400)
This bgp-specific command had its positive form defined only in bgpd and
its negative form defined only in lib, which broke the whole rule for
other daemons.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
bgpd/bgp_routemap.c
lib/routemap.c

index a8e111d361c113b3c6d8606e3d9296f4c439b6e2..1398b2aa847903054608c90fed7641d04708bf3e 100644 (file)
@@ -3499,14 +3499,20 @@ DEFUN (no_match_origin,
 
 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,
index 3d1add25dc5dc02a1ccc25ed0a19b960ae2c3995..a70248633c087d68a9fa232765b31ac3a5d2de7a 100644 (file)
@@ -2194,24 +2194,24 @@ DEFUN (set_ip_nexthop,
 
 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;
 }