rec: Fix uninited var causing wrong `bytes` field reported in protobuf log in rare cases
#endif /* HAVE_FSTRM */
// sleep until we see an answer to this, interface to mtasker
- ret = arecvfrom(buf, 0, ip, &len, qid, domain, type, queryfd, now);
+ ret = arecvfrom(buf, 0, ip, len, qid, domain, type, queryfd, *now);
}
else {
bool isNew;
LWResult::Result asendto(const char* data, size_t len, int flags, const ComboAddress& ip, uint16_t id,
const DNSName& domain, uint16_t qtype, bool ecs, int* fd);
-LWResult::Result arecvfrom(PacketBuffer& packet, int flags, const ComboAddress& ip, size_t* d_len, uint16_t id,
- const DNSName& domain, uint16_t qtype, int fd, const struct timeval* now);
+LWResult::Result arecvfrom(PacketBuffer& packet, int flags, const ComboAddress& ip, size_t& len, uint16_t id,
+ const DNSName& domain, uint16_t qtype, int fd, const struct timeval& now);
LWResult::Result asyncresolve(const ComboAddress& ip, const DNSName& domain, int type, bool doTCP, bool sendRDQuery, int EDNS0Level, struct timeval* now, boost::optional<Netmask>& srcmask, boost::optional<const ResolveContext&> context, const std::shared_ptr<std::vector<std::unique_ptr<RemoteLogger>>>& outgoingLoggers, const std::shared_ptr<std::vector<std::unique_ptr<FrameStreamLogger>>>& fstrmLoggers, const std::set<uint16_t>& exportTypes, LWResult* res, bool* chained);
return LWResult::Result::Success;
}
-LWResult::Result arecvfrom(PacketBuffer& packet, int /* flags */, const ComboAddress& fromaddr, size_t* d_len,
- uint16_t id, const DNSName& domain, uint16_t qtype, int fd, const struct timeval* now)
+LWResult::Result arecvfrom(PacketBuffer& packet, int /* flags */, const ComboAddress& fromaddr, size_t& len,
+ uint16_t id, const DNSName& domain, uint16_t qtype, int fd, const struct timeval& now)
{
static const unsigned int nearMissLimit = ::arg().asNum("spoof-nearmiss-max");
pident->type = qtype;
pident->remote = fromaddr;
- int ret = MT->waitEvent(pident, &packet, g_networkTimeoutMsec, now);
+ int ret = MT->waitEvent(pident, &packet, g_networkTimeoutMsec, &now);
+ len = 0;
/* -1 means error, 0 means timeout, 1 means a result from handleUDPServerResponse() which might still be an error */
if (ret > 0) {
return LWResult::Result::PermanentError;
}
- *d_len = packet.size();
+ len = packet.size();
if (nearMissLimit > 0 && pident->nearMisses > nearMissLimit) {
/* we have received more than nearMissLimit answers on the right IP and port, from the right source (we are using connected sockets),