summaryrefslogtreecommitdiffhomepage
path: root/networking
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-06-27 17:27:29 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-10-27 17:07:35 +0100
commit6b4960155e94076bf25518e4e268a7a5f849308e (patch)
treeb253cd4e4023364d2f0d0f20c99586d474c9234f /networking
parent8c3b520d4f937b1d1856898dec5f634b12d9cc36 (diff)
nslookup: implement support for SRV records
Add support for querying and parsing SRV DNS records. function old new delta send_queries 1711 1865 +154 qtypes 72 80 +8 Signed-off-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r--networking/nslookup.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/networking/nslookup.c b/networking/nslookup.c
index a7dd823f0..c43e60558 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -283,6 +283,7 @@ static const struct {
{ ns_t_cname, "CNAME" },
{ ns_t_mx, "MX" },
{ ns_t_txt, "TXT" },
+ { ns_t_srv, "SRV" },
{ ns_t_ptr, "PTR" },
{ ns_t_any, "ANY" },
};
@@ -435,6 +436,25 @@ static int parse_reply(const unsigned char *msg, size_t len)
}
break;
+ case ns_t_srv:
+ if (rdlen < 6) {
+ //printf("SRV record too short\n");
+ return -1;
+ }
+
+ cp = ns_rr_rdata(rr);
+ n = ns_name_uncompress(ns_msg_base(handle), ns_msg_end(handle),
+ cp + 6, dname, sizeof(dname));
+
+ if (n < 0) {
+ //printf("Unable to uncompress domain: %s\n", strerror(errno));
+ return -1;
+ }
+
+ printf("%s\tservice = %u %u %u %s\n", ns_rr_name(rr),
+ ns_get16(cp), ns_get16(cp + 2), ns_get16(cp + 4), dname);
+ break;
+
case ns_t_soa:
if (rdlen < 20) {
dbg("SOA record too short:%d\n", rdlen);