summaryrefslogtreecommitdiffstats
path: root/libnetutils
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2013-01-11 15:38:59 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-01-11 15:38:59 -0800
commitc93d30f50d15ff0c5c2d2b364019743d6cdaa88f (patch)
tree2ffd9048d054b16ca25c9d49f645af0c52477843 /libnetutils
parent60efde774d96493483bd948805547680dfd7f41a (diff)
parentfdd573188d08fbd3739aeda19ef0f2d03752db9f (diff)
downloadsystem_core-c93d30f50d15ff0c5c2d2b364019743d6cdaa88f.zip
system_core-c93d30f50d15ff0c5c2d2b364019743d6cdaa88f.tar.gz
system_core-c93d30f50d15ff0c5c2d2b364019743d6cdaa88f.tar.bz2
Merge "Support 4 dns servers, up from 2"
Diffstat (limited to 'libnetutils')
-rw-r--r--libnetutils/dhcp_utils.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/libnetutils/dhcp_utils.c b/libnetutils/dhcp_utils.c
index d0f1315..bd48eff 100644
--- a/libnetutils/dhcp_utils.c
+++ b/libnetutils/dhcp_utils.c
@@ -88,8 +88,7 @@ static int fill_ip_info(const char *interface,
char *ipaddr,
char *gateway,
uint32_t *prefixLength,
- char *dns1,
- char *dns2,
+ char *dns[],
char *server,
uint32_t *lease,
char *vendorInfo,
@@ -99,6 +98,7 @@ static int fill_ip_info(const char *interface,
char prop_value[PROPERTY_VALUE_MAX];
/* Interface name after converting p2p0-p2p0-X to p2p to reuse system properties */
char p2p_interface[MAX_INTERFACE_LENGTH];
+ int x;
get_p2p_interface_replacement(interface, p2p_interface);
@@ -139,11 +139,11 @@ static int fill_ip_info(const char *interface,
}
*prefixLength = p;
}
- snprintf(prop_name, sizeof(prop_name), "%s.%s.dns1", DHCP_PROP_NAME_PREFIX, p2p_interface);
- property_get(prop_name, dns1, NULL);
- snprintf(prop_name, sizeof(prop_name), "%s.%s.dns2", DHCP_PROP_NAME_PREFIX, p2p_interface);
- property_get(prop_name, dns2, NULL);
+ for (x=0; dns[x] != NULL; x++) {
+ snprintf(prop_name, sizeof(prop_name), "%s.%s.dns%d", DHCP_PROP_NAME_PREFIX, p2p_interface, x+1);
+ property_get(prop_name, dns[x], NULL);
+ }
snprintf(prop_name, sizeof(prop_name), "%s.%s.leasetime", DHCP_PROP_NAME_PREFIX, p2p_interface);
if (property_get(prop_name, prop_value, NULL)) {
@@ -182,8 +182,7 @@ int dhcp_do_request(const char *interface,
char *ipaddr,
char *gateway,
uint32_t *prefixLength,
- char *dns1,
- char *dns2,
+ char *dns[],
char *server,
uint32_t *lease,
char *vendorInfo,
@@ -238,8 +237,8 @@ int dhcp_do_request(const char *interface,
}
if (strcmp(prop_value, "ok") == 0) {
char dns_prop_name[PROPERTY_KEY_MAX];
- if (fill_ip_info(interface, ipaddr, gateway, prefixLength,
- dns1, dns2, server, lease, vendorInfo, domain) == -1) {
+ if (fill_ip_info(interface, ipaddr, gateway, prefixLength, dns,
+ server, lease, vendorInfo, domain) == -1) {
return -1;
}
return 0;
@@ -326,8 +325,7 @@ int dhcp_do_request_renew(const char *interface,
char *ipaddr,
char *gateway,
uint32_t *prefixLength,
- char *dns1,
- char *dns2,
+ char *dns[],
char *server,
uint32_t *lease,
char *vendorInfo,
@@ -367,8 +365,8 @@ int dhcp_do_request_renew(const char *interface,
return -1;
}
if (strcmp(prop_value, "ok") == 0) {
- fill_ip_info(interface, ipaddr, gateway, prefixLength,
- dns1, dns2, server, lease, vendorInfo, domain);
+ fill_ip_info(interface, ipaddr, gateway, prefixLength, dns,
+ server, lease, vendorInfo, domain);
return 0;
} else {
snprintf(errmsg, sizeof(errmsg), "DHCP Renew result was %s", prop_value);