]> git.ipfire.org Git - people/stevee/network.git/blame - ppp/ip-updown
network: Magnificent changes on code.
[people/stevee/network.git] / ppp / ip-updown
CommitLineData
711ffac1 1#!/bin/bash
5b20e43a
MT
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
1848564d 5# Copyright (C) 2010 Michael Tremer & Christian Schmidt #
5b20e43a
MT
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation, either version 3 of the License, or #
10# (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
21
22umask 022
23export PATH=/usr/sbin:/sbin:/usr/bin:/bin
24
711ffac1
MT
25exec &>/tmp/network.$(basename $0)
26
27# Give the variables we get passed by pppd an own namespace
28for i in IFNAME IPLOCAL IPREMOTE DNS1 DNS2 MACREMOTE; do
29 export PPP_${i}=${!i}
30 unset ${i}
31done
32
5b20e43a 33. /lib/network/functions
5b20e43a 34
1848564d 35# Zone equals IFNAME
711ffac1
MT
36ZONE=${PPP_IFNAME}
37
38assert isset ZONE
5b20e43a 39
1848564d
MT
40if ! zone_exists ${ZONE}; then
41 error "Zone '${ZONE}' does not exist."
42 exit ${EXIT_ERROR}
5b20e43a
MT
43fi
44
711ffac1
MT
45HOOK=$(zone_get_hook ${ZONE})
46
47assert isset HOOK
1848564d 48
711ffac1 49if ! hook_zone_exists ${HOOK}; then
1848564d
MT
50 error "Hook '${HOOK}' does not exist."
51 exit ${EXIT_ERROR}
52fi
53
711ffac1 54hook_zone_exec ${HOOK} ppp-$(basename ${0}) ${ZONE}