summaryrefslogtreecommitdiffhomepage
path: root/src/router.c
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2018-12-31 17:06:40 +0100
committerHans Dedecker <dedeckeh@gmail.com>2019-01-01 13:53:34 +0100
commit5e997388ba19e84764601d147ffb3bfb6cc455d1 (patch)
tree3aeb0773bdfb822174332c1ac02c1885cf291513 /src/router.c
parent1fe77f3f40cbe9227ade848e7c95f6354b2ff409 (diff)
router: make announcing DNS info configurable (FS#2020)
Make announcing options Recursive DNS server and DNS search list configurable via the ra_dns config option. This allows to disable sending RA based DNS info if such info is already provided by DHCPv6. Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'src/router.c')
-rw-r--r--src/router.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/router.c b/src/router.c
index f45ecab..f8a83a6 100644
--- a/src/router.c
+++ b/src/router.c
@@ -428,12 +428,14 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add
struct in6_addr dns_pref, *dns_addr = NULL;
size_t dns_cnt = 0;
- if (iface->dns_cnt > 0) {
- dns_addr = iface->dns;
- dns_cnt = iface->dns_cnt;
- } else if (!odhcpd_get_interface_dns_addr(iface, &dns_pref)) {
- dns_addr = &dns_pref;
- dns_cnt = 1;
+ if (iface->ra_dns) {
+ if (iface->dns_cnt > 0) {
+ dns_addr = iface->dns;
+ dns_cnt = iface->dns_cnt;
+ } else if (!odhcpd_get_interface_dns_addr(iface, &dns_pref)) {
+ dns_addr = &dns_pref;
+ dns_cnt = 1;
+ }
}
/* Construct Prefix Information options */
@@ -541,15 +543,22 @@ static uint64_t send_router_advert(struct interface *iface, const struct in6_add
} dns = {ND_OPT_RECURSIVE_DNS, (1 + (2 * dns_cnt)), 0, 0, 0};
/* DNS Search options */
- uint8_t search_buf[256], *search_domain = iface->search;
- size_t search_len = iface->search_len, search_padded = 0;
-
- if (!search_domain && !res_init() && _res.dnsrch[0] && _res.dnsrch[0][0]) {
- int len = dn_comp(_res.dnsrch[0], search_buf,
- sizeof(search_buf), NULL, NULL);
- if (len > 0) {
- search_domain = search_buf;
- search_len = len;
+ uint8_t *search_domain = NULL;
+ size_t search_len = 0, search_padded = 0;
+
+ if (iface->ra_dns) {
+ search_len = iface->search_len;
+ search_domain = iface->search;
+
+ if (!search_domain && !res_init() && _res.dnsrch[0] && _res.dnsrch[0][0]) {
+ uint8_t search_buf[256];
+
+ int len = dn_comp(_res.dnsrch[0], search_buf,
+ sizeof(search_buf), NULL, NULL);
+ if (len > 0) {
+ search_domain = search_buf;
+ search_len = len;
+ }
}
}