]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
if auto fix more.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 17 Jan 2008 08:40:08 +0000 (08:40 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 17 Jan 2008 08:40:08 +0000 (08:40 +0000)
git-svn-id: file:///svn/unbound/trunk@871 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
util/netevent.c
util/netevent.h

index 726c1f203b8bf5e54d54adce53594b9a9eac8111..d561239869ecb659715d065b8b3e2b9308b04711 100644 (file)
@@ -1,6 +1,8 @@
 17 January 2008: Wouter
        - fixup configure in case -lldns is installed.
        - fixup a couple of doxygen warnings, about enum variables.
+       - interface-automatic now copies the interface address from the
+         PKT_INFO structure as well.
 
 16 January 2008: Wouter
        - incoming queries to the server with TC bit on are replied FORMERR.
index c1c9210f44f7476187d25562e97ed505d7ab83d8..37735e058286cf7ea7e0f9c4204af9c8ee26ef25 100644 (file)
@@ -181,7 +181,7 @@ comm_point_send_udp_msg(struct comm_point *c, ldns_buffer* packet,
 /** send a UDP reply over specified interface*/
 int
 comm_point_send_udp_msg_if(struct comm_point *c, ldns_buffer* packet,
-       struct sockaddr* addr, socklen_t addrlen, int ifnum) 
+       struct sockaddr* addr, socklen_t addrlen, void* ifaddr, int ifnum) 
 {
 #if defined(AF_INET6) && defined(IPV6_PKTINFO)
        ssize_t sent;
@@ -213,8 +213,8 @@ comm_point_send_udp_msg_if(struct comm_point *c, ldns_buffer* packet,
        cmsg->cmsg_level = IPPROTO_IPV6;
        cmsg->cmsg_type = IPV6_PKTINFO;
        cmsg->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo));
-       memset(&((struct in6_pktinfo*)CMSG_DATA(cmsg))->ipi6_addr, 0,
-               sizeof(struct in6_addr));
+       memmove(&((struct in6_pktinfo*)CMSG_DATA(cmsg))->ipi6_addr, 
+               ifaddr, sizeof(struct in6_addr));
        ((struct in6_pktinfo*)CMSG_DATA(cmsg))->ipi6_ifindex = ifnum;
        msg.msg_controllen = cmsg->cmsg_len;
 #endif /* S_SPLINT_S */
@@ -287,7 +287,9 @@ comm_point_udp_ancil_callback(int fd, short event, void* arg)
                        cmsg->cmsg_type == IPV6_PKTINFO) {
                        rep.ifnum = ((struct in6_pktinfo*)CMSG_DATA(cmsg))->
                                ipi6_ifindex;
-                       /* ignored ipi6_addr with the dest ipv6 address */
+                       memmove(&rep.ifaddr, &((struct in6_pktinfo*)
+                               CMSG_DATA(cmsg))->ipi6_addr, 
+                               sizeof(struct in6_addr));
                }
        }
 #endif /* S_SPLINT_S */
@@ -295,7 +297,8 @@ comm_point_udp_ancil_callback(int fd, short event, void* arg)
        if((*rep.c->callback)(rep.c, rep.c->cb_arg, NETEVENT_NOERROR, &rep)) {
                /* send back immediate reply */
                (void)comm_point_send_udp_msg_if(rep.c, rep.c->buffer,
-                       (struct sockaddr*)&rep.addr, rep.addrlen, rep.ifnum);
+                       (struct sockaddr*)&rep.addr, rep.addrlen, 
+                       &rep.ifaddr, rep.ifnum);
        }
 #else
        fatal_exit("recvmsg: No support for IPV6_PKTINFO. "
@@ -1007,7 +1010,7 @@ comm_point_send_reply(struct comm_reply *repinfo)
                if(repinfo->ifnum != -1)
                        comm_point_send_udp_msg_if(repinfo->c, 
                        repinfo->c->buffer, (struct sockaddr*)&repinfo->addr, 
-                       repinfo->addrlen, repinfo->ifnum);
+                       repinfo->addrlen, &repinfo->ifaddr, repinfo->ifnum);
                else
                        comm_point_send_udp_msg(repinfo->c, repinfo->c->buffer,
                        (struct sockaddr*)&repinfo->addr, repinfo->addrlen);
index e6417366e6b7c8122253703e573b6509ca20b8df..15d59218827139de958c51a959a2c39130ddf77c 100644 (file)
@@ -98,6 +98,10 @@ struct comm_reply {
        struct sockaddr_storage addr;
        /** length of address */
        socklen_t addrlen;
+#ifdef AF_INET6
+       /** the interface address */
+       struct in6_addr ifaddr;
+#endif
        /** the interface received (for UDPautomaticinterface) or 0 */
        int ifnum;
 };