summaryrefslogtreecommitdiffstats
path: root/rc.inet1
diff options
context:
space:
mode:
authorDarren 'Tadgy' Austin <darren@afterdark.org.uk>2018-09-07 21:39:19 +0100
committerRobby Workman <rworkman@slackware.com>2018-11-25 20:43:48 -0600
commit50519b6e540ff1a445ca4a57a2eade3f45092432 (patch)
tree51e7cbed3a4a56a1e49fcb7c1ea4482b9116e586 /rc.inet1
parent15b6fc1b646b28a9f7895c88c1ad37dac9f7ed1a (diff)
downloadslacknetsetup-50519b6e540ff1a445ca4a57a2eade3f45092432.tar.xz
Move interface module loading into a 'pre-load' section
Also fix loading of interface modules - previously just $i was used, where it should have been ${i%%:*} Also added pre-loading of ipv6 module Signed-off-by: Robby Workman <rworkman@slackware.com>
Diffstat (limited to 'rc.inet1')
-rw-r--r--rc.inet130
1 files changed, 21 insertions, 9 deletions
diff --git a/rc.inet1 b/rc.inet1
index 325ee56..1e54098 100644
--- a/rc.inet1
+++ b/rc.inet1
@@ -48,6 +48,27 @@ do
done
debug_log "List of interfaces: '${IFNAME[*]}'"
+####################
+# PRE-LOAD MODULES #
+####################
+
+for i in "${IFNAME[@]}"; do
+ # If the interface isn't in the kernel yet (but there's an alias for it in modules.conf),
+ # then it should be loaded first:
+ if [ ! -e /sys/class/net/${i%%:*} ]; then # no interface yet
+ if /sbin/modprobe -c | grep -v "^#" | grep -w "alias ${i%%:*}" | grep -vw "alias ${i%%:*} off" >/dev/null; then
+ echo "/etc/rc.d/rc.inet1: /sbin/modprobe ${i%%:*}" | $LOGGER
+ /sbin/modprobe ${i%%:*}
+ fi
+ fi
+done
+# Normally the ipv6 module would be automatically loaded when the first IP is assigned to an interface,
+# but autoconf/accept_ra need to be set to 0 before that happens, so pre-load ipv6 here.
+if [ ! -e /proc/sys/net/ipv6 ]; then
+ /sbin/modprobe ipv6
+fi
+sleep 1
+
######################
# LOOPBACK FUNCTIONS #
######################
@@ -148,15 +169,6 @@ if_up() {
debug_log "skipping ${1} early, interface is not configured in /etc/rc.d/rc.inet1.conf"
return
fi
- # If the interface isn't in the kernel yet (but there's an alias for it in
- # modules.conf), then it should be loaded first:
- if [ ! -e /sys/class/net/${1%%:*} ]; then # no interface yet
- if /sbin/modprobe -c | grep -v "^#" | grep -w "alias ${1}" | grep -vw "alias ${1} off" > /dev/null ; then
- echo "/etc/rc.d/rc.inet1: /sbin/modprobe ${1}" | $LOGGER
- /sbin/modprobe ${1}
- sleep 1
- fi
- fi
if [ -e /sys/class/net/${1%%:*} ]; then # interface exists
if ! /sbin/ip address show scope global dev ${1} 2>/dev/null | grep -Ewq '(inet|inet6)' || \
! /sbin/ip link show dev ${1} | grep -wq "state UP"; then # interface not up or not configured