Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save josephglanville/2757336 to your computer and use it in GitHub Desktop.
Save josephglanville/2757336 to your computer and use it in GitHub Desktop.
Patch to OpenRC iproute2.sh to support abstract interfaces
From c6802bcf9f23007e573f2655e9d57c177e1279b5 Mon Sep 17 00:00:00 2001
From: Joseph Glanville <joseph.glanville@orionvm.com.au>
Date: Sun, 20 May 2012 16:30:11 +0000
Subject: [PATCH] Add abstract create_ config option to create arbitary interfaces.
This patch allows the creation of any interface supported by the
underlying NETLINK interface of iproute2.
To create an interface simply supply a create_${iface} line in
your /etc/conf.d/net file.
Example:
Create a gretap tunnel
create_vpn0="type gretap local 192.168.0.1 remote 49.156.78.82 key 12345 ttl 5"
---
net/iproute2.sh | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/net/iproute2.sh b/net/iproute2.sh
index 16186e8..0af59e6 100644
--- a/net/iproute2.sh
+++ b/net/iproute2.sh
@@ -270,6 +270,14 @@ iproute2_pre_start()
eend $? || return 1
_up
fi
+ local create=
+ eval create=\$create_${IFVAR}
+ if [ -n "${create}" ]; then
+ ebegin "Creating interface ${IFVAR}"
+ ip link add "${IFACE}" ${create}
+ eend $? || return 1
+ _up
+ fi
# MTU support
local mtu=
--
1.7.3.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment