All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools: Fix network-bridge to work with Gentoo
@ 2005-09-29 22:20 Jon Mason
  2005-09-29 23:11 ` Dan Smith
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jon Mason @ 2005-09-29 22:20 UTC (permalink / raw)
  To: xen-devel

This patch fixes domU networking in Gentoo.  The change to ifup/ifdown
(which isn't availabe in Gentoo) prevents the bridge from being setup
correctly.  The patch below checks if ifup is avaiable, and if not
starts the Gentoo networking scripts.  

Signed-off-by: Jon Mason <jdmason@us.ibm.com>

# HG changeset patch
# User root@pentium4
# Node ID 07ba15ba986268ff869d7d2253eab8eed3edbe8b
# Parent  f529cd119470032c2bc70b21432e733f9605727b
Fix network-bridge to work with Gentoo

diff -r f529cd119470 -r 07ba15ba9862 tools/examples/network-bridge
--- a/tools/examples/network-bridge	Thu Sep 29 17:28:28 2005
+++ b/tools/examples/network-bridge	Thu Sep 29 22:03:46 2005
@@ -177,7 +177,12 @@
 
     if ifconfig veth0 2>/dev/null | grep -q veth0 ; then
 	mac=`ifconfig ${netdev} | grep HWadd | sed -e 's/.*\(..:..:..:..:..:..\).*/\1/'`
-	if ! ifdown ${netdev} ; then
+	if which ifdown 2> /dev/null ; then
+		ifdown ${netdev} 2> RC=$?
+	else
+        	/etc/init.d/net.${netdev} stop 2> RC=$? 
+	fi
+	if ! $RC ; then
 		# if ifup didn't work, see if we have an ip= on cmd line
 		if egrep 'ip=[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:' /proc/cmdline ; 
 		then
@@ -197,7 +202,12 @@
 	ip link set ${bridge} up
 	ip link set vif0.0 up
 	ip link set p${netdev} up
-	if ! ifup ${netdev} ; then
+	if which ifup 2> /dev/null ; then
+		ifup ${netdev} 2> RC=$?
+	else
+        	/etc/init.d/net.${netdev} start 2> RC=$? 
+	fi
+	if ! $RC  ; then
 		if [ ${kip} ] ; then
 			# use the addresses we grocked from /proc/cmdline	
 			ifconfig ${netdev} ${kip} 
@@ -238,7 +248,7 @@
         ip link set peth0 name eth0
         ifconfig ${bridge} down
         brctl delbr ${bridge}
-        ifup eth0
+        ifup eth0 2>/dev/null || /etc/init.d/net.eth0 start
 
     else
         transfer_routes ${bridge} ${netdev}

^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: [PATCH] tools: Fix network-bridge to work with Gentoo
@ 2005-09-29 23:38 Ian Pratt
  0 siblings, 0 replies; 8+ messages in thread
From: Ian Pratt @ 2005-09-29 23:38 UTC (permalink / raw)
  To: Jon Mason, xen-devel

 
> This patch fixes domU networking in Gentoo.  The change to 
> ifup/ifdown (which isn't availabe in Gentoo) prevents the 
> bridge from being setup correctly.  The patch below checks if 
> ifup is avaiable, and if not starts the Gentoo networking scripts.  

Grrrr. At long last we have scripts that work on every version of SuSE,
RHEL, Fedora, and Debain varient I've come across, and then gentoo does
something different...

I don't particularly like this patches approach to fixing the problem,
but then I don't really think its worth a call-out to a separate vendor
script either. 

I'd be inclined to pull the code around the ifup/down into a separate
function and put the vendor workarounds in that to make it explicit.
There's already a bit of ugliness there to cope with setups where the
interface is configured with ip= on the kernel command line rather than
relying on vendor scripts at all. There's also some subtle differences
in the suse/rh ifup/down scripts. As I recall, the SuSE ones always
return a status code of zero even if they fail. Anyhow, all of this is
pretty easy to workaround, we should just pull it into a shell function
for clarity.



Ian

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-10-05 15:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-29 22:20 [PATCH] tools: Fix network-bridge to work with Gentoo Jon Mason
2005-09-29 23:11 ` Dan Smith
2005-09-29 23:31   ` Nivedita Singhvi
2005-09-29 23:23 ` Robb Romans
2005-10-04 23:54 ` [PATCH] tools: Fix network-bridge to work with Gentoo (version 2) Jon Mason
2005-10-05  4:03   ` Anthony Liguori
2005-10-05 15:05   ` Jeremy Katz
  -- strict thread matches above, loose matches on Subject: below --
2005-09-29 23:38 [PATCH] tools: Fix network-bridge to work with Gentoo Ian Pratt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.