diff --git a/package/gluon-core/files/usr/bin/gluon-list-mesh-interfaces b/package/gluon-core/files/usr/bin/gluon-list-mesh-interfaces new file mode 100755 index 00000000..9b450f90 --- /dev/null +++ b/package/gluon-core/files/usr/bin/gluon-list-mesh-interfaces @@ -0,0 +1,2 @@ +#!/bin/sh +ubus call network.interface dump | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device" diff --git a/package/gluon-l3roamd/files/etc/init.d/gluon-l3roamd b/package/gluon-l3roamd/files/etc/init.d/gluon-l3roamd index 0a51bde9..9fe597b9 100755 --- a/package/gluon-l3roamd/files/etc/init.d/gluon-l3roamd +++ b/package/gluon-l3roamd/files/etc/init.d/gluon-l3roamd @@ -10,7 +10,7 @@ start_service () { procd_set_param stdout 1 procd_set_param stderr 1 procd_set_param respawn ${respawn_threshold:-3660} ${respawn_timeout:-5} ${respawn_retry:-0} - interfaces=$(for dev in $( ubus call network.interface dump | jsonfilter -e "@.interface[@.proto='gluon_mesh' && @.up=true].device");do echo " -m $dev"; done; + interfaces=$(for dev in $(gluon-list-mesh-interfaces);do echo " -m $dev"; done; [ "$(ifstatus client | jsonfilter -e "@.up")" = "true" ] && echo " -i local-node") procd_set_param command "$PROG" -s /var/run/l3roamd.sock -p $(lua -e 'print(require("gluon.site").prefix6())') $interfaces -t 254 -a $(uci get network.loopback.ip6addr | cut -d/ -f1) -4 0:0:0:0:0:ffff::/96 -b br-client procd_close_instance diff --git a/package/gluon-status-page-mesh-batman-adv/Makefile b/package/gluon-status-page-mesh-batman-adv/Makefile new file mode 100644 index 00000000..4d2ed8f0 --- /dev/null +++ b/package/gluon-status-page-mesh-batman-adv/Makefile @@ -0,0 +1,20 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-status-page-mesh-batman-adv +PKG_VERSION:=1 + +include ../gluon.mk + +define Package/gluon-status-page-mesh-batman-adv + TITLE:=Batman-data provider for gluon-status-page + DEPENDS:=+gluon-status-page gluon-mesh-batman-adv +libnl-tiny +libbatadv +libjson-c +endef + +define Package/gluon-status-page-mesh-batman-adv/install + $(Gluon/Build/Install) + + $(INSTALL_DIR) $(1)/lib/gluon/status-page/providers + $(INSTALL_BIN) $(PKG_BUILD_DIR)/neighbours-batadv $(1)/lib/gluon/status-page/providers/ +endef + +$(eval $(call BuildPackageGluon,gluon-status-page-mesh-batman-adv)) diff --git a/package/gluon-status-page-mesh-batman-adv/src/Makefile b/package/gluon-status-page-mesh-batman-adv/src/Makefile new file mode 100644 index 00000000..5fb4ef4f --- /dev/null +++ b/package/gluon-status-page-mesh-batman-adv/src/Makefile @@ -0,0 +1,40 @@ +all: neighbours-batadv + +CFLAGS += -Wall -D_GNU_SOURCE + +ifeq ($(origin PKG_CONFIG), undefined) + PKG_CONFIG = pkg-config + ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null),) + $(error $(PKG_CONFIG) not found) + endif +endif + +ifeq ($(origin LIBNL_CFLAGS) $(origin LIBNL_LDLIBS), undefined undefined) + LIBNL_NAME ?= libnl-tiny + ifeq ($(shell $(PKG_CONFIG) --modversion $(LIBNL_NAME) 2>/dev/null),) + $(error No $(LIBNL_NAME) development libraries found!) + endif + LIBNL_CFLAGS += $(shell $(PKG_CONFIG) --cflags $(LIBNL_NAME)) + LIBNL_LDLIBS += $(shell $(PKG_CONFIG) --libs $(LIBNL_NAME)) +endif +CFLAGS += $(LIBNL_CFLAGS) +LDLIBS += $(LIBNL_LDLIBS) + +CFLAGS_JSONC = $(shell pkg-config --cflags json-c) +LDFLAGS_JSONC = $(shell pkg-config --libs json-c) + + +ifeq ($(origin LIBBATADV_CFLAGS) $(origin LIBBATADV_LDLIBS), undefined undefined) + LIBBATADV_NAME ?= libbatadv + ifeq ($(shell $(PKG_CONFIG) --modversion $(LIBBATADV_NAME) 2>/dev/null),) + $(error No $(LIBBATADV_NAME) development libraries found!) + endif + LIBBATADV_CFLAGS += $(shell $(PKG_CONFIG) --cflags $(LIBBATADV_NAME)) + LIBBATADV_LDLIBS += $(shell $(PKG_CONFIG) --libs $(LIBBATADV_NAME)) +endif +CFLAGS += $(LIBBATADV_CFLAGS) +LDLIBS += $(LIBBATADV_LDLIBS) + +neighbours-batadv: neighbours-batadv.c + $(CC) $(CFLAGS) $(CFLAGS_JSONC) $(LDFLAGS) $(LDFLAGS_JSONC) -o $@ $^ $(LDLIBS) + diff --git a/package/gluon-status-page/src/neighbours-batadv.c b/package/gluon-status-page-mesh-batman-adv/src/neighbours-batadv.c similarity index 100% rename from package/gluon-status-page/src/neighbours-batadv.c rename to package/gluon-status-page-mesh-batman-adv/src/neighbours-batadv.c diff --git a/package/gluon-status-page/Makefile b/package/gluon-status-page/Makefile index d17ce2da..923f68c7 100644 --- a/package/gluon-status-page/Makefile +++ b/package/gluon-status-page/Makefile @@ -7,14 +7,14 @@ include ../gluon.mk define Package/gluon-status-page TITLE:=Status page showing information about the node - DEPENDS:=+gluon-web +gluon-neighbour-info +gluon-respondd +uhttpd +sse-multiplex +libiwinfo +libjson-c +libnl-tiny +libubus-lua +libbatadv + DEPENDS:=+gluon-web +gluon-neighbour-info +gluon-respondd +uhttpd +sse-multiplex +libiwinfo +libjson-c +libnl-tiny +libubus-lua endef define Package/gluon-status-page/install $(Gluon/Build/Install) $(INSTALL_DIR) $(1)/lib/gluon/status-page/providers - $(INSTALL_BIN) $(PKG_BUILD_DIR)/{neighbours-batadv,stations} $(1)/lib/gluon/status-page/providers/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/stations $(1)/lib/gluon/status-page/providers/ $(INSTALL_DIR) $(1)/lib/gluon/status-page/view/ $(LN) /lib/gluon/web/i18n $(1)/lib/gluon/status-page/ diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/dyn/neighbours-nodeinfo b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/dyn/neighbours-nodeinfo index 55c46fa6..3f149100 100755 --- a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/dyn/neighbours-nodeinfo +++ b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/dyn/neighbours-nodeinfo @@ -6,6 +6,6 @@ badrequest() { exit 1 } -( batctl if | cut -d: -f1 | grep -qxF "$QUERY_STRING" ) 2>/dev/null || badrequest +( gluon-list-mesh-interfaces | grep -qxF "$QUERY_STRING" ) 2>/dev/null || badrequest -exec /usr/bin/gluon-neighbour-info -s neighbour -i "$QUERY_STRING" -d ff02::2:1001 -p 1001 -r nodeinfo +exec gluon-neighbour-info -s neighbour -i "$QUERY_STRING" -d ff02::2:1001 -p 1001 -r nodeinfo diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/dyn/stations b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/dyn/stations index 32669b4a..5ff1f125 100755 --- a/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/dyn/stations +++ b/package/gluon-status-page/files/lib/gluon/status-page/www/cgi-bin/dyn/stations @@ -6,8 +6,8 @@ badrequest() { exit 1 } -( batctl if | cut -d: -f1 | grep -qxF "$QUERY_STRING" ) 2>/dev/null || badrequest +( gluon-list-mesh-interfaces | grep -qxF "$QUERY_STRING" ) 2>/dev/null || badrequest CMD="exec /lib/gluon/status-page/providers/stations '$QUERY_STRING'" -exec /usr/sbin/sse-multiplex "$CMD" +exec sse-multiplex "$CMD" diff --git a/package/gluon-status-page/src/Makefile b/package/gluon-status-page/src/Makefile index bf5141a7..a0a14e16 100644 --- a/package/gluon-status-page/src/Makefile +++ b/package/gluon-status-page/src/Makefile @@ -20,19 +20,7 @@ endif CFLAGS_JSONC = $(shell pkg-config --cflags json-c) LDFLAGS_JSONC = $(shell pkg-config --libs json-c) -ifeq ($(origin LIBBATADV_CFLAGS) $(origin LIBBATADV_LDLIBS), undefined undefined) - LIBBATADV_NAME ?= libbatadv - ifeq ($(shell $(PKG_CONFIG) --modversion $(LIBBATADV_NAME) 2>/dev/null),) - $(error No $(LIBBATADV_NAME) development libraries found!) - endif - LIBBATADV_CFLAGS += $(shell $(PKG_CONFIG) --cflags $(LIBBATADV_NAME)) - LIBBATADV_LDLIBS += $(shell $(PKG_CONFIG) --libs $(LIBBATADV_NAME)) -endif - -all: neighbours-batadv stations - -neighbours-batadv: neighbours-batadv.c - $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_JSONC) $(LIBNL_CFLAGS) $(LIBBATADV_CFLAGS) $(LDFLAGS) $(LDFLAGS_JSONC) $(LIBNL_LDLIBS) $(LIBBATADV_LDLIBS) -Wall -o $@ $^ $(LDLIBS) +all: stations stations: stations.c $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_JSONC) $(LDFLAGS) $(LDFLAGS_JSONC) -Wall -o $@ $^ $(LDLIBS) -liwinfo