summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2013-08-16 10:39:25 +0000
committerErmal <eri@pfsense.org>2013-08-16 10:39:25 +0000
commit93d38614553352afa2bfc2bdf737a85189e24299 (patch)
treec09018c969dae416dc02d9f2d00d244a399732d2
parentc6868a8fae2ef26288e11a588749f5f54469687c (diff)
downloadpfsense-93d38614553352afa2bfc2bdf737a85189e24299.zip
pfsense-93d38614553352afa2bfc2bdf737a85189e24299.tar.gz
Handle link local addresses with embedded interface scope on is_ipaddrv6 and also on dnsmasq which is not yet there for these addresses
-rw-r--r--etc/inc/services.inc25
-rw-r--r--etc/inc/util.inc4
2 files changed, 26 insertions, 3 deletions
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index bf1be36..5938dc4 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -1639,8 +1639,18 @@ function services_dnsmasq_configure() {
if(isset($config['dnsmasq']['interface'])) {
$interfaces = explode(",", $config['dnsmasq']['interface']);
foreach ($interfaces as $interface) {
- if (is_ipaddr($interface)) {
+ if (is_ipaddrv4($interface)) {
$listen_addresses .= " --listen-address={$interface} ";
+ } else if (is_ipaddrv6($interface)) {
+ /*
+ * XXX: Since dnsmasq does not support link-local address
+ * with scope specified. These checks are being done.
+ */
+ if (is_linklocal($interface) && strstr($interface, "%")) {
+ $tmpaddrll6 = explode("%", $interface);
+ $listen_addresses .= " --listen-address={$tmpaddrll6[0]} ";
+ } else
+ $listen_addresses .= " --listen-address={$interface} ";
} else {
$if = get_real_interface($interface);
if (does_interface_exist($if)) {
@@ -1648,8 +1658,17 @@ function services_dnsmasq_configure() {
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 (is_ipaddrv6($laddr6) && !isset($config['dnsmasq']['strictbind'])) {
+ /*
+ * XXX: Since dnsmasq does not support link-local address
+ * with scope specified. These checks are being done.
+ */
+ if (is_linklocal($laddr6) && strstr($laddr6, "%")) {
+ $tmpaddrll6 = explode("%", $laddr6);
+ $listen_addresses .= " --listen-address={$tmpaddrll6[0]} ";
+ } else
+ $listen_addresses .= " --listen-address={$laddr6} ";
+ }
}
}
}
diff --git a/etc/inc/util.inc b/etc/inc/util.inc
index e5ff1dd..cb75798 100644
--- a/etc/inc/util.inc
+++ b/etc/inc/util.inc
@@ -477,6 +477,10 @@ function is_ipaddr($ipaddr) {
function is_ipaddrv6($ipaddr) {
if (!is_string($ipaddr) || empty($ipaddr))
return false;
+ if (strstr($ipaddr, "%") && is_linklocal($ipaddr)) {
+ $tmpip = explode("%", $ipaddr);
+ $ipaddr = $tmpip[0];
+ }
return Net_IPv6::checkIPv6($ipaddr);
}
OpenPOWER on IntegriCloud