summaryrefslogtreecommitdiffstats
path: root/libnetutils
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:08:08 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2008-12-17 18:08:08 -0800
commit35237d135807af84bf9b0e5b8d7f8633e58db6f5 (patch)
treed8bcf3ada2182d248604728285dd80abb466f22a /libnetutils
parent4f6e8d7a00cbeda1e70cc15be9c4af1018bdad53 (diff)
downloadsystem_core-35237d135807af84bf9b0e5b8d7f8633e58db6f5.zip
system_core-35237d135807af84bf9b0e5b8d7f8633e58db6f5.tar.gz
system_core-35237d135807af84bf9b0e5b8d7f8633e58db6f5.tar.bz2
Code drop from //branches/cupcake/...@124589
Diffstat (limited to 'libnetutils')
-rw-r--r--libnetutils/dhcp_utils.c16
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;
}