Hi Michael,

On 19/06/2025 13:50, Adolf Belka wrote:
Hi Michael,

On 19/06/2025 12:14, Michael Tremer wrote:
Hello Adolf,

I am not sure that I follow the problem.

Why do we need to stop and start the network again later?

I will have to describe this as I don't think I can use screenshots here.

* Run the setup command.
* Select Networking
* Select Drivers and card assignments
* Select OK to the question Do you wish to change these settings? at the bottom 
of the scrollable display box.
* Existing code will then say Restarting non-local network... but it will 
actually be running
/etc/rc.d/init.d/network stop red blue orange

Then you will have the page show with the assigned cards.
* Select Done without doing any thing else. This means that the
netaddresschange variable has not been set as no change was actually carried 
out but the red, blue and orange interfaces (if present) have all been stopped 
and are not restarted because no actual change was done.


Would “non-local” not mean RED only?

I am thinking that the original code was thinking non-local meant everything 
that is not the network you are doing the setup from, which in most cases would 
be green. I checked in the git repo and that bit of code has been in IPFire 
since at least CU30.

Thinking a bit more about it as the main Network Restart (stop followed by 
start and unbound restart) occurs when any change has been carried out 
(netaddresschange variable is made equal to 1) then maybe that line

runcommandwithstatus("/etc/rc.d/init.d/network stop red blue orange",
  _("Networking"), _("Restarting non-local network..."), NULL);

should just be completely removed or if a change is actually made to the zone 
assigned to a mac address while the network is still running does this cause 
problems.

I will look at testing out the removal of that partial network stop (red, blue 
& orange but not green) and see what happens when running setup.

I just tested this out and it worked fine. Nothing gets stopped and it makes no 
difference if I press the OK or Cancel button on the Drivers and card 
assignments page if I don't actually select any driver then no restart is 
needed. If I press the OK button and then do a Select on the Orange interface 
then exit from that then there is the message that at the end of the setup of 
the Networking section a full restart will be carried out.

So it looks to me that the best approach is to remove that network stop command 
as it does not look to be needed and in certain cases can leave users with red, 
blue and orange no longer connected.

I will do a v2 patch for this and it can then be reviewed to see if that is 
better or not.

Regards,

Adolf.


Let me know if I have not explained the above well enough.

Regards,

Adolf.


-Michael

On 18 Jun 2025, at 14:56, Adolf Belka <adolf.be...@ipfire.org> wrote:

- In the setup menu if the OK button is pressed when it asks if you want to 
change any
   of the interfaces then the red, blue and orange interfaces are stopped. 
However if
   none of the interfaces are changed then the network restart code does not 
get used.
- This results in the system ending up with only the green interfrace being UP 
and
   connected.
- This is the first time I have done anything with c code so if my change is not
   appropriate or there is a better way of doing it then I am fully open to 
suggestions.
- I did test the code out on my vm testbed and it worked the way I expected it 
to but
   that does not mean it is the right thing to do.
- I also changed the text for the Network stop command from Restarting to 
Stopping as it
   does not start the network again in all cases. The patch ends up now with 
the stop
   message after the OK button has been pressed on the window showing the 
interfaces
   that are available is shown. Then if no interface is changed and the Done 
button is
   pressed the message about restarting the non-local network is shown.
- If an interface is selected then the starting non-local network interfaces is 
not
   shown as the full network start and unbound start will be carried out.

Fixes: bug10245
Tested-by: Adolf Belka <adolf.be...@ipfire.org>
Signed-off-by: Adolf Belka <adolf.be...@ipfire.org>
---
src/setup/networking.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/setup/networking.c b/src/setup/networking.c
index 8d398f365..c380b1d34 100644
--- a/src/setup/networking.c
+++ b/src/setup/networking.c
@@ -422,7 +422,7 @@ int changedrivers(void)
}
if (automode == 0)
runcommandwithstatus("/etc/rc.d/init.d/network stop red blue orange",
- _("Networking"), _("Restarting non-local network..."), NULL);
+ _("Networking"), _("Stopping non-local network..."), NULL);

findkey(kv, "CONFIG_TYPE", temp); configtype = atol(temp);
if (configtype == 1)
@@ -513,6 +513,10 @@ int changedrivers(void)
}
while ( rc <= 2);

+ if ((automode == 0) && (netaddresschange == 0))
+ runcommandwithstatus("/etc/rc.d/init.d/network start red blue orange",
+ _("Networking"), _("Restarting non-local network..."), NULL);
+
freekeyvalues(kv);
return 1;
}
--
2.49.0






Reply via email to