vector_set (babel_enable_if, strdup (ifname));
- ifp = if_lookup_by_name(ifname, vrf_lookup_by_id(VRF_DEFAULT));
+ ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
if (ifp != NULL)
interface_recalculate(ifp);
free (str);
vector_unset (babel_enable_if, babel_enable_if_index);
- ifp = if_lookup_by_name(ifname, vrf_lookup_by_id(VRF_DEFAULT));
+ ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
if (ifp != NULL)
interface_reset(ifp);
show_babel_interface_sub (vty, ifp);
return CMD_SUCCESS;
}
- if ((ifp = if_lookup_by_name (argv[3]->arg,
- vrf_lookup_by_id(VRF_DEFAULT))) == NULL)
+ if ((ifp = if_lookup_by_name (argv[3]->arg, VRF_DEFAULT)) == NULL)
{
vty_out (vty, "No such interface name\n");
return CMD_WARNING;
}
return CMD_SUCCESS;
}
- if ((ifp = if_lookup_by_name (argv[3]->arg,
- vrf_lookup_by_id(VRF_DEFAULT))) == NULL)
+ if ((ifp = if_lookup_by_name (argv[3]->arg, VRF_DEFAULT)) == NULL)
{
vty_out (vty, "No such interface name\n");
return CMD_WARNING;
if (! dist->ifname)
return;
- ifp = if_lookup_by_name (dist->ifname, vrf_lookup_by_id(VRF_DEFAULT));
+ ifp = if_lookup_by_name (dist->ifname, VRF_DEFAULT);
if (ifp == NULL)
return;
if (bs->key.ifname[0]) {
if (vrf)
- ifp = if_lookup_by_name(bs->key.ifname, vrf);
+ ifp = if_lookup_by_name(bs->key.ifname, vrf->vrf_id);
else
ifp = if_lookup_by_name_all_vrf(bs->key.ifname);
if (ifp == NULL) {
return 0;
}
if (bs->key.ifname[0] && !vrf) {
- vrf = ifp->vrf;
+ vrf = vrf_lookup_by_id(ifp->vrf_id);
if (vrf == NULL) {
log_error(
"session-enable: specified VRF doesn't exists.");
{
struct bfd_session_observer *bso;
struct bfd_session *bs;
- struct vrf *vrf = ifp->vrf;
-
- if (!vrf)
- return;
+ struct vrf *vrf;
TAILQ_FOREACH(bso, &bglobal.bg_obslist, bso_entry) {
bs = bso->bso_bs;
/* Interface name mismatch. */
if (strcmp(ifp->name, bs->key.ifname))
continue;
+ vrf = vrf_lookup_by_id(ifp->vrf_id);
+ if (!vrf)
+ continue;
if (bs->key.vrfname[0] &&
strcmp(vrf->name, bs->key.vrfname))
continue;
static int bfdd_interface_vrf_update(ZAPI_CALLBACK_ARGS)
{
struct interface *ifp;
- struct vrf *nvrf;
vrf_id_t nvrfid;
ifp = zebra_interface_vrf_update_read(zclient->ibuf, vrf_id, &nvrfid);
if (ifp == NULL)
return 0;
- nvrf = vrf_lookup_by_id(nvrfid);
- if_update_to_new_vrf(ifp, nvrf);
+
+ if_update_to_new_vrf(ifp, nvrfid);
return 0;
}
if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
continue;
- ifp = if_lookup_by_name(name,
- vrf_lookup_by_id(bgp->vrf_id));
+ ifp = if_lookup_by_name(name, bgp->vrf_id);
if (ifp) {
*bgp_inst = bgp;
return 0;
/* Source is specified with interface name. */
if (peer->update_if) {
- ifp = if_lookup_by_name(peer->update_if,
- vrf_lookup_by_id(peer->bgp->vrf_id));
+ ifp = if_lookup_by_name(peer->update_if, peer->bgp->vrf_id);
if (!ifp)
return -1;
}
}
- if_update_to_new_vrf(ifp, vrf_lookup_by_id(new_vrf_id));
+ if_update_to_new_vrf(ifp, new_vrf_id);
bgp = bgp_lookup_by_vrf_id(new_vrf_id);
if (!bgp)
nexthop->v4 = local->sin.sin_addr;
if (peer->update_if)
ifp = if_lookup_by_name(peer->update_if,
- vrf_lookup_by_id(peer->bgp->vrf_id));
+ peer->bgp->vrf_id);
else
ifp = if_lookup_by_ipv4_exact(&local->sin.sin_addr,
peer->bgp->vrf_id);
ifp = if_lookup_by_name(peer->conf_if
? peer->conf_if
: peer->ifname,
- vrf_lookup_by_id(
- peer->bgp->vrf_id));
+ peer->bgp->vrf_id);
} else if (peer->update_if)
ifp = if_lookup_by_name(peer->update_if,
- vrf_lookup_by_id(peer->bgp->vrf_id));
+ peer->bgp->vrf_id);
else
ifp = if_lookup_by_ipv6_exact(&local->sin6.sin6_addr,
local->sin6.sin6_scope_id,
head = &(bgp_pbr_cfg->ifaces_by_name_ipv4);
RB_FOREACH (pbr_if, bgp_pbr_interface_head, head) {
- ifp = if_lookup_by_name(pbr_if->name,
- vrf_lookup_by_id(bgp->vrf_id));
+ ifp = if_lookup_by_name(pbr_if->name, bgp->vrf_id);
if (ifp)
stream_putl(s, ifp->ifindex);
}
head = &(bgp_pbr_cfg->ifaces_by_name_ipv4);
RB_FOREACH (pbr_if, bgp_pbr_interface_head, head) {
- if (if_lookup_by_name(pbr_if->name,
- vrf_lookup_by_id(bgp->vrf_id)))
+ if (if_lookup_by_name(pbr_if->name, bgp->vrf_id))
cnt++;
}
return cnt;
hash_release(peer->bgp->peerhash, peer);
prev_family = peer->su.sa.sa_family;
- if ((ifp = if_lookup_by_name(peer->conf_if,
- vrf_lookup_by_id(peer->bgp->vrf_id)))) {
+ if ((ifp = if_lookup_by_name(peer->conf_if, peer->bgp->vrf_id))) {
peer->ifp = ifp;
/* If BGP unnumbered is not "v6only", we first see if we can
* derive the
return;
}
- ifp = if_lookup_by_name(dist->ifname,
- vrf_lookup_by_id(VRF_DEFAULT));
+ ifp = if_lookup_by_name(dist->ifname, VRF_DEFAULT);
if (ifp == NULL)
return;
struct route_map *rmap;
struct eigrp *e;
- ifp = if_lookup_by_name(if_rmap->ifname, vrf_lookup_by_id(VRF_DEFAULT));
+ ifp = if_lookup_by_name(if_rmap->ifname);
if (ifp == NULL)
return;
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
/* And look it up. */
- return if_lookup_by_name(ifname_tmp,
- vrf_lookup_by_id(VRF_DEFAULT));
+ return if_lookup_by_name(ifname_tmp, VRF_DEFAULT);
}
void eigrp_zebra_route_add(struct prefix *p, struct list *successors,
/* add callbacks to delete each of the circuits listed
*/
const char *vrf_name =
- circuit->interface->vrf->name;
+ vrf_lookup_by_id(circuit->interface->vrf_id)
+ ->name;
snprintf(
temp_xpath, XPATH_MAXLEN,
"/frr-interface:lib/interface[name='%s'][vrf='%s']/frr-isisd:isis",
vrfname = yang_dnode_get_string(dnode->parent->parent, "./vrf");
vrf = vrf_lookup_by_name(vrfname);
assert(vrf);
- ifp = if_lookup_by_name(ifname, vrf);
+ ifp = if_lookup_by_name(ifname, vrf->vrf_id);
if (!ifp)
return NB_OK;
circuit = circuit_lookup_by_ifp(ifp, isis->init_circ_list);
vrfname = yang_dnode_get_string(dnode->parent->parent, "./vrf");
vrf = vrf_lookup_by_name(vrfname);
assert(vrf);
- ifp = if_lookup_by_name(ifname, vrf);
+ ifp = if_lookup_by_name(ifname, vrf->vrf_id);
if (!ifp)
break;
circuit = circuit_lookup_by_ifp(ifp, isis->init_circ_list);
}
} else {
/* Interface name is specified. */
- ifp = if_lookup_by_name(argv[idx_interface]->arg,
- vrf_lookup_by_id(VRF_DEFAULT));
+ ifp = if_lookup_by_name(argv[idx_interface]->arg, VRF_DEFAULT);
if (ifp == NULL)
vty_out(vty, "No such interface name\n");
else {
}
/* Create new interface structure. */
-struct interface *if_create(const char *name, struct vrf *vrf)
+struct interface *if_create(const char *name, vrf_id_t vrf_id)
{
+ struct vrf *vrf = vrf_get(vrf_id, NULL);
struct interface *ifp;
ifp = XCALLOC(MTYPE_IF, sizeof(struct interface));
assert(name);
strlcpy(ifp->name, name, sizeof(ifp->name));
- ifp->vrf = vrf;
+ ifp->vrf_id = vrf_id;
IFNAME_RB_INSERT(vrf, ifp);
ifp->connected = list_new();
ifp->connected->del = (void (*)(void *))connected_free;
return ifp;
}
-/* Create new interface structure.
- * vrf must be created outside of this routing
- */
-void if_update_to_new_vrf(struct interface *ifp, struct vrf *vrf)
+/* Create new interface structure. */
+void if_update_to_new_vrf(struct interface *ifp, vrf_id_t vrf_id)
{
- struct vrf *old_vrf;
+ struct vrf *old_vrf, *vrf;
- if (!vrf) {
- flog_err(EC_LIB_INTERFACE, "interface %s. Unknown VRF",
- ifp->name);
- return;
- }
/* remove interface from old master vrf list */
- old_vrf = ifp->vrf;
+ old_vrf = vrf_lookup_by_id(ifp->vrf_id);
if (old_vrf) {
IFNAME_RB_REMOVE(old_vrf, ifp);
if (ifp->ifindex != IFINDEX_INTERNAL)
IFINDEX_RB_REMOVE(old_vrf, ifp);
}
- ifp->vrf = vrf;
+ ifp->vrf_id = vrf_id;
+ vrf = vrf_get(ifp->vrf_id, NULL);
IFNAME_RB_INSERT(vrf, ifp);
if (ifp->ifindex != IFINDEX_INTERNAL)
IFINDEX_RB_INSERT(vrf, ifp);
- if (!old_vrf->name)
- return;
/*
* HACK: Change the interface VRF in the running configuration directly,
* bypassing the northbound layer. This is necessary to avoid deleting
/* Delete and free interface structure. */
void if_delete(struct interface *ifp)
{
- struct vrf *vrf = ifp->vrf;
+ struct vrf *vrf;
+ vrf = vrf_lookup_by_id(ifp->vrf_id);
assert(vrf);
IFNAME_RB_REMOVE(vrf, ifp);
ifindex_t ifname2ifindex(const char *name, vrf_id_t vrf_id)
{
struct interface *ifp;
- struct vrf *vrf = vrf_lookup_by_id(vrf_id);
- return ((ifp = if_lookup_by_name(name, vrf)) != NULL)
+ return ((ifp = if_lookup_by_name(name, vrf_id)) != NULL)
? ifp->ifindex
: IFINDEX_INTERNAL;
}
/* Interface existance check by interface name. */
-struct interface *if_lookup_by_name(const char *name, struct vrf *vrf)
+struct interface *if_lookup_by_name(const char *name, vrf_id_t vrf_id)
{
+ struct vrf *vrf = vrf_lookup_by_id(vrf_id);
struct interface if_tmp;
if (!vrf || !name
return NULL;
RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id) {
- ifp = if_lookup_by_name(name, vrf);
+ ifp = if_lookup_by_name(name, vrf->vrf_id);
if (ifp)
return ifp;
}
/* Get interface by name if given name interface doesn't exist create
one. */
-struct interface *if_get_by_name(const char *name, struct vrf *vrf)
+struct interface *if_get_by_name(const char *name, vrf_id_t vrf_id)
{
struct interface *ifp;
switch (vrf_get_backend()) {
case VRF_BACKEND_UNKNOWN:
case VRF_BACKEND_NETNS:
- ifp = if_lookup_by_name(name, vrf);
+ ifp = if_lookup_by_name(name, vrf_id);
if (ifp)
return ifp;
- return if_create(name, vrf);
+ return if_create(name, vrf_id);
case VRF_BACKEND_VRF_LITE:
ifp = if_lookup_by_name_all_vrf(name);
if (ifp) {
- if (ifp->vrf == vrf)
+ if (ifp->vrf_id == vrf_id)
return ifp;
/* If it came from the kernel or by way of zclient,
* believe it and update the ifp accordingly.
*/
- if_update_to_new_vrf(ifp, vrf);
+ if_update_to_new_vrf(ifp, vrf_id);
return ifp;
}
- return if_create(name, vrf);
+ return if_create(name, vrf_id);
}
return NULL;
{
struct vrf *vrf;
- vrf = ifp->vrf;
+ vrf = vrf_lookup_by_id(ifp->vrf_id);
assert(vrf);
if (ifp->ifindex == ifindex)
zlog_info(
"Interface %s vrf %u index %d metric %d mtu %d "
"mtu6 %d %s",
- ifp->name, vrf_to_id(ifp->vrf),
- ifp->ifindex, ifp->metric,
+ ifp->name, ifp->vrf_id, ifp->ifindex, ifp->metric,
ifp->mtu, ifp->mtu6, if_flag_dump(ifp->flags));
}
* if not:
* - no idea, just get the name in its entirety.
*/
-static struct interface *if_sunwzebra_get(const char *name, struct vrf *vrf)
+static struct interface *if_sunwzebra_get(const char *name, vrf_id_t vrf_id)
{
struct interface *ifp;
char *cp;
- if ((ifp = if_lookup_by_name(name, vrf)) != NULL)
+ if ((ifp = if_lookup_by_name(name, vrf_id)) != NULL)
return ifp;
/* hunt the primary interface name... */
if (cp)
*cp = '\0';
- return if_get_by_name(name, vrf);
+ return if_get_by_name(name, vrf_id);
}
#endif /* SUNOS_5 */
p = connected->address;
snprintf(logbuf, BUFSIZ, "%s interface %s vrf %u %s %s/%d ", str,
- ifp->name, vrf_to_id(ifp->vrf),
- prefix_family_str(p),
+ ifp->name, ifp->vrf_id, prefix_family_str(p),
inet_ntop(p->family, &p->u.prefix, buf, BUFSIZ), p->prefixlen);
p = connected->destination;
VRF_CMD_HELP_STR)
{
char xpath_list[XPATH_MAXLEN];
- struct interface *ifp = NULL;
+ vrf_id_t vrf_id;
+ struct interface *ifp;
int ret;
- struct vrf *vrf;
if (!vrfname)
vrfname = VRF_DEFAULT_NAME;
* interface is found, then a new one should be created on the default
* VRF.
*/
- VRF_GET_INSTANCE(vrf, vrfname, false, true);
- /*
- * within vrf context, vrf_id may be unknown
- * this happens on daemons relying on zebra
- * on this specific case, interface creation may
- * be forced
- */
- if (vrf && (vrf->vrf_id == VRF_UNKNOWN ||
- vrf_get_backend() == VRF_BACKEND_UNKNOWN))
- ifp = if_lookup_by_name(ifname, vrf);
- else
- ifp = if_lookup_by_name_all_vrf(ifname);
- if (ifp && ifp->vrf != vrf) {
+ VRF_GET_ID(vrf_id, vrfname, false);
+ ifp = if_lookup_by_name_all_vrf(ifname);
+ if (ifp && ifp->vrf_id != vrf_id) {
+ struct vrf *vrf;
+
/*
* Special case 1: a VRF name was specified, but the found
* interface is associated to different VRF. Reject the command.
*/
- if (vrf->vrf_id != VRF_DEFAULT) {
+ if (vrf_id != VRF_DEFAULT) {
vty_out(vty, "%% interface %s not in %s vrf\n", ifname,
vrfname);
return CMD_WARNING_CONFIG_FAILED;
* interface is associated to a VRF other than the default one.
* Update vrf_id and vrfname to account for that.
*/
- vrf = ifp->vrf;
+ vrf = vrf_lookup_by_id(ifp->vrf_id);
assert(vrf);
+ vrf_id = ifp->vrf_id;
vrfname = vrf->name;
}
* all interface-level commands are converted to the new
* northbound model.
*/
- ifp = if_lookup_by_name(ifname, vrf);
+ ifp = if_lookup_by_name(ifname, vrf_id);
if (ifp)
VTY_PUSH_CONTEXT(INTERFACE_NODE, ifp);
}
const char *ifname;
const char *vrfname;
struct vrf *vrf;
- struct interface *ifp = NULL;
+ struct interface *ifp;
ifname = yang_dnode_get_string(dnode, "./name");
vrfname = yang_dnode_get_string(dnode, "./vrf");
vrfname);
return NB_ERR_VALIDATION;
}
- if (vrf->vrf_id == VRF_UNKNOWN)
- zlog_warn("%s: VRF %s is not active. Using interface however.",
- __func__, vrf->name);
+ if (vrf->vrf_id == VRF_UNKNOWN) {
+ zlog_warn("%s: VRF %s is not active", __func__,
+ vrf->name);
+ return NB_ERR_VALIDATION;
+ }
/* if VRF is netns or not yet known - init for instance
* then assumption is that passed config is exact
*/
if (vrf_get_backend() == VRF_BACKEND_VRF_LITE) {
ifp = if_lookup_by_name_all_vrf(ifname);
- if (ifp && ifp->vrf != vrf) {
+ if (ifp && ifp->vrf_id != vrf->vrf_id) {
zlog_warn(
"%s: interface %s already exists in another VRF",
__func__, ifp->name);
vrf = vrf_lookup_by_name(vrfname);
assert(vrf);
#ifdef SUNOS_5
- ifp = if_sunwzebra_get(ifname, vrf);
+ ifp = if_sunwzebra_get(ifname, vrf->vrf_id);
#else
- ifp = if_get_by_name(ifname, vrf);
+ ifp = if_get_by_name(ifname, vrf->vrf_id);
#endif /* SUNOS_5 */
nb_running_set_entry(dnode, ifp);
break;
DECLARE_MTYPE(CONNECTED_LABEL)
-struct vrf;
-
/* Interface link-layer type, if known. Derived from:
*
* net/if_arp.h on various platforms - Linux especially.
#endif /* HAVE_NET_RT_IFLIST */
struct route_node *node;
- struct vrf *vrf;
+ vrf_id_t vrf_id;
QOBJ_FIELDS
};
RB_PROTOTYPE(if_index_head, interface, index_entry, if_cmp_func)
DECLARE_QOBJ_TYPE(interface)
-#define IFNAME_RB_INSERT(_vrf, _ifp) \
- if (RB_INSERT(if_name_head, &(_vrf)->ifaces_by_name, (_ifp))) \
+#define IFNAME_RB_INSERT(vrf, ifp) \
+ if (RB_INSERT(if_name_head, &vrf->ifaces_by_name, (ifp))) \
flog_err(EC_LIB_INTERFACE, \
"%s(%s): corruption detected -- interface with this " \
"name exists already in VRF %u!", \
- __func__, (_ifp)->name, (_ifp)->vrf ? \
- (_ifp)->vrf->vrf_id : VRF_UNKNOWN);
+ __func__, (ifp)->name, (ifp)->vrf_id);
-#define IFNAME_RB_REMOVE(_vrf, _ifp) \
- if (RB_REMOVE(if_name_head, &(_vrf)->ifaces_by_name, (_ifp)) == NULL) \
+#define IFNAME_RB_REMOVE(vrf, ifp) \
+ if (RB_REMOVE(if_name_head, &vrf->ifaces_by_name, (ifp)) == NULL) \
flog_err(EC_LIB_INTERFACE, \
"%s(%s): corruption detected -- interface with this " \
"name doesn't exist in VRF %u!", \
- __func__, (_ifp)->name, (_ifp)->vrf ? \
- (_ifp)->vrf->vrf_id : VRF_UNKNOWN);
+ __func__, (ifp)->name, (ifp)->vrf_id);
-#define IFINDEX_RB_INSERT(_vrf, _ifp) \
- if (RB_INSERT(if_index_head, &(_vrf)->ifaces_by_index, (_ifp))) \
+#define IFINDEX_RB_INSERT(vrf, ifp) \
+ if (RB_INSERT(if_index_head, &vrf->ifaces_by_index, (ifp))) \
flog_err(EC_LIB_INTERFACE, \
"%s(%u): corruption detected -- interface with this " \
"ifindex exists already in VRF %u!", \
- __func__, (_ifp)->ifindex, (_ifp)->vrf ? \
- (_ifp)->vrf->vrf_id : VRF_UNKNOWN);
+ __func__, (ifp)->ifindex, (ifp)->vrf_id);
-#define IFINDEX_RB_REMOVE(_vrf, _ifp) \
- if (RB_REMOVE(if_index_head, &(_vrf)->ifaces_by_index, (_ifp)) == NULL)\
+#define IFINDEX_RB_REMOVE(vrf, ifp) \
+ if (RB_REMOVE(if_index_head, &vrf->ifaces_by_index, (ifp)) == NULL) \
flog_err(EC_LIB_INTERFACE, \
"%s(%u): corruption detected -- interface with this " \
"ifindex doesn't exist in VRF %u!", \
- __func__, (_ifp)->ifindex, (_ifp)->vrf ? \
- (_ifp)->vrf->vrf_id : VRF_UNKNOWN);
+ __func__, (ifp)->ifindex, (ifp)->vrf_id);
#define FOR_ALL_INTERFACES(vrf, ifp) \
if (vrf) \
* This is useful for vrf route-leaking. So more than anything
* else think before you use VRF_UNKNOWN
*/
-extern void if_update_to_new_vrf(struct interface *, struct vrf *vrf);
-extern struct interface *if_create(const char *name, struct vrf *vrf);
+extern void if_update_to_new_vrf(struct interface *, vrf_id_t vrf_id);
+extern struct interface *if_create(const char *name, vrf_id_t vrf_id);
extern struct interface *if_lookup_by_index(ifindex_t, vrf_id_t vrf_id);
extern struct interface *if_lookup_exact_address(void *matchaddr, int family,
vrf_id_t vrf_id);
/* These 3 functions are to be used when the ifname argument is terminated
by a '\0' character: */
extern struct interface *if_lookup_by_name_all_vrf(const char *ifname);
-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_lookup_by_name(const char *ifname, vrf_id_t vrf_id);
+extern struct interface *if_get_by_name(const char *ifname, vrf_id_t vrf_id);
extern void if_set_index(struct interface *ifp, ifindex_t ifindex);
/* Delete the interface, but do not free the structure, and leave it in the
name, vrf_id, vrf->vrf_id);
return NULL;
}
- /* look for duplicates. case is followine one:
- * - a vrf is configured per name -> vrfA
- * - netlink discovery creates a vrf with vrf_id ->vrfB
- * - then, netlink discovers vrf, and associated vrf_id and name
- * -> so vrfA and vrfB must be merged
- */
- if (vrf && vrf_id != VRF_UNKNOWN
- && vrf->vrf_id == VRF_UNKNOWN) {
- struct vrf *vrf2 = vrf_lookup_by_id(vrf_id);
- struct interface *ifp;
-
- if (vrf2 && !vrf2->name && vrf2 != vrf) {
- /* move vrf2 context to vrf */
- FOR_ALL_INTERFACES (vrf2, ifp)
- if_update_to_new_vrf(ifp, vrf);
- vrf_delete(vrf2);
- }
- }
/* Try to find VRF both by ID and name */
if (!vrf && vrf_id != VRF_UNKNOWN)
vrf = vrf_lookup_by_id(vrf_id);
{
int ret = 0;
struct interface *ifp;
- struct vrf *vrf = vrf_lookup_by_id(vrf_id);
- if (fd < 0 || name == NULL || !vrf)
+ if (fd < 0 || name == NULL)
return fd;
/* the device should exist
* otherwise we should return
* case ifname = vrf in netns mode => return
*/
- ifp = if_lookup_by_name(name, vrf);
+ ifp = if_lookup_by_name(name, vrf_id);
if (!ifp)
return fd;
#ifdef SO_BINDTODEVICE
return ++vrf_id_local;
}
-
-vrf_id_t vrf_to_id(struct vrf *vrf)
-{
- return vrf ? vrf->vrf_id : VRF_UNKNOWN;
-}
-
-const char *vrf_to_name(struct vrf *vrf)
-{
- return vrf ? vrf->name : "NIL";
-}
extern struct vrf *vrf_get(vrf_id_t, const char *);
extern const char *vrf_id_to_name(vrf_id_t vrf_id);
extern vrf_id_t vrf_name_to_id(const char *);
-extern vrf_id_t vrf_to_id(struct vrf *vrf);
-extern const char *vrf_to_name(struct vrf *vrf);
-
-/* vrf context is searched and created
- */
-#define VRF_GET_INSTANCE(V, NAME, USE_JSON, FORCE_CREATION) \
- do { \
- struct vrf *_vrf; \
- \
- if (!(_vrf = vrf_lookup_by_name(NAME))) { \
- if (!FORCE_CREATION) { \
- if (USE_JSON) { \
- vty_out(vty, "{}\n"); \
- } else { \
- vty_out(vty, "%% VRF %s not found\n", \
- NAME); \
- } \
- return CMD_WARNING; \
- } \
- _vrf = vrf_get(VRF_UNKNOWN, NAME); \
- } \
- if (_vrf->vrf_id == VRF_UNKNOWN) { \
- if (USE_JSON) { \
- vty_out(vty, "{}\n"); \
- } else { \
- vty_out(vty, "%% VRF %s not active\n", NAME); \
- } \
- } \
- (V) = _vrf; \
- } while (0)
#define VRF_GET_ID(V, NAME, USE_JSON) \
do { \
{
struct interface *ifp;
char ifname_tmp[INTERFACE_NAMSIZ];
- struct vrf *vrf = vrf_lookup_by_id(vrf_id);
/* Read interface name. */
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
/* Lookup/create interface by name. */
- ifp = if_get_by_name(ifname_tmp, vrf);
-
- /* update vrf_id of interface */
- if (ifp->vrf->vrf_id == VRF_UNKNOWN &&
- vrf->vrf_id != VRF_UNKNOWN)
- ifp->vrf = vrf;
+ ifp = if_get_by_name(ifname_tmp, vrf_id);
zebra_interface_if_set_value(s, ifp);
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
/* Lookup this by interface index. */
- ifp = if_lookup_by_name(ifname_tmp,
- vrf_lookup_by_id(vrf_id));
+ ifp = if_lookup_by_name(ifname_tmp, vrf_id);
if (ifp == NULL) {
flog_err(EC_LIB_ZAPI_ENCODE,
"INTERFACE_STATE: Cannot find IF %s in VRF %d",
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) {
flog_err(EC_LIB_ZAPI_ENCODE,
stream_get(ifname, s, INTERFACE_NAMSIZ);
/* Lookup interface. */
- ifp = if_lookup_by_name(ifname,
- vrf_lookup_by_id(vrf_id));
+ ifp = if_lookup_by_name(ifname, vrf_id);
if (ifp == NULL) {
flog_err(EC_LIB_ZAPI_ENCODE,
"INTERFACE_VRF_UPDATE: Cannot find IF %s in VRF %d",
s = client->obuf;
stream_reset(s);
- zclient_create_header(s, ZEBRA_INTERFACE_SET_MASTER,
- vrf_to_id(master->vrf));
+ zclient_create_header(s, ZEBRA_INTERFACE_SET_MASTER, master->vrf_id);
- stream_putl(s, vrf_to_id(master->vrf));
+ stream_putl(s, master->vrf_id);
stream_putl(s, master->ifindex);
- stream_putl(s, vrf_to_id(slave->vrf));
+ stream_putl(s, slave->vrf_id);
stream_putl(s, slave->ifindex);
stream_putw_at(s, 0, stream_get_endp(s));
sockunion_family(&nbma) = AF_UNSPEC;
if (nifp->source)
- nbmaifp = if_lookup_by_name(nifp->source,
- vrf_lookup_by_id(VRF_DEFAULT));
+ nbmaifp = if_lookup_by_name(nifp->source, VRF_DEFAULT);
switch (ifp->ll_type) {
case ZEBRA_LLT_IPGRE: {
if (type == RMAP_OSPF6) {
ei = ((struct ospf6_route *)object)->route_option;
- ifp = if_lookup_by_name((char *)rule,
- vrf_lookup_by_id(VRF_DEFAULT));
+ ifp = if_lookup_by_name((char *)rule, VRF_DEFAULT);
if (ifp != NULL && ei->ifindex == ifp->ifindex)
return RMAP_MATCH;
struct interface *ifp;
if (argc == 5) {
- ifp = if_lookup_by_name(argv[idx_ifname]->arg,
- vrf_lookup_by_id(VRF_DEFAULT));
+ ifp = if_lookup_by_name(argv[idx_ifname]->arg, VRF_DEFAULT);
if (ifp == NULL) {
vty_out(vty, "No such Interface: %s\n",
argv[idx_ifname]->arg);
if (argv_find(argv, argc, "IFNAME", &idx_ifname)) {
intf_name = argv[idx_ifname]->arg;
- ifp = if_lookup_by_name(intf_name,
- vrf_lookup_by_id(VRF_DEFAULT));
+ ifp = if_lookup_by_name(intf_name, VRF_DEFAULT);
if (ifp == NULL) {
vty_out(vty, "No such Interface: %s\n", intf_name);
return CMD_WARNING;
struct interface *ifp;
struct ospf6_interface *oi;
- ifp = if_lookup_by_name(argv[idx_ifname]->arg,
- vrf_lookup_by_id(VRF_DEFAULT));
+ ifp = if_lookup_by_name(argv[idx_ifname]->arg, VRF_DEFAULT);
if (ifp == NULL) {
vty_out(vty, "No such Interface: %s\n", argv[idx_ifname]->arg);
return CMD_WARNING;
} else /* Interface name is specified. */
{
if ((ifp = if_lookup_by_name(argv[idx_ifname]->arg,
- vrf_lookup_by_id(VRF_DEFAULT)))
+ VRF_DEFAULT))
== NULL) {
vty_out(vty, "No such Interface: %s\n",
argv[idx_ifname]->arg);
struct ospf6_interface *oi;
struct interface *ifp;
uint32_t area_id;
- struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
/* find/create ospf6 interface */
- ifp = if_get_by_name(argv[idx_ifname]->arg, vrf);
+ ifp = if_get_by_name(argv[idx_ifname]->arg, VRF_DEFAULT);
oi = (struct ospf6_interface *)ifp->info;
if (oi == NULL)
oi = ospf6_interface_create(ifp);
struct interface *ifp;
uint32_t area_id;
- ifp = if_lookup_by_name(argv[idx_ifname]->arg,
- vrf_lookup_by_id(VRF_DEFAULT));
+ ifp = if_lookup_by_name(argv[idx_ifname]->arg, VRF_DEFAULT);
if (ifp == NULL) {
vty_out(vty, "No such interface %s\n", argv[idx_ifname]->arg);
return CMD_SUCCESS;
if (IS_DEBUG_OSPF_EVENT)
zlog_debug("%s: ospf interface %s vrf %s id %u deleted",
__PRETTY_FUNCTION__, oi->ifp->name,
- vrf_to_name(oi->ifp->vrf),
- vrf_to_id(oi->ifp->vrf));
+ ospf_vrf_id_to_name(oi->ifp->vrf_id),
+ oi->ifp->vrf_id);
ospf_delete_from_if(oi->ifp, oi);
struct in_addr area_id;
struct connected *co;
struct prefix_ipv4 *p;
- struct vrf *vrf;
if (IS_DEBUG_OSPF_EVENT)
zlog_debug("ospf_vl_new(): Start");
ospf->vrf_id);
snprintf(ifname, sizeof(ifname), "VLINK%u", vlink_count);
- vrf = vrf_lookup_by_id(ospf->vrf_id);
- vi = if_create(ifname, vrf);
+ vi = if_create(ifname, ospf->vrf_id);
/*
* if_create sets ZEBRA_INTERFACE_LINKDETECTION
* virtual links don't need this.
if (idx_interface) {
ifp = if_lookup_by_name(
argv[idx_interface]->arg,
- vrf_lookup_by_id(ospf->vrf_id));
+ ospf->vrf_id);
if (ifp == NULL) {
vty_out(vty, "No such interface name in vrf %s\n",
vrf->name);
int ret;
struct ospf_if_params *params;
struct route_node *rn;
- struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id);
if (strmatch(argv[1]->text, "default")) {
ospf_passive_interface_default(ospf, OSPF_IF_PASSIVE);
return CMD_SUCCESS;
}
if (ospf->vrf_id != VRF_UNKNOWN)
- ifp = if_get_by_name(argv[1]->arg, vrf);
+ ifp = if_get_by_name(argv[1]->arg, ospf->vrf_id);
if (ifp == NULL) {
vty_out(vty, "interface %s not found.\n", (char *)argv[1]->arg);
struct ospf_if_params *params;
int ret;
struct route_node *rn;
- struct vrf *vrf = vrf_lookup_by_id(ospf->vrf_id);
if (strmatch(argv[2]->text, "default")) {
ospf_passive_interface_default(ospf, OSPF_IF_ACTIVE);
}
if (ospf->vrf_id != VRF_UNKNOWN)
- ifp = if_get_by_name(argv[2]->arg, vrf);
+ ifp = if_get_by_name(argv[2]->arg, ospf->vrf_id);
if (ifp == NULL) {
vty_out(vty, "interface %s not found.\n", (char *)argv[2]->arg);
json_interface);
} else {
/* Interface name is specified. */
- ifp = if_lookup_by_name(intf_name,
- vrf_lookup_by_id(ospf->vrf_id));
+ ifp = if_lookup_by_name(intf_name, ospf->vrf_id);
if (ifp == NULL) {
if (use_json)
json_object_boolean_true_add(json_vrf,
}
} else {
/* Interface name is specified. */
- ifp = if_lookup_by_name(intf_name,
- vrf_lookup_by_id(ospf->vrf_id));
+ ifp = if_lookup_by_name(intf_name, ospf->vrf_id);
if (ifp != NULL) {
struct route_node *rn;
struct ospf_interface *oi;
ospf_show_vrf_name(ospf, vty, json, use_vrf);
- ifp = if_lookup_by_name(argv[arg_base]->arg,
- vrf_lookup_by_id(ospf->vrf_id));
+ ifp = if_lookup_by_name(argv[arg_base]->arg, ospf->vrf_id);
if (!ifp) {
if (use_json)
json_object_boolean_true_add(json, "noSuchIface");
argv_find(argv, argc, "IFNAME", &idx_ifname);
- ifp = if_lookup_by_name(argv[idx_ifname]->arg,
- vrf_lookup_by_id(vrf_id));
+ ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf_id);
if (!ifp)
return ret;
vty_out(vty, "\nOSPF Instance: %d\n\n", ospf->instance);
}
- ifp = if_lookup_by_name(argv[arg_base]->arg,
- vrf_lookup_by_id(ospf->vrf_id));
+ ifp = if_lookup_by_name(argv[arg_base]->arg, ospf->vrf_id);
if (!ifp) {
if (!use_json)
vty_out(vty, "No such interface.\n");
if (nbr_str) {
struct ospf *ospf = NULL;
- ospf = ospf_lookup_by_vrf(ifp->vrf);
+ ospf = ospf_lookup_by_vrf_id(ifp->vrf_id);
if (ospf) {
oi = ospf_if_lookup_by_local_addr(ospf, ifp, addr);
if (oi)
if (argc == 1) {
struct ospf *ospf = NULL;
- ospf = ospf_lookup_by_vrf(ifp->vrf);
+ ospf = ospf_lookup_by_vrf_id(ifp->vrf_id);
if (ospf) {
oi = ospf_if_lookup_by_local_addr(ospf, ifp, addr);
if (oi)
argv_find(argv, argc, "area", &idx);
areaid = argv[idx + 1]->arg;
- if (ifp->vrf && ifp->vrf->vrf_id && !instance)
- ospf = ospf_lookup_by_vrf(ifp->vrf);
+ if (ifp->vrf_id && !instance)
+ ospf = ospf_lookup_by_vrf_id(ifp->vrf_id);
else
ospf = ospf_lookup_instance(instance);
if (argv_find(argv, argc, "(1-65535)", &idx))
instance = strtol(argv[idx]->arg, NULL, 10);
- if (ifp->vrf && ifp->vrf->vrf_id && !instance)
- ospf = ospf_lookup_by_vrf(ifp->vrf);
+ if (ifp->vrf_id && !instance)
+ ospf = ospf_lookup_by_vrf_id(ifp->vrf_id);
else
ospf = ospf_lookup_instance(instance);
continue;
vty_frame(vty, "!\n");
- if (ifp->vrf->vrf_id == VRF_DEFAULT)
+ if (ifp->vrf_id == VRF_DEFAULT)
vty_frame(vty, "interface %s\n", ifp->name);
else
vty_frame(vty, "interface %s vrf %s\n", ifp->name,
}
} else {
/* Interface name is specified. */
- ifp = if_lookup_by_name(argv[idx_ifname]->arg,
- vrf_lookup_by_id(vrf_id));
+ ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf_id);
if (ifp == NULL)
vty_out(vty, "No such interface name\n");
else
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
zlog_debug(
"Zebra: interface add %s vrf %s[%u] index %d flags %llx metric %d mtu %d speed %u",
- ifp->name, vrf_to_name(ifp->vrf),
- vrf_to_id(ifp->vrf), ifp->ifindex,
+ ifp->name, ospf_vrf_id_to_name(ifp->vrf_id),
+ ifp->vrf_id, ifp->ifindex,
(unsigned long long)ifp->flags, ifp->metric, ifp->mtu,
ifp->speed);
if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
zlog_debug(
"Zebra: interface delete %s vrf %s[%u] index %d flags %llx metric %d mtu %d",
- ifp->name, vrf_to_name(ifp->vrf),
- vrf_to_id(ifp->vrf), ifp->ifindex,
+ ifp->name, ospf_vrf_id_to_name(ifp->vrf_id),
+ ifp->vrf_id, ifp->ifindex,
(unsigned long long)ifp->flags, ifp->metric, ifp->mtu);
hook_call(ospf_if_delete, ifp);
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
/* And look it up. */
- return if_lookup_by_name(ifname_tmp,
- vrf_lookup_by_id(vrf_id));
+ return if_lookup_by_name(ifname_tmp, vrf_id);
}
static int ospf_interface_state_up(ZAPI_CALLBACK_ARGS)
ospf_vrf_id_to_name(new_vrf_id), new_vrf_id);
/*if_update(ifp, ifp->name, strlen(ifp->name), new_vrf_id);*/
- if_update_to_new_vrf(ifp, vrf_lookup_by_id(new_vrf_id));
+ if_update_to_new_vrf(ifp, new_vrf_id);
return 0;
}
vrf = vrf_lookup_by_id(vrf_id);
if (!vrf)
return NULL;
- return ospf_lookup_by_vrf(vrf);
-}
-
-struct ospf *ospf_lookup_by_vrf(struct vrf *vrf)
-{
return (vrf->info) ? (struct ospf *)vrf->info : NULL;
}
if (IS_DEBUG_OSPF_EVENT)
zlog_debug(
- "%s: interface %s ifp->vrf->vrf_id %u ospf vrf %s vrf_id %u router_id %s",
- __PRETTY_FUNCTION__, ifp->name, vrf_to_id(ifp->vrf),
+ "%s: interface %s ifp->vrf_id %u ospf vrf %s vrf_id %u router_id %s",
+ __PRETTY_FUNCTION__, ifp->name, ifp->vrf_id,
ospf_vrf_id_to_name(ospf->vrf_id), ospf->vrf_id,
inet_ntoa(ospf->router_id));
extern struct ospf *ospf_lookup_by_inst_name(unsigned short instance,
const char *name);
extern struct ospf *ospf_lookup_by_vrf_id(vrf_id_t vrf_id);
-extern struct ospf *ospf_lookup_by_vrf(struct vrf *vrf);
extern void ospf_finish(struct ospf *);
extern void ospf_router_id_update(struct ospf *ospf);
extern int ospf_network_set(struct ospf *, struct prefix_ipv4 *, struct in_addr,
pim = pim_ifp->pim;
oifname = argv[idx_interface]->arg;
- oif = if_lookup_by_name(oifname, pim->vrf);
+ oif = if_lookup_by_name(oifname, pim->vrf_id);
if (!oif) {
vty_out(vty, "No such interface name %s\n", oifname);
return CMD_WARNING;
pim = pim_ifp->pim;
oifname = argv[idx_interface]->arg;
- oif = if_lookup_by_name(oifname, pim->vrf);
+ oif = if_lookup_by_name(oifname, pim->vrf_id);
if (!oif) {
vty_out(vty, "No such interface name %s\n", oifname);
return CMD_WARNING;
pim = pim_ifp->pim;
oifname = argv[idx_interface]->arg;
- oif = if_lookup_by_name(oifname, pim->vrf);
+ oif = if_lookup_by_name(oifname, pim->vrf_id);
if (!oif) {
vty_out(vty, "No such interface name %s\n", oifname);
return CMD_WARNING;
pim = pim_ifp->pim;
oifname = argv[idx_interface]->arg;
- oif = if_lookup_by_name(oifname, pim->vrf);
+ oif = if_lookup_by_name(oifname, pim->vrf_id);
if (!oif) {
vty_out(vty, "No such interface name %s\n", oifname);
return CMD_WARNING;
idx = 3;
peerlink = argv[idx]->arg;
- ifp = if_lookup_by_name(peerlink, vrf_lookup_by_id(VRF_DEFAULT));
+ ifp = if_lookup_by_name(peerlink, VRF_DEFAULT);
if (!ifp) {
vty_out(vty, "No such interface name %s\n", peerlink);
return CMD_WARNING;
pim_ifp = XCALLOC(MTYPE_PIM_INTERFACE, sizeof(*pim_ifp));
pim_ifp->options = 0;
- pim_ifp->pim = pim_get_pim_instance(vrf_to_id(ifp->vrf));
+ pim_ifp->pim = pim_get_pim_instance(ifp->vrf_id);
pim_ifp->mroute_vif_index = -1;
pim_ifp->igmp_version = IGMP_DEFAULT_VERSION;
struct connected *ifc;
struct listnode *node;
struct listnode *nextnode;
- struct vrf *vrf = ifp->vrf;
+ struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id);
struct pim_instance *pim;
if (!vrf)
int v4_addrs = 0;
int v6_addrs = 0;
struct pim_interface *pim_ifp = ifp->info;
- struct vrf *vrf = ifp->vrf;
+ struct vrf *vrf = vrf_lookup_by_id(ifp->vrf_id);
if (!vrf)
return addr;
if (!v4_addrs && v6_addrs && !if_is_loopback(ifp)) {
struct interface *lo_ifp;
// DBS - Come back and check here
- if (!ifp->vrf || ifp->vrf->vrf_id == VRF_DEFAULT)
- lo_ifp = if_lookup_by_name("lo", vrf);
+ if (ifp->vrf_id == VRF_DEFAULT)
+ lo_ifp = if_lookup_by_name("lo", vrf->vrf_id);
else
- lo_ifp = if_lookup_by_name(vrf->name, vrf);
+ lo_ifp = if_lookup_by_name(vrf->name, vrf->vrf_id);
if (lo_ifp)
return pim_find_primary_addr(lo_ifp);
snprintf(pimreg_name, sizeof(pimreg_name), "pimreg%u",
pim->vrf->data.l.table_id);
- pim->regiface = if_create(pimreg_name, pim->vrf);
+ pim->regiface = if_create(pimreg_name, pim->vrf_id);
pim->regiface->ifindex = PIM_OIF_PIM_REGISTER_VIF;
pim_if_new(pim->regiface, false, false, true,
if (pim->vrf_id != VRF_DEFAULT) {
struct interface *ifp =
- if_lookup_by_name(pim->vrf->name, pim->vrf);
+ if_lookup_by_name(pim->vrf->name, pim->vrf_id);
if (!ifp) {
flog_err(EC_LIB_INTERFACE,
"%s: Unable to lookup vrf interface: %s",
if (mp->pim->vrf_id != VRF_DEFAULT) {
struct interface *ifp =
- if_lookup_by_name(mp->pim->vrf->name, mp->pim->vrf);
+ if_lookup_by_name(mp->pim->vrf->name, mp->pim->vrf_id);
if (!ifp) {
flog_err(EC_LIB_INTERFACE,
"%s: Unable to lookup vrf interface: %s",
return -4;
}
#endif
- if (iif->vrf != oif->vrf) {
+ if (iif->vrf_id != oif->vrf_id) {
return -3;
}
*/
if (sscanf(ifp->name, "pimreg%" SCNu32, &table_id) == 1) {
struct vrf *vrf;
-
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
if ((table_id == vrf->data.l.table_id)
- && (ifp->vrf != vrf)) {
+ && (ifp->vrf_id != vrf->vrf_id)) {
struct interface *master = if_lookup_by_name(
- vrf->name, vrf);
+ vrf->name, vrf->vrf_id);
if (!master) {
zlog_debug(
__PRETTY_FUNCTION__,
ifp->name, vrf_id, new_vrf_id);
- if_update_to_new_vrf(ifp, vrf_lookup_by_id(new_vrf_id));
+ if_update_to_new_vrf(ifp, new_vrf_id);
return 0;
}
if (IS_RIP_DEBUG_ZEBRA)
zlog_debug(
"interface %s vrf %u index %d flags %llx metric %d mtu %d is down",
- ifp->name, ifp->vrf->vrf_id, ifp->ifindex,
+ ifp->name, ifp->vrf_id, ifp->ifindex,
(unsigned long long)ifp->flags, ifp->metric, ifp->mtu);
return 0;
if (IS_RIP_DEBUG_ZEBRA)
zlog_debug(
"interface %s vrf %u index %d flags %#llx metric %d mtu %d is up",
- ifp->name, ifp->vrf->vrf_id, ifp->ifindex,
+ ifp->name, ifp->vrf_id, ifp->ifindex,
(unsigned long long)ifp->flags, ifp->metric, ifp->mtu);
rip_interface_sync(ifp);
if (IS_RIP_DEBUG_ZEBRA)
zlog_debug(
"interface add %s vrf %u index %d flags %#llx metric %d mtu %d",
- ifp->name, ifp->vrf->vrf_id, ifp->ifindex,
+ ifp->name, ifp->vrf_id, ifp->ifindex,
(unsigned long long)ifp->flags, ifp->metric, ifp->mtu);
/* Check if this interface is RIP enabled or not.*/
zlog_info(
"interface delete %s vrf %u index %d flags %#llx metric %d mtu %d",
- ifp->name, ifp->vrf->vrf_id, ifp->ifindex,
+ ifp->name, ifp->vrf_id, ifp->ifindex,
(unsigned long long)ifp->flags, ifp->metric, ifp->mtu);
/* To support pseudo interface do not free interface structure. */
{
struct interface *ifp;
vrf_id_t new_vrf_id;
- struct vrf *new_vrf;
ifp = zebra_interface_vrf_update_read(zclient->ibuf, vrf_id,
&new_vrf_id);
if (!ifp)
return 0;
- new_vrf = vrf_lookup_by_id(new_vrf_id);
-
if (IS_RIP_DEBUG_ZEBRA)
zlog_debug("interface %s VRF change vrf_id %u new vrf id %u",
ifp->name, vrf_id, new_vrf_id);
- if_update_to_new_vrf(ifp, new_vrf);
-
+ if_update_to_new_vrf(ifp, new_vrf_id);
rip_interface_sync(ifp);
return 0;
{
struct vrf *vrf;
- vrf = ifp->vrf;
+ vrf = vrf_lookup_by_id(ifp->vrf_id);
if (vrf) {
struct rip_interface *ri;
if (type == RMAP_RIP) {
ifname = rule;
- ifp = if_lookup_by_name(ifname,
- vrf_lookup_by_id(VRF_DEFAULT));
+ ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
if (!ifp)
return RMAP_NOMATCH;
if (!ctx->vrf || !dist->ifname)
return;
- ifp = if_lookup_by_name(dist->ifname, ctx->vrf);
+ ifp = if_lookup_by_name(dist->ifname, ctx->vrf->vrf_id);
if (ifp == NULL)
return;
if (ctx->name)
vrf = vrf_lookup_by_name(ctx->name);
if (vrf)
- ifp = if_lookup_by_name(if_rmap->ifname, vrf);
+ ifp = if_lookup_by_name(if_rmap->ifname, vrf->vrf_id);
if (ifp == NULL)
return;
if (!rip)
return;
- if (ifp->vrf && ifp->vrf->vrf_id == VRF_UNKNOWN)
- return;
ctx = rip->if_rmap_ctx;
if (!ctx)
return;
if (IS_RIPNG_DEBUG_ZEBRA)
zlog_debug(
"interface up %s vrf %u index %d flags %llx metric %d mtu %d",
- ifp->name, ifp->vrf->vrf_id, ifp->ifindex,
+ ifp->name, ifp->vrf_id, ifp->ifindex,
(unsigned long long)ifp->flags, ifp->metric, ifp->mtu6);
ripng_interface_sync(ifp);
if (IS_RIPNG_DEBUG_ZEBRA)
zlog_debug(
"interface down %s vrf %u index %d flags %#llx metric %d mtu %d",
- ifp->name, ifp->vrf->vrf_id, ifp->ifindex,
+ ifp->name, ifp->vrf_id, ifp->ifindex,
(unsigned long long)ifp->flags, ifp->metric, ifp->mtu6);
return 0;
if (IS_RIPNG_DEBUG_ZEBRA)
zlog_debug(
"RIPng interface add %s vrf %u index %d flags %#llx metric %d mtu %d",
- ifp->name, ifp->vrf->vrf_id, ifp->ifindex,
+ ifp->name, ifp->vrf_id, ifp->ifindex,
(unsigned long long)ifp->flags, ifp->metric, ifp->mtu6);
/* Check is this interface is RIP enabled or not.*/
zlog_info(
"interface delete %s vrf %u index %d flags %#llx metric %d mtu %d",
- ifp->name, ifp->vrf->vrf_id, ifp->ifindex,
+ ifp->name, ifp->vrf_id, ifp->ifindex,
(unsigned long long)ifp->flags, ifp->metric, ifp->mtu6);
/* To support pseudo interface do not free interface structure. */
{
struct interface *ifp;
vrf_id_t new_vrf_id;
- struct vrf *new_vrf;
ifp = zebra_interface_vrf_update_read(zclient->ibuf, vrf_id,
&new_vrf_id);
if (!ifp)
return 0;
- new_vrf = vrf_lookup_by_id(new_vrf_id);
-
if (IS_RIPNG_DEBUG_ZEBRA)
zlog_debug("interface %s VRF change vrf_id %u new vrf id %u",
ifp->name, vrf_id, new_vrf_id);
- if_update_to_new_vrf(ifp, new_vrf);
-
+ if_update_to_new_vrf(ifp, new_vrf_id);
ripng_interface_sync(ifp);
return 0;
{
struct vrf *vrf;
- vrf = ifp->vrf;
+ vrf = vrf_lookup_by_id(ifp->vrf_id);
if (vrf) {
struct ripng_interface *ri;
if (type == RMAP_RIPNG) {
ifname = rule;
- ifp = if_lookup_by_name(ifname,
- vrf_lookup_by_id(VRF_DEFAULT));
+ ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
if (!ifp)
return RMAP_NOMATCH;
if (!ctx->vrf || !dist->ifname)
return;
- ifp = if_lookup_by_name(dist->ifname, ctx->vrf);
+ ifp = if_lookup_by_name(dist->ifname, ctx->vrf->vrf_id);
if (ifp == NULL)
return;
if (ctx->name)
vrf = vrf_lookup_by_name(ctx->name);
if (vrf)
- ifp = if_lookup_by_name(if_rmap->ifname, vrf);
+ ifp = if_lookup_by_name(if_rmap->ifname, vrf->vrf_id);
if (ifp == NULL)
return;
struct if_rmap *if_rmap;
struct if_rmap_ctx *ctx;
- if (ifp->vrf && ifp->vrf->vrf_id == VRF_UNKNOWN)
- return;
if (!ripng)
return;
ctx = ripng->if_rmap_ctx;
/* For registering threads. */
extern struct thread_master *master;
-static struct interface *zebra_interface_if_lookup(struct stream *s, vrf_id_t vrf_id)
+static struct interface *zebra_interface_if_lookup(struct stream *s)
{
char ifname_tmp[INTERFACE_NAMSIZ];
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
/* And look it up. */
- return if_lookup_by_name(ifname_tmp,
- vrf_lookup_by_id(vrf_id));
+ return if_lookup_by_name(ifname_tmp, VRF_DEFAULT);
}
/* Inteface addition message from zebra. */
static int interface_state_up(ZAPI_CALLBACK_ARGS)
{
- zebra_interface_if_lookup(zclient->ibuf, vrf_id);
+ zebra_interface_if_lookup(zclient->ibuf);
return 0;
}
else {
struct interface *ifp;
- ifp = if_lookup_by_name(ifname, nh_svrf->vrf);
+ ifp = if_lookup_by_name(ifname, nh_svrf->vrf->vrf_id);
if (ifp && ifp->ifindex != IFINDEX_INTERNAL) {
si->ifindex = ifp->ifindex;
static_install_route(rn, si, safi);
si->nh_vrf_id = svrf->vrf->vrf_id;
si->nh_registered = false;
if (si->ifindex) {
- ifp = if_lookup_by_name(si->ifname, svrf->vrf);
+ ifp = if_lookup_by_name(si->ifname,
+ si->nh_vrf_id);
if (ifp)
si->ifindex = ifp->ifindex;
else
si->vrf_id = vrf->vrf_id;
if (si->ifindex) {
ifp = if_lookup_by_name(si->ifname,
- vrf_lookup_by_id(
- si->nh_vrf_id));
+ si->nh_vrf_id);
if (ifp)
si->ifindex = ifp->ifindex;
else
for (rn = route_top(stable); rn; rn = route_next(rn)) {
for (si = rn->info; si; si = si->next) {
- if (si->nh_vrf_id != vrf_to_id(ifp->vrf))
+ if (si->nh_vrf_id != ifp->vrf_id)
continue;
if (si->ifindex != ifp->ifindex)
struct static_vrf *svrf = vrf->info;
/* Not needed if same vrf since happens naturally */
- if (vrf == ifp->vrf)
+ if (vrf->vrf_id == ifp->vrf_id)
continue;
/* Install any static routes configured for this interface. */
struct zclient *zclient;
static struct hash *static_nht_hash;
-static struct interface *zebra_interface_if_lookup(struct stream *s, vrf_id_t vrf_id)
+static struct interface *zebra_interface_if_lookup(struct stream *s)
{
char ifname_tmp[INTERFACE_NAMSIZ];
stream_get(ifname_tmp, s, INTERFACE_NAMSIZ);
/* And look it up. */
- return if_lookup_by_name(ifname_tmp,
- vrf_lookup_by_id(vrf_id));
+ return if_lookup_by_name(ifname_tmp, VRF_DEFAULT);
}
/* Inteface addition message from zebra. */
{
struct interface *ifp;
- ifp = zebra_interface_if_lookup(zclient->ibuf, vrf_id);
+ ifp = zebra_interface_if_lookup(zclient->ibuf);
if (ifp) {
if (if_is_vrf(ifp)) {
struct nexthop nh = {
.type = NEXTHOP_TYPE_IFINDEX,
.ifindex = ifp->ifindex,
- .vrf_id = vrf_to_id(ifp->vrf),
+ .vrf_id = ifp->vrf_id,
};
struct zebra_vrf *zvrf;
uint32_t metric;
- zvrf = zebra_vrf_lookup_by_id(ifp->vrf->vrf_id);
+ zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id);
if (!zvrf) {
flog_err(EC_ZEBRA_VRF_NOT_FOUND,
"%s: Received Up for interface but no associated zvrf: %d",
- __PRETTY_FUNCTION__, ifp->vrf->vrf_id);
+ __PRETTY_FUNCTION__, ifp->vrf_id);
return;
}
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
zlog_debug(
"%u: IF %s address %s add/up, scheduling RIB processing",
- vrf_to_id(ifp->vrf), ifp->name,
+ ifp->vrf_id, ifp->name,
prefix2str(&p, buf, sizeof(buf)));
}
rib_update(zvrf->vrf->vrf_id, RIB_UPDATE_IF_CHANGE);
struct nexthop nh = {
.type = NEXTHOP_TYPE_IFINDEX,
.ifindex = ifp->ifindex,
- .vrf_id = vrf_to_id(ifp->vrf),
+ .vrf_id = ifp->vrf_id,
};
struct zebra_vrf *zvrf;
- zvrf = zebra_vrf_lookup_by_id(ifp->vrf->vrf_id);
+ zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id);
if (!zvrf) {
flog_err(EC_ZEBRA_VRF_NOT_FOUND,
"%s: Received Up for interface but no associated zvrf: %d",
- __PRETTY_FUNCTION__, ifp->vrf->vrf_id);
+ __PRETTY_FUNCTION__, ifp->vrf_id);
return;
}
zlog_debug(
"%u: IF %s IP %s address del, scheduling RIB processing",
- vrf_to_id(ifp->vrf), ifp->name,
+ ifp->vrf_id, ifp->name,
prefix2str(p, buf, sizeof(buf)));
}
- rib_update(vrf_to_id(ifp->vrf), RIB_UPDATE_IF_CHANGE);
+ rib_update(ifp->vrf_id, RIB_UPDATE_IF_CHANGE);
/* Schedule LSP forwarding entries for processing, if appropriate. */
- if (vrf_to_id(ifp->vrf) == VRF_DEFAULT) {
+ if (ifp->vrf_id == VRF_DEFAULT) {
if (IS_ZEBRA_DEBUG_MPLS) {
char buf[PREFIX_STRLEN];
zlog_debug(
"%u: IF %s IP %s address delete, scheduling MPLS processing",
- vrf_to_id(ifp->vrf), ifp->name,
+ ifp->vrf_id, ifp->name,
prefix2str(p, buf, sizeof(buf)));
}
- mpls_mark_lsps_for_processing(zvrf_info_lookup(ifp->vrf), p);
+ mpls_mark_lsps_for_processing(vrf_info_lookup(ifp->vrf_id), p);
}
}
struct interface *ifp;
int n;
int lastlen;
- struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
/* Normally SIOCGIFCONF works with AF_INET socket. */
sock = socket(AF_INET, SOCK_DGRAM, 0);
unsigned int size;
ifreq = (struct ifreq *)((caddr_t)ifconf.ifc_req + n);
- ifp = if_get_by_name(ifreq->ifr_name, vrf);
+ ifp = if_get_by_name(ifreq->ifr_name, VRF_DEFAULT);
if_add_update(ifp);
size = ifreq->ifr_addr.sa_len;
if (size < sizeof(ifreq->ifr_addr))
}
#else
for (n = 0; n < ifconf.ifc_len; n += sizeof(struct ifreq)) {
- ifp = if_get_by_name(ifreq->ifr_name, vrf);
+ ifp = if_get_by_name(ifreq->ifr_name, VRF_DEFAULT);
if_add_update(ifp);
ifreq++;
}
ifreq.ifr_addr.sa_family = AF_INET;
/* Fetch Hardware address if available. */
- ret = vrf_if_ioctl(SIOCGIFHWADDR, (caddr_t)&ifreq,
- vrf_to_id(ifp->vrf));
+ ret = vrf_if_ioctl(SIOCGIFHWADDR, (caddr_t)&ifreq, ifp->vrf_id);
if (ret < 0)
ifp->hw_addr_len = 0;
else {
continue;
}
- ifp = if_lookup_by_name(ifap->ifa_name,
- vrf_lookup_by_id(VRF_DEFAULT));
+ ifp = if_lookup_by_name(ifap->ifa_name, VRF_DEFAULT);
if (ifp == NULL) {
flog_err(EC_LIB_INTERFACE,
"if_getaddrs(): Can't lookup interface %s\n",
int n;
size_t needed, lastneeded = 0;
char *buf = NULL;
- struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
frr_elevate_privs(&zserv_privs) {
sock = socket(af, SOCK_DGRAM, 0);
&& (*(lifreq->lifr_name + normallen) != ':'))
normallen++;
- ifp = if_get_by_name(lifreq->lifr_name, vrf);
+ ifp = if_get_by_name(lifreq->lifr_name, VRF_DEFAULT);
if (lifreq->lifr_addr.ss_family == AF_INET)
ifp->flags |= IFF_IPV4;
/* use ioctl to get IP address of an interface */
frr_elevate_privs(&zserv_privs) {
sd = vrf_socket(PF_INET, SOCK_DGRAM, IPPROTO_IP,
- vrf_to_id(interface->vrf),
+ interface->vrf_id,
NULL);
if (sd < 0) {
if (IS_ZEBRA_DEBUG_KERNEL)
return 0;
}
/* Get the current link state for the interface */
- rc = vrf_ioctl(vrf_to_id(interface->vrf), sd, SIOCETHTOOL,
+ rc = vrf_ioctl(interface->vrf_id, sd, SIOCETHTOOL,
(char *)&ifdata);
}
if (rc < 0) {
ifindex_t link_ifindex = IFINDEX_INTERNAL;
ifindex_t bond_ifindex = IFINDEX_INTERNAL;
struct zebra_if *zif;
- struct vrf *vrf;
zns = zebra_ns_lookup(ns_id);
ifi = NLMSG_DATA(h);
&& !vrf_is_backend_netns()) {
zif_slave_type = ZEBRA_IF_SLAVE_VRF;
vrf_id = *(uint32_t *)RTA_DATA(tb[IFLA_MASTER]);
- /* vrf can be needed before vrf netlink discovery */
- vrf_get(vrf_id, NULL);
} else if (slave_kind && (strcmp(slave_kind, "bridge") == 0)) {
zif_slave_type = ZEBRA_IF_SLAVE_BRIDGE;
bridge_ifindex =
}
if (vrf_is_backend_netns())
vrf_id = (vrf_id_t)ns_id;
- vrf = vrf_lookup_by_id(vrf_id);
+
/* If linking to another interface, note it. */
if (tb[IFLA_LINK])
link_ifindex = *(ifindex_t *)RTA_DATA(tb[IFLA_LINK]);
/* Add interface. */
- ifp = if_get_by_name(name, vrf);
+ ifp = if_get_by_name(name, vrf_id);
set_ifindex(ifp, ifi->ifi_index, zns);
ifp->flags = ifi->ifi_flags & 0x0000fffff;
ifp->mtu6 = ifp->mtu = *(uint32_t *)RTA_DATA(tb[IFLA_MTU]);
ifindex_t link_ifindex = IFINDEX_INTERNAL;
uint8_t old_hw_addr[INTERFACE_HWADDR_MAX];
struct zebra_if *zif;
- struct vrf *vrf;
zns = zebra_ns_lookup(ns_id);
ifi = NLMSG_DATA(h);
}
if (vrf_is_backend_netns())
vrf_id = (vrf_id_t)ns_id;
-
- vrf = vrf_lookup_by_id(vrf_id);
-
if (ifp == NULL
|| !CHECK_FLAG(ifp->status, ZEBRA_INTERFACE_ACTIVE)) {
/* Add interface notification from kernel */
if (ifp == NULL) {
/* unknown interface */
- ifp = if_get_by_name(name, vrf);
+ ifp = if_get_by_name(name, vrf_id);
} else {
/* pre-configured interface, learnt now */
- if (ifp->vrf != vrf)
- if_update_to_new_vrf(ifp, vrf);
+ if (ifp->vrf_id != vrf_id)
+ if_update_to_new_vrf(ifp, vrf_id);
}
/* Update interface information. */
bridge_ifindex);
else if (IS_ZEBRA_IF_BOND_SLAVE(ifp))
zebra_l2if_update_bond_slave(ifp, bond_ifindex);
- } else if (ifp->vrf != vrf) {
+ } else if (ifp->vrf_id != vrf_id) {
/* VRF change for an interface. */
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
"RTM_NEWLINK vrf-change for %s(%u) "
"vrf_id %u -> %u flags 0x%x",
- name, ifp->ifindex, vrf_to_id(ifp->vrf),
- vrf_id, ifi->ifi_flags);
+ name, ifp->ifindex, ifp->vrf_id, vrf_id,
+ ifi->ifi_flags);
- if_handle_vrf_change(ifp, vrf->vrf_id);
+ if_handle_vrf_change(ifp, vrf_id);
} else {
bool was_bridge_slave, was_bond_slave;
{
struct zebra_if *if_data;
struct zebra_ns *zns;
- struct zebra_vrf *zvrf = zvrf_info_lookup(ifp->vrf);
+ struct zebra_vrf *zvrf = vrf_info_lookup(ifp->vrf_id);
/* case interface populate before vrf enabled */
if (zvrf->zns)
zlog_debug(
"interface %s vrf %u index %d is shutdown. "
"Won't wake it up.",
- ifp->name, vrf_to_id(ifp->vrf),
- ifp->ifindex);
+ ifp->name, ifp->vrf_id, ifp->ifindex);
return;
}
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug(
"interface %s vrf %u index %d becomes active.",
- ifp->name, vrf_to_id(ifp->vrf), ifp->ifindex);
+ ifp->name, ifp->vrf_id, ifp->ifindex);
} else {
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug("interface %s vrf %u index %d is added.",
- ifp->name, vrf_to_id(ifp->vrf),
- ifp->ifindex);
+ ifp->name, ifp->vrf_id, ifp->ifindex);
}
}
flog_err(
EC_LIB_INTERFACE,
"interface %s vrf %u index %d is still up while being deleted.",
- ifp->name, vrf_to_id(ifp->vrf), ifp->ifindex);
+ ifp->name, ifp->vrf_id, ifp->ifindex);
return;
}
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug("interface %s vrf %u index %d is now inactive.",
- ifp->name, vrf_to_id(ifp->vrf), ifp->ifindex);
+ ifp->name, ifp->vrf_id, ifp->ifindex);
/* Delete connected routes from the kernel. */
if_delete_connected(ifp);
* occur with this implementation whereas it is not possible with
* vrf-lite).
*/
- if (ifp->vrf->vrf_id && !vrf_is_backend_netns())
+ if (ifp->vrf_id && !vrf_is_backend_netns())
if_handle_vrf_change(ifp, VRF_DEFAULT);
/* Reset some zebra interface params to default values. */
void if_handle_vrf_change(struct interface *ifp, vrf_id_t vrf_id)
{
vrf_id_t old_vrf_id;
- struct vrf *vrf = vrf_lookup_by_id(vrf_id);
- old_vrf_id = vrf_to_id(ifp->vrf);
+ old_vrf_id = ifp->vrf_id;
/* Uninstall connected routes. */
if_uninstall_connected(ifp);
zebra_interface_vrf_update_del(ifp, vrf_id);
/* update VRF */
- if_update_to_new_vrf(ifp, vrf);
+ if_update_to_new_vrf(ifp, vrf_id);
/* Send out notification on interface VRF change. */
/* This is to issue an ADD, if needed. */
*/
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug("%u: IF %s VRF change, scheduling RIB processing",
- vrf_to_id(ifp->vrf), ifp->name);
+ ifp->vrf_id, ifp->name);
rib_update(old_vrf_id, RIB_UPDATE_IF_CHANGE);
- rib_update(vrf_to_id(ifp->vrf), RIB_UPDATE_IF_CHANGE);
+ rib_update(ifp->vrf_id, RIB_UPDATE_IF_CHANGE);
}
static void ipv6_ll_address_to_mac(struct in6_addr *address, uint8_t *mac)
struct in6_addr *address,
int add)
{
- struct zebra_vrf *zvrf = zvrf_info_lookup(ifp->vrf);
+ struct zebra_vrf *zvrf = vrf_info_lookup(ifp->vrf_id);
struct zebra_if *zif = ifp->info;
char buf[16] = "169.254.0.1";
struct in_addr ipv4_ll;
{
struct zebra_if *zif;
struct interface *link_if;
- struct zebra_vrf *zvrf = zvrf_info_lookup(ifp->vrf);
+ struct zebra_vrf *zvrf = vrf_info_lookup(ifp->vrf_id);
zif = ifp->info;
zif->up_count++;
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug("%u: IF %s up, scheduling RIB processing",
- vrf_to_id(ifp->vrf), ifp->name);
- rib_update(vrf_to_id(ifp->vrf), RIB_UPDATE_IF_CHANGE);
+ ifp->vrf_id, ifp->name);
+ rib_update(ifp->vrf_id, RIB_UPDATE_IF_CHANGE);
/* Handle interface up for specific types for EVPN. Non-VxLAN interfaces
* are checked to see if (remote) neighbor entries need to be installed
{
struct zebra_if *zif;
struct interface *link_if;
- struct zebra_vrf *zvrf = zvrf_info_lookup(ifp->vrf);
+ struct zebra_vrf *zvrf = vrf_info_lookup(ifp->vrf_id);
zif = ifp->info;
zif->down_count++;
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug("%u: IF %s down, scheduling RIB processing",
- vrf_to_id(ifp->vrf), ifp->name);
- rib_update(vrf_to_id(ifp->vrf), RIB_UPDATE_IF_CHANGE);
+ ifp->vrf_id, ifp->name);
+ rib_update(ifp->vrf_id, RIB_UPDATE_IF_CHANGE);
if_nbr_ipv6ll_to_ipv4ll_neigh_del_all(ifp);
zebra_ptm_show_status(vty, ifp);
- vrf = ifp->vrf;
+ vrf = vrf_lookup_by_id(ifp->vrf_id);
vty_out(vty, " vrf: %s\n", vrf->name);
if (ifp->desc)
VRF_CMD_HELP_STR
"Interface status and configuration summary\n")
{
- struct vrf *vrf = NULL;
+ struct vrf *vrf;
struct interface *ifp;
+ vrf_id_t vrf_id = VRF_DEFAULT;
interface_update_stats();
if (name)
- VRF_GET_INSTANCE(vrf, name, false, false);
+ VRF_GET_ID(vrf_id, name, false);
/* All interface print. */
+ vrf = vrf_lookup_by_id(vrf_id);
if (brief) {
ifs_dump_brief_vty(vty, vrf);
} else {
int idx_ifname = 2;
int idx_name = 4;
struct interface *ifp;
- struct vrf *vrf;
+ vrf_id_t vrf_id;
interface_update_stats();
- VRF_GET_INSTANCE(vrf, argv[idx_name]->arg, false, false);
+ VRF_GET_ID(vrf_id, argv[idx_name]->arg, false);
/* Specified interface print. */
- ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf);
+ ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf_id);
if (ifp == NULL) {
vty_out(vty, "%% Can't find interface %s\n",
argv[idx_ifname]->arg);
/* All interface print. */
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
/* Specified interface print. */
- ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf);
+ ifp = if_lookup_by_name(argv[idx_ifname]->arg, vrf->vrf_id);
if (ifp) {
if_dump_vty(vty, ifp);
found++;
}
-static void if_show_description(struct vty *vty, struct vrf *vrf)
+static void if_show_description(struct vty *vty, vrf_id_t vrf_id)
{
+ struct vrf *vrf = vrf_lookup_by_id(vrf_id);
struct interface *ifp;
vty_out(vty, "Interface Status Protocol Description\n");
"Interface description\n"
VRF_CMD_HELP_STR)
{
- struct vrf *vrf;
+ vrf_id_t vrf_id = VRF_DEFAULT;
if (argc > 3)
- VRF_GET_INSTANCE(vrf, argv[4]->arg, false, false);
- else
- vrf = vrf_lookup_by_id(VRF_DEFAULT);
+ VRF_GET_ID(vrf_id, argv[4]->arg, false);
- if_show_description(vty, vrf);
+ if_show_description(vty, vrf_id);
return CMD_SUCCESS;
}
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
if (!RB_EMPTY(if_name_head, &vrf->ifaces_by_name)) {
vty_out(vty, "\n\tVRF %u\n\n", vrf->vrf_id);
- if_show_description(vty, vrf);
+ if_show_description(vty, vrf->vrf_id);
}
return CMD_SUCCESS;
struct vrf *vrf;
if_data = ifp->info;
- vrf = ifp->vrf;
+ vrf = vrf_lookup_by_id(ifp->vrf_id);
- if (vrf->vrf_id == VRF_DEFAULT)
+ if (ifp->vrf_id == VRF_DEFAULT)
vty_frame(vty, "interface %s\n", ifp->name);
else
vty_frame(vty, "interface %s vrf %s\n",
ifreq_set_name(&ifreq, ifp);
- if (vrf_if_ioctl(SIOCGIFMETRIC, (caddr_t)&ifreq,
- vrf_to_id(ifp->vrf)) < 0)
+ if (vrf_if_ioctl(SIOCGIFMETRIC, (caddr_t)&ifreq, ifp->vrf_id) < 0)
return;
ifp->metric = ifreq.ifr_metric;
if (ifp->metric == 0)
ifreq_set_name(&ifreq, ifp);
#if defined(SIOCGIFMTU)
- if (vrf_if_ioctl(SIOCGIFMTU, (caddr_t)&ifreq,
- vrf_to_id(ifp->vrf)) < 0) {
+ if (vrf_if_ioctl(SIOCGIFMTU, (caddr_t)&ifreq, ifp->vrf_id) < 0) {
zlog_info("Can't lookup mtu by ioctl(SIOCGIFMTU)");
ifp->mtu6 = ifp->mtu = -1;
return;
ifreq_set_name(&ifreq, ifp);
- ret = vrf_if_ioctl(SIOCGIFFLAGS, (caddr_t)&ifreq, vrf_to_id(ifp->vrf));
+ ret = vrf_if_ioctl(SIOCGIFFLAGS, (caddr_t)&ifreq, ifp->vrf_id);
if (ret < 0) {
flog_err_sys(EC_LIB_SYSTEM_CALL,
"vrf_if_ioctl(SIOCGIFFLAGS) failed: %s",
ifreq.ifr_flags = ifp->flags;
ifreq.ifr_flags |= flags;
- ret = vrf_if_ioctl(SIOCSIFFLAGS, (caddr_t)&ifreq, vrf_to_id(ifp->vrf));
+ ret = vrf_if_ioctl(SIOCSIFFLAGS, (caddr_t)&ifreq, ifp->vrf_id);
if (ret < 0) {
zlog_info("can't set interface flags");
ifreq.ifr_flags = ifp->flags;
ifreq.ifr_flags &= ~flags;
- ret = vrf_if_ioctl(SIOCSIFFLAGS, (caddr_t)&ifreq, vrf_to_id(ifp->vrf));
+ ret = vrf_if_ioctl(SIOCSIFFLAGS, (caddr_t)&ifreq, ifp->vrf_id);
if (ret < 0) {
zlog_info("can't unset interface flags");
static int ifan_read(struct if_announcemsghdr *ifan)
{
struct interface *ifp;
- struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
ifp = if_lookup_by_index(ifan->ifan_index, VRF_DEFAULT);
__func__, ifan->ifan_index, ifan->ifan_name);
/* Create Interface */
- ifp = if_get_by_name(ifan->ifan_name, vrf);
+ ifp = if_get_by_name(ifan->ifan_name, VRF_DEFAULT);
if_set_index(ifp, ifan->ifan_index);
if_get_metric(ifp);
int maskbit;
caddr_t cp;
char fbuf[64];
- struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
/* terminate ifname at head (for strnlen) and tail (for safety) */
ifname[IFNAMSIZ - 1] = '\0';
* be filled in.
*/
if ((ifp == NULL) && ifnlen)
- ifp = if_lookup_by_name(ifname, vrf);
+ ifp = if_lookup_by_name(ifname, VRF_DEFAULT);
/*
* If ifp still does not exist or has an invalid index
if (ifp == NULL) {
/* Interface that zebra was not previously aware of, so
* create. */
- ifp = if_create(ifname, vrf);
+ ifp = if_create(ifname, VRF_DEFAULT);
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug("%s: creating ifp for ifindex %d",
__func__, ifm->ifm_index);
if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug("MESSAGE: ZEBRA_INTERFACE_UP %s(%u)",
- ifp->name, vrf_to_id(ifp->vrf));
+ ifp->name, ifp->vrf_id);
if (ifp->ptm_status || !ifp->ptm_enable) {
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode,
if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug("MESSAGE: ZEBRA_INTERFACE_DOWN %s(%u)",
- ifp->name, vrf_to_id(ifp->vrf));
+ ifp->name, ifp->vrf_id);
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
zsend_interface_update(ZEBRA_INTERFACE_DOWN, client, ifp);
if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADD %s(%u)", ifp->name,
- vrf_to_id(ifp->vrf));
+ ifp->vrf_id);
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
client->ifadd_cnt++;
if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug("MESSAGE: ZEBRA_INTERFACE_DELETE %s(%u)",
- ifp->name, vrf_to_id(ifp->vrf));
+ ifp->name, ifp->vrf_id);
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
client->ifdel_cnt++;
p = ifc->address;
zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADDRESS_ADD %s on %s(%u)",
prefix2str(p, buf, sizeof(buf)), ifp->name,
- vrf_to_id(ifp->vrf));
+ ifp->vrf_id);
}
if (!CHECK_FLAG(ifc->conf, ZEBRA_IFC_REAL))
p = ifc->address;
zlog_debug("MESSAGE: ZEBRA_INTERFACE_ADDRESS_DELETE %s on %s(%u)",
prefix2str(p, buf, sizeof(buf)),
- ifp->name, vrf_to_id(ifp->vrf));
+ ifp->name, ifp->vrf_id);
}
zebra_vxlan_add_del_gw_macip(ifp, ifc->address, 0);
if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug(
"MESSAGE: ZEBRA_INTERFACE_VRF_UPDATE/DEL %s VRF Id %u -> %u",
- ifp->name, vrf_to_id(ifp->vrf), new_vrf_id);
+ ifp->name, ifp->vrf_id, new_vrf_id);
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
/* Need to delete if the client is not interested in the new
if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug(
"MESSAGE: ZEBRA_INTERFACE_VRF_UPDATE/ADD %s VRF Id %u -> %u",
- ifp->name, old_vrf_id, vrf_to_id(ifp->vrf));
+ ifp->name, old_vrf_id, ifp->vrf_id);
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client)) {
/* Need to add if the client is interested in the new VRF. */
if (IS_ZEBRA_DEBUG_EVENT)
zlog_debug("MESSAGE: ZEBRA_INTERFACE_LINK_PARAMS %s(%u)",
- ifp->name, vrf_to_id(ifp->vrf));
+ ifp->name, ifp->vrf_id);
for (ALL_LIST_ELEMENTS(zrouter.client_list, node, nnode, client))
zsend_interface_link_params(client, ifp);
struct prefix before;
struct prefix after;
struct zserv *client;
- struct zebra_vrf *zvrf = vrf_info_get(vrf_to_id(ifc->ifp->vrf));
+ struct zebra_vrf *zvrf = vrf_info_get(ifc->ifp->vrf_id);
if (router_id_bad_address(ifc))
return;
struct prefix before;
struct listnode *node;
struct zserv *client;
- struct zebra_vrf *zvrf = vrf_info_get(vrf_to_id(ifc->ifp->vrf));
+ struct zebra_vrf *zvrf = vrf_info_get(ifc->ifp->vrf_id);
if (router_id_bad_address(ifc))
return;
zebra_ns_lookup(ns_id),
index);
if (ifp)
- nh_vrf_id = vrf_to_id(ifp->vrf);
+ nh_vrf_id = ifp->vrf_id;
}
nh.vrf_id = nh_vrf_id;
zebra_ns_lookup(ns_id),
index);
if (ifp)
- nh_vrf_id = vrf_to_id(ifp->vrf);
+ nh_vrf_id = ifp->vrf_id;
else {
flog_warn(
EC_ZEBRA_UNKNOWN_INTERFACE,
char buf[256];
} req;
uint8_t dst_mac[6] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
- struct zebra_vrf *zvrf = zvrf_info_lookup(ifp->vrf);
+ struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id);
zns = zvrf->zns;
memset(&req, 0, sizeof(req));
int vid_present = 0;
char vid_buf[20];
char dst_buf[30];
- struct zebra_vrf *zvrf = zvrf_info_lookup(ifp->vrf);
+ struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id);
zns = zvrf->zns;
zif = ifp->info;
{
int ret = 0;
struct zebra_ns *zns;
- struct zebra_vrf *zvrf = zvrf_info_lookup(vlan_if->vrf);
+ struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(vlan_if->vrf_id);
char buf[INET6_ADDRSTRLEN];
struct zebra_dplane_info dp_info;
__PRETTY_FUNCTION__, vlan_if->name,
vlan_if->ifindex,
ipaddr2str(ip, buf, sizeof(buf)),
- vrf_to_id(vlan_if->vrf));
+ vlan_if->vrf_id);
ret = netlink_request_specific_neigh_in_vlan(zns, RTM_GETNEIGH, ip,
vlan_if->ifindex);
struct zebra_ns *zns;
char buf[INET6_ADDRSTRLEN];
char buf2[ETHER_ADDR_STRLEN];
- struct zebra_vrf *zvrf = zvrf_info_lookup(ifp->vrf);
+ struct zebra_vrf *zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id);
zns = zvrf->zns;
memset(&req, 0, sizeof(req));
static void rtadv_process_solicit(struct interface *ifp)
{
- struct zebra_vrf *zvrf = zvrf_info_lookup(ifp->vrf);
+ struct zebra_vrf *zvrf = vrf_info_lookup(ifp->vrf_id);
assert(zvrf);
rtadv_send_packet(rtadv_get_socket(zvrf), ifp);
struct zebra_vrf *zvrf;
zif = ifp->info;
- zvrf = zvrf_info_lookup(ifp->vrf);
+ zvrf = vrf_info_lookup(ifp->vrf_id);
if (status == RA_SUPPRESS) {
/* RA is currently enabled */
zebra_route_string(client->proto));
return;
}
- if (ifp->vrf != zvrf->vrf) {
+ if (ifp->vrf_id != zvrf_id(zvrf)) {
zlog_debug(
"%u: IF %u RA %s client %s - VRF mismatch, IF VRF %u",
zvrf_id(zvrf), ifindex, enable ? "enable" : "disable",
- zebra_route_string(client->proto), vrf_to_id(ifp->vrf));
+ zebra_route_string(client->proto), ifp->vrf_id);
return;
}
struct zebra_if *zif = ifp->info;
struct zebra_vrf *zvrf;
- zvrf = zvrf_info_lookup(ifp->vrf);
+ zvrf = vrf_info_lookup(ifp->vrf_id);
interval = strtoul(argv[idx_number]->arg, NULL, 10);
if ((zif->rtadv.AdvDefaultLifetime != -1
struct zebra_if *zif = ifp->info;
struct zebra_vrf *zvrf;
- zvrf = zvrf_info_lookup(ifp->vrf);
+ zvrf = vrf_info_lookup(ifp->vrf_id);
interval = strtoul(argv[idx_number]->arg, NULL, 10);
if ((zif->rtadv.AdvDefaultLifetime != -1
struct zebra_if *zif = ifp->info;
struct zebra_vrf *zvrf = NULL;
- zvrf = zvrf_info_lookup(ifp->vrf);
+ zvrf = vrf_info_lookup(ifp->vrf_id);
if (zif->rtadv.MaxRtrAdvInterval % 1000)
zvrf->rtadv.adv_msec_if_count--;
{
struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ);
- zclient_create_header(s, ZEBRA_INTERFACE_ADD, vrf_to_id(ifp->vrf));
+ zclient_create_header(s, ZEBRA_INTERFACE_ADD, ifp->vrf_id);
zserv_encode_interface(s, ifp);
client->ifadd_cnt++;
{
struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ);
- zclient_create_header(s, ZEBRA_INTERFACE_DELETE, vrf_to_id(ifp->vrf));
+ zclient_create_header(s, ZEBRA_INTERFACE_DELETE, ifp->vrf_id);
zserv_encode_interface(s, ifp);
client->ifdel_cnt++;
return 0;
}
- zclient_create_header(s, ZEBRA_INTERFACE_LINK_PARAMS,
- vrf_to_id(ifp->vrf));
+ zclient_create_header(s, ZEBRA_INTERFACE_LINK_PARAMS, ifp->vrf_id);
/* Add Interface Index */
stream_putl(s, ifp->ifindex);
struct prefix *p;
struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ);
- zclient_create_header(s, cmd, vrf_to_id(ifp->vrf));
+ zclient_create_header(s, cmd, ifp->vrf_id);
stream_putl(s, ifp->ifindex);
/* Interface address flag. */
struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ);
struct prefix *p;
- zclient_create_header(s, cmd, vrf_to_id(ifp->vrf));
+ zclient_create_header(s, cmd, ifp->vrf_id);
stream_putl(s, ifp->ifindex);
/* Prefix information. */
{
struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ);
- zclient_create_header(s, ZEBRA_INTERFACE_VRF_UPDATE,
- vrf_to_id(ifp->vrf));
+ zclient_create_header(s, ZEBRA_INTERFACE_VRF_UPDATE, ifp->vrf_id);
/* Fill in the name of the interface and its new VRF (id) */
stream_put(s, ifp->name, INTERFACE_NAMSIZ);
{
struct stream *s = stream_new(ZEBRA_MAX_PACKET_SIZ);
- zclient_create_header(s, cmd, vrf_to_id(ifp->vrf));
+ zclient_create_header(s, cmd, ifp->vrf_id);
zserv_encode_interface(s, ifp);
if (cmd == ZEBRA_INTERFACE_UP)
STREAM_GETC(s, ltype);
if (zvrf->vrf->vrf_id != VRF_DEFAULT)
- ifp = if_lookup_by_name(zvrf->vrf->name, zvrf->vrf);
+ ifp = if_lookup_by_name(zvrf->vrf->name, zvrf->vrf->vrf_id);
else
- ifp = if_lookup_by_name("lo", vrf_lookup_by_id(VRF_DEFAULT));
+ ifp = if_lookup_by_name("lo", VRF_DEFAULT);
if (!ifp) {
zlog_debug("Unable to find specified Interface for %s",
struct prefix_ipv4 *p;
p = (struct prefix_ipv4 *)ifc->address;
- rib_lookup_and_pushup(p, ifp->vrf->vrf_id);
+ rib_lookup_and_pushup(p, ifp->vrf_id);
}
#endif
prefix2str(ifc->address, addr_str, sizeof(addr_str));
zlog_debug("init intf ctx %s: idx %d, addr %u:%s",
- dplane_op2str(op), ifp->ifindex, ifp->vrf->vrf_id,
+ dplane_op2str(op), ifp->ifindex, ifp->vrf_id,
addr_str);
}
ctx->zd_op = op;
ctx->zd_status = ZEBRA_DPLANE_REQUEST_SUCCESS;
- ctx->zd_vrf_id = ifp->vrf->vrf_id;
+ ctx->zd_vrf_id = ifp->vrf_id;
- zns = zebra_ns_lookup(ifp->vrf->vrf_id);
+ zns = zebra_ns_lookup(ifp->vrf_id);
dplane_ctx_ns_init(ctx, zns, false);
/* Init the interface-addr-specific area */
}
if (!strcmp(ZEBRA_PTM_INVALID_VRF, vrf_str) && ifp) {
- vrf_id = vrf_to_id(ifp->vrf);
+ vrf_id = ifp->vrf_id;
} else {
vrf_id = vrf_name_to_id(vrf_str);
}
return zvrf->vrf->vrf_id;
}
-static inline struct zebra_vrf *zvrf_info_lookup(struct vrf *vrf)
-{
- struct zebra_vrf *zvrf = NULL;
-
- if (vrf)
- zvrf = (struct zebra_vrf *)vrf->info;
- return zvrf;
-}
-
static inline const char *zvrf_ns_name(struct zebra_vrf *zvrf)
{
if (!zvrf->vrf || !zvrf->vrf->ns_ctxt)
afi_t afi = ipv4 ? AFI_IP : AFI_IP6;
struct zebra_vrf *zvrf;
struct route_table *t;
- vrf_id_t vrf_id;
+ vrf_id_t vrf_id = VRF_DEFAULT;
- VRF_GET_ID(vrf_id, vrf_name, !!json);
+ if (vrf_name)
+ VRF_GET_ID(vrf_id, vrf_name, !!json);
zvrf = zebra_vrf_lookup_by_id(vrf_id);
t = zebra_router_find_table(zvrf, table, afi, SAFI_UNICAST);
struct zebra_vrf *zvrf = NULL;
char buf[ETHER_ADDR_STRLEN];
- zvrf = zvrf_info_lookup(zvni->vxlan_if->vrf);
+ zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id);
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug("Processing neighbors on local MAC %s %s, VNI %u",
struct interface *tmp_if = NULL;
struct zebra_if *zif = NULL;
- zvrf = zvrf_info_lookup(ifp->vrf);
+ zvrf = vrf_info_lookup(ifp->vrf_id);
assert(zvrf);
FOR_ALL_INTERFACES (zvrf->vrf, tmp_if) {
apply_mask(&p);
if (advertise)
- ip_prefix_send_to_client(vrf_to_id(ifp->vrf), &p,
+ ip_prefix_send_to_client(ifp->vrf_id, &p,
ZEBRA_IP_PREFIX_ROUTE_ADD);
else
- ip_prefix_send_to_client(vrf_to_id(ifp->vrf), &p,
+ ip_prefix_send_to_client(ifp->vrf_id, &p,
ZEBRA_IP_PREFIX_ROUTE_DEL);
}
return 0;
if (IS_ZEBRA_DEBUG_VXLAN)
zlog_debug(
"%u:SVI %s(%u) VNI %u, sending GW MAC %s IP %s del to BGP",
- vrf_to_id(ifp->vrf), ifp->name, ifp->ifindex, zvni->vni,
+ ifp->vrf_id, ifp->name, ifp->ifindex, zvni->vni,
prefix_mac2str(&(n->emac), buf1, sizeof(buf1)),
ipaddr2str(ip, buf2, sizeof(buf2)));
}
}
- zvrf = zvrf_info_lookup(zvni->vxlan_if->vrf);
+ zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id);
if (!zvrf) {
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("\tUnable to find vrf for: %s",
- zvni->vxlan_if->vrf->name);
+ zlog_debug("\tUnable to find vrf for: %d",
+ zvni->vxlan_if->vrf_id);
return -1;
}
vlan_if = zvni_map_to_svi(vxl->access_vlan,
zif->brslave_info.br_if);
if (vlan_if) {
- zvni->vrf_id = vrf_to_id(vlan_if->vrf);
- zl3vni = zl3vni_from_vrf(
- vrf_to_id(vlan_if->vrf));
+ zvni->vrf_id = vlan_if->vrf_id;
+ zl3vni = zl3vni_from_vrf(vlan_if->vrf_id);
if (zl3vni)
listnode_add_sort(zl3vni->l2vnis, zvni);
}
return;
}
- zvrf = zvrf_info_lookup(zvni->vxlan_if->vrf);
+ zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id);
if (!zvrf)
return;
if (!mac && !n)
return;
- zvrf = zvrf_info_lookup(zvni->vxlan_if->vrf);
+ zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id);
/* Ignore the delete if this mac is a gateway mac-ip */
if (CHECK_FLAG(mac->flags, ZEBRA_MAC_LOCAL)
return 0;
}
- zvrf = zvrf_info_lookup(zvni->vxlan_if->vrf);
+ zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id);
if (!zvrf) {
zlog_debug("%s: VNI %u vrf lookup failed.",
__PRETTY_FUNCTION__, zvni->vni);
return -1;
}
- zvrf = zvrf_info_lookup(zvni->vxlan_if->vrf);
+ zvrf = vrf_info_lookup(zvni->vxlan_if->vrf_id);
if (!zvrf) {
if (IS_ZEBRA_DEBUG_VXLAN)
- zlog_debug("\tNo Vrf found for vrf_id: %s",
- zvni->vxlan_if->vrf->name);
+ zlog_debug("\tNo Vrf found for vrf_id: %d",
+ zvni->vxlan_if->vrf_id);
return -1;
}
zlog_debug(
"SVI %s(%u) VNI %u VRF %s is UP, installing neighbors",
ifp->name, ifp->ifindex, zvni->vni,
- vrf_to_name(ifp->vrf));
+ vrf_id_to_name(ifp->vrf_id));
/* update the vrf information for l2-vni and inform bgp */
- zvni->vrf_id = vrf_to_id(ifp->vrf);
+ zvni->vrf_id = ifp->vrf_id;
zvni_send_add_to_client(zvni);
/* Install any remote neighbors for this VNI. */
vlan_if = zvni_map_to_svi(vxl->access_vlan,
zif->brslave_info.br_if);
if (vlan_if) {
- zvni->vrf_id = vrf_to_id(vlan_if->vrf);
- zl3vni = zl3vni_from_vrf(vrf_to_id(vlan_if->vrf));
+ zvni->vrf_id = vlan_if->vrf_id;
+ zl3vni = zl3vni_from_vrf(vlan_if->vrf_id);
if (zl3vni)
listnode_add_sort(zl3vni->l2vnis, zvni);
}
vlan_if = zvni_map_to_svi(vxl->access_vlan,
zif->brslave_info.br_if);
if (vlan_if) {
- zvni->vrf_id = vrf_to_id(vlan_if->vrf);
- zl3vni = zl3vni_from_vrf(vrf_to_id(vlan_if->vrf));
+ zvni->vrf_id = vlan_if->vrf_id;
+ zl3vni = zl3vni_from_vrf(vlan_if->vrf_id);
if (zl3vni)
listnode_add_sort(zl3vni->l2vnis, zvni);
}
zlog_debug(
"Add L2-VNI %u VRF %s intf %s(%u) VLAN %u local IP %s mcast_grp %s master %u",
vni,
- vlan_if ? vrf_to_name(vlan_if->vrf)
+ vlan_if ? vrf_id_to_name(vlan_if->vrf_id)
: VRF_DEFAULT_NAME,
ifp->name, ifp->ifindex, vxl->access_vlan,
addr_buf1, addr_buf2,