diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-12-07 18:35:46 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2017-12-07 18:35:46 +0100 |
commit | 46434a3cad99260b5a659e5df874eab4615bcb36 (patch) | |
tree | e5f4842fbdcc2ee0c66d6fdb437cb401a7234fb1 /sysdep/unix/io.c | |
parent | 4ff15a75c56531fa2d3858d8250dcef1af4e75b6 (diff) | |
parent | 7b2c5f3d2826e3175bf31b1c36056c9efc587a2b (diff) |
Merge commit '7b2c5f3d2826e3175bf31b1c36056c9efc587a2b' into int-new
Diffstat (limited to 'sysdep/unix/io.c')
-rw-r--r-- | sysdep/unix/io.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index 7492e031..cd2558b2 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -931,6 +931,18 @@ sk_setup(sock *s) } #endif + if (s->vrf && !s->iface) + { + /* Bind socket to associated VRF interface. + This is Linux-specific, but so is SO_BINDTODEVICE. */ +#ifdef SO_BINDTODEVICE + struct ifreq ifr = {}; + strcpy(ifr.ifr_name, s->vrf->name); + if (setsockopt(s->fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)) < 0) + ERR("SO_BINDTODEVICE"); +#endif + } + if (s->iface) { #ifdef SO_BINDTODEVICE |