From 6547750d1e8ab12497d524927b5e49d32e6dca92 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Pialasse Date: Mon, 23 Dec 2024 01:05:02 -0500 Subject: [PATCH] * Mon Dec 23 2024 Jean-Philippe Pialasse 11.0.0-17.sme - add vlan support on External Interface [SME: 12677] --- root/etc/e-smith/events/actions/update-ifcfg | 9 ++++++ .../network-scripts/ifcfg-ethX/01setupvlan | 10 +++++++ .../network-scripts/ifcfg-ethX/75vlan | 4 +++ root/etc/modules-load.d/vlan.conf | 1 + .../vendor_perl/esmith/console/configure.pm | 30 ++++++++++++++++++- smeserver-base.spec | 5 +++- 6 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/01setupvlan create mode 100644 root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/75vlan create mode 100644 root/etc/modules-load.d/vlan.conf diff --git a/root/etc/e-smith/events/actions/update-ifcfg b/root/etc/e-smith/events/actions/update-ifcfg index 5ec2014..6b56ce5 100644 --- a/root/etc/e-smith/events/actions/update-ifcfg +++ b/root/etc/e-smith/events/actions/update-ifcfg @@ -18,6 +18,15 @@ if (($c->get('EthernetDriver1')->value || 'unknown') eq 'dummy'){ if (($c->get('InternalInterface')->prop('NICBonding') || 'disabled') eq 'enabled'){ push @adapters, "bond\tbond\t10:00:01:02:03:04\tBonding virtual Interface\tbond0"; } +# if external VLAN is configured +if (($c->get('ExternalInterface')->prop('VLAN') || 'disabled') ne 'disabled'){ + my $name= ($c->get('ExternalInterface')->prop('Name') eq "ppp0") ? $c->get('pppoe')->prop('PhysicalInterface') : $c->get('ExternalInterface')->prop('Name') ; + my $vlan=$c->get('ExternalInterface')->prop('VLAN'); + $name=~ s/\.$vlan$//; + my ($newl) = grep ( /$name$/ , @adapters); + push @adapters, "$newl.$vlan"; +} +#TODO if external virtual lan is configured # Expand templates for every adapters found foreach my $adapter (@adapters){ diff --git a/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/01setupvlan b/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/01setupvlan new file mode 100644 index 0000000..ce99bf5 --- /dev/null +++ b/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/01setupvlan @@ -0,0 +1,10 @@ +{ + $is_vlan = "no"; + if ( ( exists $ExternalInterface{VLAN} && $ExternalInterface{VLAN} =~ /^\d+$/ ) && ($is_external || ( $ExternalInterface{Configuration} eq "pppoe") && $pppoe{PhysicalInterface} eq $THIS_DEVICE ) ) + { + $ifup_this_device = "yes"; + $is_vlan = "yes"; + } + + ""; +} diff --git a/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/75vlan b/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/75vlan new file mode 100644 index 0000000..f892a85 --- /dev/null +++ b/root/etc/e-smith/templates/etc/sysconfig/network-scripts/ifcfg-ethX/75vlan @@ -0,0 +1,4 @@ +{ + return unless ($is_vlan eq "yes"); + $OUT = "VLAN=yes\n"; +} diff --git a/root/etc/modules-load.d/vlan.conf b/root/etc/modules-load.d/vlan.conf new file mode 100644 index 0000000..4b3501a --- /dev/null +++ b/root/etc/modules-load.d/vlan.conf @@ -0,0 +1 @@ +8021q diff --git a/root/usr/share/perl5/vendor_perl/esmith/console/configure.pm b/root/usr/share/perl5/vendor_perl/esmith/console/configure.pm index ab95c6e..0f771c7 100644 --- a/root/usr/share/perl5/vendor_perl/esmith/console/configure.pm +++ b/root/usr/share/perl5/vendor_perl/esmith/console/configure.pm @@ -559,9 +559,37 @@ ETHERNET_EXTERNAL: goto ETHERNET_EXTERNAL; } + goto ETHERNET_EXTERNAL_VLAN;# was SERVER_GATEWAY_DEDICATED; +} +#------------------------------------------------------------ +ETHERNET_EXTERNAL_VLAN: +#------------------------------------------------------------ +{ + ($rc, $choice) = $console->input_page + ( + title => gettext("Select External Interface VLAN"), + text => + gettext("Your ISP might have provided you a VLAN to use, if not leave empty."), + value => $db->get_prop('ExternalInterface', 'VLAN') || "" + ); + + goto ETHERNET_EXTERNAL unless ($rc == 0); + # sanitize if a previous VLAN is present + my $extIF = $db->get_prop('ExternalInterface', 'Name'); + $extIF =~ s/\.\d+$//; + if ( $choice =~ /^\d+$/ ) + { + $db->set_prop('ExternalInterface', 'VLAN', $choice ); + $db->set_prop('ExternalInterface', 'Name', $extIF . ".$choice") unless $db->get_prop('ExternalInterface', 'Name') =~ /\.$choice$/; + } + else + { + $db->delete_prop('ExternalInterface', 'VLAN'); + $db->set_prop('ExternalInterface', 'Name',$extIF); + } + goto SERVER_GATEWAY_DEDICATED; } - #------------------------------------------------------------ SERVER_GATEWAY_DEDICATED: #------------------------------------------------------------ diff --git a/smeserver-base.spec b/smeserver-base.spec index 183ffa6..c862439 100644 --- a/smeserver-base.spec +++ b/smeserver-base.spec @@ -4,7 +4,7 @@ Summary: smeserver server and gateway - base module %define name smeserver-base Name: %{name} %define version 11.0.0 -%define release 16 +%define release 17 Version: %{version} Release: %{release}%{?dist} License: GPL @@ -184,6 +184,9 @@ fi %changelog +* Mon Dec 23 2024 Jean-Philippe Pialasse 11.0.0-17.sme +- add vlan support on External Interface [SME: 12677] + * Mon Dec 23 2024 Jean-Philippe Pialasse 11.0.0-16.sme - add kernel module support for rp-pppoe plugin [SME: 12678] will allow faster fiber connexion when using multiple queue interface (RSS)