# Contributed by: Kyle Fuller <inbox@kylefuller.co.uk>

. "$SUBR_DIR/ip"

: ${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: set ts=4 et sw=4:
