Compare commits

...

4 Commits

Author SHA1 Message Date
Jakob Olsson
e3743fa4b2 map-agent: add map-dynamic-backhaul hotplug script 2021-12-14 16:45:08 +01:00
Jakob Olsson
0cc03f9434 ieee1905: 3.3.8 2021-12-14 16:21:49 +01:00
Jakob Olsson
759f128c1b map-agent: remove uplink tmp file when restarting dynbhd 2021-12-14 16:21:49 +01:00
Jakob Olsson
39ef60e411 map-agent: 5.4.3: introduce dynbhd 2021-12-14 16:21:49 +01:00
5 changed files with 73 additions and 33 deletions

View File

@@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ieee1905
PKG_VERSION:=3.3.7
PKG_VERSION:=3.3.8
LOCAL_DEV=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=3fc90a1597bd06360e62fd70f4f7301a2499e267
PKG_SOURCE_VERSION:=f3b636cb5a484175831df6595a5f68a25c6c071c
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ieee1905.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
PKG_MIRROR_HASH:=skip

View File

@@ -5,9 +5,9 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=map-agent
PKG_VERSION:=5.4.2
PKG_VERSION:=5.4.3
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=50167ef5d43df49d41e9578064a46eece2fe4c59
PKG_SOURCE_VERSION:=1134a0882c47afb390c33cf205150d26b0e9736a
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
PKG_LICENSE:=PROPRIETARY IOPSYS
@@ -30,10 +30,24 @@ define Package/map-agent
+map-plugin
endef
define Package/dynbhd
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Dynamic Backhaul Daemon
DEPENDS:=+libwifi +libuci +libubox +ubus +libeasy +libieee1905 +ieee1905 \
+map-plugin +map-agent
endef
define Package/map-agent/description
This package implements EasyMesh R2 compliant WiFi Agent.
endef
define Package/dynbhd/description
Dyanmic LAN/WAN port detection and loop avoidance.
endef
define Package/map-agent/config
#source "$(SOURCE)/Config.in"
endef
@@ -53,4 +67,21 @@ define Package/map-agent/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mapagent $(1)/usr/sbin/
endef
define Package/dynbhd/install
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/lib/wifi/dynbhd
$(INSTALL_DIR) $(1)/etc/hotplug.d/ethernet
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/dynbh/dynbhd $(1)/usr/sbin/dynbhd
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/dynbh/api $(1)/lib/wifi/dynbhd/api
# $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/dynbh/map-dynamic-backhaul $(1)/etc/hotplug.d/ethernet/map-dynamic-backhaul
endef
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
rsync -r --exclude=.* ~/git/map-agent/ $(PKG_BUILD_DIR)/
endef
endif
$(eval $(call BuildPackage,map-agent))
$(eval $(call BuildPackage,dynbhd))

View File

@@ -0,0 +1,26 @@
#!/bin/sh
pid=$(pidof dynbhd)
[ -n "$pid" ] && exit 0 # dynbhd is managing the links
if [ ! -f /tmp/map.connected.ports ]; then
touch /tmp/map.connected.ports
if [ "$LINK" = "up" ]; then
touch /tmp/map.connected.ports
echo "$PORT" > /tmp/map.connected.ports
brctl delif br-lan $PORT
#ubus call network.interface.lan remove_device "{\"name\":\"$PORT\"}"
fi
else
if [ "$LINK" = "up" ]; then
brctl delif br-lan $PORT
echo "$PORT" >> /tmp/map.connected.ports
#ubus call network.interface.lan remove_device "{\"name\":\"$PORT\"}"
else
sed -i -E "/(^|:)"$PORT"(:|$)/d" /tmp/map.connected.ports
#ubus call network.interface.lan add_device "{\"name\":\"$PORT\"}"
brctl addif br-lan $PORT
[ "$(cat /tmp/map.connected.ports | wc -c)" = "0" ] && rm /tmp/map.connected.ports
fi
fi

View File

@@ -1,29 +0,0 @@
#!/bin/sh
wan=$(db -q get hw.board.ethernetWanPort)
[ -z "$wan" ] && exit 1 # no configuration
[ "$PORT" != "$wan" ] && exit 0
update_bstas() {
local section="$1"
local action="$2"
local ifname onboarded
config_get ifname "$section" ifname
config_get_bool onboarded "$section" onboarded 0
[ "$onboarded" -eq 0 ] && return
wpa_cli -i "$ifname" "$action" > /dev/null 2>&1
}
if [ "$LINK" = "up" ]; then
touch /tmp/map.agent.bsta_global_disable
config_load "mapagent"
config_foreach update_bstas bk-iface disconnect
else
rm -f /tmp/map.agent.bsta_global_disable
config_load "mapagent"
config_foreach update_bstas bk-iface reconnect
fi

View File

@@ -46,7 +46,19 @@ remove_map() {
ubus call network reload
}
start_dynbhd_service() {
rm -f /tmp/map.agent.bsta_global_disable
procd_open_instance
procd_set_param command "/usr/sbin/dynbhd"
procd_set_param respawn
# procd_set_param stdout 1
# procd_set_param stderr 1
procd_close_instance
}
start_service() {
[ -f /usr/sbin/dynbhd ] && start_dynbhd_service
config_load "mapagent"
ubus -t 5 wait_for wifi