diff options
author | 2020-05-31 01:20:25 +0300 | |
---|---|---|
committer | 2020-05-31 10:28:27 +0300 | |
commit | 0dc79645173fad82e0d437a6569b7ea7fa356197 (patch) | |
tree | ed78e5793b5203335a0f4a22e75ed36c3b58546a | |
parent | Makefile: bump (diff) | |
download | netifrc-0dc79645173fad82e0d437a6569b7ea7fa356197.tar.gz netifrc-0dc79645173fad82e0d437a6569b7ea7fa356197.tar.bz2 netifrc-0dc79645173fad82e0d437a6569b7ea7fa356197.zip |
Added macvtap support
Bug: https://bugs.gentoo.org/691372
Signed-off-by: Arseni Nimera <shorrer@yandex.by>
-rw-r--r-- | doc/net.example.Linux.in | 3 | ||||
-rw-r--r-- | 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 8896acf..f169670 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 $? } |