]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - src/initscripts/init.d/networking/red
Change networking/red not set ip to 1.1.1.1 at PPPoE connection
[people/teissler/ipfire-2.x.git] / src / initscripts / init.d / networking / red
index f56cb21843cff2e152c364afae6559db7843f684..20e052a353e1ba6b5debee3bc245afdefc91af03 100644 (file)
@@ -88,6 +88,9 @@ case "${1}" in
                                exit 1
                        fi
                fi
+
+               ## Create & Enable vnstat
+               /usr/bin/vnstat -u -i ${DEVICE} -r --enable --force > /dev/null 2>&1
                
                if [ "${TYPE}" == "STATIC" ]; then
                
@@ -99,6 +102,9 @@ case "${1}" in
                        echo -n "${DEVICE}" > /var/ipfire/red/iface
                        echo -n "${ADDRESS}"  > /var/ipfire/red/local-ipaddress
                        echo -n "${GATEWAY}" > /var/ipfire/red/remote-ipaddress
+                       grep -v "gateway" /etc/hosts > /tmp/hosts
+                       echo "$GATEWAY gateway"  >> /tmp/hosts
+                       mv /tmp/hosts /etc/hosts
                        echo -n "${DNS1}" > /var/ipfire/red/dns1
                        echo -n "${DNS2}" > /var/ipfire/red/dns2
                        touch /var/ipfire/red/active
@@ -188,7 +194,6 @@ case "${1}" in
                                boot_mesg "Createing ATM-Bridge as $PPP_NIC ..."
                                br2684ctl -c0 -e${ENCAP} -a0.${VPI}.${VCI} >/dev/null 2>&1 &
                                sleep 1
-                               ifconfig $PPP_NIC up
                                TYPE="pppoe"
                        fi
                        if [ "$TYPE" == "pppoe" ]; then                 
@@ -198,7 +203,8 @@ case "${1}" in
                                        exit 0
                                fi
                                boot_mesg "Bringing up the PPPoE interface on $PPP_NIC ..."
-                               ip addr add 1.1.1.1/24 broadcast 1.1.1.255 dev $PPP_NIC
+                               ip addr flush dev $PPP_NIC >/dev/null 2>&1
+                               ip link set ${PPP_NIC} up
                        else
                                boot_mesg "Bringing up the PPP via ${TYPE} on ${COMPORT}..."
                        fi
@@ -315,7 +321,8 @@ case "${1}" in
                                evaluate_retval
                                # echo PPP: /usr/sbin/pppd pty "$PPPOE_CMD" $PPP_STD_OPTIONS $DEBUG $DEMAND $PPPD_SYNC
                        fi
-                       
+                       ## Create & Enable vnstat
+                       /usr/bin/vnstat -u -i ppp0 -r --enable --force > /dev/null 2>&1
                        /etc/rc.d/init.d/connectd start
 
                fi
@@ -327,8 +334,8 @@ case "${1}" in
                        ip route del default via ${GATEWAY} >/dev/null 2>&1
                        echo_ok
                        if [ "$DEVICE" != "${GREEN_DEV}" ]; then
-                               boot_mesg "Removing IPv4 address ${ADDRESS} from the ${DEVICE} interface..."
-                               ip addr del ${args} dev ${DEVICE}
+                               boot_mesg "Removing IPv4 addresses from the ${DEVICE} interface..."
+                               ip addr flush dev ${DEVICE}
                                evaluate_retval
                        fi
                        run_subdir ${rc_base}/init.d/networking/red.down/
@@ -369,10 +376,11 @@ case "${1}" in
                
                elif [ "$TYPE" == "PPPOE" ]; then
                        boot_mesg "Bringing down the PPP interface ..."
+                       ## Disable vnstat collection
+                       /usr/bin/vnstat -u -i ppp0 -r --disable > /dev/null 2>&1
                        rm -f /var/ipfire/red/keepconnected
                        killall -w -s TERM /usr/sbin/pppd 2>/dev/null
                        evaluate_retval
-                       ip addr del 1.1.1.1/24 broadcast 1.1.1.255 dev ${DEVICE} >/dev/null 2>&1
                fi
 
                if [ "$DEVICE" != "${GREEN_DEV}" ] && [ "$DEVICE" != "" ]; then
@@ -388,8 +396,11 @@ case "${1}" in
                killall -w -s KILL /usr/sbin/pppd >/dev/null 2>&1
                killall -w -s KILL br2684ctl >/dev/null 2>&1
                rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
+
+               ## Disable vnstat collection
+               /usr/bin/vnstat -u -i ${DEVICE} -r --disable > /dev/null 2>&1
+               exit 0;
                ;;
-               
 esac
 
 # End