summaryrefslogtreecommitdiffstats
path: root/lib/if.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2019-02-11 14:49:12 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2019-06-11 17:10:47 +0200
commit4c634658a6aaf835eff892f7ac959aef9f0c59c8 (patch)
tree592d73567658aa3f75a52907ca2856debb0f9c8e /lib/if.c
parentMerge pull request #4482 from opensourcerouting/warnings-20190606 (diff)
downloadfrr-4c634658a6aaf835eff892f7ac959aef9f0c59c8.tar.xz
frr-4c634658a6aaf835eff892f7ac959aef9f0c59c8.zip
ospf, ospf6d, zebra, lib: change if_get_by_name prototype with vrf
vrf pointer is used as reference when calling if_get_by_name() function. this will permit to create interfaces with an unknown vrf_id, since it is only necessary to get the vrf structure to store the interfaces. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'lib/if.c')
-rw-r--r--lib/if.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/if.c b/lib/if.c
index 3f489e0c3..04087f9d0 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -419,29 +419,29 @@ size_t if_lookup_by_hwaddr(const uint8_t *hw_addr, size_t addrsz,
/* Get interface by name if given name interface doesn't exist create
one. */
-struct interface *if_get_by_name(const char *name, vrf_id_t vrf_id)
+struct interface *if_get_by_name(const char *name, struct vrf *vrf)
{
struct interface *ifp;
switch (vrf_get_backend()) {
case VRF_BACKEND_UNKNOWN:
case VRF_BACKEND_NETNS:
- ifp = if_lookup_by_name(name, vrf_id);
+ ifp = if_lookup_by_name(name, vrf->vrf_id);
if (ifp)
return ifp;
- return if_create(name, vrf_id);
+ return if_create(name, vrf->vrf_id);
case VRF_BACKEND_VRF_LITE:
ifp = if_lookup_by_name_all_vrf(name);
if (ifp) {
- if (ifp->vrf_id == vrf_id)
+ if (ifp->vrf_id == vrf->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_id);
+ if_update_to_new_vrf(ifp, vrf->vrf_id);
return ifp;
}
- return if_create(name, vrf_id);
+ return if_create(name, vrf->vrf_id);
}
return NULL;
@@ -631,12 +631,12 @@ void if_dump_all(void)
* if not:
* - no idea, just get the name in its entirety.
*/
-static struct interface *if_sunwzebra_get(const char *name, vrf_id_t vrf_id)
+static struct interface *if_sunwzebra_get(const char *name, struct vrf *vrf)
{
struct interface *ifp;
char *cp;
- if ((ifp = if_lookup_by_name(name, vrf_id)) != NULL)
+ if ((ifp = if_lookup_by_name(name, vrf->vrf_id)) != NULL)
return ifp;
/* hunt the primary interface name... */
@@ -644,7 +644,7 @@ static struct interface *if_sunwzebra_get(const char *name, vrf_id_t vrf_id)
if (cp)
*cp = '\0';
- return if_get_by_name(name, vrf_id);
+ return if_get_by_name(name, vrf);
}
#endif /* SUNOS_5 */
@@ -1343,9 +1343,9 @@ static int lib_interface_create(enum nb_event event,
vrf = vrf_lookup_by_name(vrfname);
assert(vrf);
#ifdef SUNOS_5
- ifp = if_sunwzebra_get(ifname, vrf->vrf_id);
+ ifp = if_sunwzebra_get(ifname, vrf);
#else
- ifp = if_get_by_name(ifname, vrf->vrf_id);
+ ifp = if_get_by_name(ifname, vrf);
#endif /* SUNOS_5 */
nb_running_set_entry(dnode, ifp);
break;