]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix #660: Fix interface-automatic broken in the presence of
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 2 Apr 2015 10:02:01 +0000 (10:02 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 2 Apr 2015 10:02:01 +0000 (10:02 +0000)
  asymmetric routing.

git-svn-id: file:///svn/unbound/trunk@3383 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
util/netevent.c

index 31f84c4452942ec6f00c22e238152c06aec90373..3989bfcfcee67bce20d12a1cd2e38d0c614f64e4 100644 (file)
@@ -1,3 +1,7 @@
+2 April 2015: Wouter
+       - Fix #660: Fix interface-automatic broken in the presence of
+         asymmetric routing.
+
 26 March 2015: Wouter
        - remote.c probedelay line is easier to read.
        - rename ldns subdirectory to sldns to avoid name collision.
index 9f1e869526a3209d730a170f438bdd9b53629e10..3bb8948889c58b5b6cb21b9bdc92a94888d5bdf9 100644 (file)
@@ -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 */