Skip to content

Commit

Permalink
Commit f05aefc50:
Browse files Browse the repository at this point in the history
    commit f05aefc50b1372688692afc89a800bf74811618a
    Author: Jose P. Garcia <[email protected]>
    Date: Tue Apr 2 09:30:23 2024 +0700

    Bump CE version to v7.2.1

    commit 7b0e7c89be70b5a810bb4df357385a5426f47495
    Author: nevola <[email protected]>
    Date: Mon Apr 1 19:36:00 2024 +0200

    fix modify backend with priority 2

    Signed-off-by: nevola <[email protected]>

    commit 10477e16e66f6359bbf575a3455fdfb98a5bd633
    Author: nevola <[email protected]>
    Date: Mon Apr 1 19:34:08 2024 +0200

    fix dont display backends if session is configured

    Signed-off-by: nevola <[email protected]>

date: 11:41:32_03/04/24
  • Loading branch information
AutoCommit committed Apr 3, 2024
1 parent ad2061a commit 5f37849
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 22 deletions.
2 changes: 1 addition & 1 deletion DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: relianoid
Version: 7.2.0
Version: 7.2.1
Maintainer: RELIANOID <[email protected]>
Architecture: amd64
Section: admin
Expand Down
2 changes: 1 addition & 1 deletion usr/share/perl5/Relianoid/API40/Farm/Backend.pm
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ sub modify_service_backends ($json_obj, $farmname, $service, $id_server) {
$prio = $be->{priority} + 0 if (defined $be->{priority} && $be->{priority} !~ /^$/);
if ($type =~ /http/ && &getGlobalConfiguration('proxy_ng') ne 'true' && $prio > 1) {
my $priorities = &getHTTPFarmPriorities($farmname, $service);
if (scalar(@{$priorities}) >= 1) {
if (scalar(@{$priorities}) >= 1 && !grep { $_->{id} == $id_server } @{$priorities}) {
my $msg = "Only one backend as second priority is allowed.";
&httpErrorResponse({ code => 400, desc => $desc, msg => $msg });
}
Expand Down
43 changes: 32 additions & 11 deletions usr/share/perl5/Relianoid/Farm/HTTP/Service.pm
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ sub getHTTPFarmVS ($farm_name, $service = "", $tag = "") {

my $sw = 0;
my $be_section = 0;
my $se_section = 0;
my $be_emerg = 0;
my $be = -1;
my $sw_ti = 0;
Expand All @@ -721,8 +722,12 @@ sub getHTTPFarmVS ($farm_name, $service = "", $tag = "") {
my @return;

foreach my $line (@lines) {
if ($line =~ /^\s+Service \"$service\"/) { $sw = 1; }
if ($line =~ /^\s+End\s*$/ && !$be_section && !$be_emerg) { $sw = 0; }
if ($line =~ /^\s+Service \"$service\"/) { $sw = 1; }
if ($line =~ /^\s+Session/ && $sw == 1) { $se_section = 1; }
if ($line =~ /^\s+End\s*$/) {
if ($se_section) { $se_section = 0; }
elsif (!$be_section && !$be_emerg) { $sw = 0; }
}

# returns all services for this farm
if ($tag eq "" && $service eq "") {
Expand Down Expand Up @@ -1253,6 +1258,9 @@ sub setHTTPFarmVS ($farm_name, $service, $tag, $string) {
my $farm_filename = &getFarmFile($farm_name);
my $output = 0;
my $sw = 0;
my $be_section = 0;
my $se_section = 0;
my $be_emerg = 0;
my $j = -1;
my $clean_sessions = 0;

Expand All @@ -1276,8 +1284,14 @@ sub setHTTPFarmVS ($farm_name, $service, $tag, $string) {

foreach my $line (@fileconf) {
$j++;
if ($line =~ /\s+Service \"$service\"/) { $sw = 1; }
if ($line =~ /^\s+End$/ && $sw == 1) { last; }
if ($line =~ /^\s+Service \"$service\"/) { $sw = 1; }
if ($line =~ /^\s+#?Session/ && $sw == 1) { $se_section = 1; }
if ($line =~ /^\s+#?Backend/ && $sw == 1) { $be_section = 1; }
if ($line =~ /^\s+#?Emergency/ && $sw == 1) { $be_emerg = 1; }
if ($line =~ /^\s+End\s*$/ && $sw && !$se_section && !$be_section && !$be_emerg) {
last;
}

next if $sw == 0;

#vs tag
Expand Down Expand Up @@ -1392,7 +1406,7 @@ sub setHTTPFarmVS ($farm_name, $service, $tag, $string) {
$line .= "\n\t\t\tHTTPS";
}

#go out of curret Service
#go out of the current Service
if ( $line =~ /\s+Service \"/
&& $sw == 1
&& $line !~ /\s+Service \"$service\"/)
Expand All @@ -1406,11 +1420,11 @@ sub setHTTPFarmVS ($farm_name, $service, $tag, $string) {
#session type
if ($tag eq "session") {
require Relianoid::Farm::HTTP::Sessions;
if ($string ne "nothing" && $sw == 1) {
if ($string ne "nothing" && $se_section) {
if ($line =~ /^\s+#Session/) {
$line = "\t\tSession";
}
if ($line =~ /\s+#End/) {
if ($line =~ /^\s*#End/) {
$line = "\t\tEnd";
}
if ($line =~ /^\s+#?Type\s+(.*)\s*/) {
Expand All @@ -1433,11 +1447,11 @@ sub setHTTPFarmVS ($farm_name, $service, $tag, $string) {
}
}

if ($string eq "nothing" && $sw == 1) {
if ($string eq "nothing" && $se_section) {
if ($line =~ /^\s+Session/) {
$line = "\t\t#Session";
}
if ($line =~ /^\s+End/) {
if ($line =~ /^\s*End/) {
$line = "\t\t#End";
}
if ($line =~ /^\s+TTL/) {
Expand All @@ -1451,7 +1465,7 @@ sub setHTTPFarmVS ($farm_name, $service, $tag, $string) {
$line = "\t\t\t#ID \"sessionname\"";
}
}
if ($sw == 1 && $line =~ /End/) {
if ($se_section && $line =~ /^\s*End/) {
&deleteConfL7FarmAllSession($farm_name, $service)
if ($clean_sessions);
last;
Expand Down Expand Up @@ -1496,6 +1510,13 @@ sub setHTTPFarmVS ($farm_name, $service, $tag, $string) {
last;
}
}

if ($line =~ /^\s+#?End\s*$/) {
if ($se_section) { $se_section = 0; }
elsif ($be_section) { $be_section = 0; }
elsif ($be_emerg) { $be_emerg = 0; }
elsif ($sw) { last; }
}
}

untie @fileconf;
Expand Down Expand Up @@ -1637,7 +1658,7 @@ sub getHTTPFarmPriorities ($farmname, $service_name) {
else {
foreach my $backend (@{$backends}) {
if (defined $backend->{priority} and $backend->{priority} > 1) {
push @priorities, $backend->{priority};
push @priorities, $backend;
}
}
}
Expand Down
19 changes: 10 additions & 9 deletions usr/share/perl5/Relianoid/Net/Validate.pm
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,10 @@ Parameters:
Returns:
Integer - It returns '1' if the port and IP are valid to be used or '0' if the port and IP are already applied in the system
Integer
1 - if the port and IP are available to be used
0 - if the port and IP are already being used in the system
See Also:
Expand All @@ -404,9 +407,10 @@ See Also:
=cut

sub validatePort ($ip, $port, $proto, $farmname = undef, $process = undef) {
if ($ip eq '*') {
$ip = '0.0.0.0';
}

# validate inputs
$ip = '0.0.0.0' if $ip eq '*';
if (!defined $proto && !defined $farmname) {
&zenlog("Check port needs the protocol to validate the ip '$ip' and the port '$port'", "error", "networking");
return 0;
Expand All @@ -419,15 +423,12 @@ sub validatePort ($ip, $port, $proto, $farmname = undef, $process = undef) {
$proto = &getL4FarmParam('proto', $farmname);
}
}
$proto = &getProtoTransport($proto);

return 0
if (!&validatePortUserSpace($ip, $port, $proto, $farmname, $process));

return 0 if (!&validatePortKernelSpace($ip, $port, $proto, $farmname));
$proto = &getProtoTransport($proto);

# TODO: add check for avoiding collision with datalink VIPs

return 0 if (!&validatePortUserSpace($ip, $port, $proto, $farmname, $process));
return 0 if (!&validatePortKernelSpace($ip, $port, $proto, $farmname));
return 1;
}

Expand Down

0 comments on commit 5f37849

Please sign in to comment.