svn commit: trunk/busybox: networking scripts

vda at busybox.net vda at busybox.net
Thu Jul 19 21:49:31 UTC 2007


Author: vda
Date: 2007-07-19 14:49:30 -0700 (Thu, 19 Jul 2007)
New Revision: 19164

Log:
ifup/ifdown: make location of ifstate configurable



Modified:
   trunk/busybox/networking/Config.in
   trunk/busybox/networking/ifupdown.c
   trunk/busybox/scripts/defconfig


Changeset:
Modified: trunk/busybox/networking/Config.in
===================================================================
--- trunk/busybox/networking/Config.in	2007-07-18 22:32:40 UTC (rev 19163)
+++ trunk/busybox/networking/Config.in	2007-07-19 21:49:30 UTC (rev 19164)
@@ -225,6 +225,16 @@
 	  "ifconfig", "route" and "run-parts" or the "ip" command, either
 	  via busybox or via standalone utilities.
 
+config IFUPDOWN_IFSTATE_PATH
+	string "Absolute path to ifstate file"
+	default "/var/run/ifstate"
+	help
+	  ifupdown keeps state information in a file called ifstate.
+	  Typically it is located in /var/run/ifstate, however
+	  some distributions tend to put it in other places
+	  (debian, for example, uses /etc/network/run/ifstate).
+	  This config option defines location of ifstate.
+
 config FEATURE_IFUPDOWN_IP
 	bool "Use ip applet"
 	default n

Modified: trunk/busybox/networking/ifupdown.c
===================================================================
--- trunk/busybox/networking/ifupdown.c	2007-07-18 22:32:40 UTC (rev 19163)
+++ trunk/busybox/networking/ifupdown.c	2007-07-19 21:49:30 UTC (rev 19164)
@@ -10,7 +10,9 @@
  *  Changes to upstream version
  *  Remove checks for kernel version, assume kernel version 2.2.0 or better.
  *  Lines in the interfaces file cannot wrap.
- *  To adhere to the FHS, the default state file is /var/run/ifstate.
+ *  To adhere to the FHS, the default state file is /var/run/ifstate
+ *  (defined via CONFIG_IFUPDOWN_IFSTATE_PATH) and can be overridden by build
+ *  configuration.
  *
  * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
  */
@@ -1105,7 +1107,7 @@
 static llist_t *read_iface_state(void)
 {
 	llist_t *state_list = NULL;
-	FILE *state_fp = fopen("/var/run/ifstate", "r");
+	FILE *state_fp = fopen(CONFIG_IFUPDOWN_IFSTATE_PATH, "r");
 
 	if (state_fp) {
 		char *start, *end_ptr;
@@ -1275,7 +1277,7 @@
 			}
 
 			/* Actually write the new state */
-			state_fp = xfopen("/var/run/ifstate", "w");
+			state_fp = xfopen(CONFIG_IFUPDOWN_IFSTATE_PATH, "w");
 			state = state_list;
 			while (state) {
 				if (state->data) {

Modified: trunk/busybox/scripts/defconfig
===================================================================
--- trunk/busybox/scripts/defconfig	2007-07-18 22:32:40 UTC (rev 19163)
+++ trunk/busybox/scripts/defconfig	2007-07-19 21:49:30 UTC (rev 19164)
@@ -554,6 +554,7 @@
 CONFIG_FEATURE_IFCONFIG_HW=y
 CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y
 CONFIG_IFUPDOWN=y
+CONFIG_IFUPDOWN_IFSTATE_PATH="/var/run/ifstate"
 CONFIG_FEATURE_IFUPDOWN_IP=y
 CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y
 # CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set




More information about the busybox-cvs mailing list