summaryrefslogtreecommitdiffstats
path: root/src/lib/connections/tunnel
blob: a14f96e43a310937e706b85b2c8a7ddbe9212110 (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
# Contributed by: Kyle Fuller <inbox@kylefuller.co.uk>

. "$SUBR_DIR/ip"

declare -ag BindsToInterfaces

tunnel_up() {
    if is_interface "$Interface"; then
        report_error "Interface '$Interface' already exists"
        return 1
    else
        ip tunnel add "$Interface" mode "$Mode" remote "$Remote"
    fi

    if [[ -n "$Local" ]]; then
        ip tunnel change "$Interface" local "$Local"
    fi

    bring_interface_up "$Interface"
    ip_set
}

tunnel_down() {
    ip_unset
    bring_interface_down "$Interface"
    ip tunnel del "$Interface"
}


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