commit:     ffa5a9e830c609fec987efac5723781e889ae67c
Author:     Arseni Nimera <shorrer <AT> yandex <DOT> by>
AuthorDate: Sat May 30 22:20:25 2020 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun May 31 23:15:20 2020 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=ffa5a9e8

Added macvtap support

Bug: https://bugs.gentoo.org/691372
Signed-off-by: Arseni Nimera <shorrer <AT> yandex.by>
(cherry picked from commit 0dc79645173fad82e0d437a6569b7ea7fa356197)
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

 doc/net.example.Linux.in | 3 +++
 net/macvlan.sh           | 8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in
index c211ca7..a2993c0 100644
--- a/doc/net.example.Linux.in
+++ b/doc/net.example.Linux.in
@@ -664,6 +664,9 @@
 # MAC-VLAN mode (private, vepa, bridge, passtru)
 #mode_macvlan0="private"
 
+# MAC-VLAN type (macvlan, macvtap)
+#type_macvlan0="macvtap"
+
 # IP address, MAC address, ... are configured as a normal interface
 #config_macvlan0="192.168.20.20/24"
 #mac_macvlan0="00:50:06:20:20:20"

diff --git a/net/macvlan.sh b/net/macvlan.sh
index 8d55717..6243858 100644
--- a/net/macvlan.sh
+++ b/net/macvlan.sh
@@ -34,8 +34,12 @@ macvlan_pre_start()
        eval mode=\$mode_${IFVAR}
        [ -z "${mode}" ] && mode="private"
 
+       local type=
+       eval type=\$type_${IFVAR}
+       [ -z "${type}" ] && type="macvlan"
+
        ebegin "Creating MAC-VLAN ${IFACE} to ${macvlan}"
-       e="$(ip link add link "${macvlan}" name "${IFACE}" type macvlan mode 
"${mode}" 2>&1 1>/dev/null)"
+       e="$(ip link add link "${macvlan}" name "${IFACE}" type "${type}" mode 
"${mode}" 2>&1 1>/dev/null)"
        if [ -n "${e}" ]; then
                eend 1 "${e}"
        else
@@ -49,6 +53,6 @@ macvlan_post_stop()
        _is_macvlan || return 0
 
        ebegin "Removing MAC-VLAN ${IFACE}"
-       ip link delete "${IFACE}" type macvlan >/dev/null
+       ip link delete "${IFACE}" >/dev/null
        eend $?
 }

Reply via email to