summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2013-10-23 01:12:48 +0200
committerJouke Witteveen <j.witteveen@gmail.com>2013-10-23 10:48:55 +0200
commit7c4329462e411c110b8dded92cc4b0d935e1e95d (patch)
tree34abcce54ac73717216667918bf02174c8cdded6 /src
parent8a414978b39e784fdabf6895985acc0e054d235c (diff)
downloadnetctl-7c4329462e411c110b8dded92cc4b0d935e1e95d.tar.gz
netctl-7c4329462e411c110b8dded92cc4b0d935e1e95d.tar.xz
Add a connection type for dummy interfaces
Diffstat (limited to 'src')
-rw-r--r--src/lib/connections/README3
-rw-r--r--src/lib/connections/dummy26
2 files changed, 29 insertions, 0 deletions
diff --git a/src/lib/connections/README b/src/lib/connections/README
index db840d6..6d8db9b 100644
--- a/src/lib/connections/README
+++ b/src/lib/connections/README
@@ -26,3 +26,6 @@ available. The readily sourced files are:
Here, <profile> is the profile file specifying the desired network
configuration.
+
+A simple example of a connection file is that of the dummy connection
+type.
diff --git a/src/lib/connections/dummy b/src/lib/connections/dummy
new file mode 100644
index 0000000..879fc92
--- /dev/null
+++ b/src/lib/connections/dummy
@@ -0,0 +1,26 @@
+# Contributed by: João Valverde <joao.valverde@ist.utl.pt>
+
+. "$SUBR_DIR/ip"
+
+declare -ag BindsToInterfaces
+
+dummy_up() {
+ if is_interface "$Interface"; then
+ report_error "Interface '$Interface' already exists"
+ return 1
+ fi
+
+ ip link add "$Interface" type dummy
+
+ bring_interface_up "$Interface"
+ ip_set
+}
+
+dummy_down() {
+ ip_unset
+ bring_interface_down "$Interface"
+ ip link del "$Interface"
+}
+
+
+# vim: ft=sh ts=4 et sw=4: