//if(g_vm.count("bind-non-local"))
bindAny(local.sin4.sin_family, cs->udpFD);
- // setSocketTimestamps(cs->udpFD);
+ // if (!setSocketTimestamps(cs->udpFD))
+ // L<<Logger::Warning<<"Unable to enable timestamp reporting for socket"<<endl;
+
if(IsAnyAddress(local)) {
int one=1;
return c;
}
-void setSocketTimestamps(int fd)
+bool setSocketTimestamps(int fd)
{
#ifdef SO_TIMESTAMP
int on=1;
- if (setsockopt(fd, SOL_SOCKET, SO_TIMESTAMP, (char*)&on, sizeof(on)) < 0 )
- ; // L<<Logger::Error<<"Unable to enable timestamp reporting for socket"<<endl;
+ return setsockopt(fd, SOL_SOCKET, SO_TIMESTAMP, (char*)&on, sizeof(on)) == 0;
#endif
+ return true; // we pretend this happened.
}
uint32_t pdns_strtoui(const char *nptr, char **endptr, int base)
void setFilenumLimit(unsigned int lim);
bool readFileIfThere(const char* fname, std::string* line);
uint32_t burtle(const unsigned char* k, uint32_t lengh, uint32_t init);
-void setSocketTimestamps(int fd);
+bool setSocketTimestamps(int fd);
//! Sets the socket into blocking mode.
bool setBlocking( int sock );
if(localname=="0.0.0.0")
setsockopt(s, IPPROTO_IP, GEN_IP_PKTINFO, &one, sizeof(one));
- setSocketTimestamps(s);
+ if (!setSocketTimestamps(s))
+ L<<Logger::Warning<<"Unable to enable timestamp reporting for socket"<<endl;
#ifdef SO_REUSEPORT
if( d_can_reuseport )
setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(one)); // if this fails, we report an error in tcpreceiver too
}
- setSocketTimestamps(s);
+ if (setSocketTimestamps(s))
+ L<<Logger::Warning<<"Unable to enable timestamp reporting for socket"<<endl;
#ifdef SO_REUSEPORT
if( d_can_reuseport )
if(fd < 0) {
throw PDNSException("Making a UDP server socket for resolver: "+netstringerror());
}
- setSocketTimestamps(fd);
+ if (!setSocketTimestamps(fd))
+ L<<Logger::Warning<<"Unable to enable timestamp reporting for socket"<<endl;
if(IsAnyAddress(sin)) {
setsockopt(fd, IPPROTO_IP, GEN_IP_PKTINFO, &one, sizeof(one)); // linux supports this, so why not - might fail on other systems