Subject: Re: Questions about networking
To: Juan RP <juan@xtraeme.nopcode.org>
From: Quentin Garnier <cube@cubidou.net>
List: port-xen
Date: 03/16/2005 15:00:13
--GeVBx6fdiQ4tdCds
Content-Type: multipart/mixed; boundary="9IxM5hJjweoYfefN"
Content-Disposition: inline
--9IxM5hJjweoYfefN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Tue, Mar 15, 2005 at 11:32:13PM +0100, Quentin Garnier wrote:
[...]
> FWIW, this afternoon when I could take a try at booting a domU, I used a
> modified vif-bridge script to do bridging by doing this:
>=20
> vif =3D [ 'mac=3Dlalala, bridge=3Dbridge:bridge0:fxp0' ]
>=20
> The meaning of the bridge parameter is the following: first it starts
> with bridge to distinguish between plain ifconfig case and bridge case,
> then it bridges the vif interface with fxp0 on bridge0, creating it if
> necessary. I'll send it tomorrow if you want.
Here it is. Nothing complicated. Arguably, the interface should be
removed from the bridge at down time.
--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"When I find the controls, I'll go where I like, I'll know where I want
to be, but maybe for now I'll stay right here on a silent sea."
KT Tunstall, Silent Sea, Eye to the Telescope, 2004.
--9IxM5hJjweoYfefN
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=vif-bridge
Content-Transfer-Encoding: quoted-printable
#!/bin/sh
#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
# /etc/xen/vif-bridge
#
# Script for configuring a vif.
# Xend calls a vif script when configuring a vif up or down.
# This script is the default - but it can be configured for each vif.
#
# Example invocation:
#
# vif-bridge up domain=3DVM1 vif=3Dvif1.0 bridge=3Dxen-br0 mac=3Daa:00:00:5=
0:02:f0
#
#
# Usage:
# vif-bridge (up|down) {VAR=3DVAL}*
#
# Vars:
#
# domain name of the domain the interface is on (required).
# vif vif interface name (required).
# mac vif MAC address (required).
# bridge bridge to add the vif to (required).
#
#=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
# Exit if anything goes wrong
set -e
#this will be logged in xend-debug.log
echo "vif-bridge $*"
# Operation name.
OP=3D$1
shift
# Pull variables in args into environment
for arg ; do export "${arg}" ; done
# Required parameters. Fail if not set.
domain=3D${domain:?}
vif=3D${vif:?}
mac=3D${mac:?}
bridge=3D${bridge:?}
# Are we going up or down?
case $OP in
up)
# ${bridge} contains ifconfig parameters in our case.
# It could also be parameters to brctl, or anything else we
# want.
# xend gives us vif?.? as interface name, but on NetBSD
# they're called xvif?.?
case ${bridge} in
bridge:*)
bgparam=3D${bridge#bridge:}
bgif=3D${bgparam%%:*}
lanif=3D${bgparam##*:}
if ! ifconfig -l | grep ${bgif} >/dev/null; then
ifconfig ${bgif} create
brconfig ${bgif} add ${lanif} up
fi
ifconfig x${vif} up
brconfig ${bgif} add x${vif} up
;;
*)
ifconfig x${vif} ${bridge}
;;
esac
exit 0
;;
down) =
=
=20
exit 0
;;
*)
echo 'Invalid command: ' $OP
echo 'Valid commands are: up, down'
exit 1
;;
esac
--9IxM5hJjweoYfefN--
--GeVBx6fdiQ4tdCds
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)
iQEVAwUBQjg77dgoQloHrPnoAQIgpwf/eQU4lqwtdOmAF/CTAi7iBxUc/WZBQhgt
5L5M9OXo5y3RqyoL+juM/Ts3h7TYOFKetO6GO0JM1WA0h95Kz8cKLEmXeCDchPlO
QjdoCtFT9aU45MkXgQ11SDwp9n+8JBtrsvGc5HbBbjSeO3lnWGAOY/VR9WcYAV6D
FHVyUEfJb94Z3B3miPeRbs8jmi0A9S4OWTa6S8wi2BN3goVKb2twT+rxZFduAZpf
pNiKIuRn2XWLOnE4Q1ryoRZwrEN0zJwZD8szRqBy5iV0EDCKZzx8A/c05E2kF2yp
mPbfwQhHsELgwxV2Sa78PuilyWERHA9Cs7wcQJHTKxAiGfXrt6iC8Q==
=5M4b
-----END PGP SIGNATURE-----
--GeVBx6fdiQ4tdCds--