--- /sbin/ifup.orig 2011-03-15 23:53:56 +0100 +++ /sbin/ifup 2011-03-16 01:03:07 +0100 @@ -4,6 +4,7 @@ cd /etc/sysconfig/network-scripts . network-functions +. /etc/sysconfig/network need_hostname @@ -58,6 +59,72 @@ exec $OTHERSCRIPT $CONFIG $2 fi +# 802.1q part +if [ -x /usr/sbin/vconfig -a "${VLAN}" = "yes" -a "$ISALIAS" = "no" ]; then + + # DEV_PLUS_VID* type + if echo ${DEVICE} | LANG=C egrep -v '(:)' | LANG=C egrep -q '(eth|bond)[0-9][0-9]*\.[0-9][0-9]?[0-9]?[0-9]?'; then + VID="`echo ${DEVICE} | \ + LANG=C egrep '(eth|bond)[0-9]+\.[0-9][0-9]?[0-9]?[0-9]?$' | \ + LANG=C sed 's/^[a-z0-9]*\.//g;s/^0*//'`" + PHYSDEV="`echo ${DEVICE} | \ + LANG=C egrep '(eth|bond)[0-9]+\.[0-9][0-9]?[0-9]?[0-9]?$' | \ + LANG=C sed 's/\.[a-z0-9]*$//g'`" + fi + + # VLAN_PLUS_VID* type + if echo ${DEVICE} | LANG=C egrep -q 'vlan[0-9][0-9]?[0-9]?[0-9]?'; then + VID="`echo ${DEVICE} | LANG=C sed 's/^vlan//;s/^0*//'`" + # PHYSDEV should be set in ifcfg-vlan* file + if [ -z "$PHYSDEV" ]; then + echo "PHYSDEV should be set for device ${DEVICE}" + exit 1 + fi + fi + + if [ -n "$VID" ]; then + # standard Owl kernel has vlan module compiled-in, this is redundant + if [ ! -d /proc/net/vlan ]; then + if ! modprobe 8021q >/dev/null 2>&1 ; then + echo "No 802.1Q VLAN support available in kernel for device ${DEVICE}" + exit 1 + fi + fi + + [ -z "$VLAN_NAME_TYPE" ] && VLAN_NAME_TYPE=DEV_PLUS_VID_NO_PAD + /usr/sbin/vconfig set_name_type "$VLAN_NAME_TYPE" >/dev/null + [ $? -gt 0 ] && echo "Could not set 802.1Q VLAN parameters." + + ifconfig ${PHYSDEV} 2>/dev/null | grep ${PHYSDEV} >/dev/null 2>&1 + if [ $? -gt 0 ]; then + echo "Physical device ${PHYSDEV} for ${DEVICE} does not seem to be present." + exit 1 + fi + + # Link on Physical device needs to be up but no ip required + /sbin/ifconfig ${PHYSDEV} 2>/dev/null | grep UP >/dev/null 2>&1; + [ $? -gt 0 ] && /sbin/ifconfig ${PHYSDEV} up + + if [ ! -f /proc/net/vlan/${DEVICE} ]; then + /usr/sbin/vconfig add ${PHYSDEV} ${VID} + if [ $? -gt 0 ]; then + echo "ERROR: could not add vlan ${VID} as ${DEVICE} on dev ${PHYSDEV}" + exit 1 + fi + else + case "$REORDER_HDR" in + yes|1) + /usr/sbin/vconfig set_flag ${DEVICE} 1 1 + ;; + no|0) + /usr/sbin/vconfig set_flag ${DEVICE} 1 0 + ;; + esac + fi + fi +fi +# end of 802.1q part + # is this device available? (this catches PCMCIA devices for us) /sbin/ifconfig ${REALDEVICE} 2>&1 | grep -s "not found" > /dev/null if [ "$?" = "0" ]; then @@ -135,11 +202,9 @@ fi # this is broken! it's only here for compatibility with old RH systems - if [ "${GATEWAY}" != "" -a "${GATEWAY}" != "none" ]; then - route add default gw ${GATEWAY} metric 1 ${DEVICE} - fi - - . /etc/sysconfig/network + #if [ "${GATEWAY}" != "" -a "${GATEWAY}" != "none" ]; then + # route add default gw ${GATEWAY} metric 1 ${DEVICE} + #fi if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then # set up default gateway @@ -152,8 +217,6 @@ fi fi -. /etc/sysconfig/network - if [ "$IPX" = yes ]; then /etc/sysconfig/network-scripts/ifup-ipx $DEVICE fi