summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2020-12-25 07:28:14 +0700
committerGitHub <noreply@github.com>2020-12-25 07:28:14 +0700
commita102f98f0313f42c0c321e90cfaa492d2a46c066 (patch)
tree4e4119d8145c4a377eaed01017ac34fffddf077f
parent13e1e9deeb300d777ccd88d4297a6c94612f0552 (diff)
parent6f1baf6a2adb6fb986b28b8b7ee739cd66322aff (diff)
downloadvyatta-wanloadbalance-a102f98f0313f42c0c321e90cfaa492d2a46c066.tar.gz
vyatta-wanloadbalance-a102f98f0313f42c0c321e90cfaa492d2a46c066.zip
Merge pull request #8 from DmitriyEshenko/crux-wlb-fix24122020
wanloadbalance: T3152: Fix operational commands
-rw-r--r--scripts/vyatta-wanloadbalance.pl3
-rw-r--r--scripts/vyatta-wlb-connection.pl23
2 files changed, 20 insertions, 6 deletions
diff --git a/scripts/vyatta-wanloadbalance.pl b/scripts/vyatta-wanloadbalance.pl
index a64d494..f476ac2 100644
--- a/scripts/vyatta-wanloadbalance.pl
+++ b/scripts/vyatta-wanloadbalance.pl
@@ -319,6 +319,9 @@ my $conf_file = '/var/run/load-balance/wlb.conf';
my $conf_lck_file = '/var/run/load-balance/wlb.conf.lck';
`sudo mkdir -p /var/run/load-balance`;
+# Enable conntrack counters
+`sudo sysctl -w net.netfilter.nf_conntrack_acct=1`;
+
####are we just validating?
if (defined $nexthop) {
my $rc = Vyatta::TypeChecker::validateType('ipv4', $nexthop, 1);
diff --git a/scripts/vyatta-wlb-connection.pl b/scripts/vyatta-wlb-connection.pl
index 2f59545..b034821 100644
--- a/scripts/vyatta-wlb-connection.pl
+++ b/scripts/vyatta-wlb-connection.pl
@@ -29,9 +29,11 @@ use lib "/opt/vyatta/share/perl5/";
if (!open($CONFFILE, "<", "/var/run/load-balance/wlb.conf")) {
return;
}
+$nat_source_disabled = 0;
$_ = <$CONFFILE>;
if (/disable-source-nat/) {
- if (!open($FILE, "<", "/proc/net/ip_conntrack")) {
+ $nat_source_disabled = 1;
+ if (!open($FILE, "<", "/proc/net/nf_conntrack")) {
return;
}
} else {
@@ -48,11 +50,20 @@ foreach (@line) {
my $proto,$tmp,$state,$src,$dst,$sport,$dport,$pkts,$bytes;
- if (/tcp/) {
- ($proto,$tmp,$tmp,$state,$src,$dst,$sport,$dport,$pkts,$bytes) = split(' ',$_);
- } elsif (/udp/) {
- $state = "";
- ($proto,$tmp,$tmp,$src,$dst,$sport,$dport,$pkts,$bytes) = split(' ',$_);
+ if($nat_source_disabled){
+ if (/tcp/) {
+ ($tmp,$tmp,$proto,$tmp,$tmp,$state,$src,$dst,$sport,$dport,$pkts,$bytes) = split(' ',$_);
+ } elsif (/udp/) {
+ $state = "";
+ ($tmp,$tmp,$proto,$tmp,$tmp,$src,$dst,$sport,$dport,$pkts,$bytes) = split(' ',$_);
+ }
+ } else {
+ if (/tcp/) {
+ ($proto,$tmp,$tmp,$state,$src,$dst,$sport,$dport,$pkts,$bytes) = split(' ',$_);
+ } elsif (/udp/) {
+ $state = "";
+ ($proto,$tmp,$tmp,$src,$dst,$sport,$dport,$pkts,$bytes) = split(' ',$_);
+ }
}
($tmp,$src) = split('=',$src);