Magellan Linux

Diff of /trunk/magellan-initscripts/etc/rc.d/init.d/network

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

revision 1091 by niro, Wed Jul 14 07:29:53 2010 UTC revision 1092 by niro, Wed Jul 14 11:02:11 2010 UTC
# Line 64  read_value() Line 64  read_value()
64    
65   local BRIDGE_INTERFACES   local BRIDGE_INTERFACES
66   local BRIDGE_STP   local BRIDGE_STP
67     local BRIDGE_AGEING_TIME
68     local BRIDGE_PRIORITY
69     local BRIDGE_FORWARD_DELAY
70     local BRIDGE_HELLO_TIME
71     local BRIDGE_MAX_MESSAGE_AGE
72     local BRIDGE_PATH_COST
73     local BRIDGE_PORT_PRIORITY
74    
75   source ${file}   source ${file}
76   eval value=\$$(echo ${var})   eval value=\$$(echo ${var})
# Line 259  setup_wireless_extensions() Line 266  setup_wireless_extensions()
266   esac   esac
267  }  }
268    
269    config_bridge_options()
270    {
271     local iface="$1"
272     local i
273     local port
274     local cost
275     local prio
276    
277     # enable spanning-tree protocol
278     case ${BRIDGE_STP} in
279     on|off) brctl stp "${iface}" "${BRIDGE_STP}" ;;
280     *) echo "BRIDGE: unkown value \$BRIDGE_STP='$BRIDGE_STP'."; return 1 ;;
281     esac
282    
283     # configure ageing time
284     if [[ ! -z ${BRIDGE_AGEING_TIME} ]]
285     then
286     brctl setageing "${iface}" "${BRIDGE_AGEING_TIME}"
287     fi
288    
289     # configure bridge priority
290     if [[ ! -z ${BRIDGE_PRIORITY} ]]
291     then
292     brctl setbridgeprio "${iface}" "${BRIDGE_PRIORITY}"
293     fi
294    
295     # configure forward delay
296     if [[ ! -z ${BRIDGE_FORWARD_DELAY} ]]
297     then
298     brctl setfd "${iface}" "${BRIDGE_FORWARD_DELAY}"
299     fi
300    
301     # configure hello time
302     if [[ ! -z ${BRIDGE_HELLO_TIME} ]]
303     then
304     brctl sethello "${iface}" "${BRIDGE_HELLO_TIME}"
305     fi
306    
307     # configure maximal message age
308     if [[ ! -z ${BRIDGE_MAX_MESSAGE_AGE} ]]
309     then
310     brctl setmaxage "${iface}" "${BRIDGE_MAX_MESSAGE_AGE}"
311     fi
312    
313     # configure path cost for every port
314     if [[ ! -z ${BRIDGE_PATH_COST} ]]
315     then
316     for i in ${BRIDGE_PATH_COST}
317     do
318     port="${i%=*}"
319     cost="${i#*=}"
320     [[ ! -z ${port} ]] && brctl pathcost "${iface}" "${port}" "${cost}"
321     done
322     fi
323    
324     # configure port priority for every port
325     if [[ ! -z ${BRIDGE_PORT_PRIORITY} ]]
326     then
327     for i in ${BRIDGE_PORT_PRIORITY}
328     do
329     port="${i%=*}"
330     prio="${i#*=}"
331     [[ ! -z ${port} ]] && brctl setportprio "${iface}" "${port}" "${prio}"
332     done
333     fi
334    }
335    
336  config_bridge_devices()  config_bridge_devices()
337  {  {
338   local iface="$1"   local iface="$1"
# Line 294  config_bridge_devices() Line 368  config_bridge_devices()
368   case ${method} in   case ${method} in
369   add)   add)
370   # setup the bridge device   # setup the bridge device
371   brctl addbr ${iface}   brctl addbr "${iface}"
372   for bport in ${BRIDGE_INTERFACES}   for bport in ${BRIDGE_INTERFACES}
373   do   do
374   # enter promiscous mode   # enter promiscous mode
375   ifconfig ${bport} 0.0.0.0 promisc   ifconfig "${bport}" 0.0.0.0 promisc
376   # now setup the bridge   # now setup the bridge
377   brctl addif ${iface} ${bport}   brctl addif "${iface}" "${bport}"
378   done   done
379   # enable spanning-tree protocol   # configure all other options
380   case ${BRIDGE_STP} in   config_bridge_options "${iface}"
  on|off) brctl stp ${iface} ${BRIDGE_STP} ;;  
  *) echo "BRIDGE: unkown value \$BRIDGE_STP='$BRIDGE_STP'."; return 1 ;;  
  esac  
381   ;;   ;;
382    
383   remove)   remove)
384   for bport in ${BRIDGE_INTERFACE}   for bport in ${BRIDGE_INTERFACE}
385   do   do
386   # bring the interface down   # bring the interface down
387   ifconfig ${bport} down   ifconfig "${bport}" down
388   # remove the interface from the bridge   # remove the interface from the bridge
389   brctl delif ${iface} ${bport}   brctl delif "${iface}" "${bport}"
390   done   done
391   # bring the bridge down   # bring the bridge down
392   brctl delbr ${iface}   brctl delbr "${iface}"
393   ;;   ;;
394   esac   esac
395    
# Line 352  config_routes() Line 423  config_routes()
423   \#*|"") continue ;;   \#*|"") continue ;;
424   esac   esac
425   echo -e ${COLOREDSTAR}"${message}"   echo -e ${COLOREDSTAR}"${message}"
426   route ${method} ${route}   route "${method}" "${route}"
427   evaluate_retval   evaluate_retval
428   done   done
429   fi   fi
# Line 395  networking_start() Line 466  networking_start()
466   # setup bridges   # setup bridges
467   if [[ ${iface} = br[0-9]* ]]   if [[ ${iface} = br[0-9]* ]]
468   then   then
469   config_bridge_devices ${iface} add   config_bridge_devices "${iface}" add
470   fi   fi
471    
472   # now configure wireless_extensions   # now configure wireless_extensions
# Line 427  networking_start() Line 498  networking_start()
498   if [[ -n ${GATEWAY} ]]   if [[ -n ${GATEWAY} ]]
499   then   then
500   echo -e ${COLOREDSTAR}"Setting up default gateway for ${COLBLUE}${iface}${COLDEFAULT} ..."   echo -e ${COLOREDSTAR}"Setting up default gateway for ${COLBLUE}${iface}${COLDEFAULT} ..."
501   route add default gateway ${GATEWAY} metric 1 dev ${iface}   route add default gateway "${GATEWAY}" metric 1 dev "${iface}"
502   evaluate_retval   evaluate_retval
503    
504   unset GATEWAY   unset GATEWAY
# Line 505  networking_stop() Line 576  networking_stop()
576   # remove bridges   # remove bridges
577   if [[ ${iface} = br[0-9]* ]]   if [[ ${iface} = br[0-9]* ]]
578   then   then
579   config_bridge_devices ${iface} remove   config_bridge_devices "${iface}" remove
580   fi   fi
581    
582   # shutdown dhcp-daemon   # shutdown dhcp-daemon

Legend:
Removed from v.1091  
changed lines
  Added in v.1092