mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-29 23:08:38 +00:00
Merge pull request #5586 from ton31337/fix/bgp_name_in_views_7.1
lib: [7.1] perform a bind inside vrf_socket() call
This commit is contained in:
commit
14c56d646c
@ -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 vrf_bind(vrf_id_t vrf_id, int fd, const char *name)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
struct interface *ifp;
|
||||||
|
|
||||||
if (fd < 0 || name == NULL)
|
if (fd < 0 || name == NULL)
|
||||||
return fd;
|
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;
|
return fd;
|
||||||
#ifdef SO_BINDTODEVICE
|
#ifdef SO_BINDTODEVICE
|
||||||
ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, name, strlen(name)+1);
|
ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, name, strlen(name)+1);
|
||||||
|
Loading…
Reference in New Issue
Block a user