summaryrefslogtreecommitdiffhomepage
path: root/src/dhcpv4.c
diff options
context:
space:
mode:
authoricpz <cc@icpz.dev>2020-11-21 00:55:25 +0800
committerHans Dedecker <dedeckeh@gmail.com>2020-11-24 21:24:33 +0100
commit694148a87fa5a0c964286fdaac1fa490a2fb530b (patch)
treef71a6ffb0061c6971d351ef3377f7772d7a8d868 /src/dhcpv4.c
parentfb55e80394c51d7502bb278f57520dec15a11355 (diff)
config: add option to indicate dns service presence
Adds the config option to set if ipv6 dns service is availiable on the interface. In some cases the dns service may not be listening on the ipv6 address of the interface, and thus should not be announced to clients. Signed-off-by: Paizhuo Chen <cc@icpz.dev>
Diffstat (limited to 'src/dhcpv4.c')
-rw-r--r--src/dhcpv4.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/dhcpv4.c b/src/dhcpv4.c
index 25a4c77..c3d16f5 100644
--- a/src/dhcpv4.c
+++ b/src/dhcpv4.c
@@ -842,9 +842,10 @@ void dhcpv4_handle_msg(void *addr, void *data, size_t len,
4 * iface->dhcpv4_router_cnt, iface->dhcpv4_router);
- if (iface->dhcpv4_dns_cnt == 0)
- dhcpv4_put(&reply, &cookie, DHCPV4_OPT_DNSSERVER, 4, &iface->dhcpv4_local);
- else
+ if (iface->dhcpv4_dns_cnt == 0) {
+ if (iface->dns_service)
+ dhcpv4_put(&reply, &cookie, DHCPV4_OPT_DNSSERVER, 4, &iface->dhcpv4_local);
+ } else
dhcpv4_put(&reply, &cookie, DHCPV4_OPT_DNSSERVER,
4 * iface->dhcpv4_dns_cnt, iface->dhcpv4_dns);