diff --git a/map-controller/files/etc/config/mapcontroller b/map-controller/files/etc/config/mapcontroller index 1f4da7044..268417fe0 100644 --- a/map-controller/files/etc/config/mapcontroller +++ b/map-controller/files/etc/config/mapcontroller @@ -10,6 +10,7 @@ config controller 'controller' option primary_pcp '0' option stale_sta_timeout '30d' option de_collect_interval '60' + option de_hide_dm_scanres '1' list plugin 'zerotouch' config sta_steering 'sta_steering' diff --git a/wifidmd/Makefile b/wifidmd/Makefile index 54dcac86e..f4cab12d7 100644 --- a/wifidmd/Makefile +++ b/wifidmd/Makefile @@ -71,6 +71,10 @@ define Package/wifidmd/install $(INSTALL_DIR) $(1)/etc/wifidmd $(INSTALL_BIN) ./files/etc/wifidmd/bbf_config_reload.sh $(1)/etc/wifidmd +ifeq ($(CONFIG_WIFIDMD_ENABLE_WIFI_DATAELEMENTS),y) + $(INSTALL_BIN) ./files/etc/wifidmd/hide_scanres.json $(1)/etc/wifidmd/hide_scanres.json +endif + $(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) $(PKG_NAME) endef diff --git a/wifidmd/files/etc/init.d/wifidmd b/wifidmd/files/etc/init.d/wifidmd index 1b7332c5f..fd8d5c81c 100644 --- a/wifidmd/files/etc/init.d/wifidmd +++ b/wifidmd/files/etc/init.d/wifidmd @@ -6,11 +6,39 @@ STOP=10 USE_PROCD=1 PROG=/usr/sbin/wifidmd +DM_PLUGIN_PATH="/usr/share/bbfdm/micro_services/wifidmd/hide_scanres.json" +WIFIDM_PLUGIN_PATH="/etc/wifidmd/hide_scanres.json" + +enable_scanres_dm() +{ + [ -f "${DM_PLUGIN_PATH}" ] && rm ${DM_PLUGIN_PATH} +} + +disable_scanres_dm() +{ + mkdir -p "$(dirname ${DM_PLUGIN_PATH})" + + if [ ! -f "${DM_PLUGIN_PATH}" ]; then + if [ -f "${WIFIDM_PLUGIN_PATH}" ]; then + cp "${WIFIDM_PLUGIN_PATH}" "${DM_PLUGIN_PATH}" + fi + fi +} + start_service() { log_level=$(jsonfilter -qe '@.daemon.config.loglevel' < /etc/bbfdm/services/wifidmd.json) [ -z "$log_level" ] && log_level="3" + config_load mapcontroller + config_get hide_scanres controller de_hide_dm_scanres "0" + + if [ "${hide_scanres}" -eq "1" ]; then + disable_scanres_dm + else + enable_scanres_dm + fi + procd_open_instance "wifidmd" procd_set_param command ${PROG} procd_append_param command -l "${log_level}" diff --git a/wifidmd/files/etc/wifidmd/hide_scanres.json b/wifidmd/files/etc/wifidmd/hide_scanres.json new file mode 100644 index 000000000..e43de024f --- /dev/null +++ b/wifidmd/files/etc/wifidmd/hide_scanres.json @@ -0,0 +1,20 @@ +{ + "json_plugin_version":2, + "Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.": { + "type": "object", + "protocols": [ + "cwmp", + "usp" + ], + "access": false, + "array": true, + "Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.ScanResult.": { + "type": "object", + "protocols": [ + "none" + ], + "access": false, + "array": false + } + } +} \ No newline at end of file