Revision: 5333 http://ipcop.svn.sourceforge.net/ipcop/?rev=5333&view=rev Author: owes Date: 2011-01-12 16:54:47 +0000 (Wed, 12 Jan 2011)
Log Message: ----------- Fix handling of DHCP renew in rc.updatered, in case of renew nothing changes and nothing needs to be done. Modified Paths: -------------- ipcop/trunk/src/rc.d/rc.updatered Modified: ipcop/trunk/src/rc.d/rc.updatered =================================================================== --- ipcop/trunk/src/rc.d/rc.updatered 2011-01-12 16:47:57 UTC (rev 5332) +++ ipcop/trunk/src/rc.d/rc.updatered 2011-01-12 16:54:47 UTC (rev 5333) @@ -16,6 +16,8 @@ # along with IPCop; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# (c) 2001-2011, the IPCop team +# # $Id$ # @@ -102,7 +104,7 @@ ### my $dns1 = `/bin/cat /var/ipcop/red/dns1 2>/dev/null | /usr/bin/tr -d '\012'`; my $dns2 = `/bin/cat /var/ipcop/red/dns2 2>/dev/null | /usr/bin/tr -d '\012'`; -system ('echo > /var/ipcop/red/resolv.conf'); +system('echo > /var/ipcop/red/resolv.conf'); system("echo 'nameserver $dns1' > /var/ipcop/red/resolv.conf") if ($dns1 ne ''); system("echo 'nameserver $dns2' >> /var/ipcop/red/resolv.conf") if ($dns2 ne ''); @@ -124,40 +126,45 @@ } } -if ($caller eq 'dhcpcd') { - if ($updown eq 'up') { +if ($updown eq 'up') { + if ($caller eq 'dhcpcd') { &General::log('dhcpcd[]', "$dhclient{'DHCLIENT_INTERFACE'} has been configured with new IP=$dhclient{'DHCLIENT_IPADDR'}"); system('/usr/bin/touch /var/ipcop/red/active') if ($netsettings{'RED_1_TYPE'} ne 'PPTP'); } - elsif ($updown eq 'renew') { + + system('/etc/rc.d/rc.firewall reload'); + system('/usr/local/bin/setaliases'); + + # TODO: do we need to set multicast off? + #[ "$IFACE" != "" ] && /sbin/ip link set $IFACE multicast off + + system('/usr/local/bin/restartntpd --red'); + system('/usr/local/bin/setddns.pl --force'); + system('/usr/local/bin/restartsquid --test &'); + system("/bin/sleep $ipsecsettings{'VPN_DELAYED_START'} && /usr/local/bin/ipsecctrl --start &"); + system('/usr/local/bin/updatelists.pl --red &'); + system('/usr/local/bin/restartshaping'); + system('/usr/local/bin/accountingctrl'); +} +elsif ($updown eq 'renew') { + if ($caller eq 'dhcpcd') { &General::log('dhcpcd[]', "$dhclient{'DHCLIENT_INTERFACE'} has been configured with same IP=$dhclient{'DHCLIENT_IPADDR'}"); } - elsif ($updown eq 'down') { +} +elsif ($updown eq 'down') { + if ($caller eq 'dhcpcd') { &General::log('dhcpcd[]', "$dhclient{'DHCLIENT_INTERFACE'} has been brought down"); unlink('/var/ipcop/red/active'); } -} -# Services/Things we need to do for both RED up and RED down -system('/etc/rc.d/rc.firewall reload'); -system('/usr/local/bin/setaliases'); + system('/etc/rc.d/rc.firewall reload'); + system('/usr/local/bin/setaliases'); -if (-e '/var/ipcop/red/active') { - # TODO: do we need to set multicast off? - #[ "$IFACE" != "" ] && /sbin/ip link set $IFACE multicast off - - # TODO review which ones do we need to 'call' in case of DHCP renew ? - system('/usr/local/bin/restartntpd --red') if ($updown eq 'up'); - system('/usr/local/bin/setddns.pl --force') if ($updown eq 'up'); - system('/usr/local/bin/restartsquid --test &') if ($updown eq 'up'); - system("/bin/sleep $ipsecsettings{'VPN_DELAYED_START'} && /usr/local/bin/ipsecctrl --start &") if ($updown eq 'up'); - system('/usr/local/bin/updatelists.pl --red &') if ($updown eq 'up'); - system('/usr/local/bin/restartshaping') if ($updown eq 'up'); - system('/usr/local/bin/accountingctrl') if ($updown eq 'up'); + # TODO we really need to rethink stopping IPsec as this will also kill any tunnels we might have on Blue + system('/usr/local/bin/ipsecctrl --stop &'); } else { - # TODO we really need to rethink stopping IPsec as this will also kill any tunnels we might have on Blue/Orange - system('/usr/local/bin/ipsecctrl --stop &'); + &General::log('ipcop', "rc.updatered unknown updown parameter: $updown"); } &end; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Ipcop-svn mailing list Ipcop-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipcop-svn