]>
Commit | Line | Data |
---|---|---|
cd1a2927 MT |
1 | #!/usr/bin/perl |
2 | # | |
3 | # SmoothWall CGIs | |
4 | # | |
5 | # This code is distributed under the terms of the GPL | |
6 | # | |
7 | # (c) The SmoothWall Team | |
8 | # | |
9 | # $Id: ip-up,v 1.3.2.3 2005/01/26 12:23:26 riddles Exp $ | |
10 | # | |
11 | ||
12 | use strict; | |
13 | require 'CONFIG_ROOT/general-functions.pl'; | |
14 | ||
15 | &General::log("PPP has gone up on $ARGV[0]"); | |
16 | umask 022; | |
17 | ||
18 | my %pppsettings; | |
19 | ||
20 | # read vars back from file. | |
21 | &General::readhash("${General::swroot}/ppp/settings", \%pppsettings); | |
22 | ||
23 | if ( ( $pppsettings{'TYPE'} eq 'isdn') && | |
24 | ( $pppsettings{'COMPORT'} eq 'isdn2') && | |
25 | ( $pppsettings{'USEIBOD'} eq 'off') ) { | |
26 | system('/usr/sbin/isdnctrl', 'dial', 'ippp1'); | |
27 | } | |
28 | ||
29 | my $dns = $pppsettings{'DNS'}; | |
30 | my $primarydns = $pppsettings{'DNS1'}; | |
31 | my $secondarydns = $pppsettings{'DNS2'}; | |
32 | if ($dns eq 'Automatic') { | |
33 | if (!($pppsettings{'TYPE'} =~ /^isdn/)) | |
34 | { | |
35 | if (open(FILE, ">${General::swroot}/red/dns1")) { print FILE $ENV{'DNS1'}; close FILE; } | |
36 | if (open(FILE, ">${General::swroot}/red/dns2")) { print FILE $ENV{'DNS2'}; close FILE; } | |
37 | } | |
38 | else | |
39 | { | |
40 | if (open(FILE, ">${General::swroot}/red/dns1")) { print FILE $ENV{'MS_DNS1'}; close FILE; } | |
41 | if (open(FILE, ">${General::swroot}/red/dns2")) { print FILE $ENV{'MS_DNS2'}; close FILE; } | |
42 | } | |
43 | } else { | |
44 | if (open(FILE, ">${General::swroot}/red/dns1")) { print FILE $pppsettings{'DNS1'}; close FILE; } | |
45 | if (open(FILE, ">${General::swroot}/red/dns2")) { print FILE $pppsettings{'DNS2'}; close FILE; } | |
46 | } | |
47 | ||
48 | if (open(FILE, ">${General::swroot}/red/iface")) { print FILE $ARGV[0]; close (FILE); } | |
49 | if (open(FILE, ">${General::swroot}/red/local-ipaddress")) { print FILE $ARGV[3]; close (FILE); } | |
50 | if (open(FILE, ">${General::swroot}/red/remote-ipaddress")) { print FILE $ARGV[4]; close (FILE); } | |
51 | ||
52 | system('/bin/touch', "${General::swroot}/red/active"); | |
53 | system('/etc/rc.d/rc.updatered'); | |
54 | ||
55 | # Beep when ppp goes up or down. Silence if 'nobeeps' file exists. | |
56 | if ( ! -e "${General::swroot}/ppp/nobeeps") { | |
57 | system "/bin/echo -en '\a' >/dev/console"; | |
58 | } |