summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Shmidt2013-07-24 19:37:05 -0500
committerDmitry Shmidt2013-08-02 16:09:09 -0500
commitbe06210c508d5878dcc7d185e5613f4c7e38dfe8 (patch)
treee45b1f351672d572b9dc8bd8de227c6fedcebc69
parentb4802413a72e74b41c674d93f30a56a4a693a862 (diff)
downloadplatform-system-core-be06210c508d5878dcc7d185e5613f4c7e38dfe8.tar.gz
platform-system-core-be06210c508d5878dcc7d185e5613f4c7e38dfe8.tar.xz
platform-system-core-be06210c508d5878dcc7d185e5613f4c7e38dfe8.zip
libnetutils: Get mtu together with dhcp session results
Change-Id: I517fd1f62d451b07466a21a2b770d9ce389dac19 Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
-rw-r--r--include/netutils/dhcp.h8
-rw-r--r--libnetutils/dhcp_utils.c17
2 files changed, 18 insertions, 7 deletions
diff --git a/include/netutils/dhcp.h b/include/netutils/dhcp.h
index bd2c9571a..de6bc82f4 100644
--- a/include/netutils/dhcp.h
+++ b/include/netutils/dhcp.h
@@ -30,7 +30,9 @@ extern int dhcp_do_request(const char *ifname,
30 char *dns[], 30 char *dns[],
31 char *server, 31 char *server,
32 uint32_t *lease, 32 uint32_t *lease,
33 char *vendorInfo); 33 char *vendorInfo,
34 char *domain,
35 char *mtu);
34extern int dhcp_do_request_renew(const char *ifname, 36extern int dhcp_do_request_renew(const char *ifname,
35 char *ipaddr, 37 char *ipaddr,
36 char *gateway, 38 char *gateway,
@@ -38,7 +40,9 @@ extern int dhcp_do_request_renew(const char *ifname,
38 char *dns[], 40 char *dns[],
39 char *server, 41 char *server,
40 uint32_t *lease, 42 uint32_t *lease,
41 char *vendorInfo); 43 char *vendorInfo,
44 char *domain,
45 char *mtu);
42extern int dhcp_stop(const char *ifname); 46extern int dhcp_stop(const char *ifname);
43extern int dhcp_release_lease(const char *ifname); 47extern int dhcp_release_lease(const char *ifname);
44extern char *dhcp_get_errmsg(); 48extern char *dhcp_get_errmsg();
diff --git a/libnetutils/dhcp_utils.c b/libnetutils/dhcp_utils.c
index da00f7436..e1df87481 100644
--- a/libnetutils/dhcp_utils.c
+++ b/libnetutils/dhcp_utils.c
@@ -92,7 +92,8 @@ static int fill_ip_info(const char *interface,
92 char *server, 92 char *server,
93 uint32_t *lease, 93 uint32_t *lease,
94 char *vendorInfo, 94 char *vendorInfo,
95 char *domain) 95 char *domain,
96 char *mtu)
96{ 97{
97 char prop_name[PROPERTY_KEY_MAX]; 98 char prop_name[PROPERTY_KEY_MAX];
98 char prop_value[PROPERTY_VALUE_MAX]; 99 char prop_value[PROPERTY_VALUE_MAX];
@@ -158,6 +159,10 @@ static int fill_ip_info(const char *interface,
158 p2p_interface); 159 p2p_interface);
159 property_get(prop_name, domain, NULL); 160 property_get(prop_name, domain, NULL);
160 161
162 snprintf(prop_name, sizeof(prop_name), "%s.%s.mtu", DHCP_PROP_NAME_PREFIX,
163 p2p_interface);
164 property_get(prop_name, mtu, NULL);
165
161 return 0; 166 return 0;
162} 167}
163 168
@@ -186,7 +191,8 @@ int dhcp_do_request(const char *interface,
186 char *server, 191 char *server,
187 uint32_t *lease, 192 uint32_t *lease,
188 char *vendorInfo, 193 char *vendorInfo,
189 char *domain) 194 char *domain,
195 char *mtu)
190{ 196{
191 char result_prop_name[PROPERTY_KEY_MAX]; 197 char result_prop_name[PROPERTY_KEY_MAX];
192 char daemon_prop_name[PROPERTY_KEY_MAX]; 198 char daemon_prop_name[PROPERTY_KEY_MAX];
@@ -238,7 +244,7 @@ int dhcp_do_request(const char *interface,
238 if (strcmp(prop_value, "ok") == 0) { 244 if (strcmp(prop_value, "ok") == 0) {
239 char dns_prop_name[PROPERTY_KEY_MAX]; 245 char dns_prop_name[PROPERTY_KEY_MAX];
240 if (fill_ip_info(interface, ipaddr, gateway, prefixLength, dns, 246 if (fill_ip_info(interface, ipaddr, gateway, prefixLength, dns,
241 server, lease, vendorInfo, domain) == -1) { 247 server, lease, vendorInfo, domain, mtu) == -1) {
242 return -1; 248 return -1;
243 } 249 }
244 return 0; 250 return 0;
@@ -329,7 +335,8 @@ int dhcp_do_request_renew(const char *interface,
329 char *server, 335 char *server,
330 uint32_t *lease, 336 uint32_t *lease,
331 char *vendorInfo, 337 char *vendorInfo,
332 char *domain) 338 char *domain,
339 char *mtu)
333{ 340{
334 char result_prop_name[PROPERTY_KEY_MAX]; 341 char result_prop_name[PROPERTY_KEY_MAX];
335 char prop_value[PROPERTY_VALUE_MAX] = {'\0'}; 342 char prop_value[PROPERTY_VALUE_MAX] = {'\0'};
@@ -366,7 +373,7 @@ int dhcp_do_request_renew(const char *interface,
366 } 373 }
367 if (strcmp(prop_value, "ok") == 0) { 374 if (strcmp(prop_value, "ok") == 0) {
368 return fill_ip_info(interface, ipaddr, gateway, prefixLength, dns, 375 return fill_ip_info(interface, ipaddr, gateway, prefixLength, dns,
369 server, lease, vendorInfo, domain); 376 server, lease, vendorInfo, domain, mtu);
370 } else { 377 } else {
371 snprintf(errmsg, sizeof(errmsg), "DHCP Renew result was %s", prop_value); 378 snprintf(errmsg, sizeof(errmsg), "DHCP Renew result was %s", prop_value);
372 return -1; 379 return -1;