summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--llmnr-query.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/llmnr-query.c b/llmnr-query.c
index 27a2034..cb2a65e 100644
--- a/llmnr-query.c
+++ b/llmnr-query.c
@@ -257,8 +257,6 @@ int main(int argc, char **argv)
}
}
- query_pkt_len = pkt_len(p) - sizeof(*hdr);
-
if (sendto(sock, p->data, pkt_len(p), 0, (struct sockaddr *)&sst, sizeof(sst)) < 0) {
log_err("Failed to send UDP packet: %s\n", strerror(errno));
break;
@@ -278,7 +276,10 @@ int main(int argc, char **argv)
} else if (ret) {
uint16_t j, ancount;
+ /* save query length and re-use packet for RX */
+ query_pkt_len = pkt_len(p) - sizeof(*hdr);
pkt_reset(p);
+
if (recv(sock, p->data, p->size, 0) < 0) {
log_err("Failed to receive from socket: %s\n", strerror(errno));
break;