mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
Wieder einmal die Netzwerkscripts.
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@799 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
@@ -679,15 +679,19 @@ log_warning_msg() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
animate()
|
run_subdir() {
|
||||||
{
|
$DIR=$1
|
||||||
if [ $# = 0 ]
|
for i in $( ls -v ${DIR}* 2> /dev/null); do
|
||||||
then
|
check_script_status
|
||||||
echo "Usage: animate {hook}"
|
OUT=$(echo $(basename ${i}) | awk -F- '{ print $2 }')
|
||||||
exit 1
|
case "$OUT" in
|
||||||
fi
|
S) ${i} start ;;
|
||||||
|
K) ${i} stop ;;
|
||||||
splash "$*"
|
RS) ${i} restart ;;
|
||||||
|
RL) ${i} reload ;;
|
||||||
|
*) ${i} ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# End $rc_base/init.d/functions
|
# End $rc_base/init.d/functions
|
||||||
|
|||||||
@@ -12,19 +12,26 @@
|
|||||||
#
|
#
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
|
. /etc/sysconfig/rc
|
||||||
|
. ${rc_functions}
|
||||||
|
|
||||||
eval $(/usr/local/bin/readhash "$1")
|
eval $(/usr/local/bin/readhash "$1")
|
||||||
case "$2" in
|
case "$2" in
|
||||||
up)
|
up)
|
||||||
logger -p local0.info -t dhcpcd.exe[$$] "${INTERFACE} has been configured with old IP=${IPADDR}"
|
logger -p local0.info -t dhcpcd.exe[$$] "${INTERFACE} has been configured with old IP=${IPADDR}"
|
||||||
touch /var/ipfire/red/active
|
touch /var/ipfire/red/active
|
||||||
|
run_subdir ${rc_base}/init.d/networking/red.up/
|
||||||
;;
|
;;
|
||||||
new)
|
new)
|
||||||
logger -p local0.info -t dhcpcd.exe[$$] "${INTERFACE} has been configured with new IP=${IPADDR}"
|
logger -p local0.info -t dhcpcd.exe[$$] "${INTERFACE} has been configured with new IP=${IPADDR}"
|
||||||
[ -e "/var/ipfire/red/active" ] || touch /var/ipfire/red/active
|
[ -e "/var/ipfire/red/active" ] || touch /var/ipfire/red/active
|
||||||
|
run_subdir ${rc_base}/init.d/networking/red.down/
|
||||||
|
run_subdir ${rc_base}/init.d/networking/red.up/
|
||||||
;;
|
;;
|
||||||
down)
|
down)
|
||||||
logger -p local0.info -t dhcpcd.exe[$$] "${INTERFACE} has been brought down"
|
logger -p local0.info -t dhcpcd.exe[$$] "${INTERFACE} has been brought down"
|
||||||
rm -f /var/ipfire/red/active
|
rm -f /var/ipfire/red/active
|
||||||
|
run_subdir ${rc_base}/init.d/networking/red.down/
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,8 @@ case "${1}" in
|
|||||||
echo -n "${DNS1}" > /var/ipfire/red/dns1
|
echo -n "${DNS1}" > /var/ipfire/red/dns1
|
||||||
echo -n "${DNS2}" > /var/ipfire/red/dns2
|
echo -n "${DNS2}" > /var/ipfire/red/dns2
|
||||||
|
|
||||||
|
run_subdir ${rc_base}/init.d/networking/red.up/
|
||||||
|
|
||||||
elif [ "${TYPE}" == "DHCP" ]; then
|
elif [ "${TYPE}" == "DHCP" ]; then
|
||||||
boot_mesg -n "Starting dhcpcd on the ${DEVICE} interface..."
|
boot_mesg -n "Starting dhcpcd on the ${DEVICE} interface..."
|
||||||
echo -n "${DEVICE}" > /var/ipfire/red/iface
|
echo -n "${DEVICE}" > /var/ipfire/red/iface
|
||||||
@@ -206,18 +208,6 @@ case "${1}" in
|
|||||||
/usr/sbin/pppoe-start
|
/usr/sbin/pppoe-start
|
||||||
evaluate_retval
|
evaluate_retval
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for i in $( ls -v ${rc_base}/init.d/networking/red.up/* 2> /dev/null); do
|
|
||||||
check_script_status
|
|
||||||
OUT=$(echo $(basename ${i}) | awk -F- '{ print $2 }')
|
|
||||||
case "$OUT" in
|
|
||||||
S) ${i} start ;;
|
|
||||||
K) ${i} stop ;;
|
|
||||||
RS) ${i} restart ;;
|
|
||||||
RL) ${i} reload ;;
|
|
||||||
*) ${i} ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
stop)
|
stop)
|
||||||
@@ -226,6 +216,8 @@ case "${1}" in
|
|||||||
ip addr del ${args} dev ${DEVICE}
|
ip addr del ${args} dev ${DEVICE}
|
||||||
evaluate_retval
|
evaluate_retval
|
||||||
|
|
||||||
|
run_subdir ${rc_base}/init.d/networking/red.down/
|
||||||
|
|
||||||
elif [ "$TYPE" == "DHCP" ]; then
|
elif [ "$TYPE" == "DHCP" ]; then
|
||||||
boot_mesg -n "Stopping dhcpcd on the ${DEVICE} interface..."
|
boot_mesg -n "Stopping dhcpcd on the ${DEVICE} interface..."
|
||||||
if [ -e $LEASEINFO ]; then
|
if [ -e $LEASEINFO ]; then
|
||||||
@@ -279,17 +271,6 @@ case "${1}" in
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
|
rm -f /var/ipfire/red/{active,device,dial-on-demand,dns1,dns2,local-ipaddress,remote-ipaddress,resolv.conf}
|
||||||
for i in $( ls -v ${rc_base}/init.d/networking/red.down/* 2> /dev/null); do
|
|
||||||
check_script_status
|
|
||||||
OUT=$(echo $(basename ${i}) | awk -F- '{ print $2 }')
|
|
||||||
case "$OUT" in
|
|
||||||
S) ${i} start ;;
|
|
||||||
K) ${i} stop ;;
|
|
||||||
RS) ${i} restart ;;
|
|
||||||
RL) ${i} reload ;;
|
|
||||||
*) ${i} ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ newtComponent netmaskentry;
|
|||||||
newtComponent statictyperadio;
|
newtComponent statictyperadio;
|
||||||
newtComponent dhcptyperadio;
|
newtComponent dhcptyperadio;
|
||||||
newtComponent pppoetyperadio;
|
newtComponent pppoetyperadio;
|
||||||
newtComponent pptptyperadio;
|
|
||||||
newtComponent dhcphostnameentry;
|
newtComponent dhcphostnameentry;
|
||||||
|
|
||||||
/* acceptable character filter for IP and netmaks entry boxes */
|
/* acceptable character filter for IP and netmaks entry boxes */
|
||||||
@@ -68,7 +67,6 @@ int changeaddress(struct keyvalue *kv, char *colour, int typeflag,
|
|||||||
int startstatictype = 0;
|
int startstatictype = 0;
|
||||||
int startdhcptype = 0;
|
int startdhcptype = 0;
|
||||||
int startpppoetype = 0;
|
int startpppoetype = 0;
|
||||||
int startpptptype = 0;
|
|
||||||
|
|
||||||
/* Build some key strings. */
|
/* Build some key strings. */
|
||||||
sprintf(addressfield, "%s_ADDRESS", colour);
|
sprintf(addressfield, "%s_ADDRESS", colour);
|
||||||
@@ -93,17 +91,14 @@ int changeaddress(struct keyvalue *kv, char *colour, int typeflag,
|
|||||||
if (strcmp(temp, "STATIC") == 0) startstatictype = 1;
|
if (strcmp(temp, "STATIC") == 0) startstatictype = 1;
|
||||||
if (strcmp(temp, "DHCP") == 0) startdhcptype = 1;
|
if (strcmp(temp, "DHCP") == 0) startdhcptype = 1;
|
||||||
if (strcmp(temp, "PPPOE") == 0) startpppoetype = 1;
|
if (strcmp(temp, "PPPOE") == 0) startpppoetype = 1;
|
||||||
if (strcmp(temp, "PPTP") == 0) startpptptype = 1;
|
|
||||||
statictyperadio = newtRadiobutton(2, 4, ctr[TR_STATIC], startstatictype, NULL);
|
statictyperadio = newtRadiobutton(2, 4, ctr[TR_STATIC], startstatictype, NULL);
|
||||||
dhcptyperadio = newtRadiobutton(2, 5, "DHCP", startdhcptype, statictyperadio);
|
dhcptyperadio = newtRadiobutton(2, 5, "DHCP", startdhcptype, statictyperadio);
|
||||||
pppoetyperadio = newtRadiobutton(2, 6, "PPPOE", startpppoetype, dhcptyperadio);
|
pppoetyperadio = newtRadiobutton(2, 6, "PPPOE", startpppoetype, dhcptyperadio);
|
||||||
pptptyperadio = newtRadiobutton(2, 7, "PPTP", startpptptype, pppoetyperadio);
|
|
||||||
newtFormAddComponents(networkform, statictyperadio, dhcptyperadio,
|
newtFormAddComponents(networkform, statictyperadio, dhcptyperadio,
|
||||||
pppoetyperadio, pptptyperadio, NULL);
|
pppoetyperadio, NULL);
|
||||||
newtComponentAddCallback(statictyperadio, networkdialogcallbacktype, NULL);
|
newtComponentAddCallback(statictyperadio, networkdialogcallbacktype, NULL);
|
||||||
newtComponentAddCallback(dhcptyperadio, networkdialogcallbacktype, NULL);
|
newtComponentAddCallback(dhcptyperadio, networkdialogcallbacktype, NULL);
|
||||||
newtComponentAddCallback(pppoetyperadio, networkdialogcallbacktype, NULL);
|
newtComponentAddCallback(pppoetyperadio, networkdialogcallbacktype, NULL);
|
||||||
newtComponentAddCallback(pptptyperadio, networkdialogcallbacktype, NULL);
|
|
||||||
dhcphostnamelabel = newtTextbox(2, 9, 18, 1, 0);
|
dhcphostnamelabel = newtTextbox(2, 9, 18, 1, 0);
|
||||||
newtTextboxSetText(dhcphostnamelabel, ctr[TR_DHCP_HOSTNAME]);
|
newtTextboxSetText(dhcphostnamelabel, ctr[TR_DHCP_HOSTNAME]);
|
||||||
strcpy(temp, defaultdhcphostname);
|
strcpy(temp, defaultdhcphostname);
|
||||||
@@ -121,7 +116,7 @@ int changeaddress(struct keyvalue *kv, char *colour, int typeflag,
|
|||||||
findkey(kv, addressfield, temp);
|
findkey(kv, addressfield, temp);
|
||||||
addressentry = newtEntry(20, (typeflag ? 11 : 4) + 0, temp, 20, &addressresult, 0);
|
addressentry = newtEntry(20, (typeflag ? 11 : 4) + 0, temp, 20, &addressresult, 0);
|
||||||
newtEntrySetFilter(addressentry, ip_input_filter, NULL);
|
newtEntrySetFilter(addressentry, ip_input_filter, NULL);
|
||||||
if (typeflag == 1 && startstatictype == 0 && startpptptype == 0 )
|
if (typeflag == 1 && startstatictype == 0)
|
||||||
newtEntrySetFlags(addressentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET);
|
newtEntrySetFlags(addressentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET);
|
||||||
newtFormAddComponent(networkform, addresslabel);
|
newtFormAddComponent(networkform, addresslabel);
|
||||||
newtFormAddComponent(networkform, addressentry);
|
newtFormAddComponent(networkform, addressentry);
|
||||||
@@ -132,7 +127,7 @@ int changeaddress(struct keyvalue *kv, char *colour, int typeflag,
|
|||||||
strcpy(temp, "255.255.255.0"); findkey(kv, netmaskfield, temp);
|
strcpy(temp, "255.255.255.0"); findkey(kv, netmaskfield, temp);
|
||||||
netmaskentry = newtEntry(20, (typeflag ? 11 : 4) + 1, temp, 20, &netmaskresult, 0);
|
netmaskentry = newtEntry(20, (typeflag ? 11 : 4) + 1, temp, 20, &netmaskresult, 0);
|
||||||
newtEntrySetFilter(netmaskentry, ip_input_filter, NULL);
|
newtEntrySetFilter(netmaskentry, ip_input_filter, NULL);
|
||||||
if (typeflag == 1 && startstatictype == 0 && startpptptype == 0 )
|
if (typeflag == 1 && startstatictype == 0)
|
||||||
newtEntrySetFlags(netmaskentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET);
|
newtEntrySetFlags(netmaskentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET);
|
||||||
|
|
||||||
newtFormAddComponent(networkform, netmasklabel);
|
newtFormAddComponent(networkform, netmasklabel);
|
||||||
@@ -160,7 +155,7 @@ int changeaddress(struct keyvalue *kv, char *colour, int typeflag,
|
|||||||
strcpy(type, "STATIC");
|
strcpy(type, "STATIC");
|
||||||
if (typeflag)
|
if (typeflag)
|
||||||
gettype(type);
|
gettype(type);
|
||||||
if (strcmp(type, "STATIC") == 0 || strcmp(type, "PPTP") == 0 )
|
if (strcmp(type, "STATIC") == 0)
|
||||||
{
|
{
|
||||||
if (inet_addr(addressresult) == INADDR_NONE)
|
if (inet_addr(addressresult) == INADDR_NONE)
|
||||||
{
|
{
|
||||||
@@ -189,7 +184,7 @@ int changeaddress(struct keyvalue *kv, char *colour, int typeflag,
|
|||||||
if (typeflag)
|
if (typeflag)
|
||||||
{
|
{
|
||||||
replacekeyvalue(kv, dhcphostnamefield, dhcphostnameresult);
|
replacekeyvalue(kv, dhcphostnamefield, dhcphostnameresult);
|
||||||
if (strcmp(type, "STATIC") != 0 && strcmp(type, "PPTP") != 0)
|
if (strcmp(type, "STATIC") != 0)
|
||||||
{
|
{
|
||||||
replacekeyvalue(kv, addressfield, "0.0.0.0");
|
replacekeyvalue(kv, addressfield, "0.0.0.0");
|
||||||
replacekeyvalue(kv, netmaskfield, "0.0.0.0");
|
replacekeyvalue(kv, netmaskfield, "0.0.0.0");
|
||||||
@@ -231,8 +226,6 @@ int gettype(char *type)
|
|||||||
strcpy(type, "DHCP");
|
strcpy(type, "DHCP");
|
||||||
else if (selected == pppoetyperadio)
|
else if (selected == pppoetyperadio)
|
||||||
strcpy(type, "PPPOE");
|
strcpy(type, "PPPOE");
|
||||||
else if (selected == pptptyperadio)
|
|
||||||
strcpy(type, "PPTP");
|
|
||||||
else
|
else
|
||||||
strcpy(type, "ERROR");
|
strcpy(type, "ERROR");
|
||||||
|
|
||||||
@@ -292,7 +285,7 @@ void networkdialogcallbacktype(newtComponent cm, void *data)
|
|||||||
|
|
||||||
gettype(type);
|
gettype(type);
|
||||||
|
|
||||||
if (strcmp(type, "STATIC") != 0 && strcmp(type, "PPTP") != 0 )
|
if (strcmp(type, "STATIC") != 0)
|
||||||
{
|
{
|
||||||
newtEntrySetFlags(addressentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET);
|
newtEntrySetFlags(addressentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET);
|
||||||
newtEntrySetFlags(netmaskentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET);
|
newtEntrySetFlags(netmaskentry, NEWT_FLAG_DISABLED, NEWT_FLAGS_SET);
|
||||||
|
|||||||
@@ -3,8 +3,11 @@
|
|||||||
|
|
||||||
rm -f /var/ipfire/red/active
|
rm -f /var/ipfire/red/active
|
||||||
|
|
||||||
|
run_subdir ${rc_base}/init.d/networking/red.down/
|
||||||
|
|
||||||
[ -e "/var/ipfire/ppp/nobeeps" ] || /etc/rc.d/init.d/beep down
|
[ -e "/var/ipfire/ppp/nobeeps" ] || /etc/rc.d/init.d/beep down
|
||||||
|
|
||||||
[ -e "/var/ipfire/red/keepconnected" ] && \
|
|
||||||
(ps ax | grep -q "connectioncheck reconnect") && \
|
#[ -e "/var/ipfire/red/keepconnected" ] && \
|
||||||
/etc/rc.d/init.d/connectioncheck reconnect &
|
# (ps ax | grep -q "connectioncheck reconnect") && \
|
||||||
|
# /etc/rc.d/init.d/connectioncheck reconnect &
|
||||||
|
|||||||
@@ -25,4 +25,6 @@ echo -n "$5" > /var/ipfire/red/remote-ipaddress
|
|||||||
|
|
||||||
touch /var/ipfire/red/active
|
touch /var/ipfire/red/active
|
||||||
|
|
||||||
|
run_subdir ${rc_base}/init.d/networking/red.up/
|
||||||
|
|
||||||
[ -e "/var/ipfire/ppp/nobeeps" ] || /etc/rc.d/init.d/beep up
|
[ -e "/var/ipfire/ppp/nobeeps" ] || /etc/rc.d/init.d/beep up
|
||||||
|
|||||||
Reference in New Issue
Block a user