#!/bin/bash ############################################################################### # # # IPFire.org - A linux based firewall # # Copyright (C) 2010 Michael Tremer & Christian Schmidt # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program. If not, see . # # # ############################################################################### LOG_FACILITY=$(basename ${0}) umask 022 PPP_VARIABLES="IFNAME IPLOCAL IPREMOTE DNS1 DNS2 MACREMOTE LLLOCAL LLREMOTE" # Give the variables we get passed by pppd an own namespace for i in ${PPP_VARIABLES}; do export PPP_${i}=${!i} unset ${i} done . @networkdir@/functions log DEBUG "Called." for i in ${PPP_VARIABLES}; do i="PPP_${i}" log DEBUG " ${i} = ${!i}" done # Zone equals IFNAME ZONE=${PPP_IFNAME} # If the given device is a known zone, we will call the required # hook methods. If we don't know about any zone with name ${ZONE}, # we do nothing. if isset ZONE && zone_exists ${ZONE}; then HOOK=$(zone_get_hook ${ZONE}) assert isset HOOK assert hook_zone_exists ${HOOK} PROGNAME=$(basename ${0}) METHOD="" case "${PROGNAME}" in ip-pre-up) METHOD="ppp_ip_pre_up" ;; ipv6-down) METHOD="ppp_ipv6_down" ;; ipv6-up) METHOD="ppp_ipv6_up" ;; ip-down) METHOD="ppp_ipv4_down" ;; ip-up) METHOD="ppp_ipv4_up" ;; esac assert isset METHOD log DEBUG "${PROGNAME}/${METHOD} was called with the following parameters:" log DEBUG " $@" hook_zone_exec "${HOOK}" "${METHOD}" "${ZONE}" exit $? fi exit ${EXIT_OK}