From: Anthony Liguori <aliguori@us.ibm.com>
To: Jon Mason <jdmason@us.ibm.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] tools: Fix network-bridge to work with Gentoo (version 2)
Date: Tue, 04 Oct 2005 23:03:08 -0500 [thread overview]
Message-ID: <4343507C.4000002@us.ibm.com> (raw)
In-Reply-To: <20051004235436.GB7576@us.ibm.com>
A slightly less invasive way to do it is to have a Gentoo compatibility
script that looks something like this:
# Gentoo doesn't have ifup/ifdown so if we're on Gentoo define some
which ifup >& /dev/null
if [ "$?" != 0 -a -e /etc/conf.d/net ]; then
ifup() {
/etc/init.d/net.$1 start
}
ifdown() {
/etc/init.d/net.$1 stop
}
fi
This could then be sourced from the network script (or just inlined).
Jon Mason wrote:
>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.
>
>This new version includes shell functions where distro specific options
>may be handled (per Ian's suggestion).
>
>Signed-off-by: Jon Mason <jdmason@us.ibm.com>
>
># HG changeset patch
># User root@pentium4
># Node ID 6de75791e5a54b8eb093c6630efb68f896c16fa3
># Parent 00037ba13f0bb8efe4b2c3efe40200eac21c68dd
>
>Fix network-bridge to work with Gentoo
>
>diff -r 00037ba13f0b -r 6de75791e5a5 tools/examples/network-bridge
>--- a/tools/examples/network-bridge Tue Oct 4 17:23:58 2005
>+++ b/tools/examples/network-bridge Tue Oct 4 23:42:28 2005
>@@ -54,6 +54,32 @@
> antispoof=${antispoof:-no}
>
> echo "*network $OP bridge=$bridge netdev=$netdev antispoof=$antispoof" >&2
>+
>+# Usage: eth_down interface
>+eth_down() {
>+ local rc
>+ local eth=$1
>+ ifdown=$(which ifdown 2>/dev/null)
>+ if [ -n "$ifdown" ]; then
>+ $ifdown ${eth}; rc=$?
>+ else
>+ /etc/init.d/net.${eth} stop; rc=$?
>+ fi
>+ return $rc
>+}
>+
>+# Usage: eth_up interface
>+eth_up() {
>+ local rc
>+ local eth=$1
>+ ifdown=$(which ifup 2>/dev/null)
>+ if [ -n "$ifup" ]; then
>+ $ifup ${eth}; rc=$?
>+ else
>+ /etc/init.d/net.${eth} start; rc=$?
>+ fi
>+ return $rc
>+}
>
> # Usage: transfer_addrs src dst
> # Copy all IP addresses (including aliases) from device $src to device $dst.
>@@ -177,7 +203,7 @@
>
> if ifconfig veth0 2>/dev/null | grep -q veth0 ; then
> mac=`ifconfig ${netdev} | grep HWadd | sed -e 's/.*\(..:..:..:..:..:..\).*/\1/'`
>- if ! ifdown ${netdev} ; then
>+ if ! eth_down ${netdev} ; 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 +223,7 @@
> ip link set ${bridge} up
> ip link set vif0.0 up
> ip link set p${netdev} up
>- if ! ifup ${netdev} ; then
>+ if ! eth_up ${netdev} ; then
> if [ ${kip} ] ; then
> # use the addresses we grocked from /proc/cmdline
> ifconfig ${netdev} ${kip}
>@@ -238,7 +264,7 @@
> ip link set peth0 name eth0
> ifconfig ${bridge} down
> brctl delbr ${bridge}
>- ifup eth0
>+ eth_up eth0
>
> else
> transfer_routes ${bridge} ${netdev}
>
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@lists.xensource.com
>http://lists.xensource.com/xen-devel
>
>
>
next prev parent reply other threads:[~2005-10-05 4:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2005-10-05 15:05 ` Jeremy Katz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4343507C.4000002@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=jdmason@us.ibm.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.