diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2017-02-02 01:34:33 +0900 |
---|---|---|
committer | Lorenzo Colitti <lorenzo@google.com> | 2017-02-10 11:40:06 +0900 |
commit | ce6748a3f656a206b4e85f48cda949bc152cf741 (patch) | |
tree | d9f8f3f1b7ad4d3966fb1fca6ba77dccab775e1b /server/BandwidthController.h | |
parent | 56c4b1eb7d15e55a4edb88cfc0d190d8817d1353 (diff) | |
download | netd-ce6748a3f656a206b4e85f48cda949bc152cf741.tar.gz |
Use iptables pipes when fetching tether counters.
Tested using:
adb shell ndc bandwidth gettetherstats
adb shell iptables -nvx -L natctrl_tether_counters
adb shell ip6tables -nvx -L natctrl_tether_counters
Results:
114 0 wlan0 rmnet_data0 272883 2976 8624804 6032
200 0 Tethering stats list completed
Chain natctrl_tether_counters (2 references)
pkts bytes target prot opt in out source destination
2688 179096 RETURN all -- wlan0 rmnet_data0 0.0.0.0/0 0.0.0.0/0
5713 8351999 RETURN all -- rmnet_data0 wlan0 0.0.0.0/0 0.0.0.0/0
Chain natctrl_tether_counters (1 references)
pkts bytes target prot opt in out source destination
288 93787 RETURN all wlan0 rmnet_data0 ::/0 ::/0
319 272805 RETURN all rmnet_data0 wlan0 ::/0 ::/0
Test: manual test described above
Test: data usage increases by 10MB when downloading 10MB file
Test: netd_unit_test passes
Bug: 34873832
Change-Id: I32c4e750a4d3c379074cc13ab1302d51421860d2
Diffstat (limited to 'server/BandwidthController.h')
-rw-r--r-- | server/BandwidthController.h | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/server/BandwidthController.h b/server/BandwidthController.h index 66fdeee0..0398ce9b 100644 --- a/server/BandwidthController.h +++ b/server/BandwidthController.h @@ -171,11 +171,6 @@ protected: static void addStats(TetherStatsList& statsList, const TetherStats& stats); - static int addForwardChainStats(const TetherStats& filter, - TetherStatsList& statsList, FILE *fp, - std::string &extraProcessingInfo); - - /* * stats should never have only intIface initialized. Other 3 combos are ok. * fp should be a file to the apropriate FORWARD chain of iptables rules. @@ -185,8 +180,9 @@ protected: * in:extIface out:intIface * and the rules are grouped in pairs when more that one tethering was setup. */ - static int parseForwardChainStats(SocketClient *cli, const TetherStats filter, FILE *fp, - std::string &extraProcessingInfo); + static int addForwardChainStats(const TetherStats& filter, + TetherStatsList& statsList, const std::string& iptOutput, + std::string &extraProcessingInfo); /* * Attempt to find the bw_costly_* tables that need flushing, |