Files
xen/tools/hotplug/FreeBSD/vif-bridge
T
Olaf Hering 8db2e4bab2 tools: replace private BINDIR with automake bindir
Reuse automake variable instead of inventing a private variable.

The result of this command:
 git grep -wnl BINDIR | xargs sed -i 's@BINDIR@bindir@g'

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
2015-05-21 15:12:10 +01:00

44 lines
852 B
Bash

#!/bin/sh -e
#
# FreeBSD hotplug script for attaching xnb* interfaces to bridges
#
# Parameters:
# $1: xenstore backend path of the vif
# $2: action, either "add" or "remove"
#
# Environment variables:
# $iface_dev: name of the backend device (xnb<domid>.<handle>)
#
DIR=$(dirname "$0")
. "${DIR}/hotplugpath.sh"
PATH=${bindir}:${sbindir}:${LIBEXEC_BIN}:/bin:/usr/bin:/sbin:/usr/sbin
export PATH
path=$1
action=$2
case $action in
add)
bridge=$(xenstore-read "$path/bridge")
mtu=$(ifconfig $bridge | sed -n 's/.*mtu \([0-9]*\)$/\1/p')
ifconfig $iface_dev mtu $mtu
ifconfig $bridge addm $iface_dev
ifconfig $iface_dev up
exit 0
;;
remove)
if [ "$emulated" -eq 1 ]; then
bridge=$(xenstore-read "$path/bridge")
ifconfig $iface_dev down
ifconfig $bridge deletem $iface_dev
ifconfig $iface_dev destroy
fi
exit 0
;;
*)
exit 0
;;
esac