Skip to content

Commit

Permalink
See http://codereview.chromium.org/3026044 - valgrind actually had a …
Browse files Browse the repository at this point in the history
…point, so now we shorten our sendmsg control message to what we actually send.

git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2830 d19b8d6e-7fed-0310-83ef-9ca221ded41b
  • Loading branch information
ahupowerdns committed Oct 29, 2012
1 parent a29279d commit 9af87ad
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pdns/nameserver.cc
Expand Up @@ -215,7 +215,6 @@ void UDPNameserver::send(DNSPacket *p)
struct cmsghdr *cmsg;
struct iovec iov;
char cbuf[256];
memset(cbuf, 0, sizeof(cbuf)); // not strictly necessary, but valgrind triggers on this sometimes otherwise

/* Set up iov and msgh structures. */
memset(&msgh, 0, sizeof(struct msghdr));
Expand All @@ -241,7 +240,7 @@ void UDPNameserver::send(DNSPacket *p)
pkt = (struct in6_pktinfo *) CMSG_DATA(cmsg);
memset(pkt, 0, sizeof(*pkt));
pkt->ipi6_addr = p->d_anyLocal->sin6.sin6_addr;
// cerr<<"Setting local ipv6 address"<<endl;
msgh.msg_controllen = cmsg->cmsg_len; // makes valgrind happy and is slightly better style
}
else {
#ifdef IP_PKTINFO
Expand All @@ -257,7 +256,6 @@ void UDPNameserver::send(DNSPacket *p)
pkt = (struct in_pktinfo *) CMSG_DATA(cmsg);
memset(pkt, 0, sizeof(*pkt));
pkt->ipi_spec_dst = p->d_anyLocal->sin4.sin_addr;
// cerr<<"Setting local ipv4 address Linux way"<<endl;
#endif
#ifdef IP_SENDSRCADDR
struct in_addr *in;
Expand All @@ -272,8 +270,8 @@ void UDPNameserver::send(DNSPacket *p)

in = (struct in_addr *) CMSG_DATA(cmsg);
*in = p->d_anyLocal->sin4.sin_addr;
// cerr<<"Setting local ipv4 address FreeBSD way"<<endl;
#endif
msgh.msg_controllen = cmsg->cmsg_len;
}
}
DLOG(L<<Logger::Notice<<"Sending a packet to "<< p->getRemote() <<" ("<< buffer.length()<<" octets)"<<endl);
Expand Down

0 comments on commit 9af87ad

Please sign in to comment.