summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHelmut Schaa <helmut.schaa@googlemail.com>2014-03-20 16:26:23 +0100
committerFelix Fietkau <nbd@openwrt.org>2014-03-21 16:05:20 +0100
commit3d317e90f15eec480b23f4dcddb841c292bef690 (patch)
tree23bd42c83bd676a029fe4536d68de414a606d7c9 /scripts
parent559df99f259e88edaa7e45826a0ff436f2a07d1a (diff)
downloadnetifd-3d317e90f15eec480b23f4dcddb841c292bef690.tar.gz
netifd: Reload proto on topology change
Introduce a new device event "topology change" that gets signaled by bridges on adding/removing members. On "topology changes" the proto handlers are requested to "renew" which is most useful for DHCP. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/netifd-proto.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/netifd-proto.sh b/scripts/netifd-proto.sh
index 7f08b1d..ce316c4 100644
--- a/scripts/netifd-proto.sh
+++ b/scripts/netifd-proto.sh
@@ -20,6 +20,11 @@ _proto_do_teardown() {
eval "proto_$1_teardown \"$interface\" \"$ifname\""
}
+_proto_do_renew() {
+ json_load "$data"
+ eval "proto_$1_renew \"$interface\" \"$ifname\""
+}
+
_proto_do_setup() {
json_load "$data"
_EXPORT_VAR=0
@@ -352,6 +357,7 @@ init_proto() {
add_protocol() {
no_device=0
available=0
+ renew_handler=0
add_default_handler "proto_$1_init_config"
@@ -362,10 +368,11 @@ init_proto() {
json_close_array
json_add_boolean no-device "$no_device"
json_add_boolean available "$available"
+ json_add_boolean renew-handler "$renew_handler"
json_dump
}
;;
- setup|teardown)
+ setup|teardown|renew)
interface="$1"; shift
data="$1"; shift
ifname="$1"; shift
@@ -376,6 +383,7 @@ init_proto() {
case "$cmd" in
setup) _proto_do_setup "$1";;
teardown) _proto_do_teardown "$1" ;;
+ renew) _proto_do_renew "$1" ;;
*) return 1 ;;
esac
}