diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2016-06-22 20:24:53 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-06-22 20:24:53 +0000 |
commit | ab69cc1f11a7e391bd3bb017a22ed747da89b21b (patch) | |
tree | 902a0c521964f5d87bd25c56496d76d3e8ce01f4 | |
parent | a0c08e2f8f4e8801ff3a2443a22e4db747cc2e46 (diff) | |
parent | c0808155fd10d2d5c49bb4c8d4cafed8da28c182 (diff) | |
download | native-ab69cc1f11a7e391bd3bb017a22ed747da89b21b.tar.gz |
Merge "Run iptables as root." into nyc-dev
-rw-r--r-- | cmds/dumpstate/dumpstate.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index b9c9e75ec1..5fe1f90939 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -625,6 +625,15 @@ static bool add_text_zip_entry(const std::string& entry_name, const std::string& return true; } +static void dump_iptables() { + run_command("IPTABLES", 10, "iptables", "-L", "-nvx", NULL); + run_command("IP6TABLES", 10, "ip6tables", "-L", "-nvx", NULL); + run_command("IPTABLE NAT", 10, "iptables", "-t", "nat", "-L", "-nvx", NULL); + /* no ip6 nat */ + run_command("IPTABLE RAW", 10, "iptables", "-t", "raw", "-L", "-nvx", NULL); + run_command("IP6TABLE RAW", 10, "ip6tables", "-t", "raw", "-L", "-nvx", NULL); +} + static void dumpstate(const std::string& screenshot_path, const std::string& version) { DurationReporter duration_reporter("DUMPSTATE"); unsigned long timeout; @@ -798,16 +807,7 @@ static void dumpstate(const std::string& screenshot_path, const std::string& ver run_command("ARP CACHE", 10, "ip", "-4", "neigh", "show", NULL); run_command("IPv6 ND CACHE", 10, "ip", "-6", "neigh", "show", NULL); run_command("MULTICAST ADDRESSES", 10, "ip", "maddr", NULL); - - run_command("IPTABLES", 10, SU_PATH, "root", "iptables", "-L", "-nvx", NULL); - run_command("IP6TABLES", 10, SU_PATH, "root", "ip6tables", "-L", "-nvx", NULL); - run_command("IPTABLE NAT", 10, SU_PATH, "root", "iptables", "-t", "nat", "-L", "-nvx", NULL); - /* no ip6 nat */ - run_command("IPTABLE RAW", 10, SU_PATH, "root", "iptables", "-t", "raw", "-L", "-nvx", NULL); - run_command("IP6TABLE RAW", 10, SU_PATH, "root", "ip6tables", "-t", "raw", "-L", "-nvx", NULL); - - run_command("WIFI NETWORKS", 20, - SU_PATH, "root", "wpa_cli", "IFNAME=wlan0", "list_networks", NULL); + run_command("WIFI NETWORKS", 20, "wpa_cli", "IFNAME=wlan0", "list_networks", NULL); #ifdef FWDUMP_bcmdhd run_command("ND OFFLOAD TABLE", 5, @@ -1281,12 +1281,13 @@ int main(int argc, char *argv[]) { /* collect stack traces from Dalvik and native processes (needs root) */ dump_traces_path = dump_traces(); - /* Get the tombstone fds, recovery files, and mount info here while we are running as root. */ + /* Run some operations that require root. */ get_tombstone_fds(tombstone_data); add_dir(RECOVERY_DIR, true); add_dir(RECOVERY_DATA_DIR, true); add_dir(LOGPERSIST_DATA_DIR, false); add_mountinfo(); + dump_iptables(); if (!drop_root_user()) { return -1; |