diff options
author | Dmitry Shmidt <dimitrysh@google.com> | 2013-07-24 17:37:05 -0700 |
---|---|---|
committer | Dmitry Shmidt <dimitrysh@google.com> | 2013-08-02 14:09:09 -0700 |
commit | be06210c508d5878dcc7d185e5613f4c7e38dfe8 (patch) | |
tree | e45b1f351672d572b9dc8bd8de227c6fedcebc69 | |
parent | b4802413a72e74b41c674d93f30a56a4a693a862 (diff) | |
download | system_core-be06210c508d5878dcc7d185e5613f4c7e38dfe8.zip system_core-be06210c508d5878dcc7d185e5613f4c7e38dfe8.tar.gz system_core-be06210c508d5878dcc7d185e5613f4c7e38dfe8.tar.bz2 |
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.h | 8 | ||||
-rw-r--r-- | libnetutils/dhcp_utils.c | 17 |
2 files changed, 18 insertions, 7 deletions
diff --git a/include/netutils/dhcp.h b/include/netutils/dhcp.h index bd2c957..de6bc82 100644 --- a/include/netutils/dhcp.h +++ b/include/netutils/dhcp.h @@ -30,7 +30,9 @@ extern int dhcp_do_request(const char *ifname, char *dns[], char *server, uint32_t *lease, - char *vendorInfo); + char *vendorInfo, + char *domain, + char *mtu); extern int dhcp_do_request_renew(const char *ifname, char *ipaddr, char *gateway, @@ -38,7 +40,9 @@ extern int dhcp_do_request_renew(const char *ifname, char *dns[], char *server, uint32_t *lease, - char *vendorInfo); + char *vendorInfo, + char *domain, + char *mtu); extern int dhcp_stop(const char *ifname); extern int dhcp_release_lease(const char *ifname); extern char *dhcp_get_errmsg(); diff --git a/libnetutils/dhcp_utils.c b/libnetutils/dhcp_utils.c index da00f74..e1df874 100644 --- a/libnetutils/dhcp_utils.c +++ b/libnetutils/dhcp_utils.c @@ -92,7 +92,8 @@ static int fill_ip_info(const char *interface, char *server, uint32_t *lease, char *vendorInfo, - char *domain) + char *domain, + char *mtu) { char prop_name[PROPERTY_KEY_MAX]; char prop_value[PROPERTY_VALUE_MAX]; @@ -158,6 +159,10 @@ static int fill_ip_info(const char *interface, p2p_interface); property_get(prop_name, domain, NULL); + snprintf(prop_name, sizeof(prop_name), "%s.%s.mtu", DHCP_PROP_NAME_PREFIX, + p2p_interface); + property_get(prop_name, mtu, NULL); + return 0; } @@ -186,7 +191,8 @@ int dhcp_do_request(const char *interface, char *server, uint32_t *lease, char *vendorInfo, - char *domain) + char *domain, + char *mtu) { char result_prop_name[PROPERTY_KEY_MAX]; char daemon_prop_name[PROPERTY_KEY_MAX]; @@ -238,7 +244,7 @@ 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, dns, - server, lease, vendorInfo, domain) == -1) { + server, lease, vendorInfo, domain, mtu) == -1) { return -1; } return 0; @@ -329,7 +335,8 @@ int dhcp_do_request_renew(const char *interface, char *server, uint32_t *lease, char *vendorInfo, - char *domain) + char *domain, + char *mtu) { char result_prop_name[PROPERTY_KEY_MAX]; char prop_value[PROPERTY_VALUE_MAX] = {'\0'}; @@ -366,7 +373,7 @@ int dhcp_do_request_renew(const char *interface, } if (strcmp(prop_value, "ok") == 0) { return fill_ip_info(interface, ipaddr, gateway, prefixLength, dns, - server, lease, vendorInfo, domain); + server, lease, vendorInfo, domain, mtu); } else { snprintf(errmsg, sizeof(errmsg), "DHCP Renew result was %s", prop_value); return -1; |