]> git.ipfire.org Git - people/arne_f/network.git/commitdiff
network: Create some default actions for the ppp events.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 3 Jun 2010 22:11:36 +0000 (00:11 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 3 Jun 2010 22:11:36 +0000 (00:11 +0200)
functions.events
functions.ppp
header-zone

index 1dd98a53847f4601914e185ad5e7a102f2d093e7..720ee20e9598eb966f1faac77639cf10ad0b694f 100644 (file)
@@ -13,14 +13,12 @@ function event_firewall_reload() {
        event_emit firewall-reload
 }
 
-# XXX dunno what this does.
 function event_interface_up() {
        local iface=${1}
 
        event_emit network-interface-up IFACE=${iface}
 }
 
-# XXX dunno what this does.
 function event_interface_down() {
        local iface=${1}
 
index 82038512d9f80f066c450fcb41104bd8776ffb67..631a3c88b07e4d2d624a5b2639b2309cfe00888d 100644 (file)
@@ -43,6 +43,51 @@ function ppp_post_down() {
        #connection --down --zone=${zone}
 }
 
+function ppp_common_ip_pre_up() {
+       local zone=${1}
+       shift
+
+       if ! zone_exists ${zone}; then
+               error "Zone '${zone}' does not exist."
+               return ${EXIT_ERROR}
+       fi
+
+       # Request firewall reload
+       event_firewall_reload
+
+       return ${EXIT_OK}
+}
+
+function ppp_common_ip_up() {
+       local zone=${1}
+       shift
+
+       if ! zone_exists ${zone}; then
+               error "Zone '${zone}' does not exist."
+               return ${EXIT_ERROR}
+       fi
+
+       # Emit interface-up event
+       event_interface_up ${zone}
+
+       return ${EXIT_OK}
+}
+
+function ppp_common_ip_down() {
+       local zone=${1}
+       shift
+
+       if ! zone_exists ${zone}; then
+               error "Zone '${zone}' does not exist."
+               return ${EXIT_ERROR}
+       fi
+
+       # Emit interface-up event
+       event_interface_down ${zone}
+
+       return ${EXIT_OK}
+}
+
 function ppp_secret() {
        local USER=${1}
        local SECRET=${2}
index 3ece84863d0e1b776be9d49c16058db50cffe64c..88ed0216e4c013d189ffb36cc57e3480f1f423d1 100644 (file)
@@ -223,17 +223,46 @@ function _config_show() {
        _notimplemented _config_show
 }
 
-# These tree functions exit silently
 function _ppp-ip-pre-up() {
-       exit ${EXIT_OK}
+       local zone=${1}
+       shift
+
+       if ! zone_exists ${zone}; then
+               error "Zone '${zone}' does not exist."
+               exit ${EXIT_ERROR}
+       fi
+
+       ppp_common_ip_pre_up ${zone} $@
+
+       exit $?
 }
 
 function _ppp-ip-up() {
-       exit ${EXIT_OK}
+       local zone=${1}
+       shift
+
+       if ! zone_exists ${zone}; then
+               error "Zone '${zone}' does not exist."
+               exit ${EXIT_ERROR}
+       fi
+
+       ppp_common_ip_up ${zone} $@
+
+       exit $?
 }
 
 function _ppp-ip-down() {
-       exit ${EXIT_OK}
+       local zone=${1}
+       shift
+
+       if ! zone_exists ${zone}; then
+               error "Zone '${zone}' does not exist."
+               exit ${EXIT_ERROR}
+       fi
+
+       ppp_common_ip_down ${zone} $@
+
+       exit $?
 }
 
 function run() {