diff options
author | DmitriyEshenko <dmitriy.eshenko@vyos.io> | 2020-12-24 19:33:50 +0000 |
---|---|---|
committer | Daniil Baturin <daniil@vyos.io> | 2020-12-25 13:34:31 +0200 |
commit | 26bff04824b7904298a80fff9d35877cd2c2b09a (patch) | |
tree | 15ec311ffef97961998811c9a61647e75c2446be | |
parent | ab841d3588c88e0e8ef86693471281badce92a9f (diff) | |
download | vyatta-wanloadbalance-26bff04824b7904298a80fff9d35877cd2c2b09a.tar.gz vyatta-wanloadbalance-26bff04824b7904298a80fff9d35877cd2c2b09a.zip |
wanloadbalance: T3152: Change conntrack statistics file location
-rw-r--r-- | scripts/vyatta-wlb-connection.pl | 23 |
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); |