summaryrefslogtreecommitdiffstats
path: root/lib/if.h
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2021-10-13 14:06:38 +0200
committerIgor Ryzhov <iryzhov@nfware.com>2021-10-19 14:29:51 +0200
commitf60a11883cb426f574dbe5abeff8254148e7c371 (patch)
tree2b489718f0d61ed4c5b043959bcbe3e18035d874 /lib/if.h
parentMerge pull request #9730 from AnuradhaKaruppiah/evpn-recv-lttng (diff)
downloadfrr-f60a11883cb426f574dbe5abeff8254148e7c371.tar.xz
frr-f60a11883cb426f574dbe5abeff8254148e7c371.zip
lib: allow to create interfaces in non-existing VRFs
It allows FRR to read the interface config even when the necessary VRFs are not yet created and interfaces are in "wrong" VRFs. Currently, such config is rejected. For VRF-lite backend, we don't care at all about the VRF of the inactive interface. When the interface is created in the OS and becomes active, we always use its actual VRF instead of the configured one. So there's no need to reject the config. For netns backend, we may have multiple interfaces with the same name in different VRFs. So we care about the VRF of inactive interfaces. And we must allow to preconfigure the interface in a VRF even before it is moved to the corresponding netns. From now on, we allow to create multiple configs for the same interface name in different VRFs and the necessary config is applied once the OS interface is moved to the corresponding netns. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'lib/if.h')
-rw-r--r--lib/if.h13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/if.h b/lib/if.h
index 59e75d8b6..1125acd20 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -293,6 +293,8 @@ struct interface {
#endif /* HAVE_NET_RT_IFLIST */
struct route_node *node;
+
+ struct vrf *vrf;
vrf_id_t vrf_id;
/*
@@ -510,11 +512,6 @@ extern int if_cmp_name_func(const char *p1, const char *p2);
*/
extern void if_update_to_new_vrf(struct interface *, vrf_id_t vrf_id);
-/* Create new interface, adds to name list only */
-extern struct interface *if_create_name(const char *name, vrf_id_t vrf_id);
-
-/* Create new interface, adds to index list only */
-extern struct interface *if_create_ifindex(ifindex_t ifindex, vrf_id_t vrf_id);
extern struct interface *if_lookup_by_index(ifindex_t, vrf_id_t vrf_id);
extern struct interface *if_vrf_lookup_by_index_next(ifindex_t ifindex,
vrf_id_t vrf_id);
@@ -532,13 +529,11 @@ struct vrf;
extern struct interface *if_lookup_by_name_all_vrf(const char *ifname);
extern struct interface *if_lookup_by_name_vrf(const char *name, 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 struct interface *if_get_by_ifindex(ifindex_t ifindex, vrf_id_t vrf_id);
+extern struct interface *if_get_by_name(const char *ifname, vrf_id_t vrf_id,
+ const char *vrf_name);
/* Sets the index and adds to index list */
extern int if_set_index(struct interface *ifp, ifindex_t ifindex);
-/* Sets the name and adds to name list */
-extern void if_set_name(struct interface *ifp, const char *name);
/* Delete the interface, but do not free the structure, and leave it in the
interface list. It is often advisable to leave the pseudo interface