summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2013-12-03 19:04:58 +0100
committerJouke Witteveen <j.witteveen@gmail.com>2014-03-01 22:24:37 +0100
commit0b4246c76c37d45666f1a5b739bb3d1e1a371ea8 (patch)
tree9cfe5754d9a27f0a2df27608f3f5d71a1d1d7752 /src
parent6d83ce0798af47143a9698847f05b272e3fcb7e0 (diff)
downloadnetctl-0b4246c76c37d45666f1a5b739bb3d1e1a371ea8.tar.gz
netctl-0b4246c76c37d45666f1a5b739bb3d1e1a371ea8.tar.xz
Add macvlan connection support
Diffstat (limited to 'src')
-rw-r--r--src/lib/connections/macvlan31
1 files changed, 31 insertions, 0 deletions
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 <preparationh67@gmail.com>
+
+. "$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: