mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 02:43:41 +00:00
lib, ospfd, pimd: Convert to using VRF based interface creation
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
7e2b760345
commit
4e5266b8a3
12
lib/if.c
12
lib/if.c
@ -123,7 +123,7 @@ if_cmp_func (struct interface *ifp1, struct interface *ifp2)
|
|||||||
|
|
||||||
/* Create new interface structure. */
|
/* Create new interface structure. */
|
||||||
struct interface *
|
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 interface *ifp;
|
||||||
struct list *intf_list = vrf_iflist_get (vrf_id);
|
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;
|
return ifp;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct interface *
|
|
||||||
if_create (const char *name, int namelen)
|
|
||||||
{
|
|
||||||
return if_create_vrf (name, namelen, VRF_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create new interface structure. */
|
/* Create new interface structure. */
|
||||||
void
|
void
|
||||||
if_update_vrf (struct interface *ifp, const char *name, int namelen, vrf_id_t vrf_id)
|
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;
|
struct interface *ifp;
|
||||||
|
|
||||||
return ((ifp = if_lookup_by_name_vrf (name, vrf_id)) != NULL) ? 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 *
|
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 *
|
struct interface *
|
||||||
|
5
lib/if.h
5
lib/if.h
@ -389,15 +389,14 @@ struct nbr_connected
|
|||||||
|
|
||||||
/* Prototypes. */
|
/* Prototypes. */
|
||||||
extern int if_cmp_name_func (char *, char *);
|
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 interface *if_lookup_exact_address (void *matchaddr, int family);
|
||||||
extern struct connected *if_lookup_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 struct interface *if_lookup_prefix (struct prefix *prefix);
|
||||||
|
|
||||||
extern void if_update_vrf (struct interface *, const char *name, int namelen,
|
extern void if_update_vrf (struct interface *, const char *name, int namelen,
|
||||||
vrf_id_t vrf_id);
|
vrf_id_t vrf_id);
|
||||||
extern struct interface *if_create_vrf (const char *name, int namelen,
|
extern struct interface *if_create (const char *name, int namelen,
|
||||||
vrf_id_t vrf_id);
|
vrf_id_t vrf_id);
|
||||||
extern struct interface *if_lookup_by_index (ifindex_t, 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,
|
extern struct interface *if_lookup_exact_address_vrf (void *matchaddr, int family,
|
||||||
vrf_id_t vrf_id);
|
vrf_id_t vrf_id);
|
||||||
|
@ -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");
|
zlog_debug ("ospf_vl_new(): creating pseudo zebra interface");
|
||||||
|
|
||||||
snprintf (ifname, sizeof(ifname), "VLINK%d", vlink_count);
|
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
|
* if_create sets ZEBRA_INTERFACE_LINKDETECTION
|
||||||
* virtual links don't need this.
|
* virtual links don't need this.
|
||||||
|
@ -1471,7 +1471,7 @@ void pim_if_update_assert_tracking_desired(struct interface *ifp)
|
|||||||
void pim_if_create_pimreg (void)
|
void pim_if_create_pimreg (void)
|
||||||
{
|
{
|
||||||
if (!pim_regiface) {
|
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_regiface->ifindex = PIM_OIF_PIM_REGISTER_VIF;
|
||||||
|
|
||||||
pim_if_new(pim_regiface, 0, 0);
|
pim_if_new(pim_regiface, 0, 0);
|
||||||
|
@ -517,7 +517,7 @@ ifm_read (struct if_msghdr *ifm)
|
|||||||
if (ifp == NULL)
|
if (ifp == NULL)
|
||||||
{
|
{
|
||||||
/* Interface that zebra was not previously aware of, so create. */
|
/* 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)
|
if (IS_ZEBRA_DEBUG_KERNEL)
|
||||||
zlog_debug ("%s: creating ifp for ifindex %d",
|
zlog_debug ("%s: creating ifp for ifindex %d",
|
||||||
__func__, ifm->ifm_index);
|
__func__, ifm->ifm_index);
|
||||||
|
Loading…
Reference in New Issue
Block a user