X-Git-Url: https://git.tld-linux.org/?a=blobdiff_plain;f=lib%2Fifup;h=b8536af55959af9953e55f6662a8e0e9fff06881;hb=6692a4555d8b1918484db9dc5561453e5ce1b6c5;hp=4f5d2e71f9e47104b0581bbdf5598610e1e725b2;hpb=7469b84d1e7ffde6f48bf19b999c005249df5dae;p=rc-scripts.git diff --git a/lib/ifup b/lib/ifup index 4f5d2e7..b8536af 100755 --- a/lib/ifup +++ b/lib/ifup @@ -3,6 +3,8 @@ # PATH=/sbin:/usr/sbin:/bin:/usr/bin +run_pre_up() { :; } + . /etc/sysconfig/network . /etc/rc.d/init.d/functions . /lib/rc-scripts/functions.network @@ -65,6 +67,9 @@ setup_ip_param SYSCTLDEVICE=$(echo ${DEVICE} | sed 's/\./\//g') +# anything you need done first +run_pre_up + OTHERSCRIPT="/lib/rc-scripts/ifup-${DEVICETYPE}" if [ -x "$OTHERSCRIPT" ]; then @@ -80,7 +85,7 @@ fi if [ -n "$MACVLAN_DEV" -a -n "$MACVLAN_MACADDR" ]; then ip link del link ${MACVLAN_DEV} ${DEVICE} type macvlan > /dev/null 2>&1 - ip link add link ${MACVLAN_DEV} address ${MACVLAN_MACADDR} name ${DEVICE} type macvlan + ip link add link ${MACVLAN_DEV} address ${MACVLAN_MACADDR} name ${DEVICE} type macvlan ${MACVLAN_MODE:+mode $MACVLAN_MODE} fi # is this device available? (this catches PCMCIA devices for us) @@ -120,11 +125,13 @@ if [ -n "$ETHTOOL_OPTS" ] ; then fi if is_yes "$SLAVE" && [ -n "$MASTER" ] ; then - if ! grep -wq "${DEVICE}" /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null; then - nls "Enslaving %s to %s" "$DEVICE" "$MASTER" - ip link set dev ${DEVICE} down - echo "+${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null - fi + # create master if it doesn't exist yet + [ ! -d "/sys/class/net/${MASTER}" ] && ip link add "${MASTER}" type bond + + nls "Enslaving %s to %s" "${DEVICE}" "${MASTER}" + ip link set "${DEVICE}" master "${MASTER}" + ip link set "${DEVICE}" up + exit 0 fi @@ -172,7 +179,8 @@ if [ -n "$BOOTPROTO" -a "$BOOTPROTO" != "none" -a "$BOOTPROTO" != "static" ]; th fi DHCP_ARGS="$DHCP_OPTIONS $DHCP_ARGS" - if check_link_down ${DEVICE}; then + [ -z "$CHECK_LINK_WAIT_TIMEOUT" ] && CHECK_LINK_WAIT_TIMEOUT=5 + if check_link_down ${DEVICE} $(( $CHECK_LINK_WAIT_TIMEOUT * 2 )); then run_cmd "$(nls 'Determining IP information for %s (%s)' "$DEVICE" "${DHCP_CLIENT##*/}")" /bin/false nls '%s: Check cable/radio on-off switch?' "$DEVICE" exit 1