diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-09-10 18:34:43 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-09-10 18:34:43 +0200 |
commit | c601d036d6e9efce0c31eecd0fc66a716f41f2a3 (patch) | |
tree | ffd5a7d605f1c05f56f1264f49a1c8403863acfe /proto | |
parent | 0e54c1a6088b7df98da521e4b60ac8b7e6429662 (diff) |
fix invoking shell protocol handler scripts
Diffstat (limited to 'proto')
-rwxr-xr-x | proto/netifd-proto.sh | 14 | ||||
-rwxr-xr-x | proto/ppp.sh | 10 |
2 files changed, 21 insertions, 3 deletions
diff --git a/proto/netifd-proto.sh b/proto/netifd-proto.sh index 3764281..b91863f 100755 --- a/proto/netifd-proto.sh +++ b/proto/netifd-proto.sh @@ -26,7 +26,11 @@ add_default_handler() { esac } -case "$1" in +proto="$1" +cmd="$2" +data="$3" + +case "$cmd" in dump) add_protocol() { immediate=0 @@ -45,7 +49,13 @@ case "$1" in ;; *) add_protocol() { - return; + [[ "$proto" == "$1" ]] || return 0 + + case "$cmd" in + setup) eval "$1_setup \"\$data\"" ;; + teardown) eval "$1_teardown \"\$data\"" ;; + *) return 1 ;; + esac } ;; esac diff --git a/proto/ppp.sh b/proto/ppp.sh index 8dd97c0..9a5816b 100755 --- a/proto/ppp.sh +++ b/proto/ppp.sh @@ -9,7 +9,7 @@ ppp_init_config() { } ppp_setup() { - return + echo "ppp_setup: $1" } ppp_teardown() { @@ -30,4 +30,12 @@ pppoe_init() { return } +pppoe_setup() { + echo "pppoe_setup: $1" +} + +pppoe_teardown() { + return +} + add_protocol pppoe |