Skip to content

Commit 96ffcc7

Browse files
committed
conf: set IP addresses
1 parent 59236ef commit 96ffcc7

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

src/conf.c

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -207,19 +207,12 @@ static int load(struct iface *iface, const char *path, const char *hostname)
207207
r = record(iface, 0, NULL, hlocal, QTYPE_SRV, 120);
208208
mdnsd_set_srv(d, r, 0, 0, srec.port, nlocal);
209209

210-
/* If an IPv4 address is already set, add an A record for it. */
211-
struct in_addr ipv4addr = mdnsd_get_address(d);
212-
if (ipv4addr.s_addr != 0) {
213-
r = record(iface, 0, NULL, nlocal, QTYPE_A, 120);
214-
mdnsd_set_ip(d, r, ipv4addr);
215-
}
210+
/* Ensure A/AAAA records exist; addresses populated from interface */
211+
r = record(iface, 0, NULL, nlocal, QTYPE_A, 120);
212+
r = record(iface, 0, NULL, nlocal, QTYPE_AAAA, 120);
216213

217-
/* If an IPv6 address is already set, add an AAAA record for it. */
218-
struct in6_addr ipv6addr = mdnsd_get_ipv6_address(d);
219-
if (!IN6_IS_ADDR_UNSPECIFIED(&ipv6addr)) {
220-
r = record(iface, 0, NULL, nlocal, QTYPE_AAAA, 120);
221-
mdnsd_set_ipv6(d, r, ipv6addr);
222-
}
214+
/* Publish all v4/v6 addresses for this interface and host */
215+
mdnsd_set_interface_addresses(d, iface->ifname);
223216

224217
if (srec.cname)
225218
record(iface, 1, srec.cname, nlocal, QTYPE_CNAME, 120);

0 commit comments

Comments
 (0)