diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-19 21:49:30 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-19 21:49:30 +0000 |
commit | 2a86a61c270a7d64bcc18a81b0d9004699b1be0f (patch) | |
tree | 6c97c107c7eaae830141f6feb9de8fccfa938ef1 | |
parent | 2414a96faae906da8519229f12bebe5fe00078e7 (diff) | |
download | busybox-w32-2a86a61c270a7d64bcc18a81b0d9004699b1be0f.tar.gz busybox-w32-2a86a61c270a7d64bcc18a81b0d9004699b1be0f.tar.bz2 busybox-w32-2a86a61c270a7d64bcc18a81b0d9004699b1be0f.zip |
ifup/ifdown: make location of ifstate configurable
-rw-r--r-- | networking/Config.in | 10 | ||||
-rw-r--r-- | networking/ifupdown.c | 8 | ||||
-rw-r--r-- | scripts/defconfig | 1 |
3 files changed, 16 insertions, 3 deletions
diff --git a/networking/Config.in b/networking/Config.in index 77b5d2558..2ea0650a0 100644 --- a/networking/Config.in +++ b/networking/Config.in | |||
@@ -225,6 +225,16 @@ config IFUPDOWN | |||
225 | "ifconfig", "route" and "run-parts" or the "ip" command, either | 225 | "ifconfig", "route" and "run-parts" or the "ip" command, either |
226 | via busybox or via standalone utilities. | 226 | via busybox or via standalone utilities. |
227 | 227 | ||
228 | config IFUPDOWN_IFSTATE_PATH | ||
229 | string "Absolute path to ifstate file" | ||
230 | default "/var/run/ifstate" | ||
231 | help | ||
232 | ifupdown keeps state information in a file called ifstate. | ||
233 | Typically it is located in /var/run/ifstate, however | ||
234 | some distributions tend to put it in other places | ||
235 | (debian, for example, uses /etc/network/run/ifstate). | ||
236 | This config option defines location of ifstate. | ||
237 | |||
228 | config FEATURE_IFUPDOWN_IP | 238 | config FEATURE_IFUPDOWN_IP |
229 | bool "Use ip applet" | 239 | bool "Use ip applet" |
230 | default n | 240 | default n |
diff --git a/networking/ifupdown.c b/networking/ifupdown.c index e9f0a646c..5aa3fa5f1 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c | |||
@@ -10,7 +10,9 @@ | |||
10 | * Changes to upstream version | 10 | * Changes to upstream version |
11 | * Remove checks for kernel version, assume kernel version 2.2.0 or better. | 11 | * Remove checks for kernel version, assume kernel version 2.2.0 or better. |
12 | * Lines in the interfaces file cannot wrap. | 12 | * Lines in the interfaces file cannot wrap. |
13 | * To adhere to the FHS, the default state file is /var/run/ifstate. | 13 | * To adhere to the FHS, the default state file is /var/run/ifstate |
14 | * (defined via CONFIG_IFUPDOWN_IFSTATE_PATH) and can be overridden by build | ||
15 | * configuration. | ||
14 | * | 16 | * |
15 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | 17 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. |
16 | */ | 18 | */ |
@@ -1105,7 +1107,7 @@ static llist_t *find_iface_state(llist_t *state_list, const char *iface) | |||
1105 | static llist_t *read_iface_state(void) | 1107 | static llist_t *read_iface_state(void) |
1106 | { | 1108 | { |
1107 | llist_t *state_list = NULL; | 1109 | llist_t *state_list = NULL; |
1108 | FILE *state_fp = fopen("/var/run/ifstate", "r"); | 1110 | FILE *state_fp = fopen(CONFIG_IFUPDOWN_IFSTATE_PATH, "r"); |
1109 | 1111 | ||
1110 | if (state_fp) { | 1112 | if (state_fp) { |
1111 | char *start, *end_ptr; | 1113 | char *start, *end_ptr; |
@@ -1275,7 +1277,7 @@ int ifupdown_main(int argc, char **argv) | |||
1275 | } | 1277 | } |
1276 | 1278 | ||
1277 | /* Actually write the new state */ | 1279 | /* Actually write the new state */ |
1278 | state_fp = xfopen("/var/run/ifstate", "w"); | 1280 | state_fp = xfopen(CONFIG_IFUPDOWN_IFSTATE_PATH, "w"); |
1279 | state = state_list; | 1281 | state = state_list; |
1280 | while (state) { | 1282 | while (state) { |
1281 | if (state->data) { | 1283 | if (state->data) { |
diff --git a/scripts/defconfig b/scripts/defconfig index 4d12f8ec5..088ff791a 100644 --- a/scripts/defconfig +++ b/scripts/defconfig | |||
@@ -554,6 +554,7 @@ CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y | |||
554 | CONFIG_FEATURE_IFCONFIG_HW=y | 554 | CONFIG_FEATURE_IFCONFIG_HW=y |
555 | CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y | 555 | CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y |
556 | CONFIG_IFUPDOWN=y | 556 | CONFIG_IFUPDOWN=y |
557 | CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate" | ||
557 | CONFIG_FEATURE_IFUPDOWN_IP=y | 558 | CONFIG_FEATURE_IFUPDOWN_IP=y |
558 | CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y | 559 | CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y |
559 | # CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set | 560 | # CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set |