mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 01:54:49 +00:00
interfaces: sprinkle "up" earlier for #5946
For most purposes adding an IPv4 or IPv6 address already does the UP/RUNNING thing and DHCP and PPPoE might as well so at the point when we add the description bring it "up" explicity as well and remove the later interface_bring_up() call. For rtsold this is also required and IPv6 device might be different from main device so add another "up" there and then also follow-up with another "up" and "description" in case the main device and IPv6 device differ. On the overlap cases the duplicated "up" additions do not slow down the boot.
This commit is contained in:
parent
c01ad5059f
commit
ddb79243cc
@ -2244,20 +2244,6 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal
|
||||
/* apply interface hardware settings (tso, lro, ..) */
|
||||
configure_interface_hardware($realhwif, $ifconfig_details);
|
||||
|
||||
/*
|
||||
* Unconditional actions on interface include:
|
||||
*
|
||||
* 1. Disable accepting router advertisements (SLAAC) on IPv4 device
|
||||
* 2. Set interface description on both IPv4 and IPv6 device (if any)
|
||||
*
|
||||
* In most cases the IPv6 device is the same as IPv4.
|
||||
*/
|
||||
$interface_descr = !empty($wancfg['descr']) ? $wancfg['descr'] : strtoupper($interface);
|
||||
mwexecf('/sbin/ifconfig %s inet6 -accept_rtadv description %s', [$realif, $interface_descr]);
|
||||
if ($realif != $realifv6) {
|
||||
mwexecf('/sbin/ifconfig %s inet6 description %s', [$realifv6, $interface_descr]);
|
||||
}
|
||||
|
||||
switch ($wancfg['ipaddr'] ?? '') {
|
||||
case 'dhcp':
|
||||
interface_dhcp_configure($interface);
|
||||
@ -2273,6 +2259,17 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unconditional actions on interface include:
|
||||
*
|
||||
* 1. Disable accepting router advertisements (SLAAC) on main device
|
||||
* 2. Set interface description to get more useful ifconfig output
|
||||
* 3. Set "up" flag for UP/RUNNING requirement, adding an address
|
||||
* already does that so at this point try to be more consistent.
|
||||
*/
|
||||
$interface_descr = !empty($wancfg['descr']) ? $wancfg['descr'] : strtoupper($interface);
|
||||
mwexecf('/sbin/ifconfig %s inet6 -accept_rtadv description %s up', [$realif, $interface_descr]);
|
||||
|
||||
switch ($wancfg['ipaddrv6'] ?? '') {
|
||||
case 'slaac':
|
||||
case 'dhcp6':
|
||||
@ -2280,7 +2277,7 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal
|
||||
set_single_sysctl('net.inet6.ip6.accept_rtadv', '1');
|
||||
set_single_sysctl('net.inet6.ip6.rfc6204w3', '1');
|
||||
|
||||
mwexecf('/sbin/ifconfig %s inet6 accept_rtadv -ifdisabled', $realifv6);
|
||||
mwexecf('/sbin/ifconfig %s inet6 accept_rtadv -ifdisabled up', $realifv6);
|
||||
|
||||
if (!isset($wancfg['dhcp6usev4iface'])) {
|
||||
interface_dhcpv6_prepare($interface, $wancfg);
|
||||
@ -2303,6 +2300,15 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* In most cases the IPv6 device is the same as IPv4.
|
||||
* If not the safe spot to add a description/up is below
|
||||
* when the interface was most likely created.
|
||||
*/
|
||||
if ($realif != $realifv6) {
|
||||
mwexecf('/sbin/ifconfig %s inet6 description %s up', [$realifv6, $interface_descr]);
|
||||
}
|
||||
|
||||
if (!empty($wancfg['mtu'])) {
|
||||
$intf_details = $ifconfig_details[$realhwif];
|
||||
$mtu = $wancfg['mtu'];
|
||||
@ -2326,7 +2332,6 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal
|
||||
}
|
||||
|
||||
interfaces_vips_configure($interface);
|
||||
interfaces_bring_up($realif);
|
||||
|
||||
/* XXX device plugin hook */
|
||||
$gres = link_interface_to_gre($interface);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user