diff options
Diffstat (limited to 'libnetutils')
-rw-r--r-- | libnetutils/dhcp_utils.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libnetutils/dhcp_utils.c b/libnetutils/dhcp_utils.c index 97fe76d..ba98933 100644 --- a/libnetutils/dhcp_utils.c +++ b/libnetutils/dhcp_utils.c @@ -181,6 +181,22 @@ int dhcp_stop(const char *interface) return 0; } +/** + * Release the current DHCP client lease. + */ +int dhcp_release_lease(const char *interface) +{ + const char *ctrl_prop = "ctl.stop"; + const char *desired_status = "stopped"; + + /* Stop the daemon and wait until it's reported to be stopped */ + property_set(ctrl_prop, DAEMON_NAME); + if (wait_for_property(DAEMON_PROP_NAME, desired_status, 5) < 0) { + return -1; + } + return 0; +} + char *dhcp_get_errmsg() { return errmsg; } |