X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=cache.c;fp=cache.c;h=83249939d304de87e54378a335def6f9e5d6f45e;hb=b42b22152d73c0b5825bd20742d501d47adabed1;hp=9df051d59072502a6ca5985314fce5a497b7c3c9;hpb=c63d465698c732665a166729165be8c724327fa3;p=project%2Fmdnsd.git diff --git a/cache.c b/cache.c index 9df051d..8324993 100644 --- a/cache.c +++ b/cache.c @@ -382,7 +382,8 @@ void cache_answer(struct interface *iface, struct sockaddr *from, uint8_t *base, } void -cache_dump_records(struct blob_buf *buf, const char *name, int array) +cache_dump_records(struct blob_buf *buf, const char *name, int array, + const char **hostname) { struct cache_record *r, *last, *next; const char *txt; @@ -454,8 +455,11 @@ cache_dump_records(struct blob_buf *buf, const char *name, int array) break; case TYPE_SRV: - if (r->rdata) + if (r->rdata) { blobmsg_add_string(buf, "host", (char *)r->rdata + sizeof(struct dns_srv_data)); + if (hostname) + *hostname = (char *)r->rdata + sizeof(struct dns_srv_data); + } if (r->port) blobmsg_add_u32(buf, "port", r->port); break;