commit 3021472358dc58c182a01ea32cb86d286fe8f85c
parent d71a604385f2c4c6a7a33d6292e5c4345083c725
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date: Sat, 25 Sep 2021 03:11:48 +0200
netconfig: Set netconfig_get_static6_gateway out param on success
Make sure to only set the netconfig_get_static6_gateway's out_mac
parameter on successful return and make sure to always set it, even if
to NULL.
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/netconfig.c b/src/netconfig.c
@@ -497,6 +497,7 @@ static struct l_rtnl_route *netconfig_get_static6_gateway(
{
L_AUTO_FREE_VAR(char *, gateway);
struct l_rtnl_route *ret;
+ const uint8_t *mac = NULL;
gateway = l_settings_get_string(netconfig->active_settings,
"IPv6", "Gateway");
@@ -508,7 +509,7 @@ static struct l_rtnl_route *netconfig_get_static6_gateway(
netconfig->fils_override->ipv6_gateway);
if (!l_memeqzero(netconfig->fils_override->ipv6_gateway_mac, 6))
- *out_mac = netconfig->fils_override->ipv6_gateway_mac;
+ mac = netconfig->fils_override->ipv6_gateway_mac;
} else if (!gateway)
return NULL;
@@ -522,6 +523,7 @@ static struct l_rtnl_route *netconfig_get_static6_gateway(
l_rtnl_route_set_priority(ret, ROUTE_PRIORITY_OFFSET);
l_rtnl_route_set_protocol(ret, RTPROT_STATIC);
+ *out_mac = mac;
return ret;
}
@@ -863,7 +865,7 @@ static void netconfig_ipv6_ifaddr_add_cmd_cb(int error, uint16_t type,
{
struct netconfig *netconfig = user_data;
struct l_rtnl_route *gateway;
- const uint8_t *gateway_mac = NULL;
+ const uint8_t *gateway_mac;
netconfig->addr6_add_cmd_id = 0;