Magellan Linux

Diff of /trunk/initscripts/sysvinit/rc/network

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2382 by niro, Tue Jan 7 12:02:04 2014 UTC revision 2383 by niro, Tue Jan 7 12:13:29 2014 UTC
# Line 30  iface_wait_online() Line 30  iface_wait_online()
30   return 0   return 0
31  }  }
32    
33    iface_has_link()
34    {
35     local interface="$1"
36     local flags
37    
38     [[ -n ${interface} ]] || return 2
39     interface="/sys/class/net/${interface}"
40     [[ -d ${interface} ]] || return 2
41     flags=$(cat ${interface}/flags)
42     echo $((${flags}|0x41)) > ${interface}/flags # 0x41: IFF_UP|IFF_RUNNING
43     [ "$(cat ${interface}/carrier)" = 1 ] || return 1
44    }
45    
46  # read values from files  # read values from files
47  read_value()  read_value()
48  {  {
# Line 507  networking_start() Line 520  networking_start()
520   ${CURS_UP}   ${CURS_UP}
521   ${SET_WWCOL}   ${SET_WWCOL}
522   rc_echo "[DHCP]"   rc_echo "[DHCP]"
523   loadproc ${DHCP_PROG} ${DHCP_START} "${iface}"   if iface_has_link "${iface}"
524     then
525     loadproc ${DHCP_PROG} ${DHCP_START} "${iface}"
526     else
527     rc_echo "Interface '${iface}' has no link. Not running '${DHCP_PROG}'."
528     fi
529   ;;   ;;
530   static|STATIC)   static|STATIC)
531   ${CURS_UP}   ${CURS_UP}

Legend:
Removed from v.2382  
changed lines
  Added in v.2383