Lines 1-16
Link Here
|
1 |
--- src/server.c.orig 2016-03-28 13:51:51 UTC |
1 |
--- src/server.c.orig 2016-06-05 17:14:25 UTC |
2 |
+++ src/server.c |
2 |
+++ src/server.c |
3 |
@@ -36,14 +36,14 @@ setup_listeners(struct servent *se, stru |
3 |
@@ -36,7 +36,7 @@ setup_listeners(struct servent *se, stru |
4 |
struct ifaddrs *ifa, *ifap; |
4 |
struct ifaddrs *ifa, *ifap; |
5 |
struct sockaddr *sa; |
5 |
struct sockaddr *sa; |
6 |
#ifdef SO_RTABLE |
6 |
#ifdef SO_RTABLE |
7 |
- struct if_data *ifd; |
7 |
- struct if_data *ifd; |
8 |
+ struct ifreq ifr; |
8 |
+ struct ifreq ifr; |
9 |
#endif |
9 |
#endif |
10 |
u_int8_t *a6; |
10 |
u_int8_t *a6; |
11 |
size_t sa6len = sizeof(struct in6_addr); |
11 |
size_t sa6len = sizeof(struct in6_addr); |
12 |
u_int new_cnt = 0; |
12 |
@@ -46,7 +46,7 @@ setup_listeners(struct servent *se, stru |
13 |
int tos = IPTOS_LOWDELAY; |
13 |
int on = 1; |
|
|
14 |
#endif |
14 |
#ifdef SO_RTABLE |
15 |
#ifdef SO_RTABLE |
15 |
- int rdomain = 0; |
16 |
- int rdomain = 0; |
16 |
+ int rdomain, fd; |
17 |
+ int rdomain, fd; |
Lines 17-47
Link Here
|
17 |
#endif |
18 |
#endif |
18 |
|
19 |
|
19 |
TAILQ_FOREACH(lap, &lconf->listen_addrs, entry) { |
20 |
TAILQ_FOREACH(lap, &lconf->listen_addrs, entry) { |
20 |
@@ -56,16 +56,21 @@ setup_listeners(struct servent *se, stru |
|
|
21 |
sa = ifap->ifa_addr; |
22 |
if (sa == NULL || SA_LEN(sa) == 0) |
23 |
continue; |
24 |
-#ifdef SO_RTABLE |
25 |
- if (sa->sa_family == AF_LINK) { |
26 |
- ifd = ifap->ifa_data; |
27 |
- rdomain = ifd->ifi_rdomain; |
28 |
- } |
29 |
-#endif |
30 |
if (sa->sa_family != AF_INET && |
31 |
sa->sa_family != AF_INET6) |
32 |
continue; |
33 |
#ifdef SO_RTABLE |
34 |
+ strlcpy(ifr.ifr_name, ifap->ifa_name, |
35 |
+ sizeof(ifr.ifr_name)); |
36 |
+ |
37 |
+ fd = socket(AF_INET, SOCK_DGRAM, 0); |
38 |
+ if (ioctl(fd, SIOCGIFRDOMAIN, |
39 |
+ (caddr_t)&ifr) == -1) |
40 |
+ rdomain = 0; |
41 |
+ else |
42 |
+ rdomain = ifr.ifr_rdomainid; |
43 |
+ close(fd); |
44 |
+ |
45 |
if (lap->rtable != -1 && rdomain != lap->rtable) |
46 |
continue; |
47 |
#endif |