summaryrefslogtreecommitdiff
path: root/lib/if.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2019-02-11 14:55:23 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2019-06-11 17:10:47 +0200
commite9c199a6c12ad8359d1792462545595d4679d20b (patch)
tree4175e4375b75d7c0a50863da4194e01a5a034f26 /lib/if.c
parent4c634658a6aaf835eff892f7ac959aef9f0c59c8 (diff)
lib, ospfd, pimd, zebra: change if_create() api with vrf
if_create() takes as input a vrf poiter instead of the vrf_id parameter. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'lib/if.c')
-rw-r--r--lib/if.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/if.c b/lib/if.c
index 04087f9d04..22f83bb675 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -132,9 +132,8 @@ static int if_cmp_index_func(const struct interface *ifp1,
}
/* Create new interface structure. */
-struct interface *if_create(const char *name, vrf_id_t vrf_id)
+struct interface *if_create(const char *name, struct vrf *vrf)
{
- struct vrf *vrf = vrf_get(vrf_id, NULL);
struct interface *ifp;
ifp = XCALLOC(MTYPE_IF, sizeof(struct interface));
@@ -142,7 +141,7 @@ struct interface *if_create(const char *name, vrf_id_t vrf_id)
assert(name);
strlcpy(ifp->name, name, sizeof(ifp->name));
- ifp->vrf_id = vrf_id;
+ ifp->vrf_id = vrf->vrf_id;
IFNAME_RB_INSERT(vrf, ifp);
ifp->connected = list_new();
ifp->connected->del = (void (*)(void *))connected_free;
@@ -429,7 +428,7 @@ struct interface *if_get_by_name(const char *name, struct vrf *vrf)
ifp = if_lookup_by_name(name, vrf->vrf_id);
if (ifp)
return ifp;
- return if_create(name, vrf->vrf_id);
+ return if_create(name, vrf);
case VRF_BACKEND_VRF_LITE:
ifp = if_lookup_by_name_all_vrf(name);
if (ifp) {
@@ -441,7 +440,7 @@ struct interface *if_get_by_name(const char *name, struct vrf *vrf)
if_update_to_new_vrf(ifp, vrf->vrf_id);
return ifp;
}
- return if_create(name, vrf->vrf_id);
+ return if_create(name, vrf);
}
return NULL;