diff options
author | Thomas Haller <thaller@redhat.com> | 2017-03-03 13:29:31 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-03-03 13:51:05 +0100 |
commit | c8fa7b6f57988d1761cd2d3a12631abeefce77f7 (patch) | |
tree | 3de70dde389f28ec558171c53337dfeb6d8087e6 | |
parent | 9e429ddc0abe1bd9936880751c6f979cfc84fada (diff) |
dnsmasq: use ipv4.dns and ipv4.dns-search with ipv4.method=shared
Configure the dnsmasq DHCP server for shared mode to announce the
configured name resolution settings.
-rw-r--r-- | src/dnsmasq/nm-dnsmasq-manager.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/dnsmasq/nm-dnsmasq-manager.c b/src/dnsmasq/nm-dnsmasq-manager.c index 267d6b36a..f76c983dc 100644 --- a/src/dnsmasq/nm-dnsmasq-manager.c +++ b/src/dnsmasq/nm-dnsmasq-manager.c @@ -156,9 +156,11 @@ create_dm_cmd_line (const char *iface, char first[INET_ADDRSTRLEN]; char last[INET_ADDRSTRLEN]; char localaddr[INET_ADDRSTRLEN]; + char tmpaddr[INET_ADDRSTRLEN]; char *error_desc = NULL; const char *dm_binary; const NMPlatformIP4Address *listen_address; + guint i, n; listen_address = nm_ip4_config_get_address (ip4_config, 0); g_return_val_if_fail (listen_address, NULL); @@ -226,6 +228,24 @@ create_dm_cmd_line (const char *iface, g_string_truncate (s, 0); } + if ((n = nm_ip4_config_get_num_nameservers (ip4_config))) { + g_string_append (s, "--dhcp-option=option:dns-server"); + for (i = 0; i < n; i++) { + g_string_append_c (s, ','); + g_string_append (s, nm_utils_inet4_ntop (nm_ip4_config_get_nameserver (ip4_config, i), tmpaddr)); + } + g_string_truncate (s, 0); + } + + if ((n = nm_ip4_config_get_num_searches (ip4_config))) { + g_string_append (s, "--dhcp-option=option:domain-search"); + for (i = 0; i < n; i++) { + g_string_append_c (s, ','); + g_string_append (s, nm_ip4_config_get_search (ip4_config, i)); + } + g_string_truncate (s, 0); + } + nm_cmd_line_add_string (cmd, "--dhcp-lease-max=50"); g_string_append (s, "--pid-file="); |