# the other location of cd-based network configuration file
CD_NET_CONF_ROOT=/usr/$NEW_NODE_CONF_NAME
-# if all other network configuration file sources
+# if all other network configuration file sources
# don't exist, fall back to this one (always on the cd)
FALLBACK_NET_CONF=/usr/boot/default-node.txt
}
# find and parse a node network configuration file. return 0 if not found,
-# return 1 if found and parsed. if this is the case, DEFAULT_NET_CONF will
+# return 1 if found and parsed. if this is the case, DEFAULT_NET_CONF will
# be set to 1. For any found configuration file, $USED_NET_CONF will
# contain the validated contents
function find-node-config() {
/bin/rm -f $TMP_OLD_FLOPPY_CONF_FILE 2>&1 > /dev/null
verbose-message "pl_netinit: looking for node configuration file on floppy"
-
+
/bin/mount -o ro -t $NODE_CONF_DEVICE_FS_TYPES /dev/fd0 \
$CONF_DEVICE_MOUNT_POINT 2>&1 > /dev/null
if [[ $? -eq 0 ]]; then
verbose-message "pl_netinit: no floppy could be mounted, continuing search."
fi
- # 2. check for a new named file on removable flash devices (those
+ # 2. check for a new named file on removable flash devices (those
# that start with sd*, because usb_storage emulates scsi devices).
# to prevent checking normal scsi disks, also make sure
# /sys/block/<dev>/removable is set to 1
/bin/umount $CONF_DEVICE_MOUNT_POINT
return 1
fi
-
+
verbose-message "pl_netinit: ERROR - not found"
/bin/umount $CONF_DEVICE_MOUNT_POINT
# 4. check for plnode.txt on the cd at /usr/boot
verbose-message "pl_netinit: looking for network configuration on cd in /usr/boot"
if [ -r "$CD_NET_CONF_BOOT" ]; then
-
+
verbose-message "pl_netinit: found cd configuration file $CD_NET_BOOT_CONF"
/etc/init.d/pl_validateconf < $CD_NET_CONF_BOOT > $USED_NET_CONF
return 1
fi
-
+
# 5. check for plnode.txt on the cd at /usr
verbose-message "pl_netinit: looking for network configuration on cd in /usr"
if [ -r "$CD_NET_CONF_ROOT" ]; then
-
+
verbose-message "pl_netinit: found cd configuration file $CD_NET_CONF_ROOT"
/etc/init.d/pl_validateconf < $CD_NET_CONF_ROOT > $USED_NET_CONF
return 1
verbose-message "pl_netinit: bringing loopback network device up"
-/sbin/ifconfig lo 127.0.0.1 up
+ip address add dev lo 127.0.0.1/8
+ip link set lo up
find-node-config
if [ $? -eq 0 ]; then
fi
# load the configuration file. if it was a default one (not user specified),
-# then remove the saved copy from /tmp, but continue on. since a network
+# then remove the saved copy from /tmp, but continue on. since a network
# configuration file is required and boot scripts only know about this location
# they will fail (as they should) - but the network will be up if dhcp is
# available
# within a systemd-driven startup, we often see this stage
# triggered before the network interface is actually exposed
# by udev/kernel
-# although of course we have network-online.target
-# as a requirement; go figure what systemd actually does..
-
-# in any case, let us try to work around that by allowing some delay
-# here
-
-# tmp: Thierry June 2015
-# on fedora 21 nodes we see this running in a context where eth0 is not known to the system
-# could be related to a dependency that we poorly describe to systemd
-# I am increasing this timeout to 1 minute in order to check that conjecture
-ALLOW=60
+# so allow for some small delay here
+ALLOW=10
COUNTER=0
while true; do
- if /sbin/ifconfig $ETH_DEVICE >& /dev/null; then
- verbose-message "pl_netinit: device present $ETH_DEVICE, proceeding (${COUNTER}s/${ALLOW}s)"
- break
+ ### check if the interface is known
+ # instead of using ifconfig, check the kernel area
+ if [ -e /sys/class/net/$ETH_DEVICE ]; then
+ verbose-message "pl_netinit: device present $ETH_DEVICE"
+ break
fi
verbose-message "pl_netinit: waiting for device $ETH_DEVICE - ${COUNTER}s/${ALLOW}s"
- set -x
- /sbin/ifconfig
- journalctl -b | egrep 'eth|bnx|udev'
- systemctl list-unit-files | grep -i network
- set +x
+ sleep 1
COUNTER=$(($COUNTER+1))
[ $COUNTER -ge $ALLOW ] && net-init-failed
sleep 1
# actually check to make sure ifconfig <device> succeeds
-/sbin/ifconfig $ETH_DEVICE up 2>&1 > /dev/null || {
+/usr/libexec/nm-ifup $ETH_DEVICE >& /dev/null || {
verbose-message "pl_netinit: device $ETH_DEVICE does not exist, most likely"
verbose-message "pl_netinit: this CD does not have hardware support for your"
verbose-message "pl_netinit: network adapter. please send the following lines"