be32_t router;
struct in_addr **dns;
uint16_t mtu;
+ char *hostname;
};
typedef struct DHCPLease DHCPLease;
return 0;
}
+int sd_dhcp_client_get_hostname(sd_dhcp_client *client, const char **hostname)
+{
+ assert_return(client, -EINVAL);
+ assert_return(hostname, -EINVAL);
+
+ switch (client->state) {
+ case DHCP_STATE_INIT:
+ case DHCP_STATE_SELECTING:
+ case DHCP_STATE_INIT_REBOOT:
+ case DHCP_STATE_REBOOTING:
+ case DHCP_STATE_REQUESTING:
+ return -EADDRNOTAVAIL;
+
+ case DHCP_STATE_BOUND:
+ case DHCP_STATE_RENEWING:
+ case DHCP_STATE_REBINDING:
+ if (client->lease->hostname)
+ *hostname = client->lease->hostname;
+ else
+ return -ENOENT;
+
+ break;
+ }
+
+ return 0;
+}
+
int sd_dhcp_client_prefixlen(const struct in_addr *addr)
{
int len = 0;
break;
+ case DHCP_OPTION_HOST_NAME:
+ if (len >= 1) {
+ free(lease->hostname);
+ lease->hostname = strndup((const char *)option, len);
+ }
+
+ break;
+
case DHCP_OPTION_RENEWAL_T1_TIME:
if (len == 4) {
memcpy(&val, option, 4);