Skip to content

Commit

Permalink
DO NOT MERGE Change IP renew service name
Browse files Browse the repository at this point in the history
- Change invalid service name (dhcpcd_renew -> iprenew)
- Remove condition which checks status of renew service.
- Remove unused variable.

Change-Id: Ic4ae7fb950baf4bd7286088a945a48ab5fe64e91
  • Loading branch information
TK MUN authored and Simon Wilson committed Mar 22, 2011
1 parent 5b63884 commit 7238072
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions libnetutils/dhcp_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ static const char DAEMON_NAME[] = "dhcpcd";
static const char DAEMON_PROP_NAME[] = "init.svc.dhcpcd";
static const char HOSTNAME_PROP_NAME[] = "net.hostname";
static const char DHCP_PROP_NAME_PREFIX[] = "dhcp";
static const char DAEMON_NAME_RENEW[] = "dhcpcd_renew";
static const char DAEMON_PROP_NAME_RENEW[] = "init.svc.dhcpcd_renew";
static const char DHCP_PROP_NAME_RENEW_PREFIX[] = "dhcp_renew";
static const char DAEMON_NAME_RENEW[] = "iprenew";
static const int NAP_TIME = 1; /* wait for 1 second at a time */
/* when polling for property values */
static char errmsg[100];
Expand Down Expand Up @@ -254,18 +252,12 @@ int dhcp_do_request_renew(const char *interface,
uint32_t *lease)
{
char result_prop_name[PROPERTY_KEY_MAX];
char daemon_prop_name[PROPERTY_KEY_MAX];
char prop_value[PROPERTY_VALUE_MAX] = {'\0'};
char daemon_cmd[PROPERTY_VALUE_MAX * 2];
const char *ctrl_prop = "ctl.start";
const char *desired_status = "running";

snprintf(result_prop_name, sizeof(result_prop_name), "%s.%s.result",
DHCP_PROP_NAME_RENEW_PREFIX,
interface);

snprintf(daemon_prop_name, sizeof(daemon_prop_name), "%s_%s",
DAEMON_PROP_NAME_RENEW,
DHCP_PROP_NAME_PREFIX,
interface);

/* Erase any previous setting of the dhcp result property */
Expand All @@ -275,10 +267,6 @@ int dhcp_do_request_renew(const char *interface,
snprintf(daemon_cmd, sizeof(daemon_cmd), "%s_%s:%s", DAEMON_NAME_RENEW, interface, interface);
memset(prop_value, '\0', PROPERTY_VALUE_MAX);
property_set(ctrl_prop, daemon_cmd);
if (wait_for_property(daemon_prop_name, desired_status, 10) < 0) {
snprintf(errmsg, sizeof(errmsg), "%s", "Timed out waiting for dhcpcd Renew to start");
return -1;
}

/* Wait for the daemon to return a result */
if (wait_for_property(result_prop_name, NULL, 30) < 0) {
Expand Down

0 comments on commit 7238072

Please sign in to comment.