Loading cmds/dumpstate/dumpstate.c +3 −4 Original line number Diff line number Diff line Loading @@ -180,10 +180,9 @@ static void dumpstate() { run_command("NETWORK INTERFACES", 10, SU_PATH, "root", "netcfg", NULL); run_command("IP RULES", 10, "ip", "rule", "show", NULL); run_command("IP RULES v6", 10, "ip", "-6", "rule", "show", NULL); run_command("ROUTE TABLE 60", 10, "ip", "route", "show", "table", "60", NULL); run_command("ROUTE TABLE 61 v6", 10, "ip", "-6", "route", "show", "table", "60", NULL); run_command("ROUTE TABLE 61", 10, "ip", "route", "show", "table", "61", NULL); run_command("ROUTE TABLE 61 v6", 10, "ip", "-6", "route", "show", "table", "61", NULL); dump_route_tables(); dump_file("ARP CACHE", "/proc/net/arp"); run_command("IPTABLES", 10, SU_PATH, "root", "iptables", "-L", "-nvx", NULL); run_command("IP6TABLES", 10, SU_PATH, "root", "ip6tables", "-L", "-nvx", NULL); Loading cmds/dumpstate/dumpstate.h +3 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,9 @@ void do_dmesg(); /* Dumps settings for a given user id */ void do_dump_settings(int userid); /* Prints the contents of all the routing tables, both IPv4 and IPv6. */ void dump_route_tables(); /* Play a sound via Stagefright */ void play_sound(const char* path); Loading cmds/dumpstate/utils.c +19 −0 Original line number Diff line number Diff line Loading @@ -632,3 +632,22 @@ error_close_fd: void play_sound(const char* path) { run_command(NULL, 5, "/system/bin/stagefright", "-o", "-a", path, NULL); } void dump_route_tables() { const char* const RT_TABLES_PATH = "/data/misc/net/rt_tables"; dump_file("RT_TABLES", RT_TABLES_PATH); FILE* fp = fopen(RT_TABLES_PATH, "r"); if (!fp) { printf("*** %s: %s\n", RT_TABLES_PATH, strerror(errno)); return; } char table[16]; // Each line has an integer (the table number), a space, and a string (the table name). We only // need the table number. It's a 32-bit unsigned number, so max 10 chars. Skip the table name. // Add a fixed max limit so this doesn't go awry. for (int i = 0; i < 64 && fscanf(fp, " %10s %*s", table) == 1; ++i) { run_command("ROUTE TABLE IPv4", 10, "ip", "-4", "route", "show", "table", table, NULL); run_command("ROUTE TABLE IPv6", 10, "ip", "-6", "route", "show", "table", table, NULL); } fclose(fp); } Loading
cmds/dumpstate/dumpstate.c +3 −4 Original line number Diff line number Diff line Loading @@ -180,10 +180,9 @@ static void dumpstate() { run_command("NETWORK INTERFACES", 10, SU_PATH, "root", "netcfg", NULL); run_command("IP RULES", 10, "ip", "rule", "show", NULL); run_command("IP RULES v6", 10, "ip", "-6", "rule", "show", NULL); run_command("ROUTE TABLE 60", 10, "ip", "route", "show", "table", "60", NULL); run_command("ROUTE TABLE 61 v6", 10, "ip", "-6", "route", "show", "table", "60", NULL); run_command("ROUTE TABLE 61", 10, "ip", "route", "show", "table", "61", NULL); run_command("ROUTE TABLE 61 v6", 10, "ip", "-6", "route", "show", "table", "61", NULL); dump_route_tables(); dump_file("ARP CACHE", "/proc/net/arp"); run_command("IPTABLES", 10, SU_PATH, "root", "iptables", "-L", "-nvx", NULL); run_command("IP6TABLES", 10, SU_PATH, "root", "ip6tables", "-L", "-nvx", NULL); Loading
cmds/dumpstate/dumpstate.h +3 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,9 @@ void do_dmesg(); /* Dumps settings for a given user id */ void do_dump_settings(int userid); /* Prints the contents of all the routing tables, both IPv4 and IPv6. */ void dump_route_tables(); /* Play a sound via Stagefright */ void play_sound(const char* path); Loading
cmds/dumpstate/utils.c +19 −0 Original line number Diff line number Diff line Loading @@ -632,3 +632,22 @@ error_close_fd: void play_sound(const char* path) { run_command(NULL, 5, "/system/bin/stagefright", "-o", "-a", path, NULL); } void dump_route_tables() { const char* const RT_TABLES_PATH = "/data/misc/net/rt_tables"; dump_file("RT_TABLES", RT_TABLES_PATH); FILE* fp = fopen(RT_TABLES_PATH, "r"); if (!fp) { printf("*** %s: %s\n", RT_TABLES_PATH, strerror(errno)); return; } char table[16]; // Each line has an integer (the table number), a space, and a string (the table name). We only // need the table number. It's a 32-bit unsigned number, so max 10 chars. Skip the table name. // Add a fixed max limit so this doesn't go awry. for (int i = 0; i < 64 && fscanf(fp, " %10s %*s", table) == 1; ++i) { run_command("ROUTE TABLE IPv4", 10, "ip", "-4", "route", "show", "table", table, NULL); run_command("ROUTE TABLE IPv6", 10, "ip", "-6", "route", "show", "table", table, NULL); } fclose(fp); }