mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 00:54:41 +00:00
interfaces: fix interface name split for ifctl; closes #5929
Weird stuff such as "wififoo_wlan0" is now properly handled.
This commit is contained in:
parent
85b223d00c
commit
72b04f0904
@ -306,12 +306,9 @@ function get_searchdomains()
|
||||
}
|
||||
}
|
||||
|
||||
if (is_array($search_list)) {
|
||||
foreach ($search_list as $fdns) {
|
||||
$contents = file($fdns, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
if (!is_array($contents)) {
|
||||
continue;
|
||||
}
|
||||
foreach ($search_list as $fdns) {
|
||||
$contents = file($fdns, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
if (is_array($contents)) {
|
||||
foreach ($contents as $dns) {
|
||||
if (!empty($dns) && is_hostname($dns)) {
|
||||
$master_list[] = $dns;
|
||||
@ -365,7 +362,9 @@ function get_nameservers($interface = null, $with_gateway = false)
|
||||
|
||||
foreach ($dns_lists as $fdns) {
|
||||
/* inspect dynamic servers registered in the system files */
|
||||
$intf = explode('_', basename($fdns), 2);
|
||||
$intf = [];
|
||||
$intf[0] = preg_replace('/_[^_]+$/', '', basename($fdns));
|
||||
$intf[1] = preg_replace('/^.+_/', '', basename($fdns));
|
||||
$intf[1] = strpos($intf[1], 'v6') === false ? '4' : '6';
|
||||
if (in_array($intf, $exclude_interfaces)) {
|
||||
continue;
|
||||
|
||||
@ -142,9 +142,9 @@ elif [ "${DO_COMMAND}" = "-l" ]; then
|
||||
|
||||
for MATCH in ${MATCHES}; do
|
||||
FILE=${MATCH##*/}
|
||||
IF=${FILE%%:*}
|
||||
IF=${IF%%_*}
|
||||
MD=${FILE#*_}
|
||||
IF=${FILE%_*}
|
||||
IF=${IF%%:*}
|
||||
MD=${FILE##*_}
|
||||
|
||||
# suffix :slaac sorts before plain interface
|
||||
# so we can export the resulting file name first
|
||||
@ -170,7 +170,7 @@ if [ -z "${IF}" ]; then
|
||||
# list all interfaces that have the requested file
|
||||
for FOUND in $(find -s /tmp -name "${FILE#/tmp/}"); do
|
||||
FOUND=${FOUND#/tmp/}
|
||||
FOUND=${FOUND%%_*}
|
||||
FOUND=${FOUND%_*}
|
||||
FOUND=${FOUND%:*}
|
||||
if [ -z "$(eval echo \${${FOUND}_found})" ]; then
|
||||
RESULTS="${RESULTS} ${FOUND}_found"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user