From 0b4246c76c37d45666f1a5b739bb3d1e1a371ea8 Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Tue, 3 Dec 2013 12:04:58 -0600 Subject: Add macvlan connection support --- src/lib/connections/macvlan | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/lib/connections/macvlan (limited to 'src') diff --git a/src/lib/connections/macvlan b/src/lib/connections/macvlan new file mode 100644 index 0000000..11e7017 --- /dev/null +++ b/src/lib/connections/macvlan @@ -0,0 +1,31 @@ +# Contributed by: Walter F Dworak + +. "$CONN_DIR/ethernet" + +macvlan_up() { + if [[ ${#BindsToInterfaces[@]} -ne 1 ]]; then + report_error "No unique physical device for MACVLAN interface '$Interface' specified" + return 1 + fi + if is_interface "$Interface"; then + report_error "Interface '$Interface' already exists" + return 1 + elif [[ $Mode != @(bridge|passthru|private|vepa) ]]; then + report_error "Invalid mode '$Mode' for MACVLAN interface '$Interface'" + return 1 + else + bring_interface_up "$BindsToInterfaces" + interface_add macvlan "$Interface" "$BindsToInterfaces" mode "$Mode" + if [[ $MACAddress ]]; then + ip link set dev "$Interface" address "$MACAddress" || return 1 + fi + fi + ethernet_up +} + +macvlan_down() { + ethernet_down + interface_delete "$Interface" +} + +# vim: ft=sh ts=4 et sw=4: -- cgit v1.2.3-24-g4f1b