diff options
Diffstat (limited to 'libnetutils')
-rw-r--r-- | libnetutils/dhcp_utils.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/libnetutils/dhcp_utils.c b/libnetutils/dhcp_utils.c index d18931b..398d9c4 100644 --- a/libnetutils/dhcp_utils.c +++ b/libnetutils/dhcp_utils.c @@ -70,7 +70,8 @@ static int fill_ip_info(const char *interface, char *dns1, char *dns2, char *server, - uint32_t *lease) + uint32_t *lease, + char *vendorInfo) { char prop_name[PROPERTY_KEY_MAX]; char prop_value[PROPERTY_VALUE_MAX]; @@ -122,6 +123,10 @@ static int fill_ip_info(const char *interface, if (property_get(prop_name, prop_value, NULL)) { *lease = atol(prop_value); } + + snprintf(prop_name, sizeof(prop_name), "%s.%s.vendorInfo", DHCP_PROP_NAME_PREFIX, interface); + property_get(prop_name, vendorInfo, NULL); + return 0; } @@ -158,7 +163,8 @@ int dhcp_do_request(const char *interface, char *dns1, char *dns2, char *server, - uint32_t *lease) + uint32_t *lease, + char *vendorInfo) { char result_prop_name[PROPERTY_KEY_MAX]; char daemon_prop_name[PROPERTY_KEY_MAX]; @@ -207,8 +213,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) - == -1) { + if (fill_ip_info(interface, ipaddr, gateway, prefixLength, + dns1, dns2, server, lease, vendorInfo) == -1) { return -1; } @@ -305,7 +311,8 @@ int dhcp_do_request_renew(const char *interface, in_addr_t *dns1, in_addr_t *dns2, in_addr_t *server, - uint32_t *lease) + uint32_t *lease, + char *vendorInfo) { char result_prop_name[PROPERTY_KEY_MAX]; char prop_value[PROPERTY_VALUE_MAX] = {'\0'}; @@ -341,7 +348,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); + fill_ip_info(interface, ipaddr, gateway, prefixLength, + dns1, dns2, server, lease, vendorInfo); return 0; } else { snprintf(errmsg, sizeof(errmsg), "DHCP Renew result was %s", prop_value); |