pass ifname to the shell proto handler
authorFelix Fietkau <nbd@openwrt.org>
Sun, 11 Sep 2011 14:22:29 +0000 (16:22 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 11 Sep 2011 14:22:29 +0000 (16:22 +0200)
proto-shell.c
proto/netifd-proto.sh
proto/ppp.sh

index 86126317271e235df613870f7e4f44ad1437a45d..574d969992e438c1009934a6dcdd9dc4e71ed676 100644 (file)
@@ -57,7 +57,7 @@ proto_shell_handler(struct interface_proto_state *proto,
 {
        struct proto_shell_state *state;
        struct proto_shell_handler *handler;
-       const char *argv[5];
+       const char *argv[6];
        char *config;
        int ret;
 
@@ -73,6 +73,10 @@ proto_shell_handler(struct interface_proto_state *proto,
        argv[2] = "teardown";
        argv[3] = config;
        argv[4] = NULL;
+       if (proto->iface->main_dev.dev) {
+               argv[4] = proto->iface->main_dev.dev->ifname;
+               argv[5] = NULL;
+       }
 
        switch(cmd) {
        case PROTO_CMD_SETUP:
index 9aace594453997c3a6a9cdfed44908f99aa7b02c..93bf37a24b79e0545e2eae52eac9ee125eabc186 100755 (executable)
@@ -29,6 +29,7 @@ add_default_handler() {
 proto="$1"
 cmd="$2"
 data="$3"
+ifname="$4"
 
 case "$cmd" in
        dump)
@@ -54,8 +55,8 @@ case "$cmd" in
                        [[ "$proto" == "$1" ]] || return 0
 
                        case "$cmd" in
-                               setup) eval "$1_setup \"\$data\"" ;;
-                               teardown) eval "$1_teardown \"\$data\"" ;;
+                               setup) eval "$1_setup \"\$data\" \"\$ifname\"" ;;
+                               teardown) eval "$1_teardown \"\$data\" \"\$ifname\"" ;;
                                *) return 1 ;;
                        esac
                }
index 7eed5794c8b6c2002ed007881460c931051095f1..428096b74a8c7c294faf9d97d5fed18a3f478c74 100755 (executable)
@@ -32,7 +32,7 @@ pppoe_init() {
 }
 
 pppoe_setup() {
-       echo "pppoe_setup: $1"
+       echo "pppoe_setup($2): $1"
 }
 
 pppoe_teardown() {