From 45d5d420104ae4be2d5951b7a64737e2f6548ca9 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Tue, 7 Dec 2021 10:29:16 +0100 Subject: [PATCH] interfaces: avoid inline creation of GIF/GRE tunnels Instead move the out-of-band configuration into the same area where the ipaddr/ipaddrv6 configuration is taking place. Should a tunnel not come up we have clearer readings now of which part of the GUI can force this... --- src/etc/inc/interfaces.inc | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc index c8820867a..03d061ec8 100644 --- a/src/etc/inc/interfaces.inc +++ b/src/etc/inc/interfaces.inc @@ -655,9 +655,10 @@ function interfaces_gre_configure($verbose = false, $checkparent = 0, $realif = $gre['greif'] = "gre{$i}"; } - if (!empty($realif) && $realif != $gre['greif']) { - continue; - } else { + if (!empty($realif)) { + if ($realif != $gre['greif']) { + continue; + } log_error(sprintf('Executing inline configuration of GRE tunnel %s', $realif)); } @@ -774,9 +775,10 @@ function interfaces_gif_configure($verbose = false, $checkparent = 0, $realif = $gif['gifif'] = "gif{$i}"; } - if (!empty($realif) && $realif != $gif['gifif']) { - continue; - } else { + if (!empty($realif)) { + if ($realif != $gif['gifif']) { + continue; + } log_error(sprintf('Executing inline configuration of GIF tunnel %s', $realif)); } @@ -2380,10 +2382,6 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal log_error(sprintf('Executed inline creation of non-existent interface %s (%s)', $interface, $realhwif)); } - /* make sure tunnel inside IP is set when interface changes #3702 */ - interfaces_gre_configure(false, 0, $realhwif); - interfaces_gif_configure(false, 0, $realhwif); - $ifconfig_details = legacy_interfaces_details(); if ( (strpos($realhwif, '/') === false && empty($ifconfig_details[$realhwif])) || @@ -2454,6 +2452,13 @@ function interface_configure($verbose = false, $interface = 'wan', $reload = fal /* XXX a lagg or vlan or bridge could be resolved inside this function */ configure_interface_hardware($realhwif, $ifconfig_details); + /* + * Make sure tunnel address is set when interface is configured as + * these lie outside the normal ipaddr/ipaddrv6 configuration schema. + */ + interfaces_gre_configure(false, 0, $realhwif); + interfaces_gif_configure(false, 0, $realhwif); + switch ($wancfg['ipaddr']) { case 'dhcp': interface_dhcp_configure($interface);