aboutsummaryrefslogtreecommitdiff
path: root/external/unbound/util/netevent.c
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2015-05-31 16:38:19 +0200
committerRiccardo Spagni <ric@spagni.net>2015-05-31 16:38:21 +0200
commit431397abfaf37b28c6981242d7fd59d8e520c8ec (patch)
treefa324d2f9f02668a6d56d2e4d195a59ab1d3710e /external/unbound/util/netevent.c
parentMerge pull request #301 (diff)
parentupdate libunbound (diff)
downloadmonero-431397abfaf37b28c6981242d7fd59d8e520c8ec.tar.xz
Merge pull request #302
6a11907 update libunbound (Riccardo Spagni)
Diffstat (limited to 'external/unbound/util/netevent.c')
-rw-r--r--external/unbound/util/netevent.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/external/unbound/util/netevent.c b/external/unbound/util/netevent.c
index 9f1e86952..3bb894888 100644
--- a/external/unbound/util/netevent.c
+++ b/external/unbound/util/netevent.c
@@ -498,12 +498,16 @@ comm_point_send_udp_msg_if(struct comm_point *c, sldns_buffer* packet,
cmsg = CMSG_FIRSTHDR(&msg);
if(r->srctype == 4) {
#ifdef IP_PKTINFO
+ void* cmsg_data;
msg.msg_controllen = CMSG_SPACE(sizeof(struct in_pktinfo));
log_assert(msg.msg_controllen <= sizeof(control));
cmsg->cmsg_level = IPPROTO_IP;
cmsg->cmsg_type = IP_PKTINFO;
memmove(CMSG_DATA(cmsg), &r->pktinfo.v4info,
sizeof(struct in_pktinfo));
+ /* unset the ifindex to not bypass the routing tables */
+ cmsg_data = CMSG_DATA(cmsg);
+ ((struct in_pktinfo *) cmsg_data)->ipi_ifindex = 0;
cmsg->cmsg_len = CMSG_LEN(sizeof(struct in_pktinfo));
#elif defined(IP_SENDSRCADDR)
msg.msg_controllen = CMSG_SPACE(sizeof(struct in_addr));
@@ -518,12 +522,16 @@ comm_point_send_udp_msg_if(struct comm_point *c, sldns_buffer* packet,
msg.msg_control = NULL;
#endif /* IP_PKTINFO or IP_SENDSRCADDR */
} else if(r->srctype == 6) {
+ void* cmsg_data;
msg.msg_controllen = CMSG_SPACE(sizeof(struct in6_pktinfo));
log_assert(msg.msg_controllen <= sizeof(control));
cmsg->cmsg_level = IPPROTO_IPV6;
cmsg->cmsg_type = IPV6_PKTINFO;
memmove(CMSG_DATA(cmsg), &r->pktinfo.v6info,
sizeof(struct in6_pktinfo));
+ /* unset the ifindex to not bypass the routing tables */
+ cmsg_data = CMSG_DATA(cmsg);
+ ((struct in6_pktinfo *) cmsg_data)->ipi6_ifindex = 0;
cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
} else {
/* try to pass all 0 to use default route */