1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Use SO_BINDTODEVICE also in Linux/IPv6.

This commit is contained in:
Ondrej Zajicek
2010-04-02 16:11:46 +02:00
parent 97ab4c3498
commit e7b09e4ab9
4 changed files with 24 additions and 12 deletions

View File

@@ -6,6 +6,8 @@
* Can be freely distributed and used under the terms of the GNU GPL.
*/
#include <net/if.h>
#ifdef IPV6
#ifndef IPV6_UNICAST_HOPS
@@ -28,9 +30,18 @@ get_inaddr(ip_addr *a, struct in6_addr *ia)
ipa_ntoh(*a);
}
#else
static inline char *
sysio_bind_to_iface(sock *s)
{
struct ifreq ifr;
strcpy(ifr.ifr_name, s->iface->name);
if (setsockopt(s->fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr)) < 0)
return "SO_BINDTODEVICE";
#include <net/if.h>
return NULL;
}
#else
static inline void
set_inaddr(struct in_addr *ia, ip_addr a)