summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaul <paul>2003-11-02 07:24:40 +0000
committerpaul <paul>2003-11-02 07:24:40 +0000
commitaf5cd0a52c89c73ec8c0fec808ab866cdda96f30 (patch)
tree3e1e232c39b1e5670f42a449356052d88f844d13
parent0fdc25b4189ac7151a7c19ed2556ff5119d70098 (diff)
2003-11-02 Paul Jakma <paul@dishone.st>
* bgpd/bgp_routemap.c: Fix up 'set ip next-hop A.B.C.D|peer-address' route map command so that vtysh can use it. Modified version of Hasso Tepper's patch. Fixes bug #52.
-rw-r--r--bgpd/bgp_routemap.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index a2635151..ce9ceb5d 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -2414,19 +2414,15 @@ ALIAS (no_match_origin,
DEFUN (set_ip_nexthop,
set_ip_nexthop_cmd,
- "set ip next-hop (A.B.C.D|peer-address)",
+ "set ip next-hop A.B.C.D",
SET_STR
IP_STR
"Next hop address\n"
- "IP address of next hop\n"
- "Use peer address (for BGP only)\n")
+ "IP address of next hop\n")
{
union sockunion su;
int ret;
- if (strncmp (argv[0], "peer-address", 1) == 0)
- return bgp_route_set_add (vty, vty->index, "ip next-hop", "peer-address");
-
ret = str2sockunion (argv[0], &su);
if (ret < 0)
{
@@ -2437,15 +2433,38 @@ DEFUN (set_ip_nexthop,
return bgp_route_set_add (vty, vty->index, "ip next-hop", argv[0]);
}
+DEFUN (set_ip_nexthop_peer,
+ set_ip_nexthop_peer_cmd,
+ "set ip next-hop peer-address",
+ SET_STR
+ IP_STR
+ "Next hop address\n"
+ "Use peer address (for BGP only)\n")
+{
+ return bgp_route_set_add (vty, vty->index, "ip next-hop", "peer-address");
+}
+
+DEFUN (no_set_ip_nexthop_peer,
+ no_set_ip_nexthop_peer_cmd,
+ "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 bgp_route_set_delete (vty, vty->index, "ip next-hop", NULL);
+}
+
+
DEFUN (no_set_ip_nexthop,
no_set_ip_nexthop_cmd,
"no set ip next-hop",
NO_STR
SET_STR
- IP_STR
"Next hop address\n")
{
- if (argc == 0 || strncmp (argv[0], "peer-address", 1) == 0)
+ if (argc == 0)
return bgp_route_set_delete (vty, vty->index, "ip next-hop", NULL);
return bgp_route_set_delete (vty, vty->index, "ip next-hop", argv[0]);
@@ -2453,13 +2472,12 @@ DEFUN (no_set_ip_nexthop,
ALIAS (no_set_ip_nexthop,
no_set_ip_nexthop_val_cmd,
- "no set ip next-hop (A.B.C.D|peer-address)",
+ "no set ip next-hop A.B.C.D",
NO_STR
SET_STR
IP_STR
"Next hop address\n"
- "IP address of next hop\n"
- "Use peer address (for BGP only)\n")
+ "IP address of next hop\n")
DEFUN (set_metric,
set_metric_cmd,
@@ -3279,6 +3297,7 @@ bgp_route_map_init ()
install_element (RMAP_NODE, &no_match_origin_val_cmd);
install_element (RMAP_NODE, &set_ip_nexthop_cmd);
+ install_element (RMAP_NODE, &set_ip_nexthop_peer_cmd);
install_element (RMAP_NODE, &no_set_ip_nexthop_cmd);
install_element (RMAP_NODE, &no_set_ip_nexthop_val_cmd);
install_element (RMAP_NODE, &set_local_pref_cmd);