1 |
commit: ffa5a9e830c609fec987efac5723781e889ae67c |
2 |
Author: Arseni Nimera <shorrer <AT> yandex <DOT> by> |
3 |
AuthorDate: Sat May 30 22:20:25 2020 +0000 |
4 |
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun May 31 23:15:20 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=ffa5a9e8 |
7 |
|
8 |
Added macvtap support |
9 |
|
10 |
Bug: https://bugs.gentoo.org/691372 |
11 |
Signed-off-by: Arseni Nimera <shorrer <AT> yandex.by> |
12 |
(cherry picked from commit 0dc79645173fad82e0d437a6569b7ea7fa356197) |
13 |
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> |
14 |
|
15 |
doc/net.example.Linux.in | 3 +++ |
16 |
net/macvlan.sh | 8 ++++++-- |
17 |
2 files changed, 9 insertions(+), 2 deletions(-) |
18 |
|
19 |
diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in |
20 |
index c211ca7..a2993c0 100644 |
21 |
--- a/doc/net.example.Linux.in |
22 |
+++ b/doc/net.example.Linux.in |
23 |
@@ -664,6 +664,9 @@ |
24 |
# MAC-VLAN mode (private, vepa, bridge, passtru) |
25 |
#mode_macvlan0="private" |
26 |
|
27 |
+# MAC-VLAN type (macvlan, macvtap) |
28 |
+#type_macvlan0="macvtap" |
29 |
+ |
30 |
# IP address, MAC address, ... are configured as a normal interface |
31 |
#config_macvlan0="192.168.20.20/24" |
32 |
#mac_macvlan0="00:50:06:20:20:20" |
33 |
|
34 |
diff --git a/net/macvlan.sh b/net/macvlan.sh |
35 |
index 8d55717..6243858 100644 |
36 |
--- a/net/macvlan.sh |
37 |
+++ b/net/macvlan.sh |
38 |
@@ -34,8 +34,12 @@ macvlan_pre_start() |
39 |
eval mode=\$mode_${IFVAR} |
40 |
[ -z "${mode}" ] && mode="private" |
41 |
|
42 |
+ local type= |
43 |
+ eval type=\$type_${IFVAR} |
44 |
+ [ -z "${type}" ] && type="macvlan" |
45 |
+ |
46 |
ebegin "Creating MAC-VLAN ${IFACE} to ${macvlan}" |
47 |
- e="$(ip link add link "${macvlan}" name "${IFACE}" type macvlan mode "${mode}" 2>&1 1>/dev/null)" |
48 |
+ e="$(ip link add link "${macvlan}" name "${IFACE}" type "${type}" mode "${mode}" 2>&1 1>/dev/null)" |
49 |
if [ -n "${e}" ]; then |
50 |
eend 1 "${e}" |
51 |
else |
52 |
@@ -49,6 +53,6 @@ macvlan_post_stop() |
53 |
_is_macvlan || return 0 |
54 |
|
55 |
ebegin "Removing MAC-VLAN ${IFACE}" |
56 |
- ip link delete "${IFACE}" type macvlan >/dev/null |
57 |
+ ip link delete "${IFACE}" >/dev/null |
58 |
eend $? |
59 |
} |