Skip to contentSkip to conversation

don't require ebtables in the host kernel

PATCH In review Avi Kivity 2 participants 3 messages Feb 22, 2006

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 don't require ebtables in the host kernel

The network-bridge script fails when setting a few sysctls which are only available if ebtables is present in the host kernel. Fix by ignoring the return value of the sysctl command.

tools/examples/network-bridge +3 -3
Index: xen/tools/examples/network-bridge
===================================================================
@@ -158,9 +158,9 @@
 
    # Don't create the bridge if it already exists.
    if ! brctl show | grep -q ${bridge} ; then
-	sysctl -w "net.bridge.bridge-nf-call-arptables=0"
-	sysctl -w "net.bridge.bridge-nf-call-ip6tables=0"
-	sysctl -w "net.bridge.bridge-nf-call-iptables=0"
+	! sysctl -w "net.bridge.bridge-nf-call-arptables=0"
+	! sysctl -w "net.bridge.bridge-nf-call-ip6tables=0"
+	! sysctl -w "net.bridge.bridge-nf-call-iptables=0"
	brctl addbr ${bridge}
	brctl stp ${bridge} off
	brctl setfd ${bridge} 0
Signature · 1 line
error compiling committee.c: too many arguments to function
#1 lore raw
Quoted 13 lines · Avi Kivity

The network-bridge script fails when setting a few sysctls which are only available if ebtables is present in the host kernel. Fix by ignoring the return value of the sysctl command.

Index: xen/tools/examples/network-bridge
===================================================================

tools/examples/network-bridge +0 -0
@@ -158,9 +158,9 @@
 
    # Don't create the bridge if it already exists.

tools/examples/network-bridge line 166

Quoted 10 lines
tools/examples/network-bridge +3 -3
    if ! brctl show | grep -q ${bridge} ; then
-	sysctl -w "net.bridge.bridge-nf-call-arptables=0"
-	sysctl -w "net.bridge.bridge-nf-call-ip6tables=0"
-	sysctl -w "net.bridge.bridge-nf-call-iptables=0"
+	! sysctl -w "net.bridge.bridge-nf-call-arptables=0"
+	! sysctl -w "net.bridge.bridge-nf-call-ip6tables=0"
+	! sysctl -w "net.bridge.bridge-nf-call-iptables=0"
 	brctl addbr ${bridge}
 	brctl stp ${bridge} off
 	brctl setfd ${bridge} 0

Where did this network-bridge script come from? The stock Xen-3.0 network-bridge doesn't have these sysctl lines in the first place.

Furthermore, using ! doesn't ignore the return value -- it inverts it. I'd be surprised if this works in systems that _do_ have ebtables.

Ewan.

author
#2 lore raw
Quoted 4 lines · Ewan Mellor
Quoted 4 lines
tools/examples/network-bridge +0 -0
@@ -158,9 +158,9 @@
 
Quoted 18 lines

tools/examples/network-bridge

Quoted 13 lines
tools/examples/network-bridge +3 -3
   # Don't create the bridge if it already exists.
   if ! brctl show | grep -q ${bridge} ; then
-	sysctl -w "net.bridge.bridge-nf-call-arptables=0"
-	sysctl -w "net.bridge.bridge-nf-call-ip6tables=0"
-	sysctl -w "net.bridge.bridge-nf-call-iptables=0"
+	! sysctl -w "net.bridge.bridge-nf-call-arptables=0"
+	! sysctl -w "net.bridge.bridge-nf-call-ip6tables=0"
+	! sysctl -w "net.bridge.bridge-nf-call-iptables=0"
 	brctl addbr ${bridge}
 	brctl stp ${bridge} off
 	brctl setfd ${bridge} 0

Where did this network-bridge script come from? The stock Xen-3.0 network-bridge doesn't have these sysctl lines in the first place.

It comes from FC5. Sorry, should have checked the pristine Xen sources. Sorry about the noise.

Quoted 4 lines

Furthermore, using ! doesn't ignore the return value -- it inverts it. I'd be surprised if this works in systems that _do_ have ebtables.

No, ! on the beginning of a command tells bash to ignore the exit code:

`-e'
Exit immediately if a simple command (*note Simple Commands::) exits with a non-zero status, unless the command that fails is part of the command list immediately following a while' or until' keyword, part of the test in an if' statement, part of a &&' or ||' list, or if the command's return status is being inverted using !'. A trap on `ERR', if set, is executed before the shell exits.

'sysctl -ew' would have been better though.

Signature · 1 line
error compiling committee.c: too many arguments to function