From 18720f431f98d6b14e3ae91f7f363e141bf44c4a Mon Sep 17 00:00:00 2001 From: ms Date: Tue, 14 Aug 2007 18:31:45 +0000 Subject: [PATCH] isdn4k-Utils entfernt. Alte Scripts entfernt. firewall.local bekommt die richtigen Rechte git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@767 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- config/rootfiles/common/isdn4k-utils | 75 --- lfs/initscripts | 1 + lfs/isdn4k-utils | 101 ---- make.sh | 1 - src/initscripts/init.d/red | 843 --------------------------- 5 files changed, 1 insertion(+), 1020 deletions(-) delete mode 100644 config/rootfiles/common/isdn4k-utils delete mode 100644 lfs/isdn4k-utils delete mode 100644 src/initscripts/init.d/red diff --git a/config/rootfiles/common/isdn4k-utils b/config/rootfiles/common/isdn4k-utils deleted file mode 100644 index 1995ab053a..0000000000 --- a/config/rootfiles/common/isdn4k-utils +++ /dev/null @@ -1,75 +0,0 @@ -etc/isdn/callerid.conf -etc/isdn/isdn.conf -etc/isdn/isdnlog.isdnctrl0.options -etc/isdn/isdnlog.users -etc/isdn/rate.conf -etc/isdn/stop -#sbin/divaload -#sbin/eiconctrl -#sbin/hisaxctrl -#sbin/icnctrl -sbin/isdnctrl -#sbin/pcbitctl -usr/bin/isdnbill -usr/bin/isdnconf -usr/bin/isdnrate -usr/bin/isdnrep -usr/lib/isdn/ISAR.BIN -usr/lib/isdn/country.dat -usr/lib/isdn/dest.cdb -usr/lib/isdn/dnload.bin -usr/lib/isdn/ds4bri.bit -usr/lib/isdn/dspdload.bin -usr/lib/isdn/holiday-de.dat -usr/lib/isdn/loadpg.bin -usr/lib/isdn/pc_1t_ca.bin -usr/lib/isdn/pc_eu_ca.bin -usr/lib/isdn/prload.bin -usr/lib/isdn/rate-de.dat -usr/lib/isdn/te_dmlt.pm -usr/lib/isdn/te_etsi.p -usr/lib/isdn/te_etsi.qm0 -usr/lib/isdn/te_etsi.qm1 -usr/lib/isdn/te_etsi.qm2 -usr/lib/isdn/te_etsi.qm3 -usr/lib/isdn/te_etsi.sm -usr/lib/isdn/te_etsi.sq -usr/lib/isdn/te_etsi.sx -usr/lib/isdn/te_etsi.sy -usr/lib/isdn/zone-de-dtag.cdb -usr/sbin/capiinit -usr/sbin/divalog -usr/sbin/divalogd -usr/sbin/divertctrl -usr/sbin/imon -usr/sbin/imontty -usr/sbin/ipppd -usr/sbin/ipppstats -usr/sbin/iprofd -usr/sbin/isdnlog -#usr/share/man/man1/isdnbill.1 -#usr/share/man/man1/isdnconf.1 -#usr/share/man/man1/isdnrate.1 -#usr/share/man/man1/isdnrep.1 -#usr/share/man/man5/callerid.conf.5 -#usr/share/man/man5/isdn.conf.5 -#usr/share/man/man5/isdnformat.5 -#usr/share/man/man5/isdnlog.5 -#usr/share/man/man5/isdnlog.users.5 -#usr/share/man/man5/rate-files.5 -#usr/share/man/man5/rate.conf.5 -#usr/share/man/man8/.isdnctrl_conf.8 -#usr/share/man/man8/avmcapictrl.8 -#usr/share/man/man8/capiinfo.8 -#usr/share/man/man8/divertctrl.8 -#usr/share/man/man8/eiconctrl.8 -#usr/share/man/man8/hisaxctrl.8 -#usr/share/man/man8/icnctrl.8 -#usr/share/man/man8/imon.8 -#usr/share/man/man8/imontty.8 -#usr/share/man/man8/ipppd.8 -#usr/share/man/man8/ipppstats.8 -#usr/share/man/man8/iprofd.8 -#usr/share/man/man8/isdnctrl.8 -#usr/share/man/man8/isdnlog.8 -#usr/share/man/man8/pcbitctl.8 diff --git a/lfs/initscripts b/lfs/initscripts index 9a773e4f1b..60b23edc0a 100644 --- a/lfs/initscripts +++ b/lfs/initscripts @@ -85,6 +85,7 @@ $(TARGET) : for i in $(DIR_SRC)/src/initscripts/sysconfig/*; do \ install -v -m 644 $$i /etc/sysconfig/; \ done + chmod -v 755 /etc/sysconfig/firewall.local for i in $(DIR_SRC)/src/initscripts/helper/*; do \ install -v -m 755 $$i /etc/rc.d/helper/; \ diff --git a/lfs/isdn4k-utils b/lfs/isdn4k-utils deleted file mode 100644 index cac21fdd33..0000000000 --- a/lfs/isdn4k-utils +++ /dev/null @@ -1,101 +0,0 @@ -############################################################################### -# This file is part of the IPCop Firewall. # -# # -# IPCop is free software; you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation; either version 2 of the License, or # -# (at your option) any later version. # -# # -# IPCop is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with IPCop; if not, write to the Free Software # -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# # -# Makefiles are based on LFSMake, which is # -# Copyright (C) 2002 Rod Roard # -# # -############################################################################### - -############################################################################### -# Definitions -############################################################################### - -include Config - -VER = CVS-2006-07-20 - -THISAPP = isdn4k-utils-$(VER) -DL_FILE = $(THISAPP).tar.bz2 -DL_FROM = $(URL_IPFIRE) -DIR_APP = $(DIR_SRC)/$(THISAPP) -TARGET = $(DIR_INFO)/$(THISAPP) -CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -RPM_OPT_FLAGS = "$(CFLAGS)" - -############################################################################### -# Top-level Rules -############################################################################### -objects = $(DL_FILE) - -$(DL_FILE) = $(DL_FROM)/$(DL_FILE) - -$(DL_FILE)_MD5 = 7cde4a61e870bb7e53cd912a3fc30207 - -install : $(TARGET) - -check : $(patsubst %,$(DIR_CHK)/%,$(objects)) - -download :$(patsubst %,$(DIR_DL)/%,$(objects)) - -md5 : $(subst %,%_MD5,$(objects)) - -############################################################################### -# Downloading, checking, md5sum -############################################################################### - -$(patsubst %,$(DIR_CHK)/%,$(objects)) : - @$(CHECK) - -$(patsubst %,$(DIR_DL)/%,$(objects)) : - @$(LOAD) - -$(subst %,%_MD5,$(objects)) : - @$(MD5) - -############################################################################### -# Installation Details -############################################################################### - -$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) - @$(PREBUILD) - @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE) - #cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/isdn4k-utils_ippp-filter.diff - cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/isdn4k-utils-CVS-2006-07-20-redhat.patch - cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/isdn4k-utils-CVS-2004-11-18-autoconf25x.patch - cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/isdn4k-utils-0202131200-true.patch - cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/isdn4k-utils-CVS-2006-02-13-cleanup.patch - cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/isdn4k-utils-statfs.patch - cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/isdn4k-utils-capiinit.patch - cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/isdn4k-utils-CVS-2006-07-20-pppd-2.4.4.patch - - cd $(DIR_APP) && for i in */configure; do \ - cd `dirname $$i`; \ - autoreconf --force --install; \ - cd ..; \ - done - - cd $(DIR_APP) && iconv -f iso-8859-1 -t utf-8 < imontty/imontty.8.in > imontty/imontty.8.in_ - cd $(DIR_APP) && mv imontty/imontty.8.in_ imontty/imontty.8.in - - cd $(DIR_APP) && cp -fv $(DIR_SRC)/config/isdn4k-utils/config .config - cd $(DIR_APP) && sed -e "s,',,g" .config > .config.h - - cd $(DIR_APP) && make subconfig - cd $(DIR_APP) && make - cd $(DIR_APP) && make install - @rm -rf $(DIR_APP) - @$(POSTBUILD) diff --git a/make.sh b/make.sh index 40602a3e60..69441111f3 100755 --- a/make.sh +++ b/make.sh @@ -415,7 +415,6 @@ buildipfire() { ipfiremake iputils ipfiremake l7-protocols ipfiremake mISDN - ipfiremake isdn4k-utils ipfiremake hwdata ipfiremake kudzu ipfiremake logrotate diff --git a/src/initscripts/init.d/red b/src/initscripts/init.d/red deleted file mode 100644 index ede78c0b19..0000000000 --- a/src/initscripts/init.d/red +++ /dev/null @@ -1,843 +0,0 @@ -#!/usr/bin/perl -# -# This file is part of the IPCop Firewall. -# -# IPCop is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# IPCop is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with IPCop; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# (c) The SmoothWall Team -# - -# Clean up our environment (we're running SUID!) -delete @ENV{qw(IFS CDPATH ENV BASH_ENV PATH)}; -$< = $>; - -use strict; -require '/var/ipfire/general-functions.pl'; - -my %pppsettings; -my %isdnsettings; -my %netsettings; -my %dhcpsettings; -my $iface; - -# read vars back from file. -&General::readhash("${General::swroot}/ppp/settings", \%pppsettings); -&General::readhash("${General::swroot}/isdn/settings", \%isdnsettings); -&General::readhash("${General::swroot}/ethernet/settings", \%netsettings); -&General::readhash("${General::swroot}/dhcp/settings", \%dhcpsettings); - -sub dodhcpdial($;$) { - my ($iface,$dhcp_name)=@_; - - system ('/sbin/iptables', '-A', 'REDINPUT', '-p', 'tcp', '--source-port', '67', - '--destination-port', '68', '-i', $iface, '-j', 'ACCEPT'); - system ('/sbin/iptables', '-A', 'REDINPUT', '-p', 'udp', '--source-port', '67', - '--destination-port', '68', '-i', $iface, '-j', 'ACCEPT'); - - foreach ("<${General::swroot}/dhcpc/*.info>") { unlink $1 if ( $_ =~ /^([\/\w.-]+)$/ ); } - my @dhcpcommand = ('/sbin/dhcpcd'); - push(@dhcpcommand, ('-N', '-R', "$iface",'-L', "${General::swroot}/dhcpc")); - - #FIXME the only way actually to set debug use is in pppsetup.cgi and 'RED is modem/isdn' interface - if ($pppsettings{'DEBUG'} eq 'on') { - push(@dhcpcommand, ('-d')); - } - - if ($dhcp_name ne '') { push(@dhcpcommand, ('-h', "$dhcp_name", "&>/dev/null")); } - if ($netsettings{'RED_TYPE'} eq 'PPTP') { push(@dhcpcommand, '-G'); } - - if (system (@dhcpcommand)) { - &General::log('dhcpcd fail'); - exit 1; - } else { - &General::log('dhcpcd success'); - } -} - -sub doupdatesettings { - # complete cleanup only if settings were changed or clear is ordered - system('/sbin/modprobe', '-r', 'pppoatm'); - system('/sbin/modprobe', '-r', 'pppoe'); - system('/bin/killall /usr/bin/br2684ctl 2>/dev/null'); - system('/sbin/modprobe', '-r', 'br2684'); - system('/sbin/modprobe', '-r', 'clip'); - - if ($pppsettings{'TYPE'} ne 'fritzdsl') { - system('/sbin/modprobe', '-r', 'fcdsl', 'fcdsl2', 'fcdslsl', 'fcdslusb', 'fcdslslusb');} - sleep 1; - - # remove existing default route (for static address) if it was been changed from setup or web interface SF1175052 - system ('/sbin/route del default 2>/dev/null'); - - # erase in case it was created once with 'persistent' selected but rc.red stop never used : SF1171610 - unlink ("${General::swroot}/red/iface"); -} - -# No output should be sent to the webclient -open STDIN, '/dev/null' or die "Can't write to /dev/null"; - -if ($ARGV[0] eq 'start') { - if (-e "${General::swroot}/red/active" || - -e '/var/run/ppp-ipfire.pid') - { - &General::log ("ERROR: Can't start RED when it's still active"); - exit 1; - } - - if ( ( ( ($netsettings{'RED_TYPE'} =~ /^(PPPOE|PPTP)$/) && ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/) ) || - ( ( ($pppsettings{'METHOD'} =~ /^(PPPOE|PPPOE_PLUGIN)$/) || ($pppsettings{'PROTOCOL'} eq 'RFC2364') ) && - ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/) ) ) && ($pppsettings{'RECONNECTION'} ne 'manual') ) { - system ('/etc/rc.d/init.d/connectioncheck start &'); - } - - ### - ### Red device is ethernet - ### - if ($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/) - { - if ($netsettings{'RED_DEV'} ne '') - { - &General::log("Starting RED device $netsettings{'RED_DEV'}."); - - if ( $netsettings{'RED_TYPE'} eq 'DHCP') - { - if (open(FILE, ">${General::swroot}/red/iface")) { print FILE $netsettings{'RED_DEV'}; close FILE; } - dodhcpdial($netsettings{'RED_DEV'},$netsettings{'RED_DHCP_HOSTNAME'}); - exit 0; - } - elsif ( ( $netsettings{'RED_TYPE'} eq 'PPTP') && ( $pppsettings{'METHOD'} eq 'DHCP') ) - { - if (open(FILE, ">${General::swroot}/red/device")) { print FILE $netsettings{'RED_DEV'}; close FILE; } - unlink ("${General::swroot}/red/iface"); - dodhcpdial($netsettings{'RED_DEV'},$netsettings{'RED_DHCP_HOSTNAME'}); - } - elsif ( ( $netsettings{'RED_TYPE'} eq 'STATIC') || - ( $netsettings{'RED_TYPE'} eq 'PPTP') && ( $pppsettings{'METHOD'} ne 'DHCP') ) - { - system ("/sbin/ifconfig", - $netsettings{'RED_DEV'}, $netsettings{'RED_ADDRESS'}, - "netmask", $netsettings{'RED_NETMASK'}, - "broadcast", $netsettings{'RED_BROADCAST'},"up"); - if ( $netsettings{'RED_TYPE'} eq 'STATIC') - { - system("/usr/local/bin/setaliases"); - system("echo $netsettings{'DNS1'} > ${General::swroot}/red/dns1"); - system("echo $netsettings{'DNS2'} > ${General::swroot}/red/dns2"); - system("echo $netsettings{'RED_ADDRESS'} > ${General::swroot}/red/local-ipaddress"); - system("echo $netsettings{'DEFAULT_GATEWAY'} > ${General::swroot}/red/remote-ipaddress"); - } elsif ( $netsettings{'RED_TYPE'} eq 'PPTP' ) { - if (open(FILE, ">${General::swroot}/red/device")) { print FILE $netsettings{'RED_DEV'}; close FILE; } - unlink ("${General::swroot}/red/iface"); - } - if ( $netsettings{'DEFAULT_GATEWAY'} ne '' ) - { - system ("/sbin/route","add","default","gw", - $netsettings{'DEFAULT_GATEWAY'}); - } - } - else - { - # PPPoE - system ("/sbin/ifconfig", $netsettings{'RED_DEV'}, "1.1.1.1", - "netmask", "255.255.255.0", "broadcast", "1.1.1.255", "up"); - } - - if ( $netsettings{'RED_TYPE'} eq 'STATIC') - { - if (open(FILE, ">${General::swroot}/red/iface")) { print FILE $netsettings{'RED_DEV'}; close FILE; } - system ("/bin/touch", "${General::swroot}/red/active"); - system ("/etc/rc.d/init.d/network red update"); - exit 0; - } - } - else - { - &General::log ("ERROR: Can't start RED when RED device not set!"); - exit 1; - } - } - - - if ($pppsettings{'RECONNECTION'} eq 'dialondemand') - { - system ('/bin/touch', "${General::swroot}/red/dial-on-demand"); - } - - if ($pppsettings{'VALID'} ne 'yes') { - &General::log("Profile has errors."); - exit 1; - } - - if (-e "${General::swroot}/ppp/updatesettings") { - &doupdatesettings; - } - - if (( $pppsettings{'METHOD'} eq 'STATIC') && ( $pppsettings{'DNS'} eq 'Manual')) { - system("/usr/local/bin/setaliases"); - if (open(FILE, ">${General::swroot}/red/dns1")) { print FILE $pppsettings{'DNS1'}; close FILE; } - if (open(FILE, ">${General::swroot}/red/dns2")) { print FILE $pppsettings{'DNS2'}; close FILE; } - if (open(FILE, ">${General::swroot}/red/local-ipaddress")) { print FILE $pppsettings{'IP'}; close FILE; } - if (open(FILE, ">${General::swroot}/red/remote-ipaddress")) { print FILE $pppsettings{'GATEWAY'}; close FILE; } - } - if ($pppsettings{'RECONNECTION'} eq 'dialondemand') { - &General::log("Dial-on-Demand waiting to dial $pppsettings{'PROFILENAME'}."); - } else { - &General::log("Dialling $pppsettings{'PROFILENAME'}."); - } - - if ($pppsettings{'TYPE'} eq 'modem') { &domodemdial(); } - elsif ($pppsettings{'TYPE'} eq 'serial') { &doserialdial(); } - elsif ($pppsettings{'TYPE'} eq 'isdn') { &doisdndial(); } - elsif ($pppsettings{'TYPE'} eq 'pppoe') { &dopppoedial(); } - elsif ($pppsettings{'TYPE'} eq 'pptp') { &dopptpdial(); } - elsif ($pppsettings{'TYPE'} eq 'fritzdsl') { &dofritzdsldial(); } - - if (-e "${General::swroot}/ppp/updatesettings") { - # erase update mark only after specific script had run, allowing specific script to treat the update - unlink ("${General::swroot}/ppp/updatesettings"); - } - if ( ($pppsettings{'RECONNECTION'} eq 'dialondemand') || ($pppsettings{'METHOD'} eq 'STATIC') ){ - system ("/etc/rc.d/init.d/network red update"); - } -} -elsif ($ARGV[0] eq 'stop') -{ - if (open(IFACE, "${General::swroot}/red/iface")) { - $iface = ; - close IFACE; - chomp ($iface); - $iface =~ /([a-zA-Z0-9]*)/; $iface = $1; - } - - my $device; - if (open(FILE, "${General::swroot}/red/device")) { - $device = ; - close FILE; - chomp ($device); - $device =~ /([a-zA-Z0-9]*)/; $device = $1; - } - - unlink "${General::swroot}/red/dial-on-demand"; - unlink "${General::swroot}/red/active"; - unlink "${General::swroot}/red/local-ipaddress"; - unlink "${General::swroot}/red/remote-ipaddress"; - unlink "${General::swroot}/red/dns1"; - unlink "${General::swroot}/red/dns2"; - unlink "${General::swroot}/red/resolv.conf"; - unlink "${General::swroot}/red/device"; - - # stay with keepconnected during transitional rc.red stop ordered by connectioncheck - if ( ! -e "${General::swroot}/red/redial") { - unlink "${General::swroot}/red/keepconnected"; - } - unlink "${General::swroot}/red/redial"; - - # Kill PPPD - if (open(FILE, "/var/run/ppp-ipfire.pid")) { - my $pid = ; - close FILE; - chomp ($pid); - $pid =~ /(\d*)/; $pid = $1; - system ('/bin/kill', $pid); - } - - # Bring down Ethernet interfaces & Kill DHCPC daemons - if (($netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/) && ( $netsettings{'RED_TYPE'} eq 'PPPOE') && $iface ) { - system ("/sbin/ifconfig", $iface, "down"); - } - if ($device) { - system ("/sbin/ifconfig", $device, "down"); - } - - my $file; - while (($file = glob("/var/run/dhcpcd-*.pid") )) { - if (open(FILE, $file)) { - my $pid = ; - close FILE; - chomp ($pid); - $pid =~ /(\d*)/; $pid = $1; - system ('/bin/kill', $pid); - } - } - - if (!system ('/bin/ps -ef | /bin/grep -q [a]tmarpd')) { - if ($pppsettings{'GATEWAY'} ne '') { - system("/usr/sbin/atmarp -d $pppsettings{'GATEWAY'} 2>/dev/null"); } - system('/bin/killall /usr/sbin/atmarpd 2>/dev/null'); - system ('/sbin/ifconfig', 'atm0', 'down'); - } - - if ($pppsettings{'TYPE'} eq 'isdn') { system('/etc/rc.d/rc.isdn','stop'); } - if ($pppsettings{'TYPE'} eq 'fritzdsl') { system ('/etc/rc.d/rc.fritzdsl','stop'); } - - if ( ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $netsettings{'RED_TYPE'} eq 'STATIC') || - ( $netsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $pppsettings{'PROTOCOL'} eq 'RFC1483' && - $pppsettings{'METHOD'} eq 'STATIC' ) ) { - system ("/etc/rc.d/init.d/network red update"); - } -} -elsif ($ARGV[0] eq 'clear') -{ - &doupdatesettings(); - &docleanup(); -} - -exit 0; - -sub docleanup -{ - if ($pppsettings{'TYPE'} eq 'fritzdsl') { system ('/etc/rc.d/rc.fritzdsl','cleanup'); } -} - -sub domodemdial -{ - my @pppcommand = ('/usr/sbin/pppd'); - my $loginscript = ''; - - if ($pppsettings{'COMPORT'} =~ /ttyACM/) { - system ('/sbin/rmmod acm'); - sleep 1; - system ('/sbin/modprobe acm'); - } - - my $device = "/dev/${pppsettings{'COMPORT'}}"; - - if ($pppsettings{'DNS'} eq 'Automatic') { - push(@pppcommand, ('usepeerdns')); } - - if ($pppsettings{'AUTH'} eq 'pap') { - push(@pppcommand, ('-chap')); - } elsif ($pppsettings{'AUTH'} eq 'chap') { - push(@pppcommand, ('-pap')); - } elsif ($pppsettings{'AUTH'} eq 'standard-login-script') { - $loginscript = 'standardloginscript'; - } elsif ($pppsettings{'AUTH'} eq 'demon-login-script') { - $loginscript = 'demonloginscript'; - } else { - $loginscript = $pppsettings{'LOGINSCRIPT'}; - } - - if ($pppsettings{'RECONNECTION'} ne 'persistent') { - if ($pppsettings{'TIMEOUT'} != 0) - { - my $seconds = $pppsettings{'TIMEOUT'} * 60; - push (@pppcommand, ('idle', $seconds)); - } - if ($pppsettings{'RECONNECTION'} eq 'dialondemand') { - push (@pppcommand, ('demand', 'nopersist')); - } - push (@pppcommand, - ('active-filter', - 'outbound and not icmp[0] == 3 and not tcp[13] & 4 != 0 ' )); - } - - push (@pppcommand, ('novj', 'novjccomp')); - - push (@pppcommand, ('lock', 'modem', 'crtscts', $device, - $pppsettings{'DTERATE'}, 'noipdefault', - 'defaultroute', 'user', $pppsettings{'USERNAME'}, - 'maxfail', $pppsettings{'MAXRETRIES'}, 'connect', - '/etc/ppp/dialer')); - if ($pppsettings{'DEBUG'} eq 'on') { - push(@pppcommand, ('debug')); - } - - system @pppcommand; -} - -sub doserialdial -{ - my @pppcommand = ('/usr/sbin/pppd'); - my $loginscript = ''; - - if ($pppsettings{'COMPORT'} =~ /ttyACM/) { - system ('/sbin/rmmod acm'); - sleep 1; - system ('/sbin/modprobe acm'); - } - - my $device = "/dev/${pppsettings{'COMPORT'}}"; - - if ($pppsettings{'DNS'} eq 'Automatic') { - push(@pppcommand, ('usepeerdns')); } - - if ($pppsettings{'AUTH'} eq 'pap') { - push(@pppcommand, ('-chap')); - } elsif ($pppsettings{'AUTH'} eq 'chap') { - push(@pppcommand, ('-pap')); - } - - if ($pppsettings{'RECONNECTION'} ne 'persistent') { - if ($pppsettings{'TIMEOUT'} != 0) - { - my $seconds = $pppsettings{'TIMEOUT'} * 60; - push (@pppcommand, ('idle', $seconds)); - } - if ($pppsettings{'RECONNECTION'} eq 'dialondemand') { - push (@pppcommand, ('demand', 'nopersist')); - } - push (@pppcommand, - ('active-filter', - 'outbound and not icmp[0] == 3 and not tcp[13] & 4 != 0 ' )); - } - - push (@pppcommand, ('novj', 'novjccomp')); - - push (@pppcommand, ('lock', 'modem', 'crtscts', $device, - $pppsettings{'DTERATE'}, 'noipdefault', - 'defaultroute', 'user', $pppsettings{'USERNAME'}, - 'maxfail', $pppsettings{'MAXRETRIES'}, 'connect', - '/bin/true')); - if ($pppsettings{'DEBUG'} eq 'on') { - push(@pppcommand, ('debug')); - } - - system @pppcommand; -} - -sub doisdndial -{ - my $pppoptions; - my $seconds; - my $phone; - - if (system ('/etc/rc.d/rc.isdn', 'start')) { - &General::log ("ERROR: ISDN module failed to load"); - exit 1; - } - - $seconds = $pppsettings{'TIMEOUT'} * 60; - if ($pppsettings{'USEDOV'} eq 'on') - { - $phone = 'v' . $pppsettings{'TELEPHONE'}; - } - else - { - $phone = $pppsettings{'TELEPHONE'}; - }; - - if ($pppsettings{'COMPORT'} eq 'isdn2') - { - system('/usr/sbin/isdnctrl','addif','ippp0'); - system('/usr/sbin/isdnctrl','addslave','ippp0','ippp1'); - system('/usr/sbin/isdnctrl','l2_prot','ippp0','hdlc'); - system('/usr/sbin/isdnctrl','l3_prot','ippp0','trans'); - system('/usr/sbin/isdnctrl','encap','ippp0','syncppp'); - system('/usr/sbin/isdnctrl','dialmax','ippp0',$pppsettings{'MAXRETRIES'}); - system('/usr/sbin/isdnctrl','eaz','ippp0',$isdnsettings{'MSN'}); - system('/usr/sbin/isdnctrl','addphone','ippp0','out',$phone); - system('/usr/sbin/isdnctrl','huptimeout','ippp0',$seconds); - system('/usr/sbin/isdnctrl','l2_prot','ippp1','hdlc'); - system('/usr/sbin/isdnctrl','l3_prot','ippp1','trans'); - system('/usr/sbin/isdnctrl','encap','ippp1','syncppp'); - system('/usr/sbin/isdnctrl','dialmax','ippp1',$pppsettings{'MAXRETRIES'}); - system('/usr/sbin/isdnctrl','eaz','ippp0',$isdnsettings{'MSN'}); - system('/usr/sbin/isdnctrl','addphone','ippp1','out',$phone); - system('/usr/sbin/isdnctrl','huptimeout','ippp1',$seconds); - system('/usr/sbin/isdnctrl','dialmode','ippp1','auto'); - - my @pppcommand = ('/usr/sbin/ipppd','ms-get-dns','noipdefault','+mp', - 'defaultroute','user',$pppsettings{'USERNAME'}, - 'name',$pppsettings{'USERNAME'}, - 'active-filter','outbound and not icmp[0] == 3 and not tcp[13] & 4 != 0', - 'pidfile','/var/run/ppp-ipfire.pid','/dev/ippp0','/dev/ippp1'); - if ($pppsettings{'DEBUG'} eq 'on') { - push(@pppcommand, ('debug')); - } - if ($pppsettings{'AUTH'} eq 'pap') { - push(@pppcommand, ('-chap')); - } elsif ($pppsettings{'AUTH'} eq 'chap') { - push(@pppcommand, ('-pap')); - } - system (@pppcommand); - } - else - { - system('/usr/sbin/isdnctrl','addif','ippp0'); - system('/usr/sbin/isdnctrl','l2_prot','ippp0','hdlc'); - system('/usr/sbin/isdnctrl','l3_prot','ippp0','trans'); - system('/usr/sbin/isdnctrl','encap','ippp0','syncppp'); - system('/usr/sbin/isdnctrl','dialmax','ippp0',$pppsettings{'MAXRETRIES'}); - system('/usr/sbin/isdnctrl','eaz','ippp0',$isdnsettings{'MSN'}); - system('/usr/sbin/isdnctrl','addphone','ippp0','out',$phone); - system('/usr/sbin/isdnctrl','huptimeout','ippp0',$seconds); - - my @pppcommand = ('/usr/sbin/ipppd','ms-get-dns','noipdefault', - 'defaultroute','user',$pppsettings{'USERNAME'}, - 'name',$pppsettings{'USERNAME'}, - 'active-filter','outbound and not icmp[0] == 3 and not tcp[13] & 4 != 0', - 'pidfile','/var/run/ppp-ipfire.pid','/dev/ippp0'); - if ($pppsettings{'DEBUG'} eq 'on') { - push(@pppcommand, ('debug')); - } - if ($pppsettings{'AUTH'} eq 'pap') { - push(@pppcommand, ('-chap')); - } elsif ($pppsettings{'AUTH'} eq 'chap') { - push(@pppcommand, ('-pap')); - } - system (@pppcommand); - } - - sleep 1; - - if ($pppsettings{'RECONNECTION'} eq 'dialondemand') { - system('/usr/sbin/isdnctrl','dialmode','ippp0','auto'); - system('/sbin/ifconfig','ippp0','10.112.112.112','pointopoint','10.112.112.113'); - system('/sbin/ifconfig','ippp0','-arp','-broadcast'); - system('/sbin/route','add','default','dev','ippp0'); - } else { - system('/usr/sbin/isdnctrl', 'dial', 'ippp0'); - - } - - system('/bin/killall', 'ibod'); - if ($pppsettings{'COMPORT'} eq 'isdn2') { - if ($pppsettings{'USEIBOD'} eq 'on') { - system("/usr/sbin/ibod &"); - } else { - system('/usr/sbin/isdnctrl', 'addlink', 'ippp0'); - } - } -} - -sub dopppoedial -{ - system("mknod /dev/ppp c 108 0 2>/dev/null"); - if ($pppsettings{'METHOD'} ne 'PPPOE_PLUGIN') { - my @pppcommand = ('/usr/sbin/pppd', 'pty'); - my @pppoecommand = ('/usr/sbin/pppoe', '-p','/var/run/pppoe.pid','-I', - $netsettings{'RED_DEV'}, '-T', '80', '-U', '-m', '1412'); - - if ($pppsettings{'SERVICENAME'}) { - push(@pppoecommand, ('-S', $pppsettings{'SERVICENAME'})); } - if ($pppsettings{'CONCENTRATORNAME'}) { - push(@pppoecommand, ('-C', $pppsettings{'CONCENTRATORNAME'})); } - - push(@pppcommand, "@pppoecommand"); - - if ($pppsettings{'DNS'} eq 'Automatic') { - push(@pppcommand, ('usepeerdns')); - } - - if ($pppsettings{'AUTH'} eq 'pap') { - push(@pppcommand, ('-chap')); - } elsif ($pppsettings{'AUTH'} eq 'chap') { - push(@pppcommand, ('-pap')); - } - - if ($pppsettings{'RECONNECTION'} ne 'persistent') { - if ($pppsettings{'TIMEOUT'} != 0) { - my $seconds = $pppsettings{'TIMEOUT'} * 60; - push(@pppcommand, ('idle', "$seconds")); - } - if ($pppsettings{'RECONNECTION'} eq 'dialondemand') { - push (@pppcommand, ('demand','nopersist','connect','/bin/true')); - } - push (@pppcommand, - ('active-filter', - 'outbound and not icmp[0] == 3 and not tcp[13] & 4 != 0 ' )); - } - - push(@pppcommand, ('noipdefault', 'default-asyncmap', - 'defaultroute', 'hide-password', 'local', - 'mtu', '1492', 'mru', '1492', 'noaccomp', 'noccp', - 'nobsdcomp', 'nodeflate', 'nopcomp', 'novj', 'novjccomp', - 'user', $pppsettings{'USERNAME'}, 'lcp-echo-interval', '20', - 'lcp-echo-failure', '3', 'lcp-max-configure', '50', - 'maxfail',$pppsettings{'MAXRETRIES'})); - if ($pppsettings{'DEBUG'} eq 'on') { - push(@pppcommand, ('debug')); - } - - system (@pppcommand); - } else { - # PPPoE plugin - system ('/sbin/modprobe pppoe'); - my @pppcommand = ('/usr/sbin/pppd'); - push(@pppcommand,'plugin','rp-pppoe.so',"$netsettings{'RED_DEV'}"); - if ($pppsettings{'DNS'} eq 'Automatic') { - push(@pppcommand, ('usepeerdns')); - } - if ($pppsettings{'AUTH'} eq 'pap') { - push(@pppcommand, ('-chap')); - } elsif ($pppsettings{'AUTH'} eq 'chap') { - push(@pppcommand, ('-pap')); - } - if ($pppsettings{'RECONNECTION'} ne 'persistent') { - if ($pppsettings{'TIMEOUT'} != 0) { - my $seconds = $pppsettings{'TIMEOUT'} * 60; - push(@pppcommand, ('idle', "$seconds")); - } - if ($pppsettings{'RECONNECTION'} eq 'dialondemand') { - push (@pppcommand, ('demand','nopersist')); - } - push (@pppcommand, - ('active-filter', - 'outbound and not icmp[0] == 3 and not tcp[13] & 4 != 0 ' )); - } - push(@pppcommand, ('noipdefault', 'defaultroute', 'hide-password', 'ipcp-accept-local', - 'ipcp-accept-remote', 'passive', 'noccp','nopcomp', 'novjccomp', - 'user', $pppsettings{'USERNAME'}, 'lcp-echo-interval', '20', - 'lcp-echo-failure', '3', 'lcp-max-configure', '50', - 'maxfail',$pppsettings{'MAXRETRIES'})); - if ($pppsettings{'DEBUG'} eq 'on') { - push(@pppcommand, ('debug')); - } - - system (@pppcommand); - } -} - -sub dopptpdial -{ - my %pptpdhcpc; - my $routerip = $pppsettings{'ROUTERIP'} ? $pppsettings{'ROUTERIP'} : "10.0.0.138"; - system("mknod /dev/ppp c 108 0 2>/dev/null"); - if ( $pppsettings{'METHOD'} eq 'DHCP' && open(FILE, "${General::swroot}/red/device")) { - my $device = ; - close FILE; - chomp ($device); - $device =~ /([a-zA-Z0-9]*)/; $device = $1; - if (&General::readhash("${General::swroot}/dhcpc/dhcpcd-$device.info", \%pptpdhcpc)) { - system("/sbin/route add -host $routerip gw $pptpdhcpc{'GATEWAY'}"); - } else { - system("/sbin/route add -host $routerip dev $device"); - } - } - - my @pppcommand = ('/usr/sbin/pppd', 'pty'); - my @pptpcommand = ('/usr/sbin/pptp', $routerip, '--nobuffer', '--nolaunchpppd', '--sync'); - if ($pppsettings{'PHONEBOOK'}) { - push (@pptpcommand, ('--phone ', $pppsettings{'PHONEBOOK'})); - } - - push(@pppcommand, "@pptpcommand"); - - if ($pppsettings{'DNS'} eq 'Automatic') { - push(@pppcommand, ('usepeerdns')); - } - if ($pppsettings{'AUTH'} eq 'pap') { - push(@pppcommand, ('-chap')); - } elsif ($pppsettings{'AUTH'} eq 'chap') { - push(@pppcommand, ('-pap')); - } - - if ($pppsettings{'RECONNECTION'} ne 'persistent') { - if ($pppsettings{'TIMEOUT'} != 0) { - my $seconds = $pppsettings{'TIMEOUT'} * 60; - push(@pppcommand, ('idle', "$seconds")); - } - if ($pppsettings{'RECONNECTION'} eq 'dialondemand') { - push (@pppcommand, ('demand','nopersist','connect','/bin/true')); - } - push (@pppcommand, - ('active-filter', - 'outbound and not icmp[0] == 3 and not tcp[13] & 4 != 0 ' )); - } - - push(@pppcommand, ('noipdefault', 'default-asyncmap', - 'defaultroute', 'hide-password', 'local','noaccomp', 'noccp', - 'nobsdcomp', 'nodeflate', 'nopcomp', 'novj', 'novjccomp', - 'user', $pppsettings{'USERNAME'}, 'lcp-echo-interval', '20', - 'lcp-echo-failure', '3', 'lcp-max-configure', '50', - 'maxfail',$pppsettings{'MAXRETRIES'},'sync')); - if ($pppsettings{'DEBUG'} eq 'on') { - push(@pppcommand, ('debug')); - } - - system (@pppcommand); -} - -sub dofritzdsldial -{ - my $controller; - - if (system ('/etc/rc.d/rc.fritzdsl','start')) { - &General::log ("ERROR: Fritz DSL module failed to load"); - exit 1; - } - - # controller number - if ($pppsettings{'TYPE'} eq 'fritzdsl') { - if ( ! system ('/bin/grep', '1244:2700', '/proc/pci')) { - $controller=1; # fcdslsl - } elsif (! system('/bin/grep', '1244:2900', '/proc/pci')) { - $controller=2; # fcdsl2 - } elsif (! system('/bin/grep', '1131:5402', '/proc/pci')) { - $controller=2; # fdsl - } elsif (! system('/bin/grep', 'Vendor=057c ProdID=2300', '/proc/bus/usb/devices')) { - $controller=1; # fcdslusb - } elsif (! system('/bin/grep', 'Vendor=057c ProdID=3500', '/proc/bus/usb/devices')) { - $controller=1; # fcdslslusb - } - } - system("mknod /dev/ppp c 108 0 2>/dev/null"); - my @pppcommand = ('/usr/sbin/pppd'); - my @capiplugin; - - if ($pppsettings{'DNS'} eq 'Automatic') { - push(@pppcommand, ('usepeerdns')); - } - - if ($pppsettings{'RECONNECTION'} ne 'persistent') { - if ($pppsettings{'TIMEOUT'} != 0) { - my $seconds = $pppsettings{'TIMEOUT'} * 60; - push(@pppcommand, ('idle', "$seconds")); - } - if ($pppsettings{'RECONNECTION'} eq 'dialondemand') { - push (@pppcommand, ('demand','nopersist','connect','/bin/true')); - } - push (@pppcommand, - ('active-filter', - 'outbound and not icmp[0] == 3 and not tcp[13] & 4 != 0 ' )); - } - - push(@pppcommand, ('noipdefault', 'defaultroute', 'sync', 'user', - $pppsettings{'USERNAME'}, 'ipcp-accept-local', 'ipcp-accept-remote', 'passive', - 'noaccomp', 'nopcomp', 'noccp', 'novj', 'nobsdcomp', - 'nodeflate', 'lcp-echo-interval', '20', 'lcp-echo-failure', '3', - 'lcp-max-configure', '50', 'maxfail', $pppsettings{'MAXRETRIES'})); - - if ($pppsettings{'DEBUG'} eq 'on') { - push(@pppcommand, ('debug')); - } - - if ($pppsettings {'PROTOCOL'} eq 'RFC1483') { - @capiplugin = ('plugin', 'capiplugin.so', 'protocol', 'adslpppoe', - 'controller', $controller, 'vpi', $pppsettings{'VPI'},'vci',$pppsettings{'VCI'}); - } else { - if ($pppsettings {'ENCAP'} eq '1') { - @capiplugin = ('plugin', 'capiplugin.so', 'protocol', 'adslpppoallc', - 'controller', $controller, 'vpi', $pppsettings{'VPI'},'vci',$pppsettings{'VCI'}); - } else { - @capiplugin = ('plugin', 'capiplugin.so', 'protocol', 'adslpppoa', - 'controller', $controller,'vpi', $pppsettings{'VPI'},'vci',$pppsettings{'VCI'}); - } - } - push(@pppcommand, @capiplugin); - push(@pppcommand, '/dev/null'); - - system (@pppcommand); -} - -sub doatmdial -{ - my $ENCAP; - system("mknod /dev/ppp c 108 0 2>/dev/null"); - if ($pppsettings {'PROTOCOL'} eq 'RFC2364') { - system ('/sbin/modprobe pppoatm'); - my @pppcommand = ('/usr/sbin/pppd'); - if ($pppsettings{'ENCAP'} eq '0') { $ENCAP='vc-encaps'; } else { $ENCAP='llc-encaps'; } - push(@pppcommand,'plugin', 'pppoatm.so',$pppsettings{'VPI'}.".".$pppsettings{'VCI'},"$ENCAP"); - if ($pppsettings{'DNS'} eq 'Automatic') { push(@pppcommand, ('usepeerdns'));} - if ($pppsettings{'AUTH'} eq 'pap') { - push(@pppcommand, ('-chap')); - } elsif ($pppsettings{'AUTH'} eq 'chap') { - push(@pppcommand, ('-pap')); - } - if ($pppsettings{'RECONNECTION'} ne 'persistent') { - if ($pppsettings{'TIMEOUT'} != 0) { - my $seconds = $pppsettings{'TIMEOUT'} * 60; - push(@pppcommand, ('idle', "$seconds")); - } - if ($pppsettings{'RECONNECTION'} eq 'dialondemand') { - push (@pppcommand, ('demand','nopersist')); - } - push (@pppcommand, - ('active-filter', - 'outbound and not icmp[0] == 3 and not tcp[13] & 4 != 0 ' )); - } - push(@pppcommand, ('noipdefault', 'defaultroute', 'user', - $pppsettings{'USERNAME'}, 'ipcp-accept-local', 'ipcp-accept-remote', 'passive', - 'nopcomp', 'noccp', 'novj', 'nobsdcomp', - 'nodeflate', 'lcp-echo-interval', '20', 'lcp-echo-failure', '3', - 'lcp-max-configure', '50', 'maxfail', $pppsettings{'MAXRETRIES'})); - - if ($pppsettings{'DEBUG'} eq 'on') { - push(@pppcommand, ('debug')); - } - - system (@pppcommand); - } elsif ($pppsettings {'PROTOCOL'} eq 'RFC1483') { - if ($pppsettings {'METHOD'} =~ /^(PPPOE|PPPOE_PLUGIN)$/) { - my $itf='0'; - my $device = "nas$itf"; - if (open(FILE, ">${General::swroot}/red/device")) { print FILE $device; close FILE; } - $netsettings{'RED_DEV'} = $device; - if (system ('/bin/ps -ef | /bin/grep -q [b]r2684ctl')) { - system ('/sbin/modprobe br2684'); - system ('/usr/bin/br2684ctl', '-b', '-c', "$itf", '-e', $pppsettings{'ENCAP'}, '-a', "$itf.$pppsettings{'VPI'}.$pppsettings{'VCI'}"); - sleep 3; - } - system ('/sbin/ifconfig',"$device",'up'); - &dopppoedial(); - } elsif ($pppsettings{'ENCAP'} =~ /^(0|1)$/) { - my $itf='0'; - $iface = "nas$itf"; - if (open(FILE, ">${General::swroot}/red/iface")) { print FILE $iface; close FILE; } - if (system ('/bin/ps -ef | /bin/grep -q [b]r2684ctl')) { - system ('/sbin/modprobe br2684'); - system ('/usr/bin/br2684ctl', '-b', '-c', "$itf", '-e', $pppsettings{'ENCAP'}, '-a', "$itf.$pppsettings{'VPI'}.$pppsettings{'VCI'}"); - sleep 3; - } - system ('/sbin/ifconfig',"$iface",'up'); - - if ($pppsettings{'METHOD'} eq 'STATIC') { - my @staticcommand = ('/sbin/ifconfig'); - push(@staticcommand, ($iface, $pppsettings{'IP'},'netmask', $pppsettings{'NETMASK'})); - if ($pppsettings{'BROADCAST'} ne '') { - push(@staticcommand, ('broadcast', $pppsettings{'BROADCAST'})); - } - system (@staticcommand); - system ("/sbin/route","add","default","gw",$pppsettings{'GATEWAY'}); - system ("/bin/touch", "${General::swroot}/red/active"); - system ("/etc/rc.d/init.d/network red update"); - } elsif ($pppsettings {'METHOD'} eq 'DHCP') { - dodhcpdial($iface,$pppsettings{'DHCP_HOSTNAME'}); - } - } elsif ($pppsettings{'ENCAP'} =~ /^(2|3)$/) { - my $itf='0'; - $iface = "atm$itf"; - if (open(FILE, ">${General::swroot}/red/iface")) { print FILE $iface; close FILE; } - if (system ('/bin/ps -ef | /bin/grep -q [a]tmarpd')) { - if (system ('/usr/sbin/atmarpd -b -l syslog')) { - &General::log('atmarpd fail'); - exit 1; - } - # it will fail on all attempt after the first because interface still exist - system ("/usr/sbin/atmarp -c $iface 2>/dev/null"); - - if ($pppsettings{'METHOD'} eq 'STATIC') { - my @staticcommand = ('/sbin/ifconfig'); - push(@staticcommand, ($iface, $pppsettings{'IP'},'netmask', $pppsettings{'NETMASK'}, 'up')); - if ($pppsettings{'BROADCAST'} ne '') { - push(@staticcommand, ('broadcast', $pppsettings{'BROADCAST'})); - } - system (@staticcommand); - # we have to wait a bit before launching atmarp -s - sleep 2; - my @atmarp = ('/usr/sbin/atmarp', '-s', $pppsettings{'GATEWAY'}, "$itf.$pppsettings{'VPI'}.$pppsettings{'VCI'}"); - if ($pppsettings{'ENCAP'} eq '3') { - push(@atmarp, 'null' ); # routed ip vc encap - } - system (@atmarp); - system ("/sbin/route", "add", "default", "gw", $pppsettings{'GATEWAY'}); - system ("/bin/touch", "${General::swroot}/red/active"); - } - } - } - } -} -- 2.39.2