return false;
}
+// FIXME: this function is unused, and using it could reduce some code duplication
int sendfromto(int sock, const char* data, int len, int flags, const ComboAddress& from, const ComboAddress& to)
{
struct msghdr msgh;
if(from.sin4.sin_family) {
addCMsgSrcAddr(&msgh, cbuf, &from);
}
+ else {
+ msgh.msg_control=NULL;
+ }
return sendmsg(sock, &msgh, flags);
}
// be careful: when using this for receive purposes, make sure addr->sin4.sin_family is set appropriately so getSocklen works!
// be careful: when using this function for *send* purposes, be sure to set cbufsize to 0!
+// be careful: if you don't call addCMsgSrcAddr after fillMSGHdr, make sure to set msg_control to NULL
void fillMSGHdr(struct msghdr* msgh, struct iovec* iov, char* cbuf, size_t cbufsize, char* data, size_t datalen, ComboAddress* addr)
{
iov->iov_base = data;
if(p->d_anyLocal) {
addCMsgSrcAddr(&msgh, cbuf, p->d_anyLocal.get_ptr());
}
+ else {
+ msgh.msg_control=NULL;
+ }
DLOG(L<<Logger::Notice<<"Sending a packet to "<< p->getRemote() <<" ("<< buffer.length()<<" octets)"<<endl);
if(buffer.length() > p->getMaxReplyLen()) {
L<<Logger::Error<<"Weird, trying to send a message that needs truncation, "<< buffer.length()<<" > "<<p->getMaxReplyLen()<<endl;
fillMSGHdr(&msgh, &iov, cbuf, 0, (char*)&*packet.begin(), packet.size(), &dc->d_remote);
if(dc->d_local.sin4.sin_family)
addCMsgSrcAddr(&msgh, cbuf, &dc->d_local);
+ else
+ msgh.msg_control=NULL;
sendmsg(dc->d_socket, &msgh, 0);
if(!SyncRes::s_nopacketcache && !variableAnswer ) {
t_packetCache->insertResponsePacket(string((const char*)&*packet.begin(), packet.size()),
if(destaddr.sin4.sin_family) {
addCMsgSrcAddr(&msgh, cbuf, &destaddr);
}
+ else {
+ msgh.msg_control=NULL;
+ }
sendmsg(fd, &msgh, 0);
if(response.length() >= sizeof(struct dnsheader)) {