summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Johansson <bjoernj@google.com>2017-07-27 15:41:08 -0700
committerRoman Kiryanov <rkir@google.com>2018-03-09 11:27:26 -0800
commitbc497e700e592450c632a898618866221420bf84 (patch)
tree17e3fb441a11794f252c1f3e4ce0fdf1dbe1ed4c
parentd20f07743b64e7670cb8e69e01b8c3ac55cea160 (diff)
downloadandroid_hardware_ril-bc497e700e592450c632a898618866221420bf84.tar.gz
android_hardware_ril-bc497e700e592450c632a898618866221420bf84.tar.bz2
android_hardware_ril-bc497e700e592450c632a898618866221420bf84.zip
Use system property gateway if not using WiFi
When running with WiFi the IPv4 gateway for the radio interface is known and can be hardcoded, even if TAP is enabled. This is because the gateway is the internal address in the router namespace. Without WiFi the radio interface is eth0, the public interface. The gateway for this interface can be dynamic if running with TAP networking so in that case it can't use a hardcoded gateway the way it used to. The DHCP client will set the net.eth0.gw system property to the gateway of the host network so use that property to give the correct gateway to the radio interface. Bug: 72886046 Test: manual, build and ran the emulator (steps from CTS tests) Change-Id: I110a1216cccc846a48befe4c8cb2e602ed63752f (cherry picked from commit cf111309af68ab095371ef495d2c78e1faf885a6) (cherry picked from commit 0de94de9dc67db550f50bf2ffe3360b7ce02907d)
-rw-r--r--reference-ril/reference-ril.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/reference-ril/reference-ril.c b/reference-ril/reference-ril.c
index 1a1eb9b..b04db97 100644
--- a/reference-ril/reference-ril.c
+++ b/reference-ril/reference-ril.c
@@ -34,8 +34,8 @@
#include "misc.h"
#include <getopt.h>
#include <sys/socket.h>
+#include <cutils/properties.h>
#include <cutils/sockets.h>
-#include <sys/system_properties.h>
#include <termios.h>
#include <qemu_pipe.h>
#include <sys/wait.h>
@@ -567,7 +567,7 @@ static void requestCallSelection(
static bool hasWifiCapability()
{
char propValue[PROP_VALUE_MAX];
- return __system_property_get("ro.kernel.qemu.wifi", propValue) != 0 &&
+ return property_get("ro.kernel.qemu.wifi", propValue, "") > 0 &&
strcmp("1", propValue) == 0;
}
@@ -726,7 +726,7 @@ static void requestOrSendDataCallList(RIL_Token *t)
snprintf(propName, sizeof propName, "net.eth0.dns%d", nn);
/* Ignore if undefined */
- if (__system_property_get(propName, propValue) == 0) {
+ if (property_get(propName, propValue, "") <= 0) {
continue;
}
@@ -740,7 +740,13 @@ static void requestOrSendDataCallList(RIL_Token *t)
/* There is only one gateway in the emulator. If WiFi is
* configured the interface visible to RIL will be behind a NAT
* where the gateway is different. */
- responses[i].gateways = hasWifi ? "192.168.200.1" : "10.0.2.2";
+ if (hasWifi) {
+ responses[i].gateways = "192.168.200.1";
+ } else if (property_get("net.eth0.gw", propValue, "") > 0) {
+ responses[i].gateways = propValue;
+ } else {
+ responses[i].gateways = "";
+ }
responses[i].mtu = DEFAULT_MTU;
}
else {