system/core
修訂 | f4d4c8f3662fd121f7336e88b4c00671ccbd773d (tree) |
---|---|
時間 | 2010-04-14 19:33:44 |
作者 | Yi SUn <beyounn@gmai...> |
Commiter | Chih-Wei Huang |
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
@@ -131,16 +131,18 @@ int dhcp_do_request(const char *interface, | ||
131 | 131 | char prop_value[PROPERTY_VALUE_MAX] = {'\0'}; |
132 | 132 | const char *ctrl_prop = "ctl.start"; |
133 | 133 | const char *desired_status = "running"; |
134 | + char daemon_name[PROPERTY_KEY_MAX]; | |
134 | 135 | |
135 | 136 | snprintf(result_prop_name, sizeof(result_prop_name), "%s.%s.result", |
136 | 137 | DHCP_PROP_NAME_PREFIX, |
137 | 138 | interface); |
138 | 139 | /* Erase any previous setting of the dhcp result property */ |
139 | 140 | property_set(result_prop_name, ""); |
140 | - | |
141 | + snprintf(daemon_name, PROPERTY_KEY_MAX,"%s%s",DAEMON_NAME,interface); | |
141 | 142 | /* 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) { | |
144 | 146 | snprintf(errmsg, sizeof(errmsg), "%s", "Timed out waiting for dhcpcd to start"); |
145 | 147 | return -1; |
146 | 148 | } |
@@ -173,13 +175,16 @@ int dhcp_stop(const char *interface) | ||
173 | 175 | char result_prop_name[PROPERTY_KEY_MAX]; |
174 | 176 | const char *ctrl_prop = "ctl.stop"; |
175 | 177 | const char *desired_status = "stopped"; |
178 | + char daemon_name[PROPERTY_KEY_MAX]; | |
176 | 179 | |
177 | 180 | snprintf(result_prop_name, sizeof(result_prop_name), "%s.%s.result", |
178 | 181 | DHCP_PROP_NAME_PREFIX, |
179 | 182 | interface); |
183 | + snprintf(daemon_name, PROPERTY_KEY_MAX,"%s%s",DAEMON_NAME,interface); | |
180 | 184 | /* 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) { | |
183 | 188 | return -1; |
184 | 189 | } |
185 | 190 | property_set(result_prop_name, "failed"); |