summaryrefslogtreecommitdiff
path: root/sysutils/xentools33/files/vif-ip-nbsd
blob: b16de280ccc416fc21db1d58e3cea3e9feaa57dc (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
#!/bin/sh -e

# $NetBSD: vif-ip-nbsd,v 1.1.1.1 2008/08/07 20:26:57 cegger Exp $
# Called by xenbackendd
# Usage: vif-ip xsdir_backend_path state

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)
	xip=$(xenstore-read "$xpath/ip")
	xfid=$(xenstore-read "$xpath/frontend-id")
	xhandle=$(xenstore-read "$xpath/handle")
	iface=xvif$xfid.$xhandle
	echo ifconfig $iface $xip up
	ifconfig $iface $xip up
	xenstore-write $xpath/hotplug-status connected
	echo xenstore-write $xpath/hotplug-status connected
	exit 0
	;;
*)
	exit 0
	;;
esac