X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=blobdiff_plain;f=src%2Finitscripts%2Finit.d%2Fnetworking%2Fred;h=f90e07378d5d3767d91f3a1a862fb5f282471681;hp=9b4ffe8a07696e3f5c1967f145845af28c42fb53;hb=f6a6ea8d5ea0bf9a9344d99b0715e5a3fad1476a;hpb=5cffc05ba1b16f90c81d3168543e5de48853076f diff --git a/src/initscripts/init.d/networking/red b/src/initscripts/init.d/networking/red index 9b4ffe8a07..f90e07378d 100644 --- a/src/initscripts/init.d/networking/red +++ b/src/initscripts/init.d/networking/red @@ -15,8 +15,16 @@ # ######################################################################## + + . /etc/sysconfig/rc . ${rc_functions} + +eval $(/usr/local/bin/readhash /var/ipfire/main/settings) +if [ "$RRDLOG" == "" ]; then + RRDLOG=/var/log/rrd +fi + eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) TYPE="${RED_TYPE}" @@ -114,8 +122,40 @@ case "${1}" in evaluate_retval run_subdir ${rc_base}/init.d/networking/red.up/ - + + # Configure aliases only if red static + /usr/local/bin/setaliases + elif [ "${TYPE}" == "DHCP" ]; then + + if [ -e $LEASEINFO ]; then + boot_mesg -n "Stopping dhcpcd on the ${DEVICE} interface..." + . $LEASEINFO + if [ "$LEASETIME" = "4294967295" ]; then + # do nothing, just echo ok + echo "" + echo_ok + else + if [ -n "$DHCP_STOP" ]; then + /sbin/dhcpcd ${DEVICE} $DHCP_STOP &> /dev/null + RET="$?" + if [ "$RET" -eq 0 ]; then + echo "" + echo_ok + elif [ "$RET" -eq 1 ]; then + boot_mesg "dhcpcd not running!" ${WARNING} + echo_warning + else + echo "" + echo_failure + fi + else + echo "" + killproc dhcpcd + fi + fi + fi + boot_mesg -n "Starting dhcpcd on the ${DEVICE} interface..." echo -n "${DEVICE}" > /var/ipfire/red/iface @@ -172,6 +212,7 @@ case "${1}" in echo "$GATEWAY gateway" >> /tmp/hosts mv /tmp/hosts /etc/hosts echo "$GATEWAY" > /var/ipfire/red/remote-ipaddress + touch /var/ipfire/red/active else echo "" $(exit "$RET") @@ -191,7 +232,17 @@ case "${1}" in [ -c "/dev/ppp" ] || mknod /dev/ppp c 108 0 PPP_NIC=${DEVICE} - + + if [ "$TYPE" == "vdsl" ]; then + boot_mesg "Createing VLAN Interface ${DEVICE}.7 ..." + modprobe 8021q + vconfig add ${DEVICE} 7 + PPP_NIC=${DEVICE}.7 + sleep 0.2 + ip link set ${PPP_NIC} up + TYPE="pppoe" + fi + if [ "$TYPE" == "pppoeatm" ] || [ "$TYPE" == "pptpatm" ]; then PPP_NIC=nas0 boot_mesg "Createing ATM-Bridge as $PPP_NIC ..." @@ -295,8 +346,10 @@ case "${1}" in if [ "$TYPE" == "modem" ]; then PLUGOPTS=" /dev/${COMPORT} ${DTERATE} connect /etc/ppp/dialer lock modem crtscts" + METHOD="PPPOE_PLUGIN" elif [ "$TYPE" == "serial" ]; then PLUGOPTS=" /dev/${COMPORT} ${DTERATE} connect /bin/true lock modem crtscts" + METHOD="PPPOE_PLUGIN" fi ### Standard PPP options we always use @@ -326,11 +379,12 @@ case "${1}" in # if [ "$TYPE" == "pptp" ]; then PPPOE_CMD="pptp $PPTP_PEER --nolaunchpppd" + METHOD="" fi ### Run everything # - if [ "$TYPE" == "pppoe" ] && [ "${METHOD}" == "PPPOE_PLUGIN" ]; then + if [ "$METHOD" == "PPPOE_PLUGIN" ]; then /usr/sbin/pppd $PPP_STD_OPTIONS $DEBUG $DEMAND >/dev/null 2>&1 & evaluate_retval # echo PLUGIN: /usr/sbin/pppd $PPP_STD_OPTIONS $DEBUG $DEMAND @@ -342,7 +396,10 @@ case "${1}" in ## Create & Enable vnstat /usr/bin/vnstat -u -i ppp0 -r --enable --force > /dev/null 2>&1 /etc/rc.d/init.d/connectd start - + # Add a NaN value to ppp0 rrd to supress spikes at reconnect + rrdtool update $RRDLOG/collectd/localhost/interface/if_octets-ppp0.rrd \ + $(date +%s):: > /dev/null 2>&1 + exit 0 fi ;; @@ -398,9 +455,21 @@ case "${1}" in rm -f /var/ipfire/red/keepconnected killall -w -s TERM /usr/sbin/pppd 2>/dev/null evaluate_retval + # Add a NaN value to ppp0 rrd to supress spikes at reconnect + rrdtool update $RRDLOG/collectd/localhost/interface/if_octets-ppp0.rrd \ + $(date +%s):: > /dev/null 2>&1 fi if [ "$DEVICE" != "${GREEN_DEV}" ] && [ "$DEVICE" != "" ]; then + link_status=`ip link show $DEVICE.7 2> /dev/null` + if [ -n "${link_status}" ]; then + if echo "${link_status}" | grep -q UP; then + boot_mesg "Bringing down the ${DEVICE}.7 interface..." + ip link set ${DEVICE}.7 down + vconfig del ${DEVICE} 7 + evaluate_retval + fi + fi link_status=`ip link show $DEVICE 2> /dev/null` if [ -n "${link_status}" ]; then if echo "${link_status}" | grep -q UP; then