summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriyEshenko <dmitriy.eshenko@vyos.io>2020-12-24 19:33:50 +0000
committerDmitriyEshenko <dmitriy.eshenko@vyos.io>2020-12-24 19:33:50 +0000
commita4a6414c901e255c331bd38d3f202b9221c058dd (patch)
treea79746e348ae6cd082482cd164f9665b18f164b2
parent13e1e9deeb300d777ccd88d4297a6c94612f0552 (diff)
downloadvyatta-wanloadbalance-a4a6414c901e255c331bd38d3f202b9221c058dd.tar.gz
vyatta-wanloadbalance-a4a6414c901e255c331bd38d3f202b9221c058dd.zip
wanloadbalance: T3152: Change conntrack statistics file location
-rw-r--r--scripts/vyatta-wlb-connection.pl23
1 files changed, 17 insertions, 6 deletions
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);