summaryrefslogtreecommitdiffstats
path: root/etc/inc/services.inc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2013-04-26 14:53:23 -0400
committerjim-p <jimp@pfsense.org>2013-04-26 14:53:23 -0400
commitb4323f39bc7c942b4a98943057f45cca7c701109 (patch)
treebd7beb2757a562f60582284991a4a624f1a2f1f0 /etc/inc/services.inc
parente6c49e3d9b54c202b7df7426461d0dbd29255c2e (diff)
downloadpfsense-b4323f39bc7c942b4a98943057f45cca7c701109.zip
pfsense-b4323f39bc7c942b4a98943057f45cca7c701109.tar.gz
Add the ability for dnsmasq to selectively respond to queries only on certain IPs and bind to specific interfaces.
Diffstat (limited to 'etc/inc/services.inc')
-rw-r--r--etc/inc/services.inc29
1 files changed, 28 insertions, 1 deletions
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index e56b84b..1458e1c 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -1577,6 +1577,31 @@ function services_dnsmasq_configure() {
if (is_port($config['dnsmasq']['port']))
$args .= " --port={$config['dnsmasq']['port']} ";
+ $listen_addresses = "";
+ if(isset($config['dnsmasq']['interface'])) {
+ $interfaces = explode(",", $config['dnsmasq']['interface']);
+ foreach ($interfaces as $interface) {
+ if (is_ipaddr($interface)) {
+ $listen_addresses .= " --listen-address={$interface} ";
+ } else {
+ $if = get_real_interface($interface);
+ if (does_interface_exist($if)) {
+ $laddr = find_interface_ip($if);
+ if (is_ipaddrv4($laddr))
+ $listen_addresses .= " --listen-address={$laddr} ";
+ $laddr6 = find_interface_ipv6($if);
+ if (is_ipaddrv6($laddr6) && !isset($config['dnsmasq']['strictbind']))
+ $listen_addresses .= " --listen-address={$laddr6} ";
+ }
+ }
+ }
+ if (!empty($listen_addresses)) {
+ $args .= " {$listen_addresses} ";
+ if (isset($config['dnsmasq']['strictbind']))
+ $args .= " --bind-interfaces ";
+ }
+ }
+
/* Setup forwarded domains */
if (isset($config['dnsmasq']['domainoverrides']) && is_array($config['dnsmasq']['domainoverrides'])) {
foreach($config['dnsmasq']['domainoverrides'] as $override) {
@@ -1625,7 +1650,9 @@ function services_dnsmasq_configure() {
}
/* run dnsmasq */
- mwexec_bg("/usr/local/sbin/dnsmasq --local-ttl 1 --all-servers {$dns_rebind} --dns-forward-max=5000 --cache-size=10000 {$args}");
+ $cmd = "/usr/local/sbin/dnsmasq --local-ttl 1 --all-servers {$dns_rebind} --dns-forward-max=5000 --cache-size=10000 {$args}";
+ //log_error("dnsmasq command: {$cmd}");
+ mwexec_bg($cmd);
unset($args);
if ($g['booting'])
OpenPOWER on IntegriCloud