From: <ow...@us...> - 2008-07-18 12:38:10
|
Revision: 1581 http://ipcop.svn.sourceforge.net/ipcop/?rev=1581&view=rev Author: owes Date: 2008-07-18 12:38:18 +0000 (Fri, 18 Jul 2008) Log Message: ----------- Drop dhclient, use dhcpcd Modified Paths: -------------- ipcop/trunk/config/cfgroot/header.pl ipcop/trunk/config/rc.d/rc.red ipcop/trunk/config/rc.d/rc.sysinit ipcop/trunk/config/rc.d/rc.updatered ipcop/trunk/config/rootfiles/common/dhcp ipcop/trunk/html/cgi-bin/logs.cgi/log.dat ipcop/trunk/html/cgi-bin/netstatus.cgi ipcop/trunk/lfs/dhcp ipcop/trunk/lfs/ipcop Modified: ipcop/trunk/config/cfgroot/header.pl =================================================================== --- ipcop/trunk/config/cfgroot/header.pl 2008-07-18 12:08:37 UTC (rev 1580) +++ ipcop/trunk/config/cfgroot/header.pl 2008-07-18 12:38:18 UTC (rev 1581) @@ -604,7 +604,7 @@ } else { $connstate = "<span class='ipcop_StatusBig'>$Lang::tr{'idle'} $profileused</span>"; } - } elsif ( ( (-e "/var/run/dhclient.pid") && $netsettings{'RED_1_TYPE'} ne 'PPTP' ) || + } elsif ( ( (-e "/var/run/dhcpcd-$iface.pid") && $netsettings{'RED_1_TYPE'} ne 'PPTP' ) || !system("/bin/ps -ef | /bin/grep -q '[p]ppd'") || !system("/bin/ps -ef | /bin/grep -q '[c]onnectioncheck'")) { if (-e "${General::swroot}/red/active") { $timestr = &General::age("${General::swroot}/red/active"); Modified: ipcop/trunk/config/rc.d/rc.red =================================================================== --- ipcop/trunk/config/rc.d/rc.red 2008-07-18 12:08:37 UTC (rev 1580) +++ ipcop/trunk/config/rc.d/rc.red 2008-07-18 12:38:18 UTC (rev 1581) @@ -27,7 +27,7 @@ use strict; #use warnings; -require 'CONFIG_ROOT/general-functions.pl'; +require '/var/ipcop/general-functions.pl'; my %pppsettings; my %isdnsettings; @@ -44,24 +44,21 @@ 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'); - unlink "/var/log/dhclient.info" if ( -e "/var/log/dhclient.info" ); - my @dhcpcommand = ('/usr/sbin/dhclient'); - push(@dhcpcommand, ('-q', '-cf', '/etc/dhclient.conf', "$iface")); + unlink "/var/log/dhcpclient.info" if ( -e "/var/log/dhcpclient.info" ); + my @dhcpcommand = ('/usr/sbin/dhcpcd'); + push(@dhcpcommand, ('-L', '-N', '-R', '-Y', '--script', '/usr/local/bin/dhcpcd.sh', "$iface")); -# FIXME: equivalents for dhclient ? -# if ($dhcp_name ne '') { push(@dhcpcommand, ('-h', "$dhcp_name")); } -# if ($netsettings{'RED_TYPE'} eq 'PPTP') { push(@dhcpcommand, '-G'); } + if ($dhcp_name ne '') { push(@dhcpcommand, ('-h', "$dhcp_name")); } + if ($netsettings{'RED_TYPE'} eq 'PPTP') { push(@dhcpcommand, '-G'); } if (system (@dhcpcommand)) { - &General::log('dhclient fail'); + &General::log('dhcp client fail'); exit 1; } else { - &General::log('dhclient success'); + &General::log('dhcp client success'); } } @@ -277,7 +274,7 @@ system ('/bin/kill', $pid); } - # Bring down Ethernet interfaces & Kill DHCPC daemons + # Bring down Ethernet interfaces & Kill DHCP client daemon if (($netsettings{'RED_COUNT'} > 0) && ( $netsettings{'RED_1_TYPE'} eq 'PPPOE') && $iface ) { system ("/sbin/ifconfig", $iface, "down"); } @@ -285,13 +282,21 @@ system ("/sbin/ifconfig", $device, "down"); } - if (open(FILE, "/var/run/dhclient.pid")) { - my $pid = <FILE>; - close FILE; - chomp ($pid); - $pid =~ /(\d*)/; $pid = $1; - system ('/bin/kill', $pid); - unlink "/var/run/dhclient.pid"; + if ( -e "/var/run/dhcpcd-$iface.pid" ) { + my $pidfile = "/var/run/dhcpcd-$iface.pid"; + # release lease and stop daemon nicely + system("/usr/sbin/dhcpcd -k $iface"); + # leave some time + sleep 1; + if ( open(FILE, $pidfile) ) { + # still there, okay try killing + my $pid = <FILE>; + close FILE; + chomp ($pid); + $pid =~ /(\d*)/; $pid = $1; + system ('/bin/kill', $pid); + unlink "$pidfile"; + } } if (!system ('/bin/ps -ef | /bin/grep -q [a]tmarpd')) { Modified: ipcop/trunk/config/rc.d/rc.sysinit =================================================================== --- ipcop/trunk/config/rc.d/rc.sysinit 2008-07-18 12:08:37 UTC (rev 1580) +++ ipcop/trunk/config/rc.d/rc.sysinit 2008-07-18 12:38:18 UTC (rev 1581) @@ -209,9 +209,9 @@ echo "Clearing old files" /bin/rm -f /var/run/{*.pid,*.sem,*.tdb} -/bin/rm -f /var/run/dhclient.pid +/bin/rm -f /var/run/dhcpcd-*.pid /bin/rm -f /var/lock/LCK..tty* /var/log/snort/snortrules.lock -/bin/rm -f /var/log/dhclient.info +/bin/rm -f /var/log/dhcpclient.info /bin/rm -f /var/ipcop/red/{active,eciadsl-synch-done} echo "Setting the clock" @@ -315,7 +315,7 @@ echo "Starting httpd" /usr/sbin/httpd echo "Starting dhcpd (if enabled)" -/usr/local/bin/restartdhcp +/usr/local/bin/restartdhcp -b echo "Starting sshd (if enabled)" /usr/local/bin/restartssh Modified: ipcop/trunk/config/rc.d/rc.updatered =================================================================== --- ipcop/trunk/config/rc.d/rc.updatered 2008-07-18 12:08:37 UTC (rev 1580) +++ ipcop/trunk/config/rc.d/rc.updatered 2008-07-18 12:38:18 UTC (rev 1581) @@ -18,8 +18,8 @@ if [ "$RED_1_TYPE" = "DHCP" ]; then unset DNS1 DNS2 eval $(/usr/local/bin/readhash /var/ipcop/ethernet/settings) - if [ -e /var/log/dhclient.info ]; then - eval $(/usr/local/bin/readhash /var/log/dhclient.info) + if [ -e /var/log/dhcpclient.info ]; then + eval $(/usr/local/bin/readhash /var/log/dhcpclient.info) fi if [ "$DNS1" = "" ]; then echo "$DHCLIENT_DNS1" > /var/ipcop/red/dns1 @@ -76,15 +76,15 @@ fi fi -if ( echo $0 | /bin/grep -q 'dhclient' ); then +if ( echo $0 | /bin/grep -q 'dhcpcd' ); then eval $(/usr/local/bin/readhash "$1") case "$2" in - up) /usr/bin/logger -s -p local0.info -t dhclient "${DHCLIENT_INTERFACE} has been configured with same IP=${DHCLIENT_IPADDR}" + up) /usr/bin/logger -s -p local0.info -t dhcpcd[] "${DHCLIENT_INTERFACE} has been configured with same IP=${DHCLIENT_IPADDR}" if [ "$RED_TYPE" != 'PPTP' ]; then /usr/bin/touch /var/ipcop/red/active fi ;; - new) /usr/bin/logger -s -p local0.info -t dhclient "${DHCLIENT_INTERFACE} has been configured with new IP=${DHCLIENT_IPADDR}" + new) /usr/bin/logger -s -p local0.info -t dhcpcd[] "${DHCLIENT_INTERFACE} has been configured with new IP=${DHCLIENT_IPADDR}" # When DHCP client acquire an IP, it can also be from a renew. In this case, interface is not down (red/active) # and only some service depending on the IP need a restart. if [ -e "/var/ipcop/red/active" ]; then @@ -106,7 +106,7 @@ fi fi ;; - down) /usr/bin/logger -s -p local0.info -t dhclient "${DHCLIENT_INTERFACE} has been brought down" + down) /usr/bin/logger -s -p local0.info -t dhcpcd[] "${DHCLIENT_INTERFACE} has been brought down" rm -f /var/ipcop/red/active ;; esac Modified: ipcop/trunk/config/rootfiles/common/dhcp =================================================================== --- ipcop/trunk/config/rootfiles/common/dhcp 2008-07-18 12:08:37 UTC (rev 1580) +++ ipcop/trunk/config/rootfiles/common/dhcp 2008-07-18 12:38:18 UTC (rev 1581) @@ -1,6 +1,6 @@ ## dhcp-3.1.0 ## -etc/dhclient.conf +#etc/dhclient.conf etc/dhcpd.conf #usr/bin/omshell #usr/local/include/dhcpctl.h @@ -18,7 +18,7 @@ #usr/local/include/omapip/omapip.h #usr/local/lib/libdhcpctl.a #usr/local/lib/libomapi.a -usr/sbin/dhclient +#usr/sbin/dhclient #usr/sbin/dhclient-script usr/sbin/dhcpd #usr/sbin/dhcrelay @@ -39,4 +39,4 @@ #var/state #var/state/dhcp var/state/dhcp/dhcpd.leases -var/state/dhcp/dhclient.leases +#var/state/dhcp/dhclient.leases Modified: ipcop/trunk/html/cgi-bin/logs.cgi/log.dat =================================================================== --- ipcop/trunk/html/cgi-bin/logs.cgi/log.dat 2008-07-18 12:08:37 UTC (rev 1580) +++ ipcop/trunk/html/cgi-bin/logs.cgi/log.dat 2008-07-18 12:38:18 UTC (rev 1581) @@ -49,7 +49,7 @@ my %sections = ( 'ipcop' => '(ipcop)', - 'red' => '(red.*|kernel: usb.*|pppd\[.*\]|chat\[.*\]|pppoe\[.*\]|pptp\[.*\]|pppoa\[.*\]|pppoa3\[.*\]|pppoeci\[.*\]|ipppd|ipppd\[.*\]|kernel: ippp\d|kernel: isdn.*|ibod\[.*\]|kernel: eth.*|dhclient|modem_run\[.*\])', + 'red' => '(red.*|kernel: usb.*|pppd\[.*\]|chat\[.*\]|pppoe\[.*\]|pptp\[.*\]|pppoa\[.*\]|pppoa3\[.*\]|pppoeci\[.*\]|ipppd|ipppd\[.*\]|kernel: ippp\d|kernel: isdn.*|ibod\[.*\]|kernel: eth.*|dhcpcd\[.*\]|modem_run\[.*\])', 'dns' => '(dnsmasq\[.*\])', 'dhcp' => '(dhcpd)', 'cron' => '(fcron\[.*\])', Modified: ipcop/trunk/html/cgi-bin/netstatus.cgi =================================================================== --- ipcop/trunk/html/cgi-bin/netstatus.cgi 2008-07-18 12:08:37 UTC (rev 1580) +++ ipcop/trunk/html/cgi-bin/netstatus.cgi 2008-07-18 12:38:18 UTC (rev 1581) @@ -83,9 +83,9 @@ print "<a name='reddhcp'/>\n"; &Header::openbox('100%', 'left', "RED $Lang::tr{'dhcp configuration'}"); - if (-s "/var/log/dhclient.info") { + if (-s "/var/log/dhcpclient.info") { - &General::readhash("/var/log/dhclient.info", \%dhcpinfo); + &General::readhash("/var/log/dhcpclient.info", \%dhcpinfo); my $lsetme=0; my $leasetime=""; Modified: ipcop/trunk/lfs/dhcp =================================================================== --- ipcop/trunk/lfs/dhcp 2008-07-18 12:08:37 UTC (rev 1580) +++ ipcop/trunk/lfs/dhcp 2008-07-18 12:38:18 UTC (rev 1581) @@ -87,9 +87,7 @@ cd $(DIR_APP) && make -j $(PARALLELISM) CC_OPTIONS="$(CFLAGS)" cd $(DIR_APP) && make install CLIENTBINDIR="/usr/sbin" touch /var/state/dhcp/dhcpd.leases - touch /var/state/dhcp/dhclient.leases ln -sf $(CONFIG_ROOT)/dhcp/dhcpd.conf /etc/dhcpd.conf - ln -sf $(CONFIG_ROOT)/dhcpc/dhclient.conf /etc/dhclient.conf @rm -rf $(DIR_APP) @$(POSTBUILD) Modified: ipcop/trunk/lfs/ipcop =================================================================== --- ipcop/trunk/lfs/ipcop 2008-07-18 12:08:37 UTC (rev 1580) +++ ipcop/trunk/lfs/ipcop 2008-07-18 12:38:18 UTC (rev 1581) @@ -60,7 +60,7 @@ @$(PREBUILD) # Create all directories - for i in addon-lang alcatelusb auth backup ca certs cnx_pci crls ddns dhcp dhcpc dmzholes \ + for i in addon-lang alcatelusb auth backup ca certs cnx_pci crls ddns dhcp dmzholes \ eagle-usb eciadsl ethernet firewall firmware isdn key logging main modem \ ovpn ovpn/ca ovpn/certs ovpn/crls ovpn/openssl \ patches portfw ppp private proxy red remote shaping snort time vpn wireless xtaccess ; do \ @@ -98,8 +98,6 @@ cp $(DIR_SRC)/config/cfgroot/backup-exclude.hardware $(CONFIG_ROOT)/backup/exclude.hardware cp $(DIR_SRC)/config/cfgroot/advoptions-list $(CONFIG_ROOT)/dhcp/advoptions-list cp $(DIR_SRC)/config/cfgroot/parameters-list $(CONFIG_ROOT)/dhcp/parameters-list - cp $(DIR_SRC)/config/cfgroot/dhclient.conf $(CONFIG_ROOT)/dhcpc/dhclient.conf - cp $(DIR_SRC)/config/cfgroot/dhclient.conf $(CONFIG_ROOT)/dhcpc/dhclient.conf cp $(DIR_SRC)/config/cfgroot/iface-modules-list $(CONFIG_ROOT)/ethernet/modules-list cp $(DIR_SRC)/config/cfgroot/main-settings $(CONFIG_ROOT)/main/settings cp $(DIR_SRC)/config/cfgroot/modem-defaults $(CONFIG_ROOT)/modem/defaults @@ -151,8 +149,6 @@ chown -R root:root $(CONFIG_ROOT)/$$i; \ done - chown root:nobody $(CONFIG_ROOT)/dhcpc - # OpenSWAN if [ -e /etc/rc.d/init.d/ipsec ]; then \ mv -f /etc/rc.d/init.d/ipsec /etc/rc.d/; \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |