• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/core


Commit MetaInfo

修訂f4d4c8f3662fd121f7336e88b4c00671ccbd773d (tree)
時間2010-04-14 19:33:44
作者Yi SUn <beyounn@gmai...>
CommiterChih-Wei Huang

Log Message

add etherenet state tracker support.

The dhcpcd somehow can not handle multiple interfaces with on command line.
I have to create different services for different interfaces

Change Summary

差異

--- a/libnetutils/dhcp_utils.c
+++ b/libnetutils/dhcp_utils.c
@@ -131,16 +131,18 @@ int dhcp_do_request(const char *interface,
131131 char prop_value[PROPERTY_VALUE_MAX] = {'\0'};
132132 const char *ctrl_prop = "ctl.start";
133133 const char *desired_status = "running";
134+ char daemon_name[PROPERTY_KEY_MAX];
134135
135136 snprintf(result_prop_name, sizeof(result_prop_name), "%s.%s.result",
136137 DHCP_PROP_NAME_PREFIX,
137138 interface);
138139 /* Erase any previous setting of the dhcp result property */
139140 property_set(result_prop_name, "");
140-
141+ snprintf(daemon_name, PROPERTY_KEY_MAX,"%s%s",DAEMON_NAME,interface);
141142 /* Start the daemon and wait until it's ready */
142- property_set(ctrl_prop, DAEMON_NAME);
143- if (wait_for_property(DAEMON_PROP_NAME, desired_status, 10) < 0) {
143+ property_set(ctrl_prop, daemon_name);
144+ snprintf(daemon_name, PROPERTY_KEY_MAX,"%s%s",DAEMON_PROP_NAME,interface);
145+ if (wait_for_property(daemon_name, desired_status, 10) < 0) {
144146 snprintf(errmsg, sizeof(errmsg), "%s", "Timed out waiting for dhcpcd to start");
145147 return -1;
146148 }
@@ -173,13 +175,16 @@ int dhcp_stop(const char *interface)
173175 char result_prop_name[PROPERTY_KEY_MAX];
174176 const char *ctrl_prop = "ctl.stop";
175177 const char *desired_status = "stopped";
178+ char daemon_name[PROPERTY_KEY_MAX];
176179
177180 snprintf(result_prop_name, sizeof(result_prop_name), "%s.%s.result",
178181 DHCP_PROP_NAME_PREFIX,
179182 interface);
183+ snprintf(daemon_name, PROPERTY_KEY_MAX,"%s%s",DAEMON_NAME,interface);
180184 /* Stop the daemon and wait until it's reported to be stopped */
181- property_set(ctrl_prop, DAEMON_NAME);
182- if (wait_for_property(DAEMON_PROP_NAME, desired_status, 5) < 0) {
185+ property_set(ctrl_prop, daemon_name);
186+ snprintf(daemon_name, PROPERTY_KEY_MAX,"%s%s",DAEMON_PROP_NAME,interface);
187+ if (wait_for_property(daemon_name, desired_status, 5) < 0) {
183188 return -1;
184189 }
185190 property_set(result_prop_name, "failed");