diff options
-rw-r--r-- | rc.inet1 | 30 |
1 files changed, 21 insertions, 9 deletions
@@ -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 |