dump_file("NETWORK ROUTES", "/proc/net/route");
dump_file("NETWORK ROUTES IPV6", "/proc/net/ipv6_route");
+ 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_file("ARP CACHE", "/proc/net/arp");
run_command("IPTABLES", 10, "su", "root", "iptables", "-L", "-nvx", NULL);
run_command("IP6TABLES", 10, "su", "root", "ip6tables", "-L", "-nvx", NULL);
NetworkInterface internalNetworkInterface =
NetworkInterface.getByName(internalInterface);
- Collection<InterfaceAddress>interfaceAddresses =
- internalNetworkInterface.getInterfaceAddresses();
- cmd += " " + interfaceAddresses.size();
- for (InterfaceAddress ia : interfaceAddresses) {
- InetAddress addr = NetworkUtils.getNetworkPart(ia.getAddress(),
- ia.getNetworkPrefixLength());
- cmd = cmd + " " + addr.getHostAddress() + "/" + ia.getNetworkPrefixLength();
+ if (internalNetworkInterface == null) {
+ cmd += " 0";
+ } else {
+ Collection<InterfaceAddress>interfaceAddresses =
+ internalNetworkInterface.getInterfaceAddresses();
+ cmd += " " + interfaceAddresses.size();
+ for (InterfaceAddress ia : interfaceAddresses) {
+ InetAddress addr = NetworkUtils.getNetworkPart(ia.getAddress(),
+ ia.getNetworkPrefixLength());
+ cmd = cmd + " " + addr.getHostAddress() + "/" + ia.getNetworkPrefixLength();
+ }
}
mConnector.doCommand(cmd);
// set link addresses
if (addresses != null && addresses.length > 0) {
for (String addr : addresses) {
+ addr = addr.trim();
+ if (addr.isEmpty()) continue;
LinkAddress la;
int addrPrefixLen;
// set dns servers
if (dnses != null && dnses.length > 0) {
for (String addr : dnses) {
+ addr = addr.trim();
+ if (addr.isEmpty()) continue;
InetAddress ia;
try {
ia = NetworkUtils.numericToInetAddress(addr);
dnsServers[0] = SystemProperties.get(propertyPrefix + "dns1");
dnsServers[1] = SystemProperties.get(propertyPrefix + "dns2");
for (String dnsAddr : dnsServers) {
+ dnsAddr = dnsAddr.trim();
+ if (dnsAddr.isEmpty()) continue;
InetAddress ia;
try {
ia = NetworkUtils.numericToInetAddress(dnsAddr);
}
}
for (String addr : gateways) {
+ addr = addr.trim();
+ if (addr.isEmpty()) continue;
InetAddress ia;
try {
ia = NetworkUtils.numericToInetAddress(addr);