header.pl: Hide PPPoE menu item if RED is in IP mode

Message ID 20210325204942.1780-1-hofmann@leo-andres.de
State Accepted
Commit 9db81dc9d410a5de240711cd3b8c8e4eca086bfe
Headers
Series header.pl: Hide PPPoE menu item if RED is in IP mode |

Commit Message

Leo-Andres Hofmann March 25, 2021, 8:49 p.m. UTC
  Fixes: #11342

Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de>
---
 config/cfgroot/header.pl | 6 ++++++
 1 file changed, 6 insertions(+)
  

Comments

Peter Müller March 27, 2021, 8:22 p.m. UTC | #1
Reviewed-by: Peter Müller <peter.mueller@ipfire.org>

> Fixes: #11342
> 
> Signed-off-by: Leo-Andres Hofmann <hofmann@leo-andres.de>
> ---
>  config/cfgroot/header.pl | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/config/cfgroot/header.pl b/config/cfgroot/header.pl
> index 5684c01c5..8dea804d0 100644
> --- a/config/cfgroot/header.pl
> +++ b/config/cfgroot/header.pl
> @@ -170,6 +170,12 @@ sub genmenu {
>          $menu->{'02.status'}{'subMenu'}->{'74.modem-status'}{'enabled'} = 1;
>      }
>  
> +	# Disable the Dialup/PPPoE menu item when the RED interface is in IP mode
> +	# (the "Network" module is loaded by general-functions.pl)
> +	if(&Network::is_red_mode_ip()) {
> +		$menu->{'01.system'}{'subMenu'}->{'20.dialup'}{'enabled'} = 0;
> +	}
> +
>      # Disbale unusable things in cloud environments
>      if (&General::running_in_cloud()) {
>          $menu->{'03.network'}{'subMenu'}->{'30.dhcp'}{'enabled'} = 0;
>
  

Patch

diff --git a/config/cfgroot/header.pl b/config/cfgroot/header.pl
index 5684c01c5..8dea804d0 100644
--- a/config/cfgroot/header.pl
+++ b/config/cfgroot/header.pl
@@ -170,6 +170,12 @@  sub genmenu {
         $menu->{'02.status'}{'subMenu'}->{'74.modem-status'}{'enabled'} = 1;
     }
 
+	# Disable the Dialup/PPPoE menu item when the RED interface is in IP mode
+	# (the "Network" module is loaded by general-functions.pl)
+	if(&Network::is_red_mode_ip()) {
+		$menu->{'01.system'}{'subMenu'}->{'20.dialup'}{'enabled'} = 0;
+	}
+
     # Disbale unusable things in cloud environments
     if (&General::running_in_cloud()) {
         $menu->{'03.network'}{'subMenu'}->{'30.dhcp'}{'enabled'} = 0;