What is it?
We currently save a CONFIG_TYPE as an integer in the network config, which tells use which zones we have. To interpret this config type is rather difficult, and it saves information we already have. If a ZONENAME_DEV
exists or ZONENAME_MODE=bridge
we have a zone called ZONENAME
. So to make the code easier and make it possible to implement new features, we want to get rid of it.
Who is working on it?
- Jonatan Schlag
Current Status
-
This evolved out of this thread
-
Targeted Release: Currently not known
Description
If in /var/ipfire/ethernet/settings
a variable ZONENAME_MODE
is defined and this mode is bridge
or a variable ZONENAME_DEV
is defined, a zone ZONENAME
exists. CONFIG_TYPE
needs to go in our entire codebase. This currently seems to affect the following files:
git grep -i config_type | grep -v config/kernel
config/cfgroot/header.pl: if ($ethsettings{'CONFIG_TYPE'} =~ /^[24]$/) {
config/cfgroot/header.pl: if ($ethsettings{'CONFIG_TYPE'} =~ /^[34]$/) {
config/cfgroot/header.pl: if ($ethsettings{'CONFIG_TYPE'} =~ /^[0]$/) {
config/cfgroot/header.pl: if ( $ethsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $ethsettings{'RED_TYPE'} eq 'STATIC' ) {
config/cfgroot/header.pl: } elsif ( $ethsettings{'CONFIG_TYPE'}>1 and ( $string =~ $ethsettings{'BLUE_DEV'} or &General::IpInSubnet($string2,$ethsettings{'BLUE_NETADDRESS'},$ethsettings{'BLUE_NETMASK'}) )){
config/cfgroot/header.pl: } elsif ( $ethsettings{'CONFIG_TYPE'}>2 and ( $string =~ $ethsettings{'ORANGE_DEV'} or &General::IpInSubnet($string2,$ethsettings{'ORANGE_NETADDRESS'},$ethsettings{'ORANGE_NETMASK'}) )){
config/cfgroot/network-functions.pl: my $config_type = $ethernet_settings{'CONFIG_TYPE'};
config/cfgroot/network-functions.pl: my %config_type_to_interfaces = (
config/cfgroot/network-functions.pl: my @network_zones = @{ $config_type_to_interfaces{$config_type} };
config/cfgroot/network-functions.pl: my $config_type = $ethernet_settings{'CONFIG_TYPE'};
config/cfgroot/network-functions.pl: return (($config_type ~~ [1..4]) && ($red_type ~~ ["DHCP", "STATIC"]));
config/firewall/firewall-policy:case "${CONFIG_TYPE}" in
config/rootfiles/common/cmake:#usr/share/cmake-3.20/Help/envvar/CMAKE_CONFIG_TYPE.rst
config/rootfiles/packages/libogg:#usr/include/ogg/config_types.h
html/cgi-bin/aliases.cgi:unless (( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ ) && ($netsettings{'RED_TYPE'} eq 'STATIC'))
html/cgi-bin/index.cgi:if ( ( $pppsettings{'VALID'} eq 'yes' && $modemsettings{'VALID'} eq 'yes' ) || ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ )) {
html/cgi-bin/index.cgi: if ( ( $pppsettings{'VALID'} eq 'yes' ) || ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} =~ /^(DHCP|STATIC)$/ ) ) {
html/cgi-bin/netexternal.cgi:if ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} eq "DHCP"){
html/cgi-bin/ovpnmain.cgi: if ($netsettings{'CONFIG_TYPE'} == 2) {return 1;}
html/cgi-bin/ovpnmain.cgi: if ($netsettings{'CONFIG_TYPE'} == 4) {return 1;}
html/cgi-bin/ovpnmain.cgi: if ($netsettings{'CONFIG_TYPE'} == 3) {return 1;}
html/cgi-bin/ovpnmain.cgi: if ($netsettings{'CONFIG_TYPE'} == 4) {return 1;}
html/cgi-bin/pppsetup.cgi: if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/) {
html/cgi-bin/traffic.cgi:if ($netsettings{'CONFIG_TYPE'} =~ /^(3|4)$/) {
html/cgi-bin/traffic.cgi:if ($netsettings{'CONFIG_TYPE'} =~ /^(2|4)$/) {
html/cgi-bin/wakeonlan.cgi: if ($netsettings{'CONFIG_TYPE'} == 2) {return 1;}
html/cgi-bin/wakeonlan.cgi: if ($netsettings{'CONFIG_TYPE'} == 4) {return 1;}
html/cgi-bin/wakeonlan.cgi: if ($netsettings{'CONFIG_TYPE'} == 3) {return 1;}
html/cgi-bin/wakeonlan.cgi: if ($netsettings{'CONFIG_TYPE'} == 4) {return 1;}
src/initscripts/helper/aws-setup: local config_type=1
src/initscripts/helper/aws-setup: config_type=2
src/initscripts/helper/aws-setup: # Save CONFIG_TYPE
src/initscripts/helper/aws-setup: echo "CONFIG_TYPE=${config_type}" >> /var/ipfire/ethernet/settings
src/initscripts/helper/azure-setup: local config_type=1
src/initscripts/helper/azure-setup: config_type=2
src/initscripts/helper/azure-setup: # Save CONFIG_TYPE
src/initscripts/helper/azure-setup: echo "CONFIG_TYPE=${config_type}" >> /var/ipfire/ethernet/settings
src/initscripts/helper/exoscale-setup: local config_type=1
src/initscripts/helper/exoscale-setup: config_type=2
src/initscripts/helper/exoscale-setup: # Save CONFIG_TYPE
src/initscripts/helper/exoscale-setup: echo "CONFIG_TYPE=${config_type}" >> /var/ipfire/ethernet/settings
src/initscripts/helper/gcp-setup: local config_type=1
src/initscripts/helper/gcp-setup: config_type=2
src/initscripts/helper/gcp-setup: # Save CONFIG_TYPE
src/initscripts/helper/gcp-setup: echo "CONFIG_TYPE=${config_type}" >> /var/ipfire/ethernet/settings
src/initscripts/helper/oci-setup: local config_type=1
src/initscripts/helper/oci-setup: config_type=2
src/initscripts/helper/oci-setup: # Save CONFIG_TYPE
src/initscripts/helper/oci-setup: echo "CONFIG_TYPE=${config_type}" >> /var/ipfire/ethernet/settings
src/initscripts/networking/functions.network: [ "${CONFIG_TYPE}" = "3" ] || [ "${CONFIG_TYPE}" = "4" ]
src/initscripts/networking/functions.network: [ "${CONFIG_TYPE}" = "2" ] || [ "${CONFIG_TYPE}" = "4" ]
src/misc-progs/setaliases.c: /* Find the CONFIG_TYPE value */
src/misc-progs/setaliases.c: if (!findkey(kv, "CONFIG_TYPE", s))
src/misc-progs/setaliases.c: fprintf(stderr, "Cannot read CONFIG_TYPE\n");
src/misc-progs/setaliases.c: /* Check for CONFIG_TYPE=2 or 3 i.e. RED ethernet present. If not,
src/setup/networking.c: strcpy(temp, "1"); findkey(kv, "CONFIG_TYPE", temp); configtype = atol(temp);
src/setup/networking.c: strcpy(temp, ""); findkey(kv, "CONFIG_TYPE", temp);
src/setup/networking.c: findkey(kv, "CONFIG_TYPE", temp); choise = atol(temp);
src/setup/networking.c: replacekeyvalue(kv, "CONFIG_TYPE", temp);
src/setup/networking.c: if (findkey(kv, "CONFIG_TYPE", temp))
src/setup/networking.c: fprintf(flog,"setting CONFIG_TYPE = %s\n",temp);
src/setup/networking.c: replacekeyvalue(kv, "CONFIG_TYPE", temp);
src/setup/networking.c: findkey(kv, "CONFIG_TYPE", temp); configtype = atol(temp);
src/setup/networking.c: strcpy(temp, "0"); findkey(kv, "CONFIG_TYPE", temp);
Implementation Constraints
- As few C Code as possible
Benefits to IPFire
- Makes our network stack more robust
- Enables other implementation in the future
Impact
- Hopefully non, as the functionality for the user does not change. This roadmap item is only concerned about code changes.
Documentation
- When there is a git branch to look at, it will be linked here.
Feedback
- None until now.
Dependencies
- Nothing, but a lot of time :-).
Release Notes
- Maybe not necessary