From 7fda1670ceaf1ccfda9409471911426e9dc3735e Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Sun, 3 Jan 2021 20:43:01 +0100 Subject: [PATCH] interfaces: l2tp/pptp cleanup; closes #2707 The interfaces are created by mpd5 daemon during configuration. We do not seem to have more than one issue here: IPv6 disable is too soon but that is easily fixed. Device creation moves on ok and there is no apparent error in functionality with or without it. While here fix the link when a $pppid is set and properly protect the redirect url. Previously empty() was too strict and it ignored $pppid of zero. Also remove spurious "IP Address" help text from PPP device configuration. --- src/etc/inc/interfaces.inc | 17 ++++++++++------- src/www/interfaces.php | 25 ++++++++++--------------- src/www/interfaces_ppps_edit.php | 10 ++-------- 3 files changed, 22 insertions(+), 30 deletions(-) diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index 71efff954..d2034d197 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -1225,7 +1225,8 @@ function interface_ppps_configure($interface) $gateways = isset($ppp['gateway']) ? explode(',', $ppp['gateway']) : array(); $subnets = isset($ppp['subnet']) ? explode(',', $ppp['subnet']) : array(); - /* We bring up the parent interface first because if DHCP is configured on the parent we need + /* + * We bring up the parent interface first because if DHCP is configured on the parent we need * to obtain an address first so we can write it in the mpd .conf file for PPTP and L2TP configs */ foreach ($ports as $pid => $port) { @@ -2173,9 +2174,11 @@ EOD; fclose($fd_set); - /* Making sure regulatory settings have actually changed - * before applying, because changing them requires bringing - * down all wireless networks on the interface. */ + /* + * Making sure regulatory settings have actually changed + * before applying, because changing them requires bringing + * down all wireless networks on the interface. + */ exec("{$ifconfig} " . escapeshellarg($if), $output); $ifconfig_str = implode($output); unset($output); @@ -2396,9 +2399,6 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal } } - /* Disable Accepting router advertisements unless specifically requested */ - mwexecf('/sbin/ifconfig %s inet6 -accept_rtadv', array($realif)); - /* wireless configuration? */ if (isset($wancfg['wireless']) && is_array($wancfg['wireless']) && !$linkupevent) { interface_wireless_configure($realif, $wancfg, $wancfg['wireless']); @@ -2460,6 +2460,9 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal break; } + /* disable accepting router advertisements unless specifically requested */ + mwexecf('/sbin/ifconfig %s inet6 -accept_rtadv', array($realif)); + if (isset($wancfg['ipaddrv6'])) { switch ($wancfg['ipaddrv6']) { case 'slaac': diff --git a/src/www/interfaces.php b/src/www/interfaces.php index 2e3aee243..fba930e80 100644 --- a/src/www/interfaces.php +++ b/src/www/interfaces.php @@ -435,9 +435,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { $pconfig['ipaddrv6'] = null; } - /* - locate PPP details (if any) - */ + /* locate PPP details (if any) */ $pppid = count($a_ppps); foreach ($a_ppps as $key => $ppp) { if ($a_interfaces[$if]['if'] == $ppp['if']) { @@ -472,9 +470,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { $pppid = count($a_ppps); } - /* - Wireless interface - */ if (isset($a_interfaces[$if]['wireless'])) { /* Sync first to be sure it displays the actual settings that will be used */ interface_sync_wireless_clones($a_interfaces[$if], false); @@ -2289,10 +2284,10 @@ include("head.inc"); - - ', '') ?> + + ', $pppid), '') ?> - ', '') ?> + ', '') ?> @@ -2361,13 +2356,13 @@ include("head.inc"); - + - ','') ?> + ', $pppid), '') ?> - ','') ?> + ','') ?> @@ -2443,10 +2438,10 @@ include("head.inc"); - - ','') ?> + + ', $pppid), '') ?> - ','') ?> + ','') ?> diff --git a/src/www/interfaces_ppps_edit.php b/src/www/interfaces_ppps_edit.php index 99ca2e352..f63ba2364 100644 --- a/src/www/interfaces_ppps_edit.php +++ b/src/www/interfaces_ppps_edit.php @@ -557,7 +557,7 @@ include("head.inc"); - + " /> / @@ -568,18 +568,12 @@ include("head.inc"); - - + " /> -