mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
netconfig: Implement netconfig_get_dhcp_server_ipv4
This uses l_dhcp_lease_get_server_id to get the IP of the server that offered us our current lease. l_dhcp_lease_get_server_id returns the vaue of the L_DHCP_OPTION_SERVER_IDENTIFIER option, which is the address that any unicast DHCP frames are supposed to be sent to so it seems to be the best way to get the P2P group owner's IP address as a P2P-client.
This commit is contained in:
parent
66f4981650
commit
bafd604834
@ -1149,6 +1149,20 @@ bool netconfig_reset(struct netconfig *netconfig)
|
||||
return true;
|
||||
}
|
||||
|
||||
char *netconfig_get_dhcp_server_ipv4(struct netconfig *netconfig)
|
||||
{
|
||||
const struct l_dhcp_lease *lease;
|
||||
|
||||
if (!netconfig->dhcp_client)
|
||||
return NULL;
|
||||
|
||||
lease = l_dhcp_client_get_lease(netconfig->dhcp_client);
|
||||
if (!lease)
|
||||
return NULL;
|
||||
|
||||
return l_dhcp_lease_get_server_id(lease);
|
||||
}
|
||||
|
||||
struct netconfig *netconfig_new(uint32_t ifindex)
|
||||
{
|
||||
struct netconfig *netconfig;
|
||||
|
@ -36,6 +36,7 @@ bool netconfig_configure(struct netconfig *netconfig,
|
||||
void *user_data);
|
||||
bool netconfig_reconfigure(struct netconfig *netconfig);
|
||||
bool netconfig_reset(struct netconfig *netconfig);
|
||||
char *netconfig_get_dhcp_server_ipv4(struct netconfig *netconfig);
|
||||
|
||||
struct netconfig *netconfig_new(uint32_t ifindex);
|
||||
void netconfig_destroy(struct netconfig *netconfig);
|
||||
|
Loading…
Reference in New Issue
Block a user