From dcb6b5e11750bd61a63fccb43ab62c16e6c75c8e Mon Sep 17 00:00:00 2001 From: Vincent Li Date: Sun, 7 Jul 2024 23:45:49 +0000 Subject: [PATCH] LoxiLB UI: get VIP from ipconfigfile in HA scenario, the shared/floating VIP is not configured on the red0 interface when setup LoxiLB lb from the UI in standby BPFire, some VIPs are missing since these VIPs are only configured in the active BPFire. get VIPs from /var/ipfire/loxilb/ipconfigfile Signed-off-by: Vincent Li --- html/cgi-bin/loxilbconfig.cgi | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/html/cgi-bin/loxilbconfig.cgi b/html/cgi-bin/loxilbconfig.cgi index ba90f481d..eafd3b80d 100644 --- a/html/cgi-bin/loxilbconfig.cgi +++ b/html/cgi-bin/loxilbconfig.cgi @@ -37,6 +37,21 @@ undef (@dummy); # Files used my $setting = "${General::swroot}/main/settings"; our $datafile = "${General::swroot}/loxilb/lbconfig"; #(our: used in subroutine) +my $loxilbipfile = "${General::swroot}/loxilb/ipconfigfile"; +my $redfile = "${General::swroot}/red/local-ipaddress"; + +our @REDIP = (); +our @IPFILE = (); + +if (open(FILE, "$redfile")) { + @REDIP = ; + close (FILE); +} + +if (open(FILE, "$loxilbipfile")) { + @IPFILE = ; + close (FILE); +} my %color = (); my %mainsettings = (); @@ -288,7 +303,17 @@ my @PROTOCOLS = ("tcp", "udp"); my @ALGO = ("rr", "hash", "priority", "persist", "lc"); my @MODE = ("default", "onearm", "fullnat", "dsr"); my @MONITOR = ("on", "off"); -my @VIP = &General::get_ipaddresses_from_interface("red0"); +my @VIP; +push(@VIP, @REDIP); + +foreach my $line (@IPFILE) { + chomp($line); + my @temp = split(/\,/, $line); + if ($temp[1] eq "red0") { + my @tmp = split(/\//, $temp[0]); + push(@VIP, $tmp[0]); + } +} #Edited line number (KEY1) passed until cleared by 'save' or 'remove' or 'new sort order' print <