diff options
author | Arne Schwabe <arne@rfc2549.org> | 2014-11-24 16:43:42 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2014-11-24 16:43:42 +0100 |
commit | 20b4f006493df4325be34d83d78c0df870207b8d (patch) | |
tree | 6b6dab08e5b3baf649084bc4086e330f44fc3680 /main/openvpn | |
parent | 2852394ed2ee4f04d8fe7f9cd52a9a8f7b53c7e7 (diff) |
Use pseudo gw as default gw on Android as a workaround for not being able to read /proc/net/route
--HG--
extra : rebase_source : 599f72587271291a1f2085dace253e62b5f344fe
Diffstat (limited to 'main/openvpn')
-rw-r--r-- | main/openvpn/src/openvpn/route.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/main/openvpn/src/openvpn/route.c b/main/openvpn/src/openvpn/route.c index c330169a..0fd29df6 100644 --- a/main/openvpn/src/openvpn/route.c +++ b/main/openvpn/src/openvpn/route.c @@ -2538,6 +2538,7 @@ get_default_gateway (struct route_gateway_info *rgi) CLEAR(*rgi); +#ifndef TARGET_ANDROID /* get default gateway IP addr */ { FILE *fp = fopen ("/proc/net/route", "r"); @@ -2594,6 +2595,11 @@ get_default_gateway (struct route_gateway_info *rgi) } } } +#else + /* Android, set some pseudo GW, addr is in host byte order */ + rgi->gateway.addr = 127 << 24 | 'd' << 16 | 'g' << 8 | 'w'; + rgi->flags |= RGI_ADDR_DEFINED; +#endif /* scan adapter list */ if (rgi->flags & RGI_ADDR_DEFINED) |