mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
dnsmasq: slurp all addresses for bind
PR: https://twitter.com/wget42/status/1009886764155260928
This commit is contained in:
parent
9e951d8f0b
commit
f344e9d447
@ -1,33 +1,33 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2014-2017 Franco Fichtner <franco@opnsense.org>
|
||||
Copyright (C) 2010 Ermal Luçi
|
||||
Copyright (C) 2005-2006 Colin Smith <ethethlay@gmail.com>
|
||||
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
* Copyright (C) 2014-2018 Franco Fichtner <franco@opnsense.org>
|
||||
* Copyright (C) 2010 Ermal Luçi
|
||||
* Copyright (C) 2005-2006 Colin Smith <ethethlay@gmail.com>
|
||||
* Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
||||
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
function dnsmasq_enabled()
|
||||
{
|
||||
@ -119,26 +119,26 @@ function dnsmasq_configure_do($verbose = false)
|
||||
|
||||
if (isset($config['dnsmasq']['interface'])) {
|
||||
$addresses = array();
|
||||
foreach (explode(",", $config['dnsmasq']['interface']) as $interface) {
|
||||
|
||||
foreach (explode(',', $config['dnsmasq']['interface']) as $interface) {
|
||||
if (is_ipaddrv4($interface)) {
|
||||
$addresses[] = $interface;
|
||||
} elseif (is_ipaddrv6($interface)) {
|
||||
// Since dnsmasq does not support link-local address with scope specified. strip address.
|
||||
/* no support for link-local address with scope specified */
|
||||
$addresses[] = explode("%", $interface)[0];
|
||||
} else {
|
||||
$intf_ipv4 = get_interface_ip($interface);
|
||||
$intf_ipv6 = get_interface_ipv6($interface);
|
||||
if (!empty($intf_ipv4)) {
|
||||
$addresses[] = $intf_ipv4;
|
||||
}
|
||||
if (!empty($intf_ipv6)) {
|
||||
$addresses[] = explode("%", $intf_ipv6)[0];
|
||||
foreach (legacy_getall_interface_addresses(get_real_interface($$interface)) as $tmpaddr) {
|
||||
$tmpaddr = explode('/', $tmpaddr)[0];
|
||||
$tmpaddr = explode('%', $tmpaddr)[0];
|
||||
$addresses[] = $tmpaddr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($addresses as $address) {
|
||||
$args .= " --listen-address={$address} ";
|
||||
}
|
||||
|
||||
if (!empty($addresses) && isset($config['dnsmasq']['strictbind'])) {
|
||||
$args .= " --bind-interfaces ";
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user