eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit bafd6048346f928717522df531ebf8c20d09c640
parent 66f498165026164914c99c7352f207b3b4f347fa
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date:   Sat, 11 Jul 2020 03:00:50 +0200

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.

Diffstat:
Msrc/netconfig.c | 14++++++++++++++
Msrc/netconfig.h | 1+
2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/netconfig.c b/src/netconfig.c @@ -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; diff --git a/src/netconfig.h b/src/netconfig.h @@ -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);