diff --git a/config/rootfiles/common/web-user-interface b/config/rootfiles/common/web-user-interface index de959e3e8..e0d8d6531 100644 --- a/config/rootfiles/common/web-user-interface +++ b/config/rootfiles/common/web-user-interface @@ -91,6 +91,7 @@ srv/web/ipfire/cgi-bin/wirelessclient.cgi srv/web/ipfire/cgi-bin/wlanap.cgi srv/web/ipfire/cgi-bin/zoneconf.cgi srv/web/ipfire/cgi-bin/ddos.cgi +srv/web/ipfire/cgi-bin/loxilb.cgi #srv/web/ipfire/html srv/web/ipfire/html/blob.gif #srv/web/ipfire/html/captive diff --git a/html/cgi-bin/loxilb.cgi b/html/cgi-bin/loxilb.cgi index e69de29bb..0187b4a77 100644 --- a/html/cgi-bin/loxilb.cgi +++ b/html/cgi-bin/loxilb.cgi @@ -0,0 +1,112 @@ +#!/usr/bin/perl +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007-2020 IPFire Team # +# Copyright (C) 2024 BPFire # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +use strict; + +# enable only the following on debugging purpose +use warnings; +use CGI::Carp 'fatalsToBrowser'; + +use IO::Socket; + +require '/var/ipfire/general-functions.pl'; +require "${General::swroot}/location-functions.pl"; +require "${General::swroot}/lang.pl"; +require "${General::swroot}/header.pl"; + +my %color = (); +my %mainsettings = (); +my %loxilbsettings=(); +my %checked=(); +my $errormessage=''; +my $loxilbsettingfile = "${General::swroot}/loxilb/settings"; + + +# Read configuration file. + +&General::readhash("${General::swroot}/main/settings", \%mainsettings); +&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color); + +&Header::showhttpheaders(); + +$loxilbsettings{'ENABLE_LOXILB'} = 'off'; +$loxilbsettings{'ACTION'} = ''; + +&Header::getcgihash(\%loxilbsettings); + +if ($loxilbsettings{'ACTION'} eq $Lang::tr{'save'}) +{ + + &General::writehash("$loxilbsettingfile", \%loxilbsettings); + + if ($loxilbsettings{'ENABLE_LOXILB'} eq 'on') { + &General::system('/usr/bin/touch', "${General::swroot}/loxilb/enableloxilb"); + &General::system('/usr/local/bin/loxilbctrl', 'start'); + } else { + &General::system('/usr/local/bin/loxilbctrl', 'stop'); + unlink "${General::swroot}/loxilb/enableloxilb"; + } + +} + +&Header::openpage($Lang::tr{'loxilb'}, 1, ''); + +&Header::openbigbox('100%', 'left', '', $errormessage); + +if ($errormessage) { + &Header::openbox('100%', 'left', $Lang::tr{'error messages'}); + print "$errormessage \n"; + &Header::closebox(); +} + +# Read configuration file. +&General::readhash("$loxilbsettingfile", \%loxilbsettings); + +# Checkbox pre-selection. +my $checked; +if ($loxilbsettings{'ENABLE_LOXILB'} eq "on") { + $checked = "checked='checked'"; +} + +# Print box to enable/disable locationblock. +print"
\n"; + +&Header::openbox('100%', 'center', $Lang::tr{'loxilb status'}); +print < + + $Lang::tr{'loxilb enable'} + + + + + +END + +&Header::closebox(); + +print "\n"; +# +&Header::closebigbox(); + +&Header::closepage(); + diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index f63118e47..5ff486e59 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -2452,7 +2452,9 @@ 'state or province' => 'State or Province', 'static ip' => 'Static IP', 'static routes' => 'Static Routes', -'loxilb' => 'eBPF Load Balancer', +'loxilb' => 'eBPF LoxiLB Load Balancer', +'loxilb status' => 'Status', +'loxilb enable' => 'Enable Load Balancer', 'status' => 'Status', 'status information' => 'Status information', 'status ovpn' => 'OpenVPN', diff --git a/langs/zh/cgi-bin/zh.pl b/langs/zh/cgi-bin/zh.pl index e1056c9a3..40b9f8bb3 100644 --- a/langs/zh/cgi-bin/zh.pl +++ b/langs/zh/cgi-bin/zh.pl @@ -2420,7 +2420,9 @@ 'state or province' => '州或省', 'static ip' => '静态IP', 'static routes' => '静态路由', -'loxilb' => 'eBPF 负载均衡', +'loxilb' => 'eBPF LoxiLB 负载均衡', +'loxilb status' => '负载均衡启用状态', +'loxilb enable' => '启用负载均衡', 'status' => '状态', 'status information' => '状态信息', 'status ovpn' => 'OpenVPN',