lib, ospfd, pimd: Convert to using VRF based interface creation

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-03-10 15:48:43 -05:00
parent 7e2b760345
commit 4e5266b8a3
5 changed files with 8 additions and 15 deletions

View File

@ -123,7 +123,7 @@ if_cmp_func (struct interface *ifp1, struct interface *ifp2)
/* Create new interface structure. */
struct interface *
if_create_vrf (const char *name, int namelen, vrf_id_t vrf_id)
if_create (const char *name, int namelen, vrf_id_t vrf_id)
{
struct interface *ifp;
struct list *intf_list = vrf_iflist_get (vrf_id);
@ -158,12 +158,6 @@ if_create_vrf (const char *name, int namelen, vrf_id_t vrf_id)
return ifp;
}
struct interface *
if_create (const char *name, int namelen)
{
return if_create_vrf (name, namelen, VRF_DEFAULT);
}
/* Create new interface structure. */
void
if_update_vrf (struct interface *ifp, const char *name, int namelen, vrf_id_t vrf_id)
@ -468,7 +462,7 @@ if_get_by_name_vrf (const char *name, vrf_id_t vrf_id)
struct interface *ifp;
return ((ifp = if_lookup_by_name_vrf (name, vrf_id)) != NULL) ? ifp :
if_create_vrf (name, strlen(name), vrf_id);
if_create (name, strlen(name), vrf_id);
}
struct interface *
@ -515,7 +509,7 @@ if_get_by_name_len_vrf (const char *name, size_t namelen, vrf_id_t vrf_id, int v
}
}
}
return (if_create_vrf (name, namelen, vrf_id));
return (if_create (name, namelen, vrf_id));
}
struct interface *

View File

@ -389,15 +389,14 @@ struct nbr_connected
/* Prototypes. */
extern int if_cmp_name_func (char *, char *);
extern struct interface *if_create (const char *name, int namelen);
extern struct interface *if_lookup_exact_address (void *matchaddr, int family);
extern struct connected *if_lookup_address (void *matchaddr, int family);
extern struct interface *if_lookup_prefix (struct prefix *prefix);
extern void if_update_vrf (struct interface *, const char *name, int namelen,
vrf_id_t vrf_id);
extern struct interface *if_create_vrf (const char *name, int namelen,
vrf_id_t vrf_id);
extern struct interface *if_create (const char *name, int namelen,
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_vrf (void *matchaddr, int family,
vrf_id_t vrf_id);

View File

@ -874,7 +874,7 @@ ospf_vl_new (struct ospf *ospf, struct ospf_vl_data *vl_data)
zlog_debug ("ospf_vl_new(): creating pseudo zebra interface");
snprintf (ifname, sizeof(ifname), "VLINK%d", vlink_count);
vi = if_create (ifname, strnlen(ifname, sizeof(ifname)));
vi = if_create (ifname, strnlen(ifname, sizeof(ifname)), VRF_DEFAULT);
/*
* if_create sets ZEBRA_INTERFACE_LINKDETECTION
* virtual links don't need this.

View File

@ -1471,7 +1471,7 @@ void pim_if_update_assert_tracking_desired(struct interface *ifp)
void pim_if_create_pimreg (void)
{
if (!pim_regiface) {
pim_regiface = if_create("pimreg", strlen("pimreg"));
pim_regiface = if_create("pimreg", strlen("pimreg"), VRF_DEFAULT);
pim_regiface->ifindex = PIM_OIF_PIM_REGISTER_VIF;
pim_if_new(pim_regiface, 0, 0);

View File

@ -517,7 +517,7 @@ ifm_read (struct if_msghdr *ifm)
if (ifp == NULL)
{
/* Interface that zebra was not previously aware of, so create. */
ifp = if_create (ifname, ifnlen);
ifp = if_create (ifname, ifnlen, VRF_DEFAULT);
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_debug ("%s: creating ifp for ifindex %d",
__func__, ifm->ifm_index);