[PATCH] DNS: Allow a DNS look-up with a trailing dot in the name

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] DNS: Allow a DNS look-up with a trailing dot in the name

Craig McQueen
---
 src/core/dns.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/core/dns.c b/src/core/dns.c
index 9d2f61ed..fc84229b 100644
--- a/src/core/dns.c
+++ b/src/core/dns.c
@@ -804,6 +804,10 @@ dns_send(u8_t idx)
       pbuf_put_at(p, query_idx, n);
       pbuf_take_at(p, hostname_part, copy_len, (u16_t)(query_idx + 1));
       query_idx = (u16_t)(query_idx + n + 1);
+      if (*hostname == '.' && *(hostname + 1) == 0) {
+        /* skip any trailing dot */
+        hostname++;
+      }
     } while (*hostname != 0);
     pbuf_put_at(p, query_idx, 0);
     query_idx++;
--
2.18.0.windows.1


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel