← Commit list

6b4960155

Jo-Philipp Wich
Jo-Philipp Wich
2019-10-27
SUCCESS Duration: 152s

Subject

nslookup: implement support for SRV records

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

networking/nslookup.c+20 -0
@@ -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);