blob: 428c653ba7ba6a466dfc751d39193256eb181572 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/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
|