Recognise local host with .local suffix.

This commit is contained in:
df 2020-07-24 10:17:56 +01:00
parent e42e88d61f
commit aa472217c5

View File

@ -339,13 +339,15 @@ main(int argc, char **argv)
if (0 <= mdnsd_discover_service("_http._tcp.local", 5000, &svcinfo, &numserv)) { if (0 <= mdnsd_discover_service("_http._tcp.local", 5000, &svcinfo, &numserv)) {
struct hostent * hosts = read_hosts(numserv); struct hostent * hosts = read_hosts(numserv+1);
if (!hosts) { if (!hosts) {
fprintf(stderr,"null hosts\n"); fprintf(stderr,"null hosts\n");
return 1; return 1;
} }
//dump_hosts(hosts); //dump_hosts(hosts);
struct hostent * p = hosts; struct hostent * p = hosts;
/* recognise own .local hostname */
p = add_host(p, fullname, saddr);
for (int i = 0; i < numserv; ++i) { for (int i = 0; i < numserv; ++i) {
struct in_addr it; struct in_addr it;
it.s_addr = svcinfo[i].ipaddr; it.s_addr = svcinfo[i].ipaddr;