File: if-pre-up

package info (click to toggle)
quicktun 2.2.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 240 kB
  • sloc: ansic: 2,098; sh: 185; makefile: 8
file content (17 lines) | stat: -rwxr-xr-x 635 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
test -n "${IF_QT_REMOTE_ADDRESS}" || exit 0
test -z "${IF_QT_NO_PRECREATE}" || exit 0
if [ -n "${IF_QT_TUN_MODE}" ] && [ "${IF_QT_TUN_MODE}" = "1" ]; then
	DEVTYPE="tun"
else
	DEVTYPE="tap"
fi
if [ -x /usr/sbin/openvpn ]; then
	/usr/sbin/openvpn --mktun --dev "${IFACE}" --dev-type "${DEVTYPE}" --user quicktun
elif [ -x /sbin/ip ] && /sbin/ip tuntap 2>&1 >/dev/null; then
	/sbin/ip tuntap add dev "${IFACE}" mode "${DEVTYPE}" user quicktun
elif [ -x /usr/sbin/tunctl ]; then
	/usr/sbin/tunctl -u quicktun -t "${IFACE}"
else
	echo "Unable to pre-create tun/tap interface. Run QuickTun as root by setting QT_NO_PRECREATE."
fi