From: Wouter Wijngaards Date: Thu, 17 Jan 2008 08:40:08 +0000 (+0000) Subject: if auto fix more. X-Git-Tag: release-0.9~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fec9e1d262aca4da49b30983e2ffa7108354c02e;p=thirdparty%2Funbound.git if auto fix more. git-svn-id: file:///svn/unbound/trunk@871 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index 726c1f203..d56123986 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -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. diff --git a/util/netevent.c b/util/netevent.c index c1c9210f4..37735e058 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -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); diff --git a/util/netevent.h b/util/netevent.h index e6417366e..15d592188 100644 --- a/util/netevent.h +++ b/util/netevent.h @@ -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; };