2007-06-14 21:39:45 +02:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2011-01-12 01:11:19 +01:00
|
|
|
# $NetBSD: vif-bridge-nbsd,v 1.2 2011/01/12 00:11:19 jym Exp $
|
2007-06-14 21:39:45 +02:00
|
|
|
# Called by xenbackendd
|
|
|
|
# Usage: vif-bridge xsdir_backend_path state
|
|
|
|
|
2011-01-12 01:11:19 +01:00
|
|
|
dir=$(dirname $0)
|
|
|
|
. "$dir/xen-subr"
|
|
|
|
|
2007-06-14 21:39:45 +02:00
|
|
|
PATH=/bin:/usr/bin:@PREFIX@/bin:/sbin:/usr/sbin:@PREFIX@/sbin
|
|
|
|
export PATH
|
|
|
|
|
|
|
|
xpath=$1
|
|
|
|
xstatus=$2
|
|
|
|
|
|
|
|
case $xstatus in
|
|
|
|
6)
|
|
|
|
# device removed
|
|
|
|
xenstore-rm $xpath
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
2)
|
|
|
|
xbridge=$(xenstore-read "$xpath/bridge")
|
|
|
|
xfid=$(xenstore-read "$xpath/frontend-id")
|
|
|
|
xhandle=$(xenstore-read "$xpath/handle")
|
2011-01-12 01:11:19 +01:00
|
|
|
iface=$(xenstore_read_default "$xpath/vifname" "xvif$xfid.$xhandle")
|
2007-06-14 21:39:45 +02:00
|
|
|
echo ifconfig $iface up
|
|
|
|
ifconfig $iface up
|
|
|
|
brconfig $xbridge add $iface
|
|
|
|
echo brconfig $xbridge add $iface
|
|
|
|
xenstore-write $xpath/hotplug-status connected
|
|
|
|
echo xenstore-write $xpath/hotplug-status connected
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|