summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zebra/interface.c14
-rw-r--r--zebra/zebra_static.c118
-rw-r--r--zebra/zebra_static.h15
-rw-r--r--zebra/zebra_vrf.c44
-rw-r--r--zebra/zebra_vrf.h1
-rw-r--r--zebra/zebra_vty.c64
6 files changed, 128 insertions, 128 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index 317cc722b4..c629dfb3f3 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -48,6 +48,7 @@
#include "zebra/zebra_ptm.h"
#include "zebra/rt_netlink.h"
#include "zebra/interface.h"
+#include "zebra/zebra_static.h"
#define ZEBRA_PTM_SUPPORT
@@ -118,8 +119,6 @@ if_zebra_new_hook (struct interface *ifp)
zebra_if->ipv4_subnets = route_table_init_with_delegate (&zebra_if_table_delegate);
ifp->info = zebra_if;
-
- zebra_vrf_static_route_interface_fixup (ifp);
return 0;
}
@@ -520,6 +519,7 @@ if_add_update (struct interface *ifp)
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug ("interface %s vrf %u index %d becomes active.",
ifp->name, ifp->vrf_id, ifp->ifindex);
+ static_ifindex_update(ifp, true);
}
else
{
@@ -695,6 +695,8 @@ if_delete_update (struct interface *ifp)
zlog_debug ("interface %s vrf %u index %d is now inactive.",
ifp->name, ifp->vrf_id, ifp->ifindex);
+ static_ifindex_update(ifp, false);
+
/* Delete connected routes from the kernel. */
if_delete_connected (ifp);
@@ -723,6 +725,8 @@ if_handle_vrf_change (struct interface *ifp, vrf_id_t vrf_id)
old_vrf_id = ifp->vrf_id;
+ static_ifindex_update(ifp, false);
+
/* Uninstall connected routes. */
if_uninstall_connected (ifp);
@@ -746,6 +750,8 @@ if_handle_vrf_change (struct interface *ifp, vrf_id_t vrf_id)
/* Install connected routes (in new VRF). */
if_install_connected (ifp);
+ static_ifindex_update(ifp, true);
+
/* Due to connected route change, schedule RIB processing for both old
* and new VRF.
*/
@@ -754,8 +760,6 @@ if_handle_vrf_change (struct interface *ifp, vrf_id_t vrf_id)
ifp->vrf_id, ifp->name);
rib_update (old_vrf_id, RIB_UPDATE_IF_CHANGE);
rib_update (ifp->vrf_id, RIB_UPDATE_IF_CHANGE);
-
- zebra_vrf_static_route_interface_fixup (ifp);
}
static void
@@ -862,8 +866,6 @@ if_up (struct interface *ifp)
zlog_debug ("%u: IF %s up, scheduling RIB processing",
ifp->vrf_id, ifp->name);
rib_update (ifp->vrf_id, RIB_UPDATE_IF_CHANGE);
-
- zebra_vrf_static_route_interface_fixup (ifp);
}
/* Interface goes down. We have to manage different behavior of based
diff --git a/zebra/zebra_static.c b/zebra/zebra_static.c
index 4628d11091..169f1827e0 100644
--- a/zebra/zebra_static.c
+++ b/zebra/zebra_static.c
@@ -25,6 +25,7 @@
#include <lib/nexthop.h>
#include <lib/memory.h>
#include <lib/srcdest_table.h>
+#include <lib/if.h>
#include "vty.h"
#include "zebra/debug.h"
@@ -83,7 +84,7 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p,
nh_p.u.prefix4 = si->addr.ipv4;
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
break;
- case STATIC_IFINDEX:
+ case STATIC_IFNAME:
nexthop = rib_nexthop_ifindex_add (rib, si->ifindex);
break;
case STATIC_BLACKHOLE:
@@ -96,7 +97,7 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p,
nh_p.u.prefix6 = si->addr.ipv6;
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
break;
- case STATIC_IPV6_GATEWAY_IFINDEX:
+ case STATIC_IPV6_GATEWAY_IFNAME:
nexthop = rib_nexthop_ipv6_ifindex_add (rib, &si->addr.ipv6,
si->ifindex);
break;
@@ -147,7 +148,7 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p,
nh_p.u.prefix4 = si->addr.ipv4;
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
break;
- case STATIC_IFINDEX:
+ case STATIC_IFNAME:
nexthop = rib_nexthop_ifindex_add (rib, si->ifindex);
break;
case STATIC_BLACKHOLE:
@@ -160,7 +161,7 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p,
nh_p.u.prefix6 = si->addr.ipv6;
zebra_register_rnh_static_nh(si->vrf_id, &nh_p, rn);
break;
- case STATIC_IPV6_GATEWAY_IFINDEX:
+ case STATIC_IPV6_GATEWAY_IFNAME:
nexthop = rib_nexthop_ipv6_ifindex_add (rib, &si->addr.ipv6,
si->ifindex);
break;
@@ -197,6 +198,9 @@ static_install_route (afi_t afi, safi_t safi, struct prefix *p,
}
}
+/* this works correctly with IFNAME<>IFINDEX because a static route on a
+ * non-active interface will have IFINDEX_INTERNAL and thus compare false
+ */
static int
static_nexthop_same (struct nexthop *nexthop, struct static_route *si)
{
@@ -209,7 +213,7 @@ static_nexthop_same (struct nexthop *nexthop, struct static_route *si)
&& IPV4_ADDR_SAME (&nexthop->gate.ipv4, &si->addr.ipv4))
return 1;
else if (nexthop->type == NEXTHOP_TYPE_IFINDEX
- && si->type == STATIC_IFINDEX
+ && si->type == STATIC_IFNAME
&& nexthop->ifindex == si->ifindex)
return 1;
else if (nexthop->type == NEXTHOP_TYPE_IPV6
@@ -217,7 +221,7 @@ static_nexthop_same (struct nexthop *nexthop, struct static_route *si)
&& IPV6_ADDR_SAME (&nexthop->gate.ipv6, &si->addr.ipv6))
return 1;
else if (nexthop->type == NEXTHOP_TYPE_IPV6_IFINDEX
- && si->type == STATIC_IPV6_GATEWAY_IFINDEX
+ && si->type == STATIC_IPV6_GATEWAY_IFNAME
&& IPV6_ADDR_SAME (&nexthop->gate.ipv6, &si->addr.ipv6)
&& nexthop->ifindex == si->ifindex)
return 1;
@@ -340,8 +344,7 @@ static_uninstall_route (afi_t afi, safi_t safi, struct prefix *p,
int
static_add_route (afi_t afi, safi_t safi, u_char type, struct prefix *p,
- struct prefix_ipv6 *src_p,
- union g_addr *gate, ifindex_t ifindex,
+ struct prefix_ipv6 *src_p, union g_addr *gate,
const char *ifname, u_char flags, route_tag_t tag,
u_char distance, struct zebra_vrf *zvrf,
struct static_nh_label *snh_label)
@@ -359,12 +362,12 @@ static_add_route (afi_t afi, safi_t safi, u_char type, struct prefix *p,
if (!gate &&
(type == STATIC_IPV4_GATEWAY ||
type == STATIC_IPV6_GATEWAY ||
- type == STATIC_IPV6_GATEWAY_IFINDEX))
+ type == STATIC_IPV6_GATEWAY_IFNAME))
return -1;
- if (!ifindex &&
- (type == STATIC_IFINDEX ||
- type == STATIC_IPV6_GATEWAY_IFINDEX))
+ if (!ifname &&
+ (type == STATIC_IFNAME ||
+ type == STATIC_IPV6_GATEWAY_IFNAME))
return -1;
/* Lookup static route prefix. */
@@ -377,7 +380,7 @@ static_add_route (afi_t afi, safi_t safi, u_char type, struct prefix *p,
&& (! gate ||
((afi == AFI_IP && IPV4_ADDR_SAME (gate, &si->addr.ipv4)) ||
(afi == AFI_IP6 && IPV6_ADDR_SAME (gate, &si->addr.ipv6))))
- && (! ifindex || ifindex == si->ifindex))
+ && (!strcmp (ifname ? ifname : "", si->ifname)))
{
if ((distance == si->distance) && (tag == si->tag) &&
!memcmp (&si->snh_label, snh_label, sizeof (struct static_nh_label)) &&
@@ -393,7 +396,7 @@ static_add_route (afi_t afi, safi_t safi, u_char type, struct prefix *p,
/* Distance or tag or label changed, delete existing first. */
if (update)
- static_delete_route (afi, safi, type, p, src_p, gate, ifindex, update->tag,
+ static_delete_route (afi, safi, type, p, src_p, gate, ifname, update->tag,
update->distance, zvrf, &update->snh_label);
/* Make new static route structure. */
@@ -404,9 +407,9 @@ static_add_route (afi_t afi, safi_t safi, u_char type, struct prefix *p,
si->flags = flags;
si->tag = tag;
si->vrf_id = zvrf_id (zvrf);
- si->ifindex = ifindex;
- if (si->ifindex)
- strcpy(si->ifname, ifname);
+ if (ifname)
+ strlcpy(si->ifname, ifname, sizeof(si->ifname));
+ si->ifindex = IFINDEX_INTERNAL;
switch (type)
{
@@ -416,10 +419,10 @@ static_add_route (afi_t afi, safi_t safi, u_char type, struct prefix *p,
case STATIC_IPV6_GATEWAY:
si->addr.ipv6 = gate->ipv6;
break;
- case STATIC_IPV6_GATEWAY_IFINDEX:
+ case STATIC_IPV6_GATEWAY_IFNAME:
si->addr.ipv6 = gate->ipv6;
break;
- case STATIC_IFINDEX:
+ case STATIC_IFNAME:
break;
}
@@ -453,8 +456,20 @@ static_add_route (afi_t afi, safi_t safi, u_char type, struct prefix *p,
si->prev = pp;
si->next = cp;
- /* Install into rib. */
- static_install_route (afi, safi, p, src_p, si);
+ /* check whether interface exists in system & install if it does */
+ if (!ifname)
+ static_install_route(afi, safi, p, src_p, si);
+ else
+ {
+ struct interface *ifp;
+
+ ifp = if_lookup_by_name(ifname, zvrf_id(zvrf));
+ if (ifp && ifp->ifindex != IFINDEX_INTERNAL)
+ {
+ si->ifindex = ifp->ifindex;
+ static_install_route (afi, safi, p, src_p, si);
+ }
+ }
return 1;
}
@@ -462,7 +477,7 @@ static_add_route (afi_t afi, safi_t safi, u_char type, struct prefix *p,
int
static_delete_route (afi_t afi, safi_t safi, u_char type, struct prefix *p,
struct prefix_ipv6 *src_p,
- union g_addr *gate, ifindex_t ifindex,
+ union g_addr *gate, const char *ifname,
route_tag_t tag, u_char distance, struct zebra_vrf *zvrf,
struct static_nh_label *snh_label)
{
@@ -486,7 +501,7 @@ static_delete_route (afi_t afi, safi_t safi, u_char type, struct prefix *p,
&& (! gate || (
(afi == AFI_IP && IPV4_ADDR_SAME (gate, &si->addr.ipv4)) ||
(afi == AFI_IP6 && IPV6_ADDR_SAME (gate, &si->addr.ipv6))))
- && (! ifindex || ifindex == si->ifindex)
+ && (!strcmp(ifname ? ifname : "", si->ifname))
&& (! tag || (tag == si->tag))
&& (! snh_label->num_labels ||
!memcmp (&si->snh_label, snh_label, sizeof (struct static_nh_label))))
@@ -499,8 +514,9 @@ static_delete_route (afi_t afi, safi_t safi, u_char type, struct prefix *p,
return 0;
}
- /* Install into rib. */
- static_uninstall_route (afi, safi, p, src_p, si);
+ /* Uninstall from rib. */
+ if (!si->ifname[0] || si->ifindex != IFINDEX_INTERNAL)
+ static_uninstall_route (afi, safi, p, src_p, si);
/* Unlink static route from linked list. */
if (si->prev)
@@ -518,3 +534,55 @@ static_delete_route (afi_t afi, safi_t safi, u_char type, struct prefix *p,
return 1;
}
+
+static void
+static_ifindex_update_af(struct interface *ifp, bool up,
+ afi_t afi, safi_t safi)
+{
+ struct route_table *stable;
+ struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id);
+ struct route_node *rn;
+ struct static_route *si;
+ struct prefix *p, *src_pp;
+ struct prefix_ipv6 *src_p;
+
+ stable = zebra_vrf_static_table(afi, safi, zvrf);
+ if (!stable)
+ return;
+
+ for (rn = route_top(stable); rn; rn = srcdest_route_next(rn))
+ {
+ srcdest_rnode_prefixes(rn, &p, &src_pp);
+ src_p = (struct prefix_ipv6 *)src_pp;
+
+ for (si = rn->info; si; si = si->next)
+ {
+ if (!si->ifname[0])
+ continue;
+ if (up)
+ {
+ if (strcmp(si->ifname, ifp->name))
+ continue;
+ si->ifindex = ifp->ifindex;
+ static_install_route(afi, safi, p, src_p, si);
+ }
+ else
+ {
+ if (si->ifindex != ifp->ifindex)
+ continue;
+ static_uninstall_route(afi, safi, p, src_p, si);
+ si->ifindex = IFINDEX_INTERNAL;
+ }
+ }
+ }
+}
+
+/* called from if_{add,delete}_update, i.e. when ifindex becomes [in]valid */
+void
+static_ifindex_update(struct interface *ifp, bool up)
+{
+ static_ifindex_update_af(ifp, up, AFI_IP, SAFI_UNICAST);
+ static_ifindex_update_af(ifp, up, AFI_IP, SAFI_MULTICAST);
+ static_ifindex_update_af(ifp, up, AFI_IP6, SAFI_UNICAST);
+ static_ifindex_update_af(ifp, up, AFI_IP6, SAFI_MULTICAST);
+}
diff --git a/zebra/zebra_static.h b/zebra/zebra_static.h
index adc2efff58..6d3bafa325 100644
--- a/zebra/zebra_static.h
+++ b/zebra/zebra_static.h
@@ -32,11 +32,11 @@ struct static_nh_label
};
typedef enum {
- STATIC_IFINDEX,
+ STATIC_IFNAME,
STATIC_IPV4_GATEWAY,
STATIC_BLACKHOLE,
STATIC_IPV6_GATEWAY,
- STATIC_IPV6_GATEWAY_IFINDEX,
+ STATIC_IPV6_GATEWAY_IFNAME,
} zebra_static_types;
/* Static route information. */
@@ -64,7 +64,7 @@ struct static_route
* Under IPv4 addr and ifindex are
* used independentyly.
* STATIC_IPV4_GATEWAY uses addr
- * STATIC_IFINDEX uses ifindex
+ * STATIC_IFNAME uses ifindex
*/
union g_addr addr;
ifindex_t ifindex;
@@ -91,16 +91,15 @@ static_uninstall_route (afi_t afi, safi_t safi, struct prefix *p,
extern int
static_add_route (afi_t, safi_t safi, u_char type, struct prefix *p,
- struct prefix_ipv6 *src_p,
- union g_addr *gate, ifindex_t ifindex,
+ struct prefix_ipv6 *src_p, union g_addr *gate,
const char *ifname, u_char flags, route_tag_t tag,
u_char distance, struct zebra_vrf *zvrf,
struct static_nh_label *snh_label);
extern int
static_delete_route (afi_t, safi_t safi, u_char type, struct prefix *p,
- struct prefix_ipv6 *src_p,
- union g_addr *gate, ifindex_t ifindex, route_tag_t tag,
+ struct prefix_ipv6 *src_p, union g_addr *gate,
+ const char *ifname, route_tag_t tag,
u_char distance, struct zebra_vrf *zvrf,
struct static_nh_label *snh_label);
@@ -119,4 +118,6 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
const char *distance_str, const char *vrf_id_str,
const char *label_str);
+extern void static_ifindex_update(struct interface *ifp, bool up);
+
#endif
diff --git a/zebra/zebra_vrf.c b/zebra/zebra_vrf.c
index 1797ef080c..06d87a468e 100644
--- a/zebra/zebra_vrf.c
+++ b/zebra/zebra_vrf.c
@@ -98,50 +98,6 @@ zebra_vrf_new (struct vrf *vrf)
return 0;
}
-/*
- * Moving an interface amongst different vrf's
- * causes the interface to get a new ifindex
- * so we need to find static routes with
- * the old ifindex and replace with new
- * ifindex to insert back into the table
- */
-void
-zebra_vrf_static_route_interface_fixup (struct interface *ifp)
-{
- afi_t afi;
- safi_t safi;
- struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id (ifp->vrf_id);
- struct route_table *stable = NULL;
- struct route_node *rn = NULL;
- struct static_route *si = NULL;
-
- if (!zvrf)
- return;
-
- for (afi = AFI_IP; afi < AFI_MAX; afi++)
- {
- for (safi = SAFI_UNICAST ; safi < SAFI_MAX ; safi++)
- {
- stable = zvrf->stable[afi][safi];
- if (stable)
- for (rn = route_top (stable); rn; rn = route_next (rn))
- {
- if (rn->info)
- {
- si = rn->info;
- if ((strcmp (si->ifname, ifp->name) == 0) &&
- (si->ifindex != ifp->ifindex))
- {
- si->ifindex = ifp->ifindex;
- static_install_route (afi, safi, &rn->p, NULL, si);
- }
- }
- }
- }
- }
-
-}
-
/* Callback upon enabling a VRF. */
static int
zebra_vrf_enable (struct vrf *vrf)
diff --git a/zebra/zebra_vrf.h b/zebra/zebra_vrf.h
index 56c98931f2..cfe7cde75c 100644
--- a/zebra/zebra_vrf.h
+++ b/zebra/zebra_vrf.h
@@ -105,7 +105,6 @@ struct route_table *
zebra_vrf_table_with_table_id (afi_t afi, safi_t safi,
vrf_id_t vrf_id, u_int32_t table_id);
-extern void zebra_vrf_static_route_interface_fixup (struct interface *ifp);
extern void zebra_vrf_update_all (struct zserv *client);
extern struct zebra_vrf *zebra_vrf_lookup_by_id (vrf_id_t vrf_id);
extern struct zebra_vrf *zebra_vrf_lookup_by_name (const char *);
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 180ecd64a5..aeb01be070 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -69,7 +69,6 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
u_char flag = 0;
route_tag_t tag = 0;
struct zebra_vrf *zvrf = NULL;
- unsigned int ifindex = 0;
const char *ifname = NULL;
u_char type = STATIC_BLACKHOLE;
struct static_nh_label snh_label;
@@ -142,10 +141,10 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
return CMD_WARNING;
}
if (add_cmd)
- static_add_route (AFI_IP, safi, type, &p, NULL, NULL, ifindex, ifname,
+ static_add_route (AFI_IP, safi, type, &p, NULL, NULL, ifname,
ZEBRA_FLAG_BLACKHOLE, tag, distance, zvrf, &snh_label);
else
- static_delete_route (AFI_IP, safi, type, &p, NULL, NULL, ifindex, tag,
+ static_delete_route (AFI_IP, safi, type, &p, NULL, NULL, ifname, tag,
distance, zvrf, &snh_label);
return CMD_SUCCESS;
}
@@ -170,11 +169,11 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
if (gate_str == NULL)
{
if (add_cmd)
- static_add_route (AFI_IP, safi, type, &p, NULL, NULL, ifindex, ifname, flag,
+ static_add_route (AFI_IP, safi, type, &p, NULL, NULL, ifname, flag,
tag, distance, zvrf, &snh_label);
else
- static_delete_route (AFI_IP, safi, type, &p, NULL, NULL, ifindex, tag, distance,
- zvrf, &snh_label);
+ static_delete_route (AFI_IP, safi, type, &p, NULL, NULL, ifname, tag,
+ distance, zvrf, &snh_label);
return CMD_SUCCESS;
}
@@ -184,27 +183,19 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
ret = inet_aton (gate_str, &gate);
if (!ret)
{
- struct interface *ifp = if_lookup_by_name (gate_str, zvrf_id (zvrf));
- if (!ifp)
- {
- vty_out (vty, "%% Unknown interface: %s%s", gate_str, VTY_NEWLINE);
- ifindex = IFINDEX_DELETED;
- }
- else
- ifindex = ifp->ifindex;
ifname = gate_str;
- type = STATIC_IFINDEX;
+ type = STATIC_IFNAME;
}
else
type = STATIC_IPV4_GATEWAY;
if (add_cmd)
static_add_route (AFI_IP, safi, type, &p, NULL,
- ifindex ? NULL : (union g_addr *)&gate, ifindex, ifname,
+ ret ? (union g_addr *)&gate : NULL, ifname,
flag, tag, distance, zvrf, &snh_label);
else
static_delete_route (AFI_IP, safi, type, &p, NULL,
- ifindex ? NULL : (union g_addr *)&gate, ifindex, tag,
+ ret ? (union g_addr *)&gate : NULL, ifname, tag,
distance, zvrf, &snh_label);
return CMD_SUCCESS;
@@ -2287,7 +2278,7 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
case STATIC_IPV4_GATEWAY:
vty_out (vty, " %s", inet_ntoa (si->addr.ipv4));
break;
- case STATIC_IFINDEX:
+ case STATIC_IFNAME:
vty_out (vty, " %s", si->ifname);
break;
case STATIC_BLACKHOLE:
@@ -2296,7 +2287,7 @@ static_config_ipv4 (struct vty *vty, safi_t safi, const char *cmd)
case STATIC_IPV6_GATEWAY:
vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
break;
- case STATIC_IPV6_GATEWAY_IFINDEX:
+ case STATIC_IPV6_GATEWAY_IFNAME:
vty_out (vty, " %s %s",
inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
ifindex2ifname (si->ifindex, si->vrf_id));
@@ -2354,8 +2345,6 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
u_char type = STATIC_BLACKHOLE;
u_char flag = 0;
route_tag_t tag = 0;
- unsigned int ifindex = 0;
- struct interface *ifp = NULL;
struct zebra_vrf *zvrf;
struct static_nh_label snh_label;
@@ -2430,11 +2419,11 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
return CMD_WARNING;
}
if (add_cmd)
- static_add_route (AFI_IP6, SAFI_UNICAST, type, &p, src_p, NULL, ifindex, ifname,
+ static_add_route (AFI_IP6, SAFI_UNICAST, type, &p, src_p, NULL, ifname,
ZEBRA_FLAG_BLACKHOLE, tag, distance, zvrf, &snh_label);
else
- static_delete_route (AFI_IP6, SAFI_UNICAST, type, &p, src_p, NULL, ifindex, tag,
- distance, zvrf, &snh_label);
+ static_delete_route (AFI_IP6, SAFI_UNICAST, type, &p, src_p, NULL,
+ ifname, tag, distance, zvrf, &snh_label);
return CMD_SUCCESS;
}
@@ -2464,15 +2453,8 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
vty_out (vty, "%% Malformed address%s", VTY_NEWLINE);
return CMD_WARNING;
}
- type = STATIC_IPV6_GATEWAY_IFINDEX;
+ type = STATIC_IPV6_GATEWAY_IFNAME;
gate = &gate_addr;
- ifp = if_lookup_by_name (ifname, zvrf_id (zvrf));
- if (!ifp)
- {
- vty_out (vty, "%% Malformed Interface name %s%s", ifname, VTY_NEWLINE);
- return CMD_WARNING;
- }
- ifindex = ifp->ifindex;
}
else
{
@@ -2483,25 +2465,17 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
}
else
{
- type = STATIC_IFINDEX;
- ifp = if_lookup_by_name (gate_str, zvrf_id (zvrf));
- if (!ifp)
- {
- vty_out (vty, "%% Malformed Interface name %s%s", gate_str, VTY_NEWLINE);
- ifindex = IFINDEX_DELETED;
- }
- else
- ifindex = ifp->ifindex;
+ type = STATIC_IFNAME;
ifname = gate_str;
}
}
if (add_cmd)
static_add_route (AFI_IP6, SAFI_UNICAST, type, &p, src_p, (union g_addr *)gate,
- ifindex, ifname, flag, tag, distance, zvrf, &snh_label);
+ ifname, flag, tag, distance, zvrf, &snh_label);
else
static_delete_route (AFI_IP6, SAFI_UNICAST, type, &p, src_p, (union g_addr *)gate,
- ifindex, tag, distance, zvrf, &snh_label);
+ ifname, tag, distance, zvrf, &snh_label);
return CMD_SUCCESS;
}
@@ -3780,13 +3754,13 @@ static_config_ipv6 (struct vty *vty)
case STATIC_IPV6_GATEWAY:
vty_out (vty, " %s", inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ));
break;
- case STATIC_IFINDEX:
+ case STATIC_IFNAME:
vty_out (vty, " %s", si->ifname);
break;
case STATIC_BLACKHOLE:
vty_out (vty, " Null0" );
break;
- case STATIC_IPV6_GATEWAY_IFINDEX:
+ case STATIC_IPV6_GATEWAY_IFNAME:
vty_out (vty, " %s %s",
inet_ntop (AF_INET6, &si->addr.ipv6, buf, BUFSIZ),
ifindex2ifname (si->ifindex, si->vrf_id));