Skip to contentSkip to conversation

Do not redefine DEFAULT_NETWORK_{, DOWN_}SCRIPT

PATCH In review Ian Jackson 2 participants 4 messages Jun 12, 2008 – Jun 13, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Do not redefine DEFAULT_NETWORK_{, DOWN_}SCRIPT

With this change it is possible to change the default network script with a change to CPPFLAGS or a suitable config.h, for example
-DDEFAULT_NETWORK_SCRIPT='"/path/to/some/script/of/mine/ifup"' \
-DDEFAULT_NETWORK_DOWN_SCRIPT='"/path/to/some/script/of/mine/ifdown"'

My patch assumes that you'll want to override both defaults, or neither.

---
 vl.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
vl.c +2 -0
index f1d92c1..229b536 100644
@@ -131,8 +131,10 @@ int inet_aton(const char *cp, struct in_addr *ia);
 
 #include "exec-all.h"
 
+#ifndef DEFAULT_NETWORK_SCRIPT
 #define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
 #define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
+#endif
 #ifdef __sun__
 #define SMBD_COMMAND "/usr/sfw/sbin/smbd"
 #else
Signature · 1 line
1.4.4.4
#1 lore raw
Quoted 5 lines · Ian Jackson

With this change it is possible to change the default network script with a change to CPPFLAGS or a suitable config.h, for example
-DDEFAULT_NETWORK_SCRIPT='"/path/to/some/script/of/mine/ifup"' \
-DDEFAULT_NETWORK_DOWN_SCRIPT='"/path/to/some/script/of/mine/ifdown"'

This is a good idea, but I think it should be something that is specified in ./configure.

Regards,

Anthony Liguori

Quoted 25 lines

My patch assumes that you'll want to override both defaults, or neither.

---
 vl.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
vl.c +2 -0
index f1d92c1..229b536 100644
@@ -131,8 +131,10 @@ int inet_aton(const char *cp, struct in_addr *ia);
 
 #include "exec-all.h"
 
+#ifndef DEFAULT_NETWORK_SCRIPT
 #define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
 #define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
+#endif
 #ifdef __sun__
 #define SMBD_COMMAND "/usr/sfw/sbin/smbd"
 #else
#2 lore raw

Anthony Liguori writes ("Re: [Qemu-devel] [PATCH] Do not redefine DEFAULT_NETWORK_{, DOWN_}SCRIPT"):

Quoted 9 lines
Quoted 5 lines · Ian Jackson

With this change it is possible to change the default network script with a change to CPPFLAGS or a suitable config.h, for example
-DDEFAULT_NETWORK_SCRIPT='"/path/to/some/script/of/mine/ifup"' \
-DDEFAULT_NETWORK_DOWN_SCRIPT='"/path/to/some/script/of/mine/ifdown"'

This is a good idea, but I think it should be something that is specified in ./configure.

Yes, I agree that ./configure should be able to provide a setting for this. I'll follow up with a patch which does that.

Ian.

#3 lore raw
In reply to Anthony Liguori

Anthony Liguori writes ("Re: [Qemu-devel] [PATCH] Do not redefine DEFAULT_NETWORK_{, DOWN_}SCRIPT"):

Quoted 2 lines

This is a good idea, but I think it should be something that is specified in ./configure.

In the attached patch, you can specify this as an argument to ./configure, --network-scripts=ifup,ifdown.
You need my previous patch too to avoid redefinition.

---
 configure |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
configure +14 -0
index c1ab850..0b9cbb2 100755
@@ -331,6 +331,10 @@ for opt do
   ;;
   --disable-curses) curses="no"
   ;;
+  --network-scripts=*) network_scripts="$optarg"
+  ;;
+  --network-script-ifup=*) network_script_ifup="$optarg"
+  ;;
   *) echo "ERROR: unknown option $opt"; show_help="yes"
   ;;
   esac
@@ -430,6 +434,7 @@ echo "  --enable-linux-user      enable all linux usermode emulation targets"
 echo "  --disable-linux-user     disable all linux usermode emulation targets"
 echo "  --enable-darwin-user     enable all darwin usermode emulation targets"
 echo "  --disable-darwin-user    disable all darwin usermode emulation targets"
+echo "  --network-scripts=IFUP,IFDOWN  use IFUP, IFDOWN for networking setup"
 echo "  --fmod-lib               path to FMOD library"
 echo "  --fmod-inc               path to FMOD includes"
 echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
@@ -1100,6 +1105,15 @@ if [ "$bsd" = "yes" ] ; then
   echo "#define _BSD 1" >> $config_h
 fi
 
+if [ "x$network_scripts" != x ]; then
+  cat >>$config_h <<END
+#define DEFAULT_NETWORK_SCRIPT "${network_scripts%,*}"
+#define DEFAULT_NETWORK_DOWN_SCRIPT "${network_scripts#*,}"
+END
+else
+  echo >>$config_h "/* DEFAULT_NETWORK_[DOWN_]SCRIPT not set */"
+fi
+
 echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h
 
 tools=
Signature · 1 line
1.4.4.4