diff options
Diffstat (limited to 'network-scripts')
| -rwxr-xr-x | network-scripts/ifup | 8 | ||||
| -rwxr-xr-x | network-scripts/ifup-aliases | 2 | ||||
| -rwxr-xr-x | network-scripts/ifup-ctc | 2 | ||||
| -rwxr-xr-x | network-scripts/ifup-eth | 14 | ||||
| -rwxr-xr-x | network-scripts/ifup-ippp | 16 | ||||
| -rwxr-xr-x | network-scripts/ifup-plip | 2 | ||||
| -rwxr-xr-x | network-scripts/ifup-plusb | 2 | ||||
| -rwxr-xr-x | network-scripts/ifup-tunnel | 2 | ||||
| -rw-r--r-- | network-scripts/network-functions | 50 | ||||
| -rw-r--r-- | network-scripts/network-functions-ipv6 | 10 | 
10 files changed, 60 insertions, 48 deletions
diff --git a/network-scripts/ifup b/network-scripts/ifup index 5aac4c9f..a0530779 100755 --- a/network-scripts/ifup +++ b/network-scripts/ifup @@ -122,7 +122,7 @@ if is_true "${VLAN}" && is_false "$ISALIAS" && [ -n "$DEVICE" ]; then          }          # Link on Physical device needs to be up but no ip required -        check_device_down ${PHYSDEV} && { ip -o link set dev ${PHYSDEV} up; } +        check_device_down ${PHYSDEV} && set_link_up ${PHYSDEV}          if [ ! -f /proc/net/vlan/${DEVICE} ]; then              if is_false "${REORDER_HDR}"; then @@ -134,13 +134,11 @@ if is_true "${VLAN}" && is_false "$ISALIAS" && [ -n "$DEVICE" ]; then              fi              ip link add dev ${DEVICE} link ${PHYSDEV} type vlan id ${VID} ${FLAG_REORDER_HDR} ${FLAG_GVRP} || { -                (/usr/bin/logger -p daemon.info -t ifup \ -                     $"ERROR: could not add vlan ${VID} as ${DEVICE} on dev ${PHYSDEV}" &) & -                net_log $"ERROR: could not add vlan ${VID} as ${DEVICE} on dev ${PHYSDEV}" +                net_log $"ERROR: could not add vlan ${VID} as ${DEVICE} on dev ${PHYSDEV}" info ifup                   exit 1              } -            [ -n "${VLAN_EGRESS_PRIORITY_MAP}" ] && ip link set ${DEVICE} type vlan egress ${VLAN_EGRESS_PRIORITY_MAP} +            [ -n "${VLAN_EGRESS_PRIORITY_MAP}" ] && ip link set dev ${DEVICE} type vlan egress ${VLAN_EGRESS_PRIORITY_MAP}          fi      fi diff --git a/network-scripts/ifup-aliases b/network-scripts/ifup-aliases index 8020f407..971ce208 100755 --- a/network-scripts/ifup-aliases +++ b/network-scripts/ifup-aliases @@ -266,7 +266,7 @@ function new_interface ()          if [ "${parent_device}" != "lo" ] &&  ! is_false "${ARPCHECK}" && \                  is_available ${parent_device} && \                  ( grep -qswi "up" /sys/class/net/${parent_device}/operstate ||  grep -qswi "1" /sys/class/net/${parent_device}/carrier ) ; then -            echo $"Determining if ip address ${IPADDR} is already in use for device ${parent_device}..." +            echo $"Determining if IP address ${IPADDR} is already in use for device ${parent_device}…"              ARPING=$(/sbin/arping -c 2 -w ${ARPING_WAIT:-3} -D -I ${parent_device} ${IPADDR})              if [ $? = 1 ]; then                  ARPINGMAC=$(echo $ARPING | sed -ne 's/.*\[\(.*\)\].*/\1/p') diff --git a/network-scripts/ifup-ctc b/network-scripts/ifup-ctc index 83f754a0..89f50a09 100755 --- a/network-scripts/ifup-ctc +++ b/network-scripts/ifup-ctc @@ -26,7 +26,7 @@ fi  [ -z "$PREFIX" ] && eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK})  ip addr add ${IPADDR} peer ${GATEWAY}/${PREFIX} dev ${DEVICE} -ip link set up dev ${DEVICE} +set_link_up ${DEVICE}  # Wait for the device to come up - the chandev'ified ctc driver can take  # quite a while...  timeout=0 diff --git a/network-scripts/ifup-eth b/network-scripts/ifup-eth index 178b5173..730e08fd 100755 --- a/network-scripts/ifup-eth +++ b/network-scripts/ifup-eth @@ -60,7 +60,7 @@ if [ "${TYPE}" = "Bridge" ]; then      if [ ! -d /sys/class/net/${DEVICE}/bridge ]; then          ip link add ${DEVICE} type bridge $bridge_opts || exit 1      elif [ -n "${bridge_opts}" ]; then -        ip link set ${DEVICE} type bridge $bridge_opts || exit 1 +        ip link set dev ${DEVICE} type bridge $bridge_opts || exit 1      fi      unset bridge_opts @@ -76,7 +76,7 @@ if [ "${TYPE}" = "Bridge" ]; then      # set LINKDELAY (used as timeout when calling check_link_down())      # to at least (${DELAY} * 2) + 7 if STP is enabled. This is the      # minimum time required for /sys/class/net/$REALDEVICE/carrier to -    # become 1 after "ip link set dev $DEVICE up" is called. +    # become 1 after "set_link_up $DEVICE" is called.      if is_true "${STP}"; then          if [ -n "${DELAY}" ]; then            forward_delay="${DELAY}" @@ -164,7 +164,7 @@ fi  # so it can actually get an IP.  if is_false "$ISALIAS" && is_bonding_device ${DEVICE}; then      install_bonding_driver ${DEVICE} -    /sbin/ip link set dev ${DEVICE} up +    set_link_up ${DEVICE}      for device in $(LANG=C grep -l "^[[:space:]]*MASTER=['\"]\?${DEVICE}['\"]\?\([[:space:]#]\|$\)" /etc/sysconfig/network-scripts/ifcfg-*) ; do          is_ignored_file "$device" && continue          /sbin/ifup ${device##*/} || net_log "Unable to start slave device ${device##*/} for master ${DEVICE}." warning @@ -188,10 +188,10 @@ if [ -n "${BRIDGE}" ]; then          ip link add ${BRIDGE} type bridge 2>/dev/null      fi      /sbin/ip addr flush dev ${DEVICE} 2>/dev/null -    /sbin/ip link set dev ${DEVICE} up +    set_link_up ${DEVICE}      ethtool_set      [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY} -    ip link set ${DEVICE} master ${BRIDGE} +    ip link set dev ${DEVICE} master ${BRIDGE}      # add the bits to setup driver parameters here      for arg in $BRIDGING_OPTS ; do          key=${arg%%=*}; @@ -243,7 +243,7 @@ if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then  else       if [ -z "${IPADDR}" -a -z "${IPADDR0}" -a -z "${IPADDR1}" -a -z "${IPADDR2}" ]; then          # enable device without IP, useful for e.g. PPPoE -        ip link set dev ${REALDEVICE} up +        set_link_up ${REALDEVICE}          ethtool_set          [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}      else @@ -253,7 +253,7 @@ else          [ -n "${ARP}" ] && \              ip link set dev ${REALDEVICE} $(toggle_value arp $ARP) -        if ! ip link set dev ${REALDEVICE} up ; then +        if ! set_link_up ${REALDEVICE} ; then              net_log $"Failed to bring up ${DEVICE}."              exit 1          fi diff --git a/network-scripts/ifup-ippp b/network-scripts/ifup-ippp index b8df7c07..a19c12e0 100755 --- a/network-scripts/ifup-ippp +++ b/network-scripts/ifup-ippp @@ -30,20 +30,20 @@ fi  # check that ipppd is available for syncppp   if [ "$ENCAP" = "syncppp" ]; then      if [ ! -x /sbin/ipppd ] && [ ! -x /usr/sbin/ipppd ] ; then -        /usr/bin/logger -p daemon.info -t ifup-ippp "ipppd does not exist or is not executable" +        net_log $"ipppd does not exist or is not executable" info ifup-ippp          exit 1      fi  fi  # check that isdnctrl is available  if [ ! -x /sbin/isdnctrl ] && [ ! -x /usr/sbin/isdnctrl ] ; then -    /usr/bin/logger -p daemon.info -t ifup-ippp "isdnctrl does not exist or is not executable" +    net_log $"isdnctrl does not exist or is not executable" info ifup-ippp      exit 1  fi  # check all ISDN devices  if ! isdnctrl list all >/dev/null 2>&1 ; then -    /usr/bin/logger -p daemon.info -t ifup-ippp "cannot list ISDN devices" +    net_log $"cannot list ISDN devices" info ifup-ippp      exit 1  fi @@ -52,12 +52,12 @@ isdnctrl list $DEVICE >/dev/null 2>&1 && exit 0  function log_echo()  { -    /usr/bin/logger -p daemon.info -t ifup-ippp $"$*" +    net_log $"$*" info ifup-ippp  }  function log_isdnctrl()  { -    /usr/bin/logger -p daemon.info -t ifup-ippp isdnctrl $* +    net_log $"$*" info ifup-ippp      isdnctrl $* >/dev/null 2>&1 || exit 1  } @@ -340,13 +340,13 @@ function addprovider()          pfx=${val##PREFIX=}      }      # activate ISDN device -    /usr/bin/logger -p daemon.info -t ifup-ippp "ip addr add $IPADDR peer $GATEWAY${pfx:/$pfx} dev $DEVICE" +    net_log $"ip addr add $IPADDR peer $GATEWAY${pfx:/$pfx} dev $DEVICE" info ifup-ippp      ip addr add $IPADDR peer $GATEWAY${pfx:/$pfx} dev $DEVICE -    ip link set dev $DEVICE up +    set_link_up ${DEVICE}      if [ "$ENCAP" = "syncppp" ]; then          # start ipppd daemon -        /usr/bin/logger -p daemon.info -t ifup-ippp "ipppd $options $netmask" +        net_log $"ipppd $options $netmask" info ifup-ippp          ipppd $options $netmask >/dev/null 2>&1          # start ibod daemon diff --git a/network-scripts/ifup-plip b/network-scripts/ifup-plip index 2cea68b4..3524b261 100755 --- a/network-scripts/ifup-plip +++ b/network-scripts/ifup-plip @@ -12,7 +12,7 @@ fi  [ -z "$PREFIX" ] && eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK})  ip addr add ${IPADDR} peer ${REMIP}/${PREFIX} dev ${DEVICE} -ip link set up dev ${DEVICE} +set_link_up ${DEVICE}  ip route add ${NETWORK} dev ${DEVICE}  . /etc/sysconfig/network diff --git a/network-scripts/ifup-plusb b/network-scripts/ifup-plusb index 1b29afeb..2b2c2c5c 100755 --- a/network-scripts/ifup-plusb +++ b/network-scripts/ifup-plusb @@ -29,7 +29,7 @@ if [ ${BROADCAST} != ""  ]  ; then  else      ip addr add ${IPADDR} peer ${REMIP}/${PREFIX} dev ${DEVICE}  fi -ip link set up dev ${DEVICE} +set_link_up ${DEVICE}  . /etc/sysconfig/network diff --git a/network-scripts/ifup-tunnel b/network-scripts/ifup-tunnel index ea85df52..f20048a3 100755 --- a/network-scripts/ifup-tunnel +++ b/network-scripts/ifup-tunnel @@ -91,7 +91,7 @@ fi  /sbin/ip addr add "$MY_INNER_IPADDR" dev "$DEVICE" \      ${PEER_INNER_IPADDR:+peer "$PEER_INNER_IPADDR"} -/sbin/ip link set dev "$DEVICE" up +set_link_up "${DEVICE}"  # IPv6 initialisation?  /etc/sysconfig/network-scripts/ifup-ipv6 ${CONFIG} diff --git a/network-scripts/network-functions b/network-scripts/network-functions index 99096bd8..c80467ab 100644 --- a/network-scripts/network-functions +++ b/network-scripts/network-functions @@ -195,25 +195,29 @@ nm_con_load () {          array:string:"/etc/sysconfig/network-scripts/${1}" >/dev/null 2>&1  } -ethtool_set() +ethtool_set ()  { -    oldifs=$IFS; -    IFS=';'; -    if [ -n "${ETHTOOL_DELAY}" ]; then -      # Convert microseconds to seconds: -      local ETHTOOL_DELAY_SEC=$(convert2sec ${ETHTOOL_DELAY} micro) -      sleep ${ETHTOOL_DELAY_SEC} -    fi -    for opts in $ETHTOOL_OPTS ; do -        IFS=$oldifs; -        if [[ "${opts}" =~ [[:space:]]*- ]]; then -            /sbin/ethtool $opts -        else -            /sbin/ethtool -s ${REALDEVICE} $opts -        fi +    if [ -n "${ETHTOOL_OPTS}" ] && [ ! -x /sbin/ethtool ] ; then +        net_log "ethtool does not exist or is not executable." warning +    else +        oldifs=$IFS;          IFS=';'; -    done -    IFS=$oldifs; +        if [ -n "${ETHTOOL_DELAY}" ] ; then +            # Convert microseconds to seconds: +            local ETHTOOL_DELAY_SEC=$(convert2sec ${ETHTOOL_DELAY} micro) +            sleep ${ETHTOOL_DELAY_SEC} +        fi +        for opts in $ETHTOOL_OPTS ; do +            IFS=$oldifs; +            if [[ "${opts}" =~ [[:space:]]*- ]] ; then +                /sbin/ethtool $opts +            else +                /sbin/ethtool -s ${REALDEVICE} $opts +            fi +            IFS=';'; +        done +        IFS=$oldifs; +    fi  }  expand_config () @@ -453,11 +457,16 @@ check_device_down ()      fi  } -check_link_down () +set_link_up ()  { -    if ! LC_ALL=C ip link show dev $1 2>/dev/null| grep -q ",UP" ; then +    if [ "$LINKSTATUS" != up ]; then          ip link set dev $1 up >/dev/null 2>&1      fi +} + +check_link_down () +{ +    set_link_up $1      timeout=0      delay=10      [ -n "$LINKDELAY" ] && delay=$(($LINKDELAY * 2)) @@ -622,6 +631,8 @@ is_bonding_device ()  # Invoke this when /etc/resolv.conf has changed:  change_resolv_conf ()  { +    oldumask=$(umask) +    umask 022      s=$(/bin/grep '^[\ \       ]*option' /etc/resolv.conf 2>/dev/null)      if [ $# -gt 1 ]; then          if [ "x$s" != "x" ]; then @@ -657,6 +668,7 @@ change_resolv_conf ()          /usr/bin/logger -p local7.notice -t "NET" -i "$0 : updated /etc/resolv.conf"          [ -e /run/nscd/socket ] && /usr/sbin/nscd -i hosts # invalidate cache      fi +    umask "$oldumask"      return $r  } diff --git a/network-scripts/network-functions-ipv6 b/network-scripts/network-functions-ipv6 index 2f7b19b8..a85a776d 100644 --- a/network-scripts/network-functions-ipv6 +++ b/network-scripts/network-functions-ipv6 @@ -10,6 +10,8 @@  #  # +# Source network-functions due to need of set_link_up() +. ./network-functions  ##### Test for IPv6 capabilities  # $1: (optional) testflag: currently supported: "testonly" (do not load a module) @@ -108,7 +110,7 @@ ipv6_enable_autotunnel() {          true      else          # bring up basic tunnel device -        /sbin/ip link set sit0 up +        set_link_up sit0              if ! ipv6_test_device_status sit0; then                  net_log $"Tunnel device 'sit0' enabling didn't work" err $fn @@ -159,7 +161,7 @@ ipv6_add_addr_on_device() {          net_log $"Device '$device' doesn't exist" err $fn          return 3      else -        /sbin/ip link set $device up +        set_link_up $device              if ! ipv6_test_device_status $device; then                  net_log $"Device '$device' enabling didn't work" err $fn @@ -604,7 +606,7 @@ ipv6_add_tunnel_device() {              return 3          fi -        /sbin/ip link set $device up +        set_link_up $device          if ! ipv6_test_device_status $device; then              net_log $"Tunnel device '$device' bringing up didn't work" err $fn @@ -1077,7 +1079,7 @@ ipv6_wait_tentative() {      if [ -n "$ip_output" ]; then          net_log $"Some IPv6 address(es) of ${device} remain still in 'tentative' state" warning $fn -        net_log $"Run 'ip -6 addr show dev ${device} tentative' to see more" warning $fn +        net_log $"Run 'ip -6 addr show dev ${device} tentative' for more info" warning $fn      fi      return 0  | 
