aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2021-08-24 17:40:28 +0200
committerFelix Fietkau <nbd@nbd.name>2021-08-26 13:27:27 +0200
commit3ebbf795df2633bbd277a5ec8651d4b093a775a2 (patch)
tree1b483c18bfac20a6be41434f9de4627d70e22ab8
parent364bd887a148a1963bf9a94fe7dd171f36afb87e (diff)
downloadupstream-3ebbf795df2633bbd277a5ec8651d4b093a775a2.tar.gz
upstream-3ebbf795df2633bbd277a5ec8651d4b093a775a2.tar.bz2
upstream-3ebbf795df2633bbd277a5ec8651d4b093a775a2.zip
ustp: add OpenWrt STP/RSTP daemon
This integrates with netifd in order to provide STP/RSTP protocol support in user space. It defaults to using RSTP for bridges with stp enabled. This daemon has no config files, it uses the configuration passed from netifd via ubus Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--package/network/services/ustp/Makefile41
-rw-r--r--package/network/services/ustp/files/ustpd.init14
2 files changed, 55 insertions, 0 deletions
diff --git a/package/network/services/ustp/Makefile b/package/network/services/ustp/Makefile
new file mode 100644
index 0000000000..682bd9f350
--- /dev/null
+++ b/package/network/services/ustp/Makefile
@@ -0,0 +1,41 @@
+#
+# Copyright (C) 2021 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ustp
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL=$(PROJECT_GIT)/project/ustp.git
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_DATE:=2021-08-25
+PKG_SOURCE_VERSION:=9622264cf92691f18ae9222b0a4c9db95af5d80d
+PKG_MIRROR_HASH:=de4ed29eee21192b60e8683633d916d251bcccd5701bdac83b5ba435189297f1
+
+PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
+PKG_LICENSE:=GPL-2.0
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/ustp
+ SECTION:=net
+ CATEGORY:=Network
+ TITLE:=OpenWrt STP/RSTP daemon
+ DEPENDS:=+libubox +libubus
+endef
+
+TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -flto
+TARGET_LDFLAGS += -flto -fuse-linker-plugin
+
+define Package/ustp/install
+ $(INSTALL_DIR) $(1)/sbin $(1)/etc/init.d
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/ipkg-install/sbin/* $(1)/sbin/
+ $(INSTALL_BIN) ./files/ustpd.init $(1)/etc/init.d/ustpd
+endef
+
+$(eval $(call BuildPackage,ustp))
diff --git a/package/network/services/ustp/files/ustpd.init b/package/network/services/ustp/files/ustpd.init
new file mode 100644
index 0000000000..9b741fec78
--- /dev/null
+++ b/package/network/services/ustp/files/ustpd.init
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+# Copyright (c) 2021 OpenWrt.org
+
+START=50
+
+USE_PROCD=1
+PROG=/sbin/ustpd
+
+start_service() {
+ procd_open_instance
+ procd_set_param command "$PROG"
+ procd_set_param respawn
+ procd_close_instance
+}