]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - src/ppp/ip-up
Alpha2 - Aenderungen von Arne F. eingepflegt.
[people/teissler/ipfire-2.x.git] / src / ppp / ip-up
CommitLineData
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
12use strict;
c545beb1 13require '/var/ipfire/general-functions.pl';
cd1a2927
MT
14
15&General::log("PPP has gone up on $ARGV[0]");
16umask 022;
17
18my %pppsettings;
19
20# read vars back from file.
21&General::readhash("${General::swroot}/ppp/settings", \%pppsettings);
22
23if ( ( $pppsettings{'TYPE'} eq 'isdn') &&
24 ( $pppsettings{'COMPORT'} eq 'isdn2') &&
25 ( $pppsettings{'USEIBOD'} eq 'off') ) {
26 system('/usr/sbin/isdnctrl', 'dial', 'ippp1');
27}
28
29my $dns = $pppsettings{'DNS'};
30my $primarydns = $pppsettings{'DNS1'};
31my $secondarydns = $pppsettings{'DNS2'};
32if ($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
48if (open(FILE, ">${General::swroot}/red/iface")) { print FILE $ARGV[0]; close (FILE); }
49if (open(FILE, ">${General::swroot}/red/local-ipaddress")) { print FILE $ARGV[3]; close (FILE); }
50if (open(FILE, ">${General::swroot}/red/remote-ipaddress")) { print FILE $ARGV[4]; close (FILE); }
51
c545beb1 52system('/usr/bin/touch', "${General::swroot}/red/active");
3e615c37 53system('/etc/rc.d/init.d/net/red/update');
cd1a2927
MT
54
55# Beep when ppp goes up or down. Silence if 'nobeeps' file exists.
56if ( ! -e "${General::swroot}/ppp/nobeeps") {
57 system "/bin/echo -en '\a' >/dev/console";
58}