summaryrefslogtreecommitdiff
path: root/zebra/if_ioctl.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2021-10-13 15:06:38 +0300
committerIgor Ryzhov <iryzhov@nfware.com>2021-10-19 15:29:51 +0300
commitf60a11883cb426f574dbe5abeff8254148e7c371 (patch)
tree2b489718f0d61ed4c5b043959bcbe3e18035d874 /zebra/if_ioctl.c
parente9f7b2b597ad8c6947ce3b7238e89391e4f9f863 (diff)
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 'zebra/if_ioctl.c')
-rw-r--r--zebra/if_ioctl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c
index 14d8ac442e..c3faf22d17 100644
--- a/zebra/if_ioctl.c
+++ b/zebra/if_ioctl.c
@@ -109,7 +109,8 @@ static int interface_list_ioctl(void)
unsigned int size;
ifreq = (struct ifreq *)((caddr_t)ifconf.ifc_req + n);
- ifp = if_get_by_name(ifreq->ifr_name, VRF_DEFAULT);
+ ifp = if_get_by_name(ifreq->ifr_name, VRF_DEFAULT,
+ VRF_DEFAULT_NAME);
if_add_update(ifp);
size = ifreq->ifr_addr.sa_len;
if (size < sizeof(ifreq->ifr_addr))
@@ -119,7 +120,8 @@ static int interface_list_ioctl(void)
}
#else
for (n = 0; n < ifconf.ifc_len; n += sizeof(struct ifreq)) {
- ifp = if_get_by_name(ifreq->ifr_name, VRF_DEFAULT);
+ ifp = if_get_by_name(ifreq->ifr_name, VRF_DEFAULT,
+ VRF_DEFAULT_NAME);
if_add_update(ifp);
ifreq++;
}