*: Refactor if_lookup_by_name to be VRF aware

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-03-11 07:27:15 -05:00
parent a90607a4ba
commit 1306c09a1b
25 changed files with 56 additions and 61 deletions

View File

@ -262,7 +262,7 @@ bgp_get_instance_for_inc_conn (int sock, struct bgp **bgp_inst)
if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW) if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
continue; continue;
ifp = if_lookup_by_name_vrf (name, bgp->vrf_id); ifp = if_lookup_by_name (name, bgp->vrf_id);
if (ifp) if (ifp)
{ {
*bgp_inst = bgp; *bgp_inst = bgp;
@ -544,7 +544,7 @@ bgp_update_source (struct peer *peer)
/* Source is specified with interface name. */ /* Source is specified with interface name. */
if (peer->update_if) if (peer->update_if)
{ {
ifp = if_lookup_by_name_vrf (peer->update_if, peer->bgp->vrf_id); ifp = if_lookup_by_name (peer->update_if, peer->bgp->vrf_id);
if (! ifp) if (! ifp)
return -1; return -1;

View File

@ -1026,7 +1026,7 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote,
{ {
nexthop->v4 = local->sin.sin_addr; nexthop->v4 = local->sin.sin_addr;
if (peer->update_if) if (peer->update_if)
ifp = if_lookup_by_name_vrf (peer->update_if, peer->bgp->vrf_id); ifp = if_lookup_by_name (peer->update_if, peer->bgp->vrf_id);
else else
ifp = if_lookup_by_ipv4_exact (&local->sin.sin_addr, peer->bgp->vrf_id); ifp = if_lookup_by_ipv4_exact (&local->sin.sin_addr, peer->bgp->vrf_id);
} }
@ -1035,10 +1035,10 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote,
if (IN6_IS_ADDR_LINKLOCAL (&local->sin6.sin6_addr)) if (IN6_IS_ADDR_LINKLOCAL (&local->sin6.sin6_addr))
{ {
if (peer->conf_if || peer->ifname) if (peer->conf_if || peer->ifname)
ifp = if_lookup_by_name_vrf (peer->conf_if ? peer->conf_if : peer->ifname, peer->bgp->vrf_id); ifp = if_lookup_by_name (peer->conf_if ? peer->conf_if : peer->ifname, peer->bgp->vrf_id);
} }
else if (peer->update_if) else if (peer->update_if)
ifp = if_lookup_by_name_vrf (peer->update_if, peer->bgp->vrf_id); ifp = if_lookup_by_name (peer->update_if, peer->bgp->vrf_id);
else else
ifp = if_lookup_by_ipv6_exact (&local->sin6.sin6_addr, ifp = if_lookup_by_ipv6_exact (&local->sin6.sin6_addr,
local->sin6.sin6_scope_id, local->sin6.sin6_scope_id,

View File

@ -1435,7 +1435,7 @@ bgp_peer_conf_if_to_su_update (struct peer *peer)
return; return;
prev_family = peer->su.sa.sa_family; prev_family = peer->su.sa.sa_family;
if ((ifp = if_lookup_by_name_vrf (peer->conf_if, peer->bgp->vrf_id))) if ((ifp = if_lookup_by_name (peer->conf_if, peer->bgp->vrf_id)))
{ {
peer->ifp = ifp; peer->ifp = ifp;
/* If BGP unnumbered is not "v6only", we first see if we can derive the /* If BGP unnumbered is not "v6only", we first see if we can derive the

View File

@ -1323,7 +1323,7 @@ DEFUN (show_isis_mpls_te_interface,
/* Interface name is specified. */ /* Interface name is specified. */
else else
{ {
if ((ifp = if_lookup_by_name (argv[idx_interface]->arg)) == NULL) if ((ifp = if_lookup_by_name (argv[idx_interface]->arg, VRF_DEFAULT)) == NULL)
vty_out (vty, "No such interface name%s", VTY_NEWLINE); vty_out (vty, "No such interface name%s", VTY_NEWLINE);
else else
show_mpls_te_sub (vty, ifp); show_mpls_te_sub (vty, ifp);

View File

@ -900,7 +900,7 @@ ldp_vty_interface(struct vty *vty, struct vty_arg *args[])
goto cancel; goto cancel;
} }
ifp = if_lookup_by_name(ifname); ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
memset(&kif, 0, sizeof(kif)); memset(&kif, 0, sizeof(kif));
strlcpy(kif.ifname, ifname, sizeof(kif.ifname)); strlcpy(kif.ifname, ifname, sizeof(kif.ifname));
if (ifp) { if (ifp) {
@ -1558,7 +1558,7 @@ ldp_vty_l2vpn_interface(struct vty *vty, struct vty_arg *args[])
goto cancel; goto cancel;
} }
ifp = if_lookup_by_name(ifname); ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
memset(&kif, 0, sizeof(kif)); memset(&kif, 0, sizeof(kif));
strlcpy(kif.ifname, ifname, sizeof(kif.ifname)); strlcpy(kif.ifname, ifname, sizeof(kif.ifname));
if (ifp) { if (ifp) {
@ -1616,7 +1616,7 @@ ldp_vty_l2vpn_pseudowire(struct vty *vty, struct vty_arg *args[])
goto cancel; goto cancel;
} }
ifp = if_lookup_by_name(ifname); ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
memset(&kif, 0, sizeof(kif)); memset(&kif, 0, sizeof(kif));
strlcpy(kif.ifname, ifname, sizeof(kif.ifname)); strlcpy(kif.ifname, ifname, sizeof(kif.ifname));
if (ifp) { if (ifp) {
@ -1809,7 +1809,7 @@ iface_new_api(struct ldpd_conf *conf, const char *name)
memset(&kif, 0, sizeof(kif)); memset(&kif, 0, sizeof(kif));
strlcpy(kif.ifname, ifname, sizeof(kif.ifname)); strlcpy(kif.ifname, ifname, sizeof(kif.ifname));
ifp = if_lookup_by_name(ifname); ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
if (ifp) { if (ifp) {
kif.ifindex = ifp->ifindex; kif.ifindex = ifp->ifindex;
kif.flags = ifp->flags; kif.flags = ifp->flags;
@ -1920,7 +1920,7 @@ l2vpn_if_new_api(struct ldpd_conf *conf, struct l2vpn *l2vpn,
memset(&kif, 0, sizeof(kif)); memset(&kif, 0, sizeof(kif));
strlcpy(kif.ifname, ifname, sizeof(kif.ifname)); strlcpy(kif.ifname, ifname, sizeof(kif.ifname));
ifp = if_lookup_by_name(ifname); ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
if (ifp) { if (ifp) {
kif.ifindex = ifp->ifindex; kif.ifindex = ifp->ifindex;
kif.flags = ifp->flags; kif.flags = ifp->flags;
@ -1951,7 +1951,7 @@ l2vpn_pw_new_api(struct ldpd_conf *conf, struct l2vpn *l2vpn,
memset(&kif, 0, sizeof(kif)); memset(&kif, 0, sizeof(kif));
strlcpy(kif.ifname, ifname, sizeof(kif.ifname)); strlcpy(kif.ifname, ifname, sizeof(kif.ifname));
ifp = if_lookup_by_name(ifname); ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
if (ifp) { if (ifp) {
kif.ifindex = ifp->ifindex; kif.ifindex = ifp->ifindex;
kif.flags = ifp->flags; kif.flags = ifp->flags;

View File

@ -136,7 +136,7 @@ if_create (const char *name, int namelen, vrf_id_t vrf_id)
strncpy (ifp->name, name, namelen); strncpy (ifp->name, name, namelen);
ifp->name[namelen] = '\0'; ifp->name[namelen] = '\0';
ifp->vrf_id = vrf_id; ifp->vrf_id = vrf_id;
if (if_lookup_by_name_vrf (ifp->name, vrf_id) == NULL) if (if_lookup_by_name (ifp->name, vrf_id) == NULL)
listnode_add_sort (intf_list, ifp); listnode_add_sort (intf_list, ifp);
else else
zlog_err("if_create(%s): corruption detected -- interface with this " zlog_err("if_create(%s): corruption detected -- interface with this "
@ -173,7 +173,7 @@ if_update_vrf (struct interface *ifp, const char *name, int namelen, vrf_id_t vr
strncpy (ifp->name, name, namelen); strncpy (ifp->name, name, namelen);
ifp->name[namelen] = '\0'; ifp->name[namelen] = '\0';
ifp->vrf_id = vrf_id; ifp->vrf_id = vrf_id;
if (if_lookup_by_name_vrf (ifp->name, vrf_id) == NULL) if (if_lookup_by_name (ifp->name, vrf_id) == NULL)
listnode_add_sort (intf_list, ifp); listnode_add_sort (intf_list, ifp);
else else
zlog_err("if_create(%s): corruption detected -- interface with this " zlog_err("if_create(%s): corruption detected -- interface with this "
@ -266,7 +266,7 @@ ifname2ifindex_vrf (const char *name, vrf_id_t vrf_id)
{ {
struct interface *ifp; struct interface *ifp;
return ((ifp = if_lookup_by_name_vrf (name, vrf_id)) != NULL) ? ifp->ifindex return ((ifp = if_lookup_by_name (name, vrf_id)) != NULL) ? ifp->ifindex
: IFINDEX_INTERNAL; : IFINDEX_INTERNAL;
} }
@ -278,7 +278,7 @@ ifname2ifindex (const char *name)
/* Interface existance check by interface name. */ /* Interface existance check by interface name. */
struct interface * struct interface *
if_lookup_by_name_vrf (const char *name, vrf_id_t vrf_id) if_lookup_by_name (const char *name, vrf_id_t vrf_id)
{ {
struct listnode *node; struct listnode *node;
struct interface *ifp; struct interface *ifp;
@ -300,7 +300,7 @@ if_lookup_by_name_all_vrf (const char *name)
RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
{ {
ifp = if_lookup_by_name_vrf (name, vrf->vrf_id); ifp = if_lookup_by_name (name, vrf->vrf_id);
if (ifp) if (ifp)
return ifp; return ifp;
} }
@ -308,12 +308,6 @@ if_lookup_by_name_all_vrf (const char *name)
return NULL; return NULL;
} }
struct interface *
if_lookup_by_name (const char *name)
{
return if_lookup_by_name_vrf (name, VRF_DEFAULT);
}
struct interface * struct interface *
if_lookup_by_name_len (const char *name, size_t namelen, vrf_id_t vrf_id) if_lookup_by_name_len (const char *name, size_t namelen, vrf_id_t vrf_id)
{ {
@ -437,7 +431,7 @@ if_get_by_name_vrf (const char *name, vrf_id_t vrf_id)
{ {
struct interface *ifp; struct interface *ifp;
return ((ifp = if_lookup_by_name_vrf (name, vrf_id)) != NULL) ? ifp : return ((ifp = if_lookup_by_name (name, vrf_id)) != NULL) ? ifp :
if_create (name, strlen(name), vrf_id); if_create (name, strlen(name), vrf_id);
} }
@ -771,7 +765,7 @@ DEFUN_NOSH (no_interface,
if (argc > 3) if (argc > 3)
VRF_GET_ID (vrf_id, vrfname); VRF_GET_ID (vrf_id, vrfname);
ifp = if_lookup_by_name_vrf (ifname, vrf_id); ifp = if_lookup_by_name (ifname, vrf_id);
if (ifp == NULL) if (ifp == NULL)
{ {

View File

@ -404,12 +404,11 @@ extern struct interface *if_lookup_prefix (struct prefix *prefix,
/* These 2 functions are to be used when the ifname argument is terminated /* These 2 functions are to be used when the ifname argument is terminated
by a '\0' character: */ by a '\0' character: */
extern struct interface *if_lookup_by_name (const char *ifname);
extern struct interface *if_get_by_name (const char *ifname); extern struct interface *if_get_by_name (const char *ifname);
extern struct interface *if_lookup_by_name_all_vrf (const char *ifname); extern struct interface *if_lookup_by_name_all_vrf (const char *ifname);
extern struct interface *if_lookup_by_name_vrf (const char *ifname, extern struct interface *if_lookup_by_name (const char *ifname,
vrf_id_t vrf_id); vrf_id_t vrf_id);
extern struct interface *if_get_by_name_vrf (const char *ifname, extern struct interface *if_get_by_name_vrf (const char *ifname,
vrf_id_t vrf_id); vrf_id_t vrf_id);

View File

@ -117,7 +117,7 @@ static void nhrp_interface_update_nbma(struct interface *ifp)
sockunion_family(&nbma) = AF_UNSPEC; sockunion_family(&nbma) = AF_UNSPEC;
if (nifp->source) if (nifp->source)
nbmaifp = if_lookup_by_name(nifp->source); nbmaifp = if_lookup_by_name(nifp->source, VRF_DEFAULT);
switch (ifp->ll_type) { switch (ifp->ll_type) {
case ZEBRA_LLT_IPGRE: { case ZEBRA_LLT_IPGRE: {

View File

@ -866,7 +866,7 @@ ospf6_routemap_rule_match_interface (void *rule, struct prefix *prefix,
if (type == RMAP_OSPF6) if (type == RMAP_OSPF6)
{ {
ei = ((struct ospf6_route *) object)->route_option; ei = ((struct ospf6_route *) object)->route_option;
ifp = if_lookup_by_name ((char *)rule); ifp = if_lookup_by_name ((char *)rule, VRF_DEFAULT);
if (ifp != NULL if (ifp != NULL
&& ei->ifindex == ifp->ifindex) && ei->ifindex == ifp->ifindex)

View File

@ -1006,7 +1006,7 @@ DEFUN (show_ipv6_ospf6_interface,
if (argc == 5) if (argc == 5)
{ {
ifp = if_lookup_by_name (argv[idx_ifname]->arg); ifp = if_lookup_by_name (argv[idx_ifname]->arg, VRF_DEFAULT);
if (ifp == NULL) if (ifp == NULL)
{ {
vty_out (vty, "No such Interface: %s%s", argv[idx_ifname]->arg, vty_out (vty, "No such Interface: %s%s", argv[idx_ifname]->arg,
@ -1043,7 +1043,7 @@ DEFUN (show_ipv6_ospf6_interface_ifname_prefix,
struct interface *ifp; struct interface *ifp;
struct ospf6_interface *oi; struct ospf6_interface *oi;
ifp = if_lookup_by_name (argv[idx_ifname]->arg); ifp = if_lookup_by_name (argv[idx_ifname]->arg, VRF_DEFAULT);
if (ifp == NULL) if (ifp == NULL)
{ {
vty_out (vty, "No such Interface: %s%s", argv[idx_ifname]->arg, VNL); vty_out (vty, "No such Interface: %s%s", argv[idx_ifname]->arg, VNL);
@ -1897,7 +1897,7 @@ DEFUN (clear_ipv6_ospf6_interface,
} }
else /* Interface name is specified. */ else /* Interface name is specified. */
{ {
if ((ifp = if_lookup_by_name (argv[idx_ifname]->arg)) == NULL) if ((ifp = if_lookup_by_name (argv[idx_ifname]->arg, VRF_DEFAULT)) == NULL)
{ {
vty_out (vty, "No such Interface: %s%s", argv[idx_ifname]->arg, VNL); vty_out (vty, "No such Interface: %s%s", argv[idx_ifname]->arg, VNL);
return CMD_WARNING; return CMD_WARNING;

View File

@ -728,7 +728,7 @@ DEFUN (no_ospf6_interface_area,
struct interface *ifp; struct interface *ifp;
u_int32_t area_id; u_int32_t area_id;
ifp = if_lookup_by_name (argv[idx_ifname]->arg); ifp = if_lookup_by_name (argv[idx_ifname]->arg, VRF_DEFAULT);
if (ifp == NULL) if (ifp == NULL)
{ {
vty_out (vty, "No such interface %s%s", argv[idx_ifname]->arg, VNL); vty_out (vty, "No such interface %s%s", argv[idx_ifname]->arg, VNL);

View File

@ -32,6 +32,7 @@
#include "command.h" #include "command.h"
#include "log.h" #include "log.h"
#include "plist.h" #include "plist.h"
#include "vrf.h"
#include "ospfd/ospfd.h" #include "ospfd/ospfd.h"
#include "ospfd/ospf_asbr.h" #include "ospfd/ospf_asbr.h"
@ -360,7 +361,7 @@ route_match_interface (void *rule, struct prefix *prefix,
if (type == RMAP_OSPF) if (type == RMAP_OSPF)
{ {
ei = object; ei = object;
ifp = if_lookup_by_name ((char *)rule); ifp = if_lookup_by_name ((char *)rule, VRF_DEFAULT);
if (ifp == NULL || ifp->ifindex != ei->ifindex) if (ifp == NULL || ifp->ifindex != ei->ifindex)
return RMAP_NOMATCH; return RMAP_NOMATCH;

View File

@ -2630,7 +2630,7 @@ DEFUN (show_ip_ospf_mpls_te_link,
/* Interface name is specified. */ /* Interface name is specified. */
else else
{ {
if ((ifp = if_lookup_by_name (argv[idx_interface]->arg)) == NULL) if ((ifp = if_lookup_by_name (argv[idx_interface]->arg, VRF_DEFAULT)) == NULL)
vty_out (vty, "No such interface name%s", VTY_NEWLINE); vty_out (vty, "No such interface name%s", VTY_NEWLINE);
else else
show_mpls_te_link_sub (vty, ifp); show_mpls_te_link_sub (vty, ifp);

View File

@ -3592,7 +3592,7 @@ show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc,
else else
{ {
/* Interface name is specified. */ /* Interface name is specified. */
if ((ifp = if_lookup_by_name (argv[iface_argv]->arg)) == NULL) if ((ifp = if_lookup_by_name (argv[iface_argv]->arg, VRF_DEFAULT)) == NULL)
{ {
if (use_json) if (use_json)
json_object_boolean_true_add(json, "noSuchIface"); json_object_boolean_true_add(json, "noSuchIface");
@ -3950,7 +3950,7 @@ show_ip_ospf_neighbor_int_common (struct vty *vty, struct ospf *ospf, int arg_ba
VTY_NEWLINE, VTY_NEWLINE); VTY_NEWLINE, VTY_NEWLINE);
} }
ifp = if_lookup_by_name (argv[arg_base]->arg); ifp = if_lookup_by_name (argv[arg_base]->arg, VRF_DEFAULT);
if (!ifp) if (!ifp)
{ {
if (use_json) if (use_json)
@ -4609,7 +4609,7 @@ show_ip_ospf_neighbor_int_detail_common (struct vty *vty, struct ospf *ospf,
VTY_NEWLINE, VTY_NEWLINE); VTY_NEWLINE, VTY_NEWLINE);
} }
ifp = if_lookup_by_name (argv[arg_base]->arg); ifp = if_lookup_by_name (argv[arg_base]->arg, VRF_DEFAULT);
if (!ifp) if (!ifp)
{ {
if (!use_json) if (!use_json)
@ -9142,7 +9142,7 @@ DEFUN (clear_ip_ospf_interface,
} }
else /* Interface name is specified. */ else /* Interface name is specified. */
{ {
if ((ifp = if_lookup_by_name (argv[idx_ifname]->text)) == NULL) if ((ifp = if_lookup_by_name (argv[idx_ifname]->text, VRF_DEFAULT)) == NULL)
vty_out (vty, "No such interface name%s", VTY_NEWLINE); vty_out (vty, "No such interface name%s", VTY_NEWLINE);
else else
ospf_interface_clear(ifp); ospf_interface_clear(ifp);

View File

@ -4418,7 +4418,7 @@ DEFUN (interface_ip_mroute,
int result; int result;
oifname = argv[idx_interface]->arg; oifname = argv[idx_interface]->arg;
oif = if_lookup_by_name(oifname); oif = if_lookup_by_name(oifname, VRF_DEFAULT);
if (!oif) { if (!oif) {
vty_out(vty, "No such interface name %s%s", vty_out(vty, "No such interface name %s%s",
oifname, VTY_NEWLINE); oifname, VTY_NEWLINE);
@ -4465,7 +4465,7 @@ DEFUN (interface_ip_mroute_source,
int result; int result;
oifname = argv[idx_interface]->arg; oifname = argv[idx_interface]->arg;
oif = if_lookup_by_name(oifname); oif = if_lookup_by_name(oifname, VRF_DEFAULT);
if (!oif) { if (!oif) {
vty_out(vty, "No such interface name %s%s", vty_out(vty, "No such interface name %s%s",
oifname, VTY_NEWLINE); oifname, VTY_NEWLINE);
@ -4516,7 +4516,7 @@ DEFUN (interface_no_ip_mroute,
int result; int result;
oifname = argv[idx_interface]->arg; oifname = argv[idx_interface]->arg;
oif = if_lookup_by_name(oifname); oif = if_lookup_by_name(oifname, VRF_DEFAULT);
if (!oif) { if (!oif) {
vty_out(vty, "No such interface name %s%s", vty_out(vty, "No such interface name %s%s",
oifname, VTY_NEWLINE); oifname, VTY_NEWLINE);
@ -4564,7 +4564,7 @@ DEFUN (interface_no_ip_mroute_source,
int result; int result;
oifname = argv[idx_interface]->arg; oifname = argv[idx_interface]->arg;
oif = if_lookup_by_name(oifname); oif = if_lookup_by_name(oifname, VRF_DEFAULT);
if (!oif) { if (!oif) {
vty_out(vty, "No such interface name %s%s", vty_out(vty, "No such interface name %s%s",
oifname, VTY_NEWLINE); oifname, VTY_NEWLINE);

View File

@ -858,7 +858,7 @@ pim_find_primary_addr (struct interface *ifp)
if (!v4_addrs && v6_addrs && !if_is_loopback (ifp)) if (!v4_addrs && v6_addrs && !if_is_loopback (ifp))
{ {
struct interface *lo_ifp; struct interface *lo_ifp;
lo_ifp = if_lookup_by_name_vrf ("lo", VRF_DEFAULT); lo_ifp = if_lookup_by_name ("lo", VRF_DEFAULT);
if (lo_ifp) if (lo_ifp)
return pim_find_primary_addr (lo_ifp); return pim_find_primary_addr (lo_ifp);
} }
@ -1005,7 +1005,7 @@ struct interface *pim_if_find_by_vif_index(ifindex_t vif_index)
struct interface *ifp; struct interface *ifp;
if (vif_index == 0) if (vif_index == 0)
return if_lookup_by_name_vrf ("pimreg", VRF_DEFAULT); return if_lookup_by_name ("pimreg", VRF_DEFAULT);
for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) { for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT), ifnode, ifp)) {
if (ifp->info) { if (ifp->info) {

View File

@ -31,6 +31,7 @@
#include "log.h" #include "log.h"
#include "sockunion.h" /* for inet_aton () */ #include "sockunion.h" /* for inet_aton () */
#include "plist.h" #include "plist.h"
#include "vrf.h"
#include "ripd/ripd.h" #include "ripd/ripd.h"
@ -136,7 +137,7 @@ route_match_interface (void *rule, struct prefix *prefix,
if (type == RMAP_RIP) if (type == RMAP_RIP)
{ {
ifname = rule; ifname = rule;
ifp = if_lookup_by_name(ifname); ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
if (!ifp) if (!ifp)
return RMAP_NOMATCH; return RMAP_NOMATCH;

View File

@ -3763,7 +3763,7 @@ rip_distribute_update (struct distribute *dist)
if (! dist->ifname) if (! dist->ifname)
return; return;
ifp = if_lookup_by_name (dist->ifname); ifp = if_lookup_by_name (dist->ifname, VRF_DEFAULT);
if (ifp == NULL) if (ifp == NULL)
return; return;
@ -3962,7 +3962,7 @@ rip_if_rmap_update (struct if_rmap *if_rmap)
struct rip_interface *ri; struct rip_interface *ri;
struct route_map *rmap; struct route_map *rmap;
ifp = if_lookup_by_name (if_rmap->ifname); ifp = if_lookup_by_name (if_rmap->ifname, VRF_DEFAULT);
if (ifp == NULL) if (ifp == NULL)
return; return;

View File

@ -110,7 +110,7 @@ route_match_interface (void *rule, struct prefix *prefix,
if (type == RMAP_RIPNG) if (type == RMAP_RIPNG)
{ {
ifname = rule; ifname = rule;
ifp = if_lookup_by_name(ifname); ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
if (!ifp) if (!ifp)
return RMAP_NOMATCH; return RMAP_NOMATCH;

View File

@ -2814,7 +2814,7 @@ ripng_distribute_update (struct distribute *dist)
if (! dist->ifname) if (! dist->ifname)
return; return;
ifp = if_lookup_by_name (dist->ifname); ifp = if_lookup_by_name (dist->ifname, VRF_DEFAULT);
if (ifp == NULL) if (ifp == NULL)
return; return;
@ -3009,7 +3009,7 @@ ripng_if_rmap_update (struct if_rmap *if_rmap)
struct ripng_interface *ri; struct ripng_interface *ri;
struct route_map *rmap; struct route_map *rmap;
ifp = if_lookup_by_name (if_rmap->ifname); ifp = if_lookup_by_name (if_rmap->ifname, VRF_DEFAULT);
if (ifp == NULL) if (ifp == NULL)
return; return;

View File

@ -201,7 +201,7 @@ if_getaddrs (void)
continue; continue;
} }
ifp = if_lookup_by_name (ifap->ifa_name); ifp = if_lookup_by_name (ifap->ifa_name, VRF_DEFAULT);
if (ifp == NULL) if (ifp == NULL)
{ {
zlog_err ("if_getaddrs(): Can't lookup interface %s\n", zlog_err ("if_getaddrs(): Can't lookup interface %s\n",

View File

@ -1320,7 +1320,7 @@ DEFUN (show_interface_name_vrf,
VRF_GET_ID (vrf_id, argv[idx_name]->arg); VRF_GET_ID (vrf_id, argv[idx_name]->arg);
/* Specified interface print. */ /* Specified interface print. */
ifp = if_lookup_by_name_vrf (argv[idx_ifname]->arg, vrf_id); ifp = if_lookup_by_name (argv[idx_ifname]->arg, vrf_id);
if (ifp == NULL) if (ifp == NULL)
{ {
vty_out (vty, "%% Can't find interface %s%s", argv[idx_ifname]->arg, vty_out (vty, "%% Can't find interface %s%s", argv[idx_ifname]->arg,
@ -1352,7 +1352,7 @@ DEFUN (show_interface_name_vrf_all,
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
{ {
/* Specified interface print. */ /* Specified interface print. */
ifp = if_lookup_by_name_vrf (argv[idx_ifname]->arg, vrf->vrf_id); ifp = if_lookup_by_name (argv[idx_ifname]->arg, vrf->vrf_id);
if (ifp) if (ifp)
{ {
if_dump_vty (vty, ifp); if_dump_vty (vty, ifp);

View File

@ -487,7 +487,7 @@ ifm_read (struct if_msghdr *ifm)
* be filled in. * be filled in.
*/ */
if ( (ifp == NULL) && ifnlen) if ( (ifp == NULL) && ifnlen)
ifp = if_lookup_by_name (ifname); ifp = if_lookup_by_name (ifname, VRF_DEFAULT);
/* /*
* If ifp still does not exist or has an invalid index (IFINDEX_INTERNAL), * If ifp still does not exist or has an invalid index (IFINDEX_INTERNAL),

View File

@ -171,7 +171,7 @@ zebra_vrf_enable (struct vrf *vrf)
si->vrf_id = vrf->vrf_id; si->vrf_id = vrf->vrf_id;
if (si->ifindex) if (si->ifindex)
{ {
ifp = if_lookup_by_name_vrf (si->ifname, si->vrf_id); ifp = if_lookup_by_name (si->ifname, si->vrf_id);
if (ifp) if (ifp)
si->ifindex = ifp->ifindex; si->ifindex = ifp->ifindex;
else else

View File

@ -184,7 +184,7 @@ zebra_static_ipv4 (struct vty *vty, safi_t safi, int add_cmd,
ret = inet_aton (gate_str, &gate); ret = inet_aton (gate_str, &gate);
if (!ret) if (!ret)
{ {
struct interface *ifp = if_lookup_by_name_vrf (gate_str, zvrf_id (zvrf)); struct interface *ifp = if_lookup_by_name (gate_str, zvrf_id (zvrf));
if (!ifp) if (!ifp)
{ {
vty_out (vty, "%% Unknown interface: %s%s", gate_str, VTY_NEWLINE); vty_out (vty, "%% Unknown interface: %s%s", gate_str, VTY_NEWLINE);
@ -2459,7 +2459,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
} }
type = STATIC_IPV6_GATEWAY_IFINDEX; type = STATIC_IPV6_GATEWAY_IFINDEX;
gate = &gate_addr; gate = &gate_addr;
ifp = if_lookup_by_name_vrf (ifname, zvrf_id (zvrf)); ifp = if_lookup_by_name (ifname, zvrf_id (zvrf));
if (!ifp) if (!ifp)
{ {
vty_out (vty, "%% Malformed Interface name %s%s", ifname, VTY_NEWLINE); vty_out (vty, "%% Malformed Interface name %s%s", ifname, VTY_NEWLINE);
@ -2477,7 +2477,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str,
else else
{ {
type = STATIC_IFINDEX; type = STATIC_IFINDEX;
ifp = if_lookup_by_name_vrf (gate_str, zvrf_id (zvrf)); ifp = if_lookup_by_name (gate_str, zvrf_id (zvrf));
if (!ifp) if (!ifp)
{ {
vty_out (vty, "%% Malformed Interface name %s%s", gate_str, VTY_NEWLINE); vty_out (vty, "%% Malformed Interface name %s%s", gate_str, VTY_NEWLINE);