forked from Mirror/frr
*: change if_lookup_by_name() api with vrf
the vrf_id parameter is replaced by struct vrf * parameter. this impacts most of the daemons that look for an interface based on the name and the vrf identifier. Also, it fixes 2 lookup calls in zebra and sharpd, where the vrf_id was ignored until now. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
e9c199a6c1
commit
f11e98eca3
|
@ -241,7 +241,7 @@ babel_enable_if_add (const char *ifname)
|
||||||
|
|
||||||
vector_set (babel_enable_if, strdup (ifname));
|
vector_set (babel_enable_if, strdup (ifname));
|
||||||
|
|
||||||
ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
|
ifp = if_lookup_by_name(ifname, vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
if (ifp != NULL)
|
if (ifp != NULL)
|
||||||
interface_recalculate(ifp);
|
interface_recalculate(ifp);
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ babel_enable_if_delete (const char *ifname)
|
||||||
free (str);
|
free (str);
|
||||||
vector_unset (babel_enable_if, babel_enable_if_index);
|
vector_unset (babel_enable_if, babel_enable_if_index);
|
||||||
|
|
||||||
ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
|
ifp = if_lookup_by_name(ifname, vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
if (ifp != NULL)
|
if (ifp != NULL)
|
||||||
interface_reset(ifp);
|
interface_reset(ifp);
|
||||||
|
|
||||||
|
@ -907,7 +907,8 @@ DEFUN (show_babel_interface,
|
||||||
show_babel_interface_sub (vty, ifp);
|
show_babel_interface_sub (vty, ifp);
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
if ((ifp = if_lookup_by_name (argv[3]->arg, VRF_DEFAULT)) == NULL)
|
if ((ifp = if_lookup_by_name (argv[3]->arg,
|
||||||
|
vrf_lookup_by_id(VRF_DEFAULT))) == NULL)
|
||||||
{
|
{
|
||||||
vty_out (vty, "No such interface name\n");
|
vty_out (vty, "No such interface name\n");
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
@ -949,7 +950,8 @@ DEFUN (show_babel_neighbour,
|
||||||
}
|
}
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
if ((ifp = if_lookup_by_name (argv[3]->arg, VRF_DEFAULT)) == NULL)
|
if ((ifp = if_lookup_by_name (argv[3]->arg,
|
||||||
|
vrf_lookup_by_id(VRF_DEFAULT))) == NULL)
|
||||||
{
|
{
|
||||||
vty_out (vty, "No such interface name\n");
|
vty_out (vty, "No such interface name\n");
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
|
|
@ -555,7 +555,7 @@ babel_distribute_update (struct distribute_ctx *ctx, struct distribute *dist)
|
||||||
if (! dist->ifname)
|
if (! dist->ifname)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ifp = if_lookup_by_name (dist->ifname, VRF_DEFAULT);
|
ifp = if_lookup_by_name (dist->ifname, vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
if (ifp == NULL)
|
if (ifp == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -310,7 +310,8 @@ static int 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(name, bgp->vrf_id);
|
ifp = if_lookup_by_name(name,
|
||||||
|
vrf_lookup_by_id(bgp->vrf_id));
|
||||||
if (ifp) {
|
if (ifp) {
|
||||||
*bgp_inst = bgp;
|
*bgp_inst = bgp;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -570,7 +571,8 @@ static int 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(peer->update_if, peer->bgp->vrf_id);
|
ifp = if_lookup_by_name(peer->update_if,
|
||||||
|
vrf_lookup_by_id(peer->bgp->vrf_id));
|
||||||
if (!ifp)
|
if (!ifp)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
|
@ -787,7 +787,7 @@ bool bgp_zebra_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(peer->update_if,
|
ifp = if_lookup_by_name(peer->update_if,
|
||||||
peer->bgp->vrf_id);
|
vrf_lookup_by_id(peer->bgp->vrf_id));
|
||||||
else
|
else
|
||||||
ifp = if_lookup_by_ipv4_exact(&local->sin.sin_addr,
|
ifp = if_lookup_by_ipv4_exact(&local->sin.sin_addr,
|
||||||
peer->bgp->vrf_id);
|
peer->bgp->vrf_id);
|
||||||
|
@ -798,10 +798,11 @@ bool bgp_zebra_nexthop_set(union sockunion *local, union sockunion *remote,
|
||||||
ifp = if_lookup_by_name(peer->conf_if
|
ifp = if_lookup_by_name(peer->conf_if
|
||||||
? peer->conf_if
|
? peer->conf_if
|
||||||
: peer->ifname,
|
: peer->ifname,
|
||||||
peer->bgp->vrf_id);
|
vrf_lookup_by_id(
|
||||||
|
peer->bgp->vrf_id));
|
||||||
} else if (peer->update_if)
|
} else if (peer->update_if)
|
||||||
ifp = if_lookup_by_name(peer->update_if,
|
ifp = if_lookup_by_name(peer->update_if,
|
||||||
peer->bgp->vrf_id);
|
vrf_lookup_by_id(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,
|
||||||
|
@ -2882,7 +2883,8 @@ static void bgp_encode_pbr_interface_list(struct bgp *bgp, struct stream *s)
|
||||||
head = &(bgp_pbr_cfg->ifaces_by_name_ipv4);
|
head = &(bgp_pbr_cfg->ifaces_by_name_ipv4);
|
||||||
|
|
||||||
RB_FOREACH (pbr_if, bgp_pbr_interface_head, head) {
|
RB_FOREACH (pbr_if, bgp_pbr_interface_head, head) {
|
||||||
ifp = if_lookup_by_name(pbr_if->name, bgp->vrf_id);
|
ifp = if_lookup_by_name(pbr_if->name,
|
||||||
|
vrf_lookup_by_id(bgp->vrf_id));
|
||||||
if (ifp)
|
if (ifp)
|
||||||
stream_putl(s, ifp->ifindex);
|
stream_putl(s, ifp->ifindex);
|
||||||
}
|
}
|
||||||
|
@ -2900,7 +2902,8 @@ static int bgp_pbr_get_ifnumber(struct bgp *bgp)
|
||||||
head = &(bgp_pbr_cfg->ifaces_by_name_ipv4);
|
head = &(bgp_pbr_cfg->ifaces_by_name_ipv4);
|
||||||
|
|
||||||
RB_FOREACH (pbr_if, bgp_pbr_interface_head, head) {
|
RB_FOREACH (pbr_if, bgp_pbr_interface_head, head) {
|
||||||
if (if_lookup_by_name(pbr_if->name, bgp->vrf_id))
|
if (if_lookup_by_name(pbr_if->name,
|
||||||
|
vrf_lookup_by_id(bgp->vrf_id)))
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
|
|
|
@ -1436,7 +1436,8 @@ void bgp_peer_conf_if_to_su_update(struct peer *peer)
|
||||||
hash_release(peer->bgp->peerhash, peer);
|
hash_release(peer->bgp->peerhash, peer);
|
||||||
|
|
||||||
prev_family = peer->su.sa.sa_family;
|
prev_family = peer->su.sa.sa_family;
|
||||||
if ((ifp = if_lookup_by_name(peer->conf_if, peer->bgp->vrf_id))) {
|
if ((ifp = if_lookup_by_name(peer->conf_if,
|
||||||
|
vrf_lookup_by_id(peer->bgp->vrf_id)))) {
|
||||||
peer->ifp = ifp;
|
peer->ifp = ifp;
|
||||||
/* If BGP unnumbered is not "v6only", we first see if we can
|
/* If BGP unnumbered is not "v6only", we first see if we can
|
||||||
* derive the
|
* derive the
|
||||||
|
|
|
@ -174,7 +174,8 @@ void eigrp_distribute_update(struct distribute_ctx *ctx,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ifp = if_lookup_by_name(dist->ifname, VRF_DEFAULT);
|
ifp = if_lookup_by_name(dist->ifname,
|
||||||
|
vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
if (ifp == NULL)
|
if (ifp == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ void eigrp_if_rmap_update(struct if_rmap *if_rmap)
|
||||||
struct route_map *rmap;
|
struct route_map *rmap;
|
||||||
struct eigrp *e;
|
struct eigrp *e;
|
||||||
|
|
||||||
ifp = if_lookup_by_name(if_rmap->ifname);
|
ifp = if_lookup_by_name(if_rmap->ifname, vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
if (ifp == NULL)
|
if (ifp == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -336,7 +336,8 @@ static struct interface *zebra_interface_if_lookup(struct stream *s)
|
||||||
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
|
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
|
||||||
|
|
||||||
/* And look it up. */
|
/* And look it up. */
|
||||||
return if_lookup_by_name(ifname_tmp, VRF_DEFAULT);
|
return if_lookup_by_name(ifname_tmp,
|
||||||
|
vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
}
|
}
|
||||||
|
|
||||||
void eigrp_zebra_route_add(struct prefix *p, struct list *successors,
|
void eigrp_zebra_route_add(struct prefix *p, struct list *successors,
|
||||||
|
|
|
@ -1597,7 +1597,7 @@ static int lib_interface_isis_area_tag_modify(enum nb_event event,
|
||||||
vrfname = yang_dnode_get_string(dnode->parent->parent, "./vrf");
|
vrfname = yang_dnode_get_string(dnode->parent->parent, "./vrf");
|
||||||
vrf = vrf_lookup_by_name(vrfname);
|
vrf = vrf_lookup_by_name(vrfname);
|
||||||
assert(vrf);
|
assert(vrf);
|
||||||
ifp = if_lookup_by_name(ifname, vrf->vrf_id);
|
ifp = if_lookup_by_name(ifname, vrf);
|
||||||
if (!ifp)
|
if (!ifp)
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
circuit = circuit_lookup_by_ifp(ifp, isis->init_circ_list);
|
circuit = circuit_lookup_by_ifp(ifp, isis->init_circ_list);
|
||||||
|
@ -1635,7 +1635,7 @@ static int lib_interface_isis_circuit_type_modify(enum nb_event event,
|
||||||
vrfname = yang_dnode_get_string(dnode->parent->parent, "./vrf");
|
vrfname = yang_dnode_get_string(dnode->parent->parent, "./vrf");
|
||||||
vrf = vrf_lookup_by_name(vrfname);
|
vrf = vrf_lookup_by_name(vrfname);
|
||||||
assert(vrf);
|
assert(vrf);
|
||||||
ifp = if_lookup_by_name(ifname, vrf->vrf_id);
|
ifp = if_lookup_by_name(ifname, vrf);
|
||||||
if (!ifp)
|
if (!ifp)
|
||||||
break;
|
break;
|
||||||
circuit = circuit_lookup_by_ifp(ifp, isis->init_circ_list);
|
circuit = circuit_lookup_by_ifp(ifp, isis->init_circ_list);
|
||||||
|
|
|
@ -1175,7 +1175,8 @@ DEFUN (show_isis_mpls_te_interface,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Interface name is specified. */
|
/* Interface name is specified. */
|
||||||
ifp = if_lookup_by_name(argv[idx_interface]->arg, VRF_DEFAULT);
|
ifp = if_lookup_by_name(argv[idx_interface]->arg,
|
||||||
|
vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
if (ifp == NULL)
|
if (ifp == NULL)
|
||||||
vty_out(vty, "No such interface name\n");
|
vty_out(vty, "No such interface name\n");
|
||||||
else {
|
else {
|
||||||
|
|
21
lib/if.c
21
lib/if.c
|
@ -264,16 +264,16 @@ const char *ifindex2ifname(ifindex_t ifindex, vrf_id_t vrf_id)
|
||||||
ifindex_t ifname2ifindex(const char *name, vrf_id_t vrf_id)
|
ifindex_t ifname2ifindex(const char *name, vrf_id_t vrf_id)
|
||||||
{
|
{
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
|
struct vrf *vrf = vrf_lookup_by_id(vrf_id);
|
||||||
|
|
||||||
return ((ifp = if_lookup_by_name(name, vrf_id)) != NULL)
|
return ((ifp = if_lookup_by_name(name, vrf)) != NULL)
|
||||||
? ifp->ifindex
|
? ifp->ifindex
|
||||||
: IFINDEX_INTERNAL;
|
: IFINDEX_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Interface existance check by interface name. */
|
/* Interface existance check by interface name. */
|
||||||
struct interface *if_lookup_by_name(const char *name, vrf_id_t vrf_id)
|
struct interface *if_lookup_by_name(const char *name, struct vrf *vrf)
|
||||||
{
|
{
|
||||||
struct vrf *vrf = vrf_lookup_by_id(vrf_id);
|
|
||||||
struct interface if_tmp;
|
struct interface if_tmp;
|
||||||
|
|
||||||
if (!vrf || !name
|
if (!vrf || !name
|
||||||
|
@ -293,7 +293,7 @@ struct interface *if_lookup_by_name_all_vrf(const char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
|
RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
|
||||||
ifp = if_lookup_by_name(name, vrf->vrf_id);
|
ifp = if_lookup_by_name(name, vrf);
|
||||||
if (ifp)
|
if (ifp)
|
||||||
return ifp;
|
return ifp;
|
||||||
}
|
}
|
||||||
|
@ -425,7 +425,7 @@ struct interface *if_get_by_name(const char *name, struct vrf *vrf)
|
||||||
switch (vrf_get_backend()) {
|
switch (vrf_get_backend()) {
|
||||||
case VRF_BACKEND_UNKNOWN:
|
case VRF_BACKEND_UNKNOWN:
|
||||||
case VRF_BACKEND_NETNS:
|
case VRF_BACKEND_NETNS:
|
||||||
ifp = if_lookup_by_name(name, vrf->vrf_id);
|
ifp = if_lookup_by_name(name, vrf);
|
||||||
if (ifp)
|
if (ifp)
|
||||||
return ifp;
|
return ifp;
|
||||||
return if_create(name, vrf);
|
return if_create(name, vrf);
|
||||||
|
@ -635,7 +635,7 @@ static struct interface *if_sunwzebra_get(const char *name, struct vrf *vrf)
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
if ((ifp = if_lookup_by_name(name, vrf->vrf_id)) != NULL)
|
if ((ifp = if_lookup_by_name(name, vrf)) != NULL)
|
||||||
return ifp;
|
return ifp;
|
||||||
|
|
||||||
/* hunt the primary interface name... */
|
/* hunt the primary interface name... */
|
||||||
|
@ -1128,6 +1128,7 @@ DEFPY_NOSH (interface,
|
||||||
vrf_id_t vrf_id;
|
vrf_id_t vrf_id;
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
int ret;
|
int ret;
|
||||||
|
struct vrf *vrf;
|
||||||
|
|
||||||
if (!vrfname)
|
if (!vrfname)
|
||||||
vrfname = VRF_DEFAULT_NAME;
|
vrfname = VRF_DEFAULT_NAME;
|
||||||
|
@ -1142,8 +1143,6 @@ DEFPY_NOSH (interface,
|
||||||
VRF_GET_ID(vrf_id, vrfname, false);
|
VRF_GET_ID(vrf_id, vrfname, false);
|
||||||
ifp = if_lookup_by_name_all_vrf(ifname);
|
ifp = if_lookup_by_name_all_vrf(ifname);
|
||||||
if (ifp && ifp->vrf_id != vrf_id) {
|
if (ifp && ifp->vrf_id != vrf_id) {
|
||||||
struct vrf *vrf;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Special case 1: a VRF name was specified, but the found
|
* Special case 1: a VRF name was specified, but the found
|
||||||
* interface is associated to different VRF. Reject the command.
|
* interface is associated to different VRF. Reject the command.
|
||||||
|
@ -1161,9 +1160,9 @@ DEFPY_NOSH (interface,
|
||||||
*/
|
*/
|
||||||
vrf = vrf_lookup_by_id(ifp->vrf_id);
|
vrf = vrf_lookup_by_id(ifp->vrf_id);
|
||||||
assert(vrf);
|
assert(vrf);
|
||||||
vrf_id = ifp->vrf_id;
|
|
||||||
vrfname = vrf->name;
|
vrfname = vrf->name;
|
||||||
}
|
} else
|
||||||
|
vrf = vrf_lookup_by_id(vrf_id);
|
||||||
|
|
||||||
snprintf(xpath_list, sizeof(xpath_list),
|
snprintf(xpath_list, sizeof(xpath_list),
|
||||||
"/frr-interface:lib/interface[name='%s'][vrf='%s']", ifname,
|
"/frr-interface:lib/interface[name='%s'][vrf='%s']", ifname,
|
||||||
|
@ -1180,7 +1179,7 @@ DEFPY_NOSH (interface,
|
||||||
* all interface-level commands are converted to the new
|
* all interface-level commands are converted to the new
|
||||||
* northbound model.
|
* northbound model.
|
||||||
*/
|
*/
|
||||||
ifp = if_lookup_by_name(ifname, vrf_id);
|
ifp = if_lookup_by_name(ifname, vrf);
|
||||||
if (ifp)
|
if (ifp)
|
||||||
VTY_PUSH_CONTEXT(INTERFACE_NODE, ifp);
|
VTY_PUSH_CONTEXT(INTERFACE_NODE, ifp);
|
||||||
}
|
}
|
||||||
|
|
2
lib/if.h
2
lib/if.h
|
@ -494,7 +494,7 @@ size_t if_lookup_by_hwaddr(const uint8_t *hw_addr, size_t addrsz,
|
||||||
/* These 3 functions are to be used when the ifname argument is terminated
|
/* These 3 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_all_vrf(const char *ifname);
|
extern struct interface *if_lookup_by_name_all_vrf(const char *ifname);
|
||||||
extern struct interface *if_lookup_by_name(const char *ifname, vrf_id_t vrf_id);
|
extern struct interface *if_lookup_by_name(const char *ifname, struct vrf *vrf);
|
||||||
extern struct interface *if_get_by_name(const char *ifname, struct vrf *vrf);
|
extern struct interface *if_get_by_name(const char *ifname, struct vrf *vrf);
|
||||||
extern void if_set_index(struct interface *ifp, ifindex_t ifindex);
|
extern void if_set_index(struct interface *ifp, ifindex_t ifindex);
|
||||||
|
|
||||||
|
|
|
@ -1490,7 +1490,8 @@ struct interface *zebra_interface_state_read(struct stream *s, vrf_id_t vrf_id)
|
||||||
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
|
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
|
||||||
|
|
||||||
/* Lookup this by interface index. */
|
/* Lookup this by interface index. */
|
||||||
ifp = if_lookup_by_name(ifname_tmp, vrf_id);
|
ifp = if_lookup_by_name(ifname_tmp,
|
||||||
|
vrf_lookup_by_id(vrf_id));
|
||||||
if (ifp == NULL) {
|
if (ifp == NULL) {
|
||||||
flog_err(EC_LIB_ZAPI_ENCODE,
|
flog_err(EC_LIB_ZAPI_ENCODE,
|
||||||
"INTERFACE_STATE: Cannot find IF %s in VRF %d",
|
"INTERFACE_STATE: Cannot find IF %s in VRF %d",
|
||||||
|
@ -1550,7 +1551,8 @@ struct interface *zebra_interface_link_params_read(struct stream *s,
|
||||||
|
|
||||||
ifindex = stream_getl(s);
|
ifindex = stream_getl(s);
|
||||||
|
|
||||||
struct interface *ifp = if_lookup_by_index(ifindex, vrf_id);
|
struct interface *ifp = if_lookup_by_index(ifindex,
|
||||||
|
vrf_id);
|
||||||
|
|
||||||
if (ifp == NULL) {
|
if (ifp == NULL) {
|
||||||
flog_err(EC_LIB_ZAPI_ENCODE,
|
flog_err(EC_LIB_ZAPI_ENCODE,
|
||||||
|
@ -1846,7 +1848,8 @@ struct interface *zebra_interface_vrf_update_read(struct stream *s,
|
||||||
stream_get(ifname, s, INTERFACE_NAMSIZ);
|
stream_get(ifname, s, INTERFACE_NAMSIZ);
|
||||||
|
|
||||||
/* Lookup interface. */
|
/* Lookup interface. */
|
||||||
ifp = if_lookup_by_name(ifname, vrf_id);
|
ifp = if_lookup_by_name(ifname,
|
||||||
|
vrf_lookup_by_id(vrf_id));
|
||||||
if (ifp == NULL) {
|
if (ifp == NULL) {
|
||||||
flog_err(EC_LIB_ZAPI_ENCODE,
|
flog_err(EC_LIB_ZAPI_ENCODE,
|
||||||
"INTERFACE_VRF_UPDATE: Cannot find IF %s in VRF %d",
|
"INTERFACE_VRF_UPDATE: Cannot find IF %s in VRF %d",
|
||||||
|
|
|
@ -126,7 +126,8 @@ 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, VRF_DEFAULT);
|
nbmaifp = if_lookup_by_name(nifp->source,
|
||||||
|
vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
|
|
||||||
switch (ifp->ll_type) {
|
switch (ifp->ll_type) {
|
||||||
case ZEBRA_LLT_IPGRE: {
|
case ZEBRA_LLT_IPGRE: {
|
||||||
|
|
|
@ -1404,7 +1404,8 @@ ospf6_routemap_rule_match_interface(void *rule, const 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, VRF_DEFAULT);
|
ifp = if_lookup_by_name((char *)rule,
|
||||||
|
vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
|
|
||||||
if (ifp != NULL && ei->ifindex == ifp->ifindex)
|
if (ifp != NULL && ei->ifindex == ifp->ifindex)
|
||||||
return RMAP_MATCH;
|
return RMAP_MATCH;
|
||||||
|
|
|
@ -996,7 +996,8 @@ DEFUN (show_ipv6_ospf6_interface,
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
|
|
||||||
if (argc == 5) {
|
if (argc == 5) {
|
||||||
ifp = if_lookup_by_name(argv[idx_ifname]->arg, VRF_DEFAULT);
|
ifp = if_lookup_by_name(argv[idx_ifname]->arg,
|
||||||
|
vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
if (ifp == NULL) {
|
if (ifp == NULL) {
|
||||||
vty_out(vty, "No such Interface: %s\n",
|
vty_out(vty, "No such Interface: %s\n",
|
||||||
argv[idx_ifname]->arg);
|
argv[idx_ifname]->arg);
|
||||||
|
@ -1081,7 +1082,8 @@ DEFUN (show_ipv6_ospf6_interface_traffic,
|
||||||
|
|
||||||
if (argv_find(argv, argc, "IFNAME", &idx_ifname)) {
|
if (argv_find(argv, argc, "IFNAME", &idx_ifname)) {
|
||||||
intf_name = argv[idx_ifname]->arg;
|
intf_name = argv[idx_ifname]->arg;
|
||||||
ifp = if_lookup_by_name(intf_name, VRF_DEFAULT);
|
ifp = if_lookup_by_name(intf_name,
|
||||||
|
vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
if (ifp == NULL) {
|
if (ifp == NULL) {
|
||||||
vty_out(vty, "No such Interface: %s\n", intf_name);
|
vty_out(vty, "No such Interface: %s\n", intf_name);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
@ -1125,7 +1127,8 @@ 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, VRF_DEFAULT);
|
ifp = if_lookup_by_name(argv[idx_ifname]->arg,
|
||||||
|
vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
if (ifp == NULL) {
|
if (ifp == NULL) {
|
||||||
vty_out(vty, "No such Interface: %s\n", argv[idx_ifname]->arg);
|
vty_out(vty, "No such Interface: %s\n", argv[idx_ifname]->arg);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
@ -2026,7 +2029,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,
|
if ((ifp = if_lookup_by_name(argv[idx_ifname]->arg,
|
||||||
VRF_DEFAULT))
|
vrf_lookup_by_id(VRF_DEFAULT)))
|
||||||
== NULL) {
|
== NULL) {
|
||||||
vty_out(vty, "No such Interface: %s\n",
|
vty_out(vty, "No such Interface: %s\n",
|
||||||
argv[idx_ifname]->arg);
|
argv[idx_ifname]->arg);
|
||||||
|
|
|
@ -715,7 +715,8 @@ DEFUN (no_ospf6_interface_area,
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
uint32_t area_id;
|
uint32_t area_id;
|
||||||
|
|
||||||
ifp = if_lookup_by_name(argv[idx_ifname]->arg, VRF_DEFAULT);
|
ifp = if_lookup_by_name(argv[idx_ifname]->arg,
|
||||||
|
vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
if (ifp == NULL) {
|
if (ifp == NULL) {
|
||||||
vty_out(vty, "No such interface %s\n", argv[idx_ifname]->arg);
|
vty_out(vty, "No such interface %s\n", argv[idx_ifname]->arg);
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
|
|
|
@ -2569,7 +2569,7 @@ DEFUN (show_ip_ospf_mpls_te_link,
|
||||||
if (idx_interface) {
|
if (idx_interface) {
|
||||||
ifp = if_lookup_by_name(
|
ifp = if_lookup_by_name(
|
||||||
argv[idx_interface]->arg,
|
argv[idx_interface]->arg,
|
||||||
ospf->vrf_id);
|
vrf_lookup_by_id(ospf->vrf_id));
|
||||||
if (ifp == NULL) {
|
if (ifp == NULL) {
|
||||||
vty_out(vty, "No such interface name in vrf %s\n",
|
vty_out(vty, "No such interface name in vrf %s\n",
|
||||||
vrf->name);
|
vrf->name);
|
||||||
|
|
|
@ -3741,7 +3741,8 @@ static int show_ip_ospf_interface_common(struct vty *vty, struct ospf *ospf,
|
||||||
json_interface);
|
json_interface);
|
||||||
} else {
|
} else {
|
||||||
/* Interface name is specified. */
|
/* Interface name is specified. */
|
||||||
ifp = if_lookup_by_name(intf_name, ospf->vrf_id);
|
ifp = if_lookup_by_name(intf_name,
|
||||||
|
vrf_lookup_by_id(ospf->vrf_id));
|
||||||
if (ifp == NULL) {
|
if (ifp == NULL) {
|
||||||
if (use_json)
|
if (use_json)
|
||||||
json_object_boolean_true_add(json_vrf,
|
json_object_boolean_true_add(json_vrf,
|
||||||
|
@ -3881,7 +3882,8 @@ static int show_ip_ospf_interface_traffic_common(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Interface name is specified. */
|
/* Interface name is specified. */
|
||||||
ifp = if_lookup_by_name(intf_name, ospf->vrf_id);
|
ifp = if_lookup_by_name(intf_name,
|
||||||
|
vrf_lookup_by_id(ospf->vrf_id));
|
||||||
if (ifp != NULL) {
|
if (ifp != NULL) {
|
||||||
struct route_node *rn;
|
struct route_node *rn;
|
||||||
struct ospf_interface *oi;
|
struct ospf_interface *oi;
|
||||||
|
@ -4691,7 +4693,8 @@ static int show_ip_ospf_neighbor_int_common(struct vty *vty, struct ospf *ospf,
|
||||||
|
|
||||||
ospf_show_vrf_name(ospf, vty, json, use_vrf);
|
ospf_show_vrf_name(ospf, vty, json, use_vrf);
|
||||||
|
|
||||||
ifp = if_lookup_by_name(argv[arg_base]->arg, ospf->vrf_id);
|
ifp = if_lookup_by_name(argv[arg_base]->arg,
|
||||||
|
vrf_lookup_by_id(ospf->vrf_id));
|
||||||
if (!ifp) {
|
if (!ifp) {
|
||||||
if (use_json)
|
if (use_json)
|
||||||
json_object_boolean_true_add(json, "noSuchIface");
|
json_object_boolean_true_add(json, "noSuchIface");
|
||||||
|
@ -4759,7 +4762,8 @@ DEFUN (show_ip_ospf_neighbor_int,
|
||||||
|
|
||||||
argv_find(argv, argc, "IFNAME", &idx_ifname);
|
argv_find(argv, argc, "IFNAME", &idx_ifname);
|
||||||
|
|
||||||
ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf_id);
|
ifp = if_lookup_by_name(argv[idx_ifname]->arg,
|
||||||
|
vrf_lookup_by_id(vrf_id));
|
||||||
if (!ifp)
|
if (!ifp)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -5576,7 +5580,8 @@ static int show_ip_ospf_neighbor_int_detail_common(struct vty *vty,
|
||||||
vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance);
|
vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
ifp = if_lookup_by_name(argv[arg_base]->arg, ospf->vrf_id);
|
ifp = if_lookup_by_name(argv[arg_base]->arg,
|
||||||
|
vrf_lookup_by_id(ospf->vrf_id));
|
||||||
if (!ifp) {
|
if (!ifp) {
|
||||||
if (!use_json)
|
if (!use_json)
|
||||||
vty_out(vty, "No such interface.\n");
|
vty_out(vty, "No such interface.\n");
|
||||||
|
@ -10684,7 +10689,8 @@ DEFUN (clear_ip_ospf_interface,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Interface name is specified. */
|
/* Interface name is specified. */
|
||||||
ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf_id);
|
ifp = if_lookup_by_name(argv[idx_ifname]->arg,
|
||||||
|
vrf_lookup_by_id(vrf_id));
|
||||||
if (ifp == NULL)
|
if (ifp == NULL)
|
||||||
vty_out(vty, "No such interface name\n");
|
vty_out(vty, "No such interface name\n");
|
||||||
else
|
else
|
||||||
|
|
|
@ -175,7 +175,8 @@ static struct interface *zebra_interface_if_lookup(struct stream *s,
|
||||||
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
|
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
|
||||||
|
|
||||||
/* And look it up. */
|
/* And look it up. */
|
||||||
return if_lookup_by_name(ifname_tmp, vrf_id);
|
return if_lookup_by_name(ifname_tmp,
|
||||||
|
vrf_lookup_by_id(vrf_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ospf_interface_state_up(ZAPI_CALLBACK_ARGS)
|
static int ospf_interface_state_up(ZAPI_CALLBACK_ARGS)
|
||||||
|
|
|
@ -7655,7 +7655,7 @@ DEFUN (interface_ip_mroute,
|
||||||
pim = pim_ifp->pim;
|
pim = pim_ifp->pim;
|
||||||
|
|
||||||
oifname = argv[idx_interface]->arg;
|
oifname = argv[idx_interface]->arg;
|
||||||
oif = if_lookup_by_name(oifname, pim->vrf_id);
|
oif = if_lookup_by_name(oifname, pim->vrf);
|
||||||
if (!oif) {
|
if (!oif) {
|
||||||
vty_out(vty, "No such interface name %s\n", oifname);
|
vty_out(vty, "No such interface name %s\n", oifname);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
@ -7706,7 +7706,7 @@ DEFUN (interface_ip_mroute_source,
|
||||||
pim = pim_ifp->pim;
|
pim = pim_ifp->pim;
|
||||||
|
|
||||||
oifname = argv[idx_interface]->arg;
|
oifname = argv[idx_interface]->arg;
|
||||||
oif = if_lookup_by_name(oifname, pim->vrf_id);
|
oif = if_lookup_by_name(oifname, pim->vrf);
|
||||||
if (!oif) {
|
if (!oif) {
|
||||||
vty_out(vty, "No such interface name %s\n", oifname);
|
vty_out(vty, "No such interface name %s\n", oifname);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
@ -7761,7 +7761,7 @@ DEFUN (interface_no_ip_mroute,
|
||||||
pim = pim_ifp->pim;
|
pim = pim_ifp->pim;
|
||||||
|
|
||||||
oifname = argv[idx_interface]->arg;
|
oifname = argv[idx_interface]->arg;
|
||||||
oif = if_lookup_by_name(oifname, pim->vrf_id);
|
oif = if_lookup_by_name(oifname, pim->vrf);
|
||||||
if (!oif) {
|
if (!oif) {
|
||||||
vty_out(vty, "No such interface name %s\n", oifname);
|
vty_out(vty, "No such interface name %s\n", oifname);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
@ -7813,7 +7813,7 @@ DEFUN (interface_no_ip_mroute_source,
|
||||||
pim = pim_ifp->pim;
|
pim = pim_ifp->pim;
|
||||||
|
|
||||||
oifname = argv[idx_interface]->arg;
|
oifname = argv[idx_interface]->arg;
|
||||||
oif = if_lookup_by_name(oifname, pim->vrf_id);
|
oif = if_lookup_by_name(oifname, pim->vrf);
|
||||||
if (!oif) {
|
if (!oif) {
|
||||||
vty_out(vty, "No such interface name %s\n", oifname);
|
vty_out(vty, "No such interface name %s\n", oifname);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
@ -10127,7 +10127,7 @@ DEFUN_HIDDEN (ip_pim_mlag,
|
||||||
|
|
||||||
idx = 3;
|
idx = 3;
|
||||||
peerlink = argv[idx]->arg;
|
peerlink = argv[idx]->arg;
|
||||||
ifp = if_lookup_by_name(peerlink, VRF_DEFAULT);
|
ifp = if_lookup_by_name(peerlink, vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
if (!ifp) {
|
if (!ifp) {
|
||||||
vty_out(vty, "No such interface name %s\n", peerlink);
|
vty_out(vty, "No such interface name %s\n", peerlink);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
|
|
@ -895,9 +895,9 @@ struct in_addr pim_find_primary_addr(struct interface *ifp)
|
||||||
struct interface *lo_ifp;
|
struct interface *lo_ifp;
|
||||||
// DBS - Come back and check here
|
// DBS - Come back and check here
|
||||||
if (ifp->vrf_id == VRF_DEFAULT)
|
if (ifp->vrf_id == VRF_DEFAULT)
|
||||||
lo_ifp = if_lookup_by_name("lo", vrf->vrf_id);
|
lo_ifp = if_lookup_by_name("lo", vrf);
|
||||||
else
|
else
|
||||||
lo_ifp = if_lookup_by_name(vrf->name, vrf->vrf_id);
|
lo_ifp = if_lookup_by_name(vrf->name, vrf);
|
||||||
|
|
||||||
if (lo_ifp)
|
if (lo_ifp)
|
||||||
return pim_find_primary_addr(lo_ifp);
|
return pim_find_primary_addr(lo_ifp);
|
||||||
|
|
|
@ -158,7 +158,7 @@ int pim_msdp_sock_listen(struct pim_instance *pim)
|
||||||
|
|
||||||
if (pim->vrf_id != VRF_DEFAULT) {
|
if (pim->vrf_id != VRF_DEFAULT) {
|
||||||
struct interface *ifp =
|
struct interface *ifp =
|
||||||
if_lookup_by_name(pim->vrf->name, pim->vrf_id);
|
if_lookup_by_name(pim->vrf->name, pim->vrf);
|
||||||
if (!ifp) {
|
if (!ifp) {
|
||||||
flog_err(EC_LIB_INTERFACE,
|
flog_err(EC_LIB_INTERFACE,
|
||||||
"%s: Unable to lookup vrf interface: %s",
|
"%s: Unable to lookup vrf interface: %s",
|
||||||
|
@ -239,7 +239,7 @@ int pim_msdp_sock_connect(struct pim_msdp_peer *mp)
|
||||||
|
|
||||||
if (mp->pim->vrf_id != VRF_DEFAULT) {
|
if (mp->pim->vrf_id != VRF_DEFAULT) {
|
||||||
struct interface *ifp =
|
struct interface *ifp =
|
||||||
if_lookup_by_name(mp->pim->vrf->name, mp->pim->vrf_id);
|
if_lookup_by_name(mp->pim->vrf->name, mp->pim->vrf);
|
||||||
if (!ifp) {
|
if (!ifp) {
|
||||||
flog_err(EC_LIB_INTERFACE,
|
flog_err(EC_LIB_INTERFACE,
|
||||||
"%s: Unable to lookup vrf interface: %s",
|
"%s: Unable to lookup vrf interface: %s",
|
||||||
|
|
|
@ -211,11 +211,12 @@ static int pim_zebra_if_state_up(ZAPI_CALLBACK_ARGS)
|
||||||
*/
|
*/
|
||||||
if (sscanf(ifp->name, "pimreg%" SCNu32, &table_id) == 1) {
|
if (sscanf(ifp->name, "pimreg%" SCNu32, &table_id) == 1) {
|
||||||
struct vrf *vrf;
|
struct vrf *vrf;
|
||||||
|
|
||||||
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
|
||||||
if ((table_id == vrf->data.l.table_id)
|
if ((table_id == vrf->data.l.table_id)
|
||||||
&& (ifp->vrf_id != vrf->vrf_id)) {
|
&& (ifp->vrf_id != vrf->vrf_id)) {
|
||||||
struct interface *master = if_lookup_by_name(
|
struct interface *master = if_lookup_by_name(
|
||||||
vrf->name, vrf->vrf_id);
|
vrf->name, vrf);
|
||||||
|
|
||||||
if (!master) {
|
if (!master) {
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
|
|
|
@ -106,7 +106,8 @@ static route_map_result_t route_match_interface(void *rule,
|
||||||
|
|
||||||
if (type == RMAP_RIP) {
|
if (type == RMAP_RIP) {
|
||||||
ifname = rule;
|
ifname = rule;
|
||||||
ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
|
ifp = if_lookup_by_name(ifname,
|
||||||
|
vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
|
|
||||||
if (!ifp)
|
if (!ifp)
|
||||||
return RMAP_NOMATCH;
|
return RMAP_NOMATCH;
|
||||||
|
|
|
@ -3299,7 +3299,7 @@ static void rip_distribute_update(struct distribute_ctx *ctx,
|
||||||
if (!ctx->vrf || !dist->ifname)
|
if (!ctx->vrf || !dist->ifname)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ifp = if_lookup_by_name(dist->ifname, ctx->vrf->vrf_id);
|
ifp = if_lookup_by_name(dist->ifname, ctx->vrf);
|
||||||
if (ifp == NULL)
|
if (ifp == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -3418,7 +3418,7 @@ static void rip_if_rmap_update(struct if_rmap_ctx *ctx,
|
||||||
if (ctx->name)
|
if (ctx->name)
|
||||||
vrf = vrf_lookup_by_name(ctx->name);
|
vrf = vrf_lookup_by_name(ctx->name);
|
||||||
if (vrf)
|
if (vrf)
|
||||||
ifp = if_lookup_by_name(if_rmap->ifname, vrf->vrf_id);
|
ifp = if_lookup_by_name(if_rmap->ifname, vrf);
|
||||||
if (ifp == NULL)
|
if (ifp == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,8 @@ static route_map_result_t route_match_interface(void *rule,
|
||||||
|
|
||||||
if (type == RMAP_RIPNG) {
|
if (type == RMAP_RIPNG) {
|
||||||
ifname = rule;
|
ifname = rule;
|
||||||
ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
|
ifp = if_lookup_by_name(ifname,
|
||||||
|
vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
|
|
||||||
if (!ifp)
|
if (!ifp)
|
||||||
return RMAP_NOMATCH;
|
return RMAP_NOMATCH;
|
||||||
|
|
|
@ -2454,7 +2454,7 @@ static void ripng_distribute_update(struct distribute_ctx *ctx,
|
||||||
if (!ctx->vrf || !dist->ifname)
|
if (!ctx->vrf || !dist->ifname)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ifp = if_lookup_by_name(dist->ifname, ctx->vrf->vrf_id);
|
ifp = if_lookup_by_name(dist->ifname, ctx->vrf);
|
||||||
if (ifp == NULL)
|
if (ifp == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -2571,7 +2571,7 @@ static void ripng_if_rmap_update(struct if_rmap_ctx *ctx,
|
||||||
if (ctx->name)
|
if (ctx->name)
|
||||||
vrf = vrf_lookup_by_name(ctx->name);
|
vrf = vrf_lookup_by_name(ctx->name);
|
||||||
if (vrf)
|
if (vrf)
|
||||||
ifp = if_lookup_by_name(if_rmap->ifname, vrf->vrf_id);
|
ifp = if_lookup_by_name(if_rmap->ifname, vrf);
|
||||||
if (ifp == NULL)
|
if (ifp == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ struct zclient *zclient = NULL;
|
||||||
/* For registering threads. */
|
/* For registering threads. */
|
||||||
extern struct thread_master *master;
|
extern struct thread_master *master;
|
||||||
|
|
||||||
static struct interface *zebra_interface_if_lookup(struct stream *s)
|
static struct interface *zebra_interface_if_lookup(struct stream *s, vrf_id_t vrf_id)
|
||||||
{
|
{
|
||||||
char ifname_tmp[INTERFACE_NAMSIZ];
|
char ifname_tmp[INTERFACE_NAMSIZ];
|
||||||
|
|
||||||
|
@ -54,7 +54,8 @@ static struct interface *zebra_interface_if_lookup(struct stream *s)
|
||||||
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
|
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
|
||||||
|
|
||||||
/* And look it up. */
|
/* And look it up. */
|
||||||
return if_lookup_by_name(ifname_tmp, VRF_DEFAULT);
|
return if_lookup_by_name(ifname_tmp,
|
||||||
|
vrf_lookup_by_id(vrf_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Inteface addition message from zebra. */
|
/* Inteface addition message from zebra. */
|
||||||
|
@ -112,7 +113,7 @@ static int interface_address_delete(ZAPI_CALLBACK_ARGS)
|
||||||
static int interface_state_up(ZAPI_CALLBACK_ARGS)
|
static int interface_state_up(ZAPI_CALLBACK_ARGS)
|
||||||
{
|
{
|
||||||
|
|
||||||
zebra_interface_if_lookup(zclient->ibuf);
|
zebra_interface_if_lookup(zclient->ibuf, vrf_id);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ int static_add_route(afi_t afi, safi_t safi, uint8_t type, struct prefix *p,
|
||||||
else {
|
else {
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
|
|
||||||
ifp = if_lookup_by_name(ifname, nh_svrf->vrf->vrf_id);
|
ifp = if_lookup_by_name(ifname, nh_svrf->vrf);
|
||||||
if (ifp && ifp->ifindex != IFINDEX_INTERNAL) {
|
if (ifp && ifp->ifindex != IFINDEX_INTERNAL) {
|
||||||
si->ifindex = ifp->ifindex;
|
si->ifindex = ifp->ifindex;
|
||||||
static_install_route(rn, si, safi);
|
static_install_route(rn, si, safi);
|
||||||
|
@ -331,8 +331,7 @@ static void static_fixup_vrf(struct static_vrf *svrf,
|
||||||
si->nh_vrf_id = svrf->vrf->vrf_id;
|
si->nh_vrf_id = svrf->vrf->vrf_id;
|
||||||
si->nh_registered = false;
|
si->nh_registered = false;
|
||||||
if (si->ifindex) {
|
if (si->ifindex) {
|
||||||
ifp = if_lookup_by_name(si->ifname,
|
ifp = if_lookup_by_name(si->ifname, svrf->vrf);
|
||||||
si->nh_vrf_id);
|
|
||||||
if (ifp)
|
if (ifp)
|
||||||
si->ifindex = ifp->ifindex;
|
si->ifindex = ifp->ifindex;
|
||||||
else
|
else
|
||||||
|
@ -367,7 +366,8 @@ static void static_enable_vrf(struct static_vrf *svrf,
|
||||||
si->vrf_id = vrf->vrf_id;
|
si->vrf_id = vrf->vrf_id;
|
||||||
if (si->ifindex) {
|
if (si->ifindex) {
|
||||||
ifp = if_lookup_by_name(si->ifname,
|
ifp = if_lookup_by_name(si->ifname,
|
||||||
si->nh_vrf_id);
|
vrf_lookup_by_id(
|
||||||
|
si->nh_vrf_id));
|
||||||
if (ifp)
|
if (ifp)
|
||||||
si->ifindex = ifp->ifindex;
|
si->ifindex = ifp->ifindex;
|
||||||
else
|
else
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
struct zclient *zclient;
|
struct zclient *zclient;
|
||||||
static struct hash *static_nht_hash;
|
static struct hash *static_nht_hash;
|
||||||
|
|
||||||
static struct interface *zebra_interface_if_lookup(struct stream *s)
|
static struct interface *zebra_interface_if_lookup(struct stream *s, vrf_id_t vrf_id)
|
||||||
{
|
{
|
||||||
char ifname_tmp[INTERFACE_NAMSIZ];
|
char ifname_tmp[INTERFACE_NAMSIZ];
|
||||||
|
|
||||||
|
@ -55,7 +55,8 @@ static struct interface *zebra_interface_if_lookup(struct stream *s)
|
||||||
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
|
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
|
||||||
|
|
||||||
/* And look it up. */
|
/* And look it up. */
|
||||||
return if_lookup_by_name(ifname_tmp, VRF_DEFAULT);
|
return if_lookup_by_name(ifname_tmp,
|
||||||
|
vrf_lookup_by_id(vrf_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Inteface addition message from zebra. */
|
/* Inteface addition message from zebra. */
|
||||||
|
@ -115,7 +116,7 @@ static int interface_state_up(ZAPI_CALLBACK_ARGS)
|
||||||
{
|
{
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
|
|
||||||
ifp = zebra_interface_if_lookup(zclient->ibuf);
|
ifp = zebra_interface_if_lookup(zclient->ibuf, vrf_id);
|
||||||
|
|
||||||
if (ifp) {
|
if (ifp) {
|
||||||
if (if_is_vrf(ifp)) {
|
if (if_is_vrf(ifp)) {
|
||||||
|
|
|
@ -196,7 +196,8 @@ static int if_getaddrs(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ifp = if_lookup_by_name(ifap->ifa_name, VRF_DEFAULT);
|
ifp = if_lookup_by_name(ifap->ifa_name,
|
||||||
|
vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
if (ifp == NULL) {
|
if (ifp == NULL) {
|
||||||
flog_err(EC_LIB_INTERFACE,
|
flog_err(EC_LIB_INTERFACE,
|
||||||
"if_getaddrs(): Can't lookup interface %s\n",
|
"if_getaddrs(): Can't lookup interface %s\n",
|
||||||
|
|
|
@ -1653,7 +1653,8 @@ DEFUN (show_interface_name_vrf,
|
||||||
VRF_GET_ID(vrf_id, argv[idx_name]->arg, false);
|
VRF_GET_ID(vrf_id, argv[idx_name]->arg, false);
|
||||||
|
|
||||||
/* Specified interface print. */
|
/* Specified interface print. */
|
||||||
ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf_id);
|
ifp = if_lookup_by_name(argv[idx_ifname]->arg,
|
||||||
|
vrf_lookup_by_id(vrf_id));
|
||||||
if (ifp == NULL) {
|
if (ifp == NULL) {
|
||||||
vty_out(vty, "%% Can't find interface %s\n",
|
vty_out(vty, "%% Can't find interface %s\n",
|
||||||
argv[idx_ifname]->arg);
|
argv[idx_ifname]->arg);
|
||||||
|
@ -1683,7 +1684,7 @@ DEFUN (show_interface_name_vrf_all,
|
||||||
/* All interface print. */
|
/* All interface print. */
|
||||||
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(argv[idx_ifname]->arg, vrf->vrf_id);
|
ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf);
|
||||||
if (ifp) {
|
if (ifp) {
|
||||||
if_dump_vty(vty, ifp);
|
if_dump_vty(vty, ifp);
|
||||||
found++;
|
found++;
|
||||||
|
|
|
@ -616,7 +616,7 @@ int 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, VRF_DEFAULT);
|
ifp = if_lookup_by_name(ifname, vrf);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If ifp still does not exist or has an invalid index
|
* If ifp still does not exist or has an invalid index
|
||||||
|
|
|
@ -2207,9 +2207,9 @@ static void zread_vrf_label(ZAPI_HANDLER_ARGS)
|
||||||
STREAM_GETC(s, ltype);
|
STREAM_GETC(s, ltype);
|
||||||
|
|
||||||
if (zvrf->vrf->vrf_id != VRF_DEFAULT)
|
if (zvrf->vrf->vrf_id != VRF_DEFAULT)
|
||||||
ifp = if_lookup_by_name(zvrf->vrf->name, zvrf->vrf->vrf_id);
|
ifp = if_lookup_by_name(zvrf->vrf->name, zvrf->vrf);
|
||||||
else
|
else
|
||||||
ifp = if_lookup_by_name("lo", VRF_DEFAULT);
|
ifp = if_lookup_by_name("lo", vrf_lookup_by_id(VRF_DEFAULT));
|
||||||
|
|
||||||
if (!ifp) {
|
if (!ifp) {
|
||||||
zlog_debug("Unable to find specified Interface for %s",
|
zlog_debug("Unable to find specified Interface for %s",
|
||||||
|
|
Loading…
Reference in a new issue