Files
poky/meta/recipes-core/init-ifupdown/init-ifupdown-1.0/init
Jackie Huang e695d4104f init-ifupdown: set kernel parameters firstly
When do ipv6 ready test, some DAD (duplicate address detect) tests failed
since it expect IPV6 will be disabled, but not. even accept_dad has been
set to correct value 2. Further investigation shows the root cause is that
setting the kernel parameter happens after the NIC is upped.

Make kernel parameters be configured before the interfaces is upped, and
duplicate setting the kernel parameters does not have negative effect.

(From OE-Core rev: cabe22b9470e870e63b5ef1ec8349c67b0823abf)

Signed-off-by: Roy.Li <rongqing.li@windriver.com>
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-05 15:34:21 +01:00

1.9 KiB

#!/bin/sh -e

BEGIN INIT INFO

Provides: networking

Required-Start: mountvirtfs $local_fs

Required-Stop: $local_fs

Should-Start: ifupdown

Should-Stop: ifupdown

Default-Start: S

Default-Stop: 0 6

Short-Description: Raise network interfaces.

END INIT INFO

PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"

[ -x /sbin/ifup ] || exit 0

check_network_file_systems() { [ -e /proc/mounts ] || return 0

if [ -e /etc/iscsi/iscsi.initramfs ]; then
echo "not deconfiguring network interfaces: iSCSI root is mounted."
exit 0
fi

exec 9<&0 < /proc/mounts
while read DEV MTPT FSTYPE REST; do
case $DEV in
/dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
    echo "not deconfiguring network interfaces: network devices still mounted."
    exit 0
    ;;
esac
case $FSTYPE in
nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs)
    echo "not deconfiguring network interfaces: network file systems still mounted."
    exit 0
    ;;
esac
done
exec 0<&9 9<&-

}

check_network_swap() { [ -e /proc/swaps ] || return 0

exec 9<&0 < /proc/swaps
while read DEV MTPT FSTYPE REST; do
case $DEV in
/dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
    echo "not deconfiguring network interfaces: network swap still mounted."
    exit 0
    ;;
esac
done
exec 0<&9 9<&-

}

case "$1" in start) echo -n "Configuring network interfaces... " sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1 ifup -a echo "done." ;;

stop) check_network_file_systems check_network_swap

echo -n "Deconfiguring network interfaces... "
ifdown -a
echo "done."
;;

force-reload|restart) echo "Running $0 $1 is deprecated because it may not enable again some interfaces" echo "Reconfiguring network interfaces... " ifdown -a || true ifup -a echo "done." ;;

*) echo "Usage: /etc/init.d/networking {start|stop}" exit 1 ;; esac

exit 0