summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobby Workman <rworkman@slackware.com>2017-07-13 19:16:24 -0500
committerRobby Workman <rworkman@slackware.com>2017-07-13 19:16:24 -0500
commitc66636bb8a7ad7c18483f7eff1cb10ac722af895 (patch)
tree10bc5d49506412e5d855eeef21372d03f788195a
parent9342d196f5ff5ad7a4753ae4402338f4adae788c (diff)
parent6281b5d47da57004b1d00f1a9946f5af6cca38a0 (diff)
downloadslacknetsetup-c66636bb8a7ad7c18483f7eff1cb10ac722af895.tar.xz
Merge branch 'virtual-ifs'
-rw-r--r--README12
-rw-r--r--rc.inet127
-rw-r--r--rc.inet1.conf17
3 files changed, 47 insertions, 9 deletions
diff --git a/README b/README
index 877a671..36e31d4 100644
--- a/README
+++ b/README
@@ -9,13 +9,7 @@ please make changes in a user branch, push them, and I'll merge,
or make a diff and send it to me. If you would like commit access
to a user branch, send me a mail with an ssh pubkey attached.
-Before production use and/or heavy testing, grep through for any
-instances of "TODO" and fix them :-)
-
-At this point, I *think* this branch (master) has feature (and bug)
-parity with the stock networking scripts in Slackware -current.
-
-If you're interested in something more experimental (creation of
-virtual interfaces, along with ability to add them to a bridge),
-see the "virtual-ifs" branch instead.
+This branch is feature-complete with respect to the stock networking
+scripts in Slackware -current, but it also (has|will hopefully have)
+other features listed below as TODO items.
diff --git a/rc.inet1 b/rc.inet1
index 5f9c29d..871b38d 100644
--- a/rc.inet1
+++ b/rc.inet1
@@ -73,6 +73,31 @@ lo_down() {
# INTERFACE FUNCTIONS #
#######################
+# Function to determine if virtual interfaces are defined
+virtif_determine() {
+ if [ ! -z ${VIRTIFNAME} ]; then
+ virtifcount=$(($(echo ${VIRTIFNAME[@]} | wc -w) - 1))
+ else
+ return 1
+ fi
+}
+
+# Function to create virtual interfaces
+virtif_create() {
+ # argument is 'i' - the position of this interface in the IFNAME array.
+ for i in $(seq 0 ${virtifcount}); do
+ /sbin/ip tuntap add dev ${VIRTIFNAME[$i]} mode ${VIRTIFTYPE[$i]} user ${VIRTIFUSER[$i]} group ${VIRTIFGROUP[$i]}
+ done
+}
+
+# Function to destory virtual interfaces
+virtif_destroy() {
+ # argument is 'i' - the position of this interface in the IFNAME array.
+ for i in $(seq 0 ${virtifcount}); do
+ /sbin/ip tuntap del dev ${VIRTIFNAME[$i]} mode ${VIRTIFTYPE[$i]}
+ done
+}
+
# Function to assemble a bridge interface.
br_open() {
# argument is 'i' - the position of this interface in the IFNAME array.
@@ -256,6 +281,7 @@ gateway_down() {
# Function to start the network:
start() {
lo_up
+ virtif_determine && virtif_create
for i in ${IFNAME[@]} ; do
if_up $i
done
@@ -268,6 +294,7 @@ stop() {
for i in ${IFNAME[@]} ; do
if_down $i
done
+ virtif_determine && virtif_destroy
lo_down
}
diff --git a/rc.inet1.conf b/rc.inet1.conf
index 85a8041..93b3e6c 100644
--- a/rc.inet1.conf
+++ b/rc.inet1.conf
@@ -55,6 +55,23 @@ DEBUG_ETH_UP="no"
#USE_DHCP[0]=""
#DHCP_HOSTNAME[0]=""
+# Virtual interfaces to create - these are created before any address
+# configuration or bridge setup is done, so you may use these interfaces
+# as IFNAME or BRNICS values. These can be tun or tap interfaces:
+# adjust VIRTIFNAME and VIRTIFTYPE accordingly
+#
+# Virtual tap interface example
+#VIRTIFNAME[0]="tap0"
+#VIRTIFTYPE[0]="tap"
+#VIRTIFUSER[0]="root"
+#VIRTIFGROUP[0]="root"
+#
+# Virtual tun interface example
+#VIRTIFNAME[1]="tun0"
+#VIRTIFTYPE[1]="tun"
+#VIRTIFUSER[1]="someuser"
+#VIRTIFGROUP[1]="somegroup"
+
## Example config information for wlan0. Uncomment the lines you need and fill
## in your data. (You may not need all of these for your wireless network)
#IFNAME[4]="wlan0"