sd-dhcp-client: Add reference counting for DHCP

System Internals / systemd - Patrik Flykt [linux.intel.com] - 11 April 2014 02:53 UTC

The DHCP library user can decide to free the DHCP client any time the callback is called. After the callback has been called, other computations may still be needed - the best example being a full restart of the DHCP procedure in case of lease expiry.

Fix this by introducing proper reference counting. Properly handle a returned NULL from the notify and stop functions if the DHCP client was freed.

e5b04c8 sd-dhcp-client: Add reference counting for DHCP
src/libsystemd-network/sd-dhcp-client.c | 93 ++++++++++++++++++++---------
src/libsystemd-network/test-dhcp-client.c | 4 +-
src/network/networkd-link.c | 2 +-
src/systemd/sd-dhcp-client.h | 5 +-
4 files changed, 72 insertions(+), 32 deletions(-)

Upstream: github.com


  • Share