3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-23 06:02:37 +01:00

netconfig: Do not leak l_acd if static IP is used

==209==    by 0x43E48A: netconfig_ipv4_select_and_install (netconfig.c:887)
==209==    by 0x43E48A: netconfig_configure (netconfig.c:1025)
==209==    by 0x41743C: station_connect_cb (station.c:2556)
==209==    by 0x408E0D: netdev_connect_ok (netdev.c:1311)
==209==    by 0x47549E: process_unicast (genl.c:994)
==209==    by 0x47549E: received_data (genl.c:1102)
==209==    by 0x4720EB: io_callback (io.c:120)
==209==    by 0x47130C: l_main_iterate (main.c:478)
==209==    by 0x4713DB: l_main_run (main.c:525)
==209==    by 0x4713DB: l_main_run (main.c:507)
==209==    by 0x4715EB: l_main_run_with_signal (main.c:647)
==209==    by 0x403EE1: main (main.c:550)
This commit is contained in:
Denis Kenzior 2021-05-19 13:50:56 -05:00
parent 66b73262df
commit 23451be606

View File

@ -824,24 +824,32 @@ static void netconfig_dhcp6_event_handler(struct l_dhcp6_client *client,
} }
} }
static void netconfig_remove_v4_address(struct netconfig *netconfig)
{
if (!netconfig->v4_address)
return;
L_WARN_ON(!l_rtnl_ifaddr_delete(rtnl, netconfig->ifindex,
netconfig->v4_address,
netconfig_ifaddr_del_cmd_cb,
netconfig, NULL));
l_rtnl_address_free(netconfig->v4_address);
netconfig->v4_address = NULL;
}
static void netconfig_reset_v4(struct netconfig *netconfig) static void netconfig_reset_v4(struct netconfig *netconfig)
{ {
if (netconfig->rtm_protocol) { if (netconfig->rtm_protocol) {
if (netconfig->v4_address) { netconfig_remove_v4_address(netconfig);
L_WARN_ON(!l_rtnl_ifaddr_delete(rtnl,
netconfig->ifindex,
netconfig->v4_address,
netconfig_ifaddr_del_cmd_cb,
netconfig, NULL));
l_rtnl_address_free(netconfig->v4_address);
netconfig->v4_address = NULL;
}
l_strfreev(netconfig->dns4_overrides); l_strfreev(netconfig->dns4_overrides);
netconfig->dns4_overrides = NULL; netconfig->dns4_overrides = NULL;
l_dhcp_client_stop(netconfig->dhcp_client); l_dhcp_client_stop(netconfig->dhcp_client);
netconfig->rtm_protocol = 0; netconfig->rtm_protocol = 0;
l_acd_destroy(netconfig->acd);
netconfig->acd = NULL;
} }
} }
@ -872,7 +880,7 @@ static void netconfig_ipv4_acd_event(enum l_acd_event event, void *user_data)
* case. * case.
*/ */
l_error("netconfig: statically configured address was lost"); l_error("netconfig: statically configured address was lost");
netconfig_reset_v4(netconfig); netconfig_remove_v4_address(netconfig);
break; break;
} }
} }