add proper parameters for protocol notify functions
authorFelix Fietkau <nbd@openwrt.org>
Thu, 13 Oct 2011 21:57:39 +0000 (23:57 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 13 Oct 2011 21:59:08 +0000 (23:59 +0200)
dummy/netifd-proto.sh
dummy/proto/ppp.sh

index ae05b9c71c4a58d5c22401269720d6d735f53f4e..9fc9cab84c693c629462412026d4a4c47b55ecb9 100755 (executable)
@@ -121,6 +121,7 @@ _proto_push_array() {
 }
 
 _proto_notify() {
+       local interface="$1"
        ubus call network.interface."$interface" notify_proto "$(json_dump)"
 }
 
@@ -132,10 +133,12 @@ proto_send_update() {
        _proto_push_array "route" "$PROTO_ROUTE" _proto_push_route
        _proto_push_array "route6" "$PROTO_ROUTE6" _proto_push_route
        _proto_push_array "dns" "$PROTO_DNS" _proto_push_ip
-       _proto_notify
+       _proto_notify "$interface"
 }
 
 proto_run_command() {
+       local interface="$1"; shift
+
        json_init
        json_add_int action 1
        json_add_array command
@@ -143,7 +146,7 @@ proto_run_command() {
                json_add_string "" "$1"
                shift
        done
-       _proto_notify
+       _proto_notify "$interface"
 }
 
 init_proto() {
index e7b9839332aaed005f2ca1e2c1a574680efa1fb3..8673b98a08df5e54f608c7e1119ac742defebafd 100755 (executable)
@@ -33,14 +33,17 @@ pppoe_init() {
 }
 
 pppoe_setup() {
+       local interface="$1"
+       local device="$2"
+
        json_get_var username username
        json_get_var password password
-       echo "pppoe_setup($1, $2), username=$username, password=$password"
+       echo "pppoe_setup($interface, $device), username=$username, password=$password"
        proto_init_update ppp0 1
        proto_add_ipv4_address "192.168.2.1" 32
        proto_add_dns_server "192.168.2.2"
-       proto_send_update "$1"
-       proto_run_command sleep 10
+       proto_send_update "$interface"
+       proto_run_command "$interface" sleep 10
 }
 
 pppoe_teardown() {