# Contributed by: Thomas S Hatch <thatch45@gmail.com>

. "$SUBR_DIR/connections/ethernet"

vlan_up() {
    if [[ ${#BindsToInterfaces[@]} -ne 1 ]]; then
        report_error "No unique physical device for VLAN interface '$Interface' specified"
        return 1
    fi
    if is_interface "$Interface"; then
        report_error "Interface '$Interface' already exists"
        return 1
    elif [[ $VLANID != +([[:digit:]]) ]]; then
        report_error "Invalid VLAN identifier: '$VLANID'"
        return 1
    else
        bring_interface_up "$BindsToInterfaces"
        interface_add vlan "$Interface" "$MACAddress" "$BindsToInterfaces" id "$VLANID"
    fi

    ethernet_up
}

vlan_down() {
    ethernet_down
    interface_delete "$Interface"
}


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