]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #5586 from ton31337/fix/bgp_name_in_views_7.1
authorQuentin Young <qlyoung@users.noreply.github.com>
Tue, 14 Jan 2020 06:40:28 +0000 (01:40 -0500)
committerGitHub <noreply@github.com>
Tue, 14 Jan 2020 06:40:28 +0000 (01:40 -0500)
lib: [7.1] perform a bind inside vrf_socket() call

lib/vrf.c

index 6d9ac2e1e44ba15fb6c887752109163b8325439e..6ec3cc8e0d288b4abfc4ca7387129eab5147bcd8 100644 (file)
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -904,10 +904,16 @@ vrf_id_t vrf_get_default_id(void)
 int vrf_bind(vrf_id_t vrf_id, int fd, const char *name)
 {
        int ret = 0;
+       struct interface *ifp;
 
        if (fd < 0 || name == NULL)
                return fd;
-       if (vrf_is_backend_netns())
+       /* the device should exist
+        * otherwise we should return
+        * case ifname = vrf in netns mode => return
+        */
+       ifp = if_lookup_by_name(name, vrf_id);
+       if (!ifp)
                return fd;
 #ifdef SO_BINDTODEVICE
        ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, name, strlen(name)+1);