mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-11 19:55:52 +02:00
Add PPTP over DHCP support to red
This commit is contained in:
@@ -74,16 +74,13 @@ if [ "${TYPE}" == "STATIC" ]; then
|
||||
echo_failure
|
||||
exit 1
|
||||
fi
|
||||
|
||||
elif [ "${TYPE}" == "DHCP" ]; then
|
||||
|
||||
PIDFILE="/var/run/dhcpcd-${DEVICE}.pid"
|
||||
LEASEINFO="/var/ipfire/dhcpc/dhcpcd-${DEVICE}.info"
|
||||
DHCP_START="-N -R -L /var/ipfire/dhcpc -c /var/ipfire/dhcpc/dhcpcd.exe "
|
||||
DHCP_STOP="-k -c /var/ipfire/dhcpc/dhcpcd.exe "
|
||||
|
||||
fi
|
||||
|
||||
PIDFILE="/var/run/dhcpcd-${DEVICE}.pid"
|
||||
LEASEINFO="/var/ipfire/dhcpc/dhcpcd-${DEVICE}.info"
|
||||
DHCP_START="-N -R -L /var/ipfire/dhcpc -c /var/ipfire/dhcpc/dhcpcd.exe "
|
||||
DHCP_STOP="-k -c /var/ipfire/dhcpc/dhcpcd.exe "
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
if [ "${DEVICE}" != "${GREEN_DEV}" ] && [ "${DEVICE}" != "" ]; then
|
||||
@@ -264,8 +261,6 @@ case "${1}" in
|
||||
if [ "${RED_VDSL_IPTV_DISABLE}" == "0" ]; then
|
||||
PIDFILE="/var/run/dhcpcd-${DEVICE}.${RED_VDSL_IPTV_VLAN}.pid"
|
||||
LEASEINFO="/var/ipfire/dhcpc/dhcpcd-${DEVICE}.${RED_VDSL_IPTV_VLAN}.info"
|
||||
DHCP_START="-N -R -L /var/ipfire/dhcpc -c /var/ipfire/dhcpc/dhcpcd.exe "
|
||||
DHCP_STOP="-k -c /var/ipfire/dhcpc/dhcpcd.exe "
|
||||
|
||||
# Test to see if there is a stale pid file
|
||||
if [ -f "$PIDFILE" ]; then
|
||||
@@ -329,7 +324,47 @@ case "${1}" in
|
||||
boot_mesg "Bringing up the $TYPE interface on $PPP_NIC ..."
|
||||
ip addr flush dev $PPP_NIC >/dev/null 2>&1
|
||||
if [ "$TYPE" == "pptp" ]; then
|
||||
ip addr add $PPTP_NICCFG dev $PPP_NIC
|
||||
if [ "$PPTP_NICCFG" == "dhcp" ]; then
|
||||
|
||||
# Test to see if there is a stale pid file
|
||||
if [ -f "$PIDFILE" ]; then
|
||||
ps `cat "$PIDFILE"` | grep dhcpcd > /dev/null
|
||||
if [ $? != 0 ]; then
|
||||
rm -f /var/run/dhcpcd-${DEVICE}.${RED_VDSL_IPTV_VLAN}.pid > /dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f "$PIDFILE" ]; then
|
||||
boot_mesg -n "Starting dhcpcd on the ${DEVICE}.${RED_VDSL_IPTV_VLAN} interface..."
|
||||
/sbin/dhcpcd ${DEVICE} ${DHCP_START} >/dev/null 2>&1
|
||||
RET="$?"
|
||||
|
||||
if [ "$RET" = "0" ]; then
|
||||
. /var/ipfire/dhcpc/dhcpcd-${DEVICE}.info
|
||||
echo ""
|
||||
echo_ok
|
||||
boot_mesg " DHCP Assigned Settings for ${DEVICE}:"
|
||||
boot_mesg_flush
|
||||
boot_mesg " IP Address: $IPADDR"
|
||||
boot_mesg_flush
|
||||
boot_mesg " Hostname: $RED_DHCP_HOSTNAME"
|
||||
boot_mesg_flush
|
||||
boot_mesg " Subnet Mask: $NETMASK"
|
||||
boot_mesg_flush
|
||||
boot_mesg " Default Gateway: $GATEWAY"
|
||||
boot_mesg_flush
|
||||
boot_mesg " DNS Server: $DNS"
|
||||
boot_mesg_flush
|
||||
|
||||
else
|
||||
echo ""
|
||||
$(exit "$RET")
|
||||
evaluate_retval
|
||||
fi
|
||||
fi
|
||||
else
|
||||
ip addr add $PPTP_NICCFG dev $PPP_NIC
|
||||
fi
|
||||
fi
|
||||
ip link set ${PPP_NIC} up
|
||||
else
|
||||
@@ -480,39 +515,6 @@ case "${1}" in
|
||||
fi
|
||||
run_subdir ${rc_base}/init.d/networking/red.down/
|
||||
|
||||
elif [ "$TYPE" == "DHCP" ]; then
|
||||
boot_mesg -n "Stopping dhcpcd on the ${DEVICE} interface..."
|
||||
if [ -e $LEASEINFO ]; then
|
||||
. $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
|
||||
else
|
||||
boot_mesg -n "LEASEINFO Test failed! - " ${WARNING}
|
||||
boot_mesg "dhcpcd is not running!" ${WARNING}
|
||||
echo_warning
|
||||
fi
|
||||
|
||||
elif [ "$TYPE" == "PPPOE" ]; then
|
||||
boot_mesg "Bringing down the PPP interface ..."
|
||||
## Disable vnstat collection
|
||||
@@ -525,6 +527,34 @@ case "${1}" in
|
||||
$(date +%s):: > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
if [ "$DEVICE" != "${GREEN_DEV}" ] && [ "$DEVICE" != "" ]; then
|
||||
link_status=`ip link show $DEVICE.${RED_VDSL_INET_VLAN} 2> /dev/null`
|
||||
if [ -n "${link_status}" ]; then
|
||||
|
||||
Reference in New Issue
Block a user