interfaces: for consistency bootstrap the implicit 'none' value

This commit is contained in:
Franco Fichtner 2023-09-25 09:09:25 +02:00
parent 0bd1280a45
commit f63fd66472
2 changed files with 11 additions and 11 deletions

View File

@ -2178,7 +2178,7 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal
$realif = get_real_interface($interface);
$realifv6 = get_real_interface($interface, 'inet6');
switch ($wancfg['ipaddr'] ?? '') {
switch ($wancfg['ipaddr'] ?? 'none') {
case 'l2tp':
case 'ppp':
case 'pppoe':
@ -2272,7 +2272,7 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal
interface_configure_mtu($realhwif, $wancfg['mtu'], $ifconfig_details);
}
switch ($wancfg['ipaddr'] ?? '') {
switch ($wancfg['ipaddr'] ?? 'none') {
case 'dhcp':
interface_dhcp_configure($interface);
break;
@ -2298,7 +2298,7 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal
$interface_descr = sprintf('%s (%s)', !empty($wancfg['descr']) ? $wancfg['descr'] : strtoupper($interface), $interface);
mwexecf('/sbin/ifconfig %s inet6 -accept_rtadv description %s up', [$realif, $interface_descr]);
switch ($wancfg['ipaddrv6'] ?? '') {
switch ($wancfg['ipaddrv6'] ?? 'none') {
case 'slaac':
case 'dhcp6':
/* XXX move these to tunables maybe as they are global anyway */
@ -3969,15 +3969,15 @@ function get_interfaces_info($include_unlinked = false)
$ifinfo['outerrs'] = $ifinfotmp['output errors'];
$ifinfo['collisions'] = $ifinfotmp['collisions'];
$link_type = $config['interfaces'][$ifdescr]['ipaddr'] ?? '';
$link_type = $config['interfaces'][$ifdescr]['ipaddr'] ?? 'none';
switch ($link_type) {
case 'dhcp':
$ifinfo['dhcplink'] = isvalidpid("/var/run/dhclient.{$ifinfo['if']}.pid") ? 'up' : 'down';
break;
/* PPPoE/PPTP/L2TP interface? -> get status from virtual interface */
case "pppoe":
case "pptp":
case "l2tp":
case 'pppoe':
case 'pptp':
case 'l2tp':
if ($ifinfo['status'] == "up") {
/* XXX get PPPoE link status for dial on demand */
$ifinfo["{$link_type}link"] = "up";
@ -3986,7 +3986,7 @@ function get_interfaces_info($include_unlinked = false)
}
break;
/* PPP interface? -> get uptime for this session and cumulative uptime from the persistent log file in conf */
case "ppp":
case 'ppp':
if ($ifinfo['status'] == "up") {
$ifinfo['ppplink'] = "up";
} else {
@ -4028,7 +4028,7 @@ function get_interfaces_info($include_unlinked = false)
}
}
switch ($config['interfaces'][$ifdescr]['ipaddrv6'] ?? '') {
switch ($config['interfaces'][$ifdescr]['ipaddrv6'] ?? 'none') {
case 'dhcp6':
$ifinfo['dhcp6link'] = isvalidpid('/var/run/dhcp6c.pid') && file_exists("/var/etc/dhcp6c_{$ifdescr}.conf") ? 'up' : 'down';
break;
@ -4371,7 +4371,7 @@ function interfaces_has_prefix_only($interface)
$interfaces_a = config_read_array('interfaces');
$ret = false;
switch ($interfaces_a[$interface]['ipaddrv6'] ?? '') {
switch ($interfaces_a[$interface]['ipaddrv6'] ?? 'none') {
case 'dhcp6':
$ret = empty($interfaces_a[$interface]['adv_dhcp6_config_file_override']) &&
((!empty($interfaces_a[$interface]['adv_dhcp6_config_advanced']) &&

View File

@ -336,7 +336,7 @@ class Gateways
$this->cached_gateways[$gwkey] = $thisconf;
} elseif (
$ipproto == 'inet6'
&& in_array($ifcfg['ipaddrv6'] ?? null, ['slaac', 'dhcp6', '6to4', '6rd'])
&& in_array($ifcfg['ipaddrv6'] ?? 'none', ['slaac', 'dhcp6', '6to4', '6rd'])
) {
// Dynamic IPv6 interface, but no router solicit response received using rtsold.
$gwkey = $this->newKey($thisconf['priority'], !empty($thisconf['defaultgw']));