summaryrefslogtreecommitdiffstats
path: root/src/lib/connections/tuntap
blob: 0bf53cc707595ee490381e1a3ad76e0cdacc5ee5 (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
# Contributed by: Rémy Oudompheng <remy@archlinux.org>

. "$SUBR_DIR/ip"

# Make sure BindsToInterfaces is set
BindsToInterfaces=("${BindsToInterfaces[@]}")

tuntap_up() {
    if is_interface "$Interface"; then
        report_error "Interface '$Interface' already exists"
        return 1
    fi

    do_debug ip tuntap add dev "$Interface" mode "$Mode" \
        ${User:+user "$User"} ${Group:+group "$Group"} || return

    bring_interface_up "$Interface"
    IP=${IP-no} ip_set
}

tuntap_down() {
    ip_unset
    bring_interface_down "$Interface"
    ip tuntap delete dev "$Interface" mode "$Mode"
}


# vim: ft=sh ts=4 et sw=4: