diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2015-02-17 10:09:47 +0100 |
---|---|---|
committer | Tobias Klauser <tklauser@distanz.ch> | 2015-02-17 10:09:47 +0100 |
commit | 01641aa1d0789afe5389afa1686717c361e54f14 (patch) | |
tree | 44e3a3959b7c0af71e8ee79aa41e48be8833b042 | |
parent | 89dc6f3478c8619ecdfb84cad7aafef9636bda17 (diff) |
llmnr: Report proper address type in response for qtype ANY
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r-- | llmnr.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -132,15 +132,18 @@ static void llmnr_respond(unsigned int ifindex, const struct llmnr_hdr *hdr, for (i = 0; i < n; i++) { void *addr; size_t addr_size; + uint16_t type; if (addrs[i].ss_family == AF_INET) { struct sockaddr_in *sin = (struct sockaddr_in *)&addrs[i]; addr = &sin->sin_addr; addr_size = sizeof(sin->sin_addr); + type = LLMNR_TYPE_A; } else if (addrs[i].ss_family == AF_INET6) { struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&addrs[i]; addr = &sin6->sin6_addr; addr_size = sizeof(sin6->sin6_addr); + type = LLMNR_TYPE_AAAA; } else { /* skip */ continue; @@ -154,7 +157,7 @@ static void llmnr_respond(unsigned int ifindex, const struct llmnr_hdr *hdr, */ memcpy(pkt_put(p, llmnr_hostname[0] + 2), llmnr_hostname, llmnr_hostname[0] + 2); /* TYPE */ - pkt_put_u16(p, htons(qtype)); + pkt_put_u16(p, htons(type)); /* CLASS */ pkt_put_u16(p, htons(LLMNR_CLASS_IN)); /* TTL */ |