eiwd

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

commit cfde6c3f5546510c63940ab4cff6c4f646c72bd4
parent 927a3dc32236be23aac560bc31c1efc6212a0998
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date:   Thu, 21 Oct 2021 10:50:32 +0200

netconfig: Refactor netconfig_ipv4_get_gateway

Use a separate fils variable to make the code a bit prettier.

Also make sure that the out_mac parameter is not NULL prior to storing
the gateway_mac in it.

Diffstat:
Msrc/netconfig.c | 17++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/netconfig.c b/src/netconfig.c @@ -436,6 +436,8 @@ static char *netconfig_ipv4_get_gateway(struct netconfig *netconfig, { const struct l_dhcp_lease *lease; char *gateway; + const struct ie_fils_ip_addr_response_info *fils = + netconfig->fils_override; switch (netconfig->rtm_protocol) { case RTPROT_STATIC: @@ -449,15 +451,12 @@ static char *netconfig_ipv4_get_gateway(struct netconfig *netconfig, return gateway; case RTPROT_DHCP: - if (netconfig->fils_override && - netconfig->fils_override->ipv4_gateway) { - gateway = netconfig_ipv4_to_string( - netconfig->fils_override->ipv4_gateway); - - if (gateway && !l_memeqzero(netconfig->fils_override-> - ipv4_gateway_mac, 6)) - *out_mac = netconfig->fils_override-> - ipv4_gateway_mac; + if (fils && fils->ipv4_gateway) { + gateway = netconfig_ipv4_to_string(fils->ipv4_gateway); + + if (gateway && out_mac && + !l_memeqzero(fils->ipv4_gateway_mac, 6)) + *out_mac = fils->ipv4_gateway_mac; return gateway; }