summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki2017-03-09 21:17:32 +0000
committerRafał Miłecki2017-03-10 10:53:25 +0000
commit46b87811664756aacaf6ef945b9d247790de49df (patch)
tree337314900e2f12440b9883761904bcb2175ebcd1
parente985074edacf30012e360f7cc745e070ce997141 (diff)
downloadmdnsd-46b87811664756aacaf6ef945b9d247790de49df.tar.gz
Drop unneeded code to simplify getting hosts over ubus
This code in umdns_hosts was there since ever but it seems like an unneeded copy & paste part of umdns_browse. In this function we iterate over *host* entries of cached services list. It means the entry field conains values like "example.local". In such case looking for "._" is pointless and appending ".local" results in looking for entries like "example.local.local". This code make sense for browsing *services* only where for entries like "ex._ssh._tcp.local" we try dumping "ex.local" & "ex._ssh._tcp.local". Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-rw-r--r--ubus.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/ubus.c b/ubus.c
index 9ceeab1..4120fd5 100644
--- a/ubus.c
+++ b/ubus.c
@@ -97,21 +97,13 @@ umdns_hosts(struct ubus_context *ctx, struct ubus_object *obj,
struct blob_attr *msg)
{
struct cache_service *s;
- char *buffer = (char *) mdns_buf;
void *c;
blob_buf_init(&b, 0);
avl_for_each_element(&services, s, avl) {
- char *local;
if (!cache_service_is_host(s))
continue;
- snprintf(buffer, MAX_NAME_LEN, "%s", s->entry);
- local = strstr(buffer, "._");
- if (local)
- *local = '\0';
- c = blobmsg_open_table(&b, buffer);
- strncat(buffer, ".local", MAX_NAME_LEN);
- cache_dump_records(&b, buffer);
+ c = blobmsg_open_table(&b, s->entry);
cache_dump_records(&b, s->entry);
blobmsg_close_table(&b, c);
}