Procházet zdrojové kódy

gluon-core: add gluon_mesh netifd proto

This new protocol will allow configuring mesh interfaces independently of
the used mesh protocol.
Matthias Schiffer před 7 roky
rodič
revize
5cd6295265

+ 0 - 0
package/gluon-core/files/lib/gluon/core/mesh/setup.d/.keep


+ 0 - 0
package/gluon-core/files/lib/gluon/core/mesh/teardown.d/.keep


+ 39 - 0
package/gluon-core/files/lib/netifd/proto/gluon_mesh.sh

@@ -0,0 +1,39 @@
+#!/bin/sh
+
+. /lib/functions.sh
+. ../netifd-proto.sh
+init_proto "$@"
+
+proto_gluon_mesh_init_config() {
+	proto_config_add_boolean fixed_mtu
+	proto_config_add_boolean transitive
+}
+
+proto_gluon_mesh_setup() {
+	export CONFIG="$1"
+	export IFNAME="$2"
+
+	local fixed_mtu transitive
+	json_get_vars fixed_mtu transitive
+
+	export FIXED_MTU="$fixed_mtu"
+	export TRANSITIVE="$transitive"
+
+	for script in /lib/gluon/core/mesh/setup.d/*; do
+	        [ ! -x "$script" ] || "$script"
+	done
+
+        proto_init_update "$IFNAME" 1
+        proto_send_update "$CONFIG"
+}
+
+proto_gluon_mesh_teardown() {
+	export CONFIG="$1"
+	export IFNAME="$2"
+
+	for script in /lib/gluon/core/mesh/teardown.d/*; do
+	        [ ! -x "$script" ] || "$script"
+	done
+}
+
+add_protocol gluon_mesh