summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO1
-rw-r--r--doc/net.example.Linux.in9
-rw-r--r--net/dummy.sh41
3 files changed, 50 insertions, 1 deletions
diff --git a/TODO b/TODO
index f8d8902..64f62e2 100644
--- a/TODO
+++ b/TODO
@@ -12,7 +12,6 @@
- add vlan3 - _ifindex (eth0=0,vlan2=1,vlan3=2)
Now your routing table has entries for both vlan2 and vlan3 with a metric of 2.
- Support many more device types easily:
- - Dummy: ip link add dev dummy1 type dummy
- HSR: ip link add name hsr0 type hsr slave1 dummy3 slave2 dummy4
- VXLAN: ip link add link dummy2 name vxlan199 type vxlan id 199 dev dummy2 group 224.2.0.199 dstport 4789
- IPVLAN: ...
diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in
index f71385d..1eaebac 100644
--- a/doc/net.example.Linux.in
+++ b/doc/net.example.Linux.in
@@ -150,6 +150,15 @@
##############################################################################
# OPTIONAL MODULES
+#-----------------------------------------------------------------------------
+# IPROUTE2 INTERFACE TYPES
+# The type_$iface variable maps to the link type parameter in iproute2.
+# If you need to use additional interface types, you should try to use that
+# parameter. Supported interface types are listed below. Please note that some
+# interface types may mandate a specific naming scheme.
+#
+# Dummy network interface:
+#type_dummy0=dummy
#-----------------------------------------------------------------------------
# WIRELESS (802.11 support)
diff --git a/net/dummy.sh b/net/dummy.sh
new file mode 100644
index 0000000..3050216
--- /dev/null
+++ b/net/dummy.sh
@@ -0,0 +1,41 @@
+# Copyright (c) 2015 Gentoo Foundation
+# All rights reserved. Released under the 2-clause BSD license.
+
+dummy_depend()
+{
+ program ip
+ after interface
+ before dhcp macchanger
+}
+
+_is_dummy() {
+ is_interface_type dummy
+}
+
+dummy_pre_start()
+{
+ local dummy=
+ eval dummy=\$type_${IFVAR}
+ [ "${dummy}" = "dummy" ] || return 0
+
+ ebegin "Creating dummy interface ${IFACE}"
+ cmd="ip link add name "${IFACE}" type dummy"
+ veinfo $cmd
+ if $cmd ; then
+ eend 0 && _up && set_interface_type dummy
+ else
+ eend 1
+ fi
+}
+
+
+dummy_post_stop()
+{
+ _is_dummy || return 0
+
+ ebegin "Removing dummy ${IFACE}"
+ cmd="ip link delete "${IFACE}" type dummy"
+ veinfo "$cmd"
+ $cmd
+ eend $?
+}