bbfdm: add support for Device.IP.ActivePort

active-port sub-package added, which installs:

* JSON datamodel plugin for ActivePort data model object
* daemon that implements active-port ubus call
This commit is contained in:
Mohd Mehdi 2024-07-16 14:10:37 +00:00 committed by IOPSYS Dev
parent d99da1039b
commit 947fe9ef99
No known key found for this signature in database
3 changed files with 150 additions and 2 deletions

View file

@ -5,13 +5,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=bbfdm
PKG_VERSION:=1.9.9
PKG_VERSION:=1.9.10
USE_LOCAL:=0
ifneq ($(USE_LOCAL),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/bbfdm.git
PKG_SOURCE_VERSION:=56312c7b0344cb2d52352c285ebc3554450fad34
PKG_SOURCE_VERSION:=51e9dac7dba88547bde7225aad79619e5c03cddd
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
@ -58,6 +58,17 @@ define Package/bbf_configmngr
MENU:=1
endef
define Package/active-port
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=TRx69
TITLE:= Device.IP.ActivePort object
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +bbfdmd
DEPENDS+=+@BUSYBOX_DEFAULT_NETSTAT
DEPENDS+=+@BUSYBOX_DEFAULT_AWK
MENU:=1
endef
define Package/libbbfdm/config
source "$(SOURCE)/Config_bbfdm.in"
endef
@ -78,6 +89,10 @@ define Package/bbf_configmngr/description
Daemon for handling bbf reload services via ubus bbf.config
endef
define Package/active-port/description
Provides Device.IP.ActivePort data model object.
endef
ifeq ($(USE_LOCAL),1)
define Build/Prepare
$(CP) ~/git/bbfdm/* $(PKG_BUILD_DIR)/
@ -166,6 +181,14 @@ ifeq ($(CONFIG_BBF_CONFIGMNGR_SCRIPT_BACKEND),y)
endif
endef
define Package/active-port/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) ./files/etc/init.d/active-port $(1)/etc/init.d/active-port
$(INSTALL_BIN) $(PKG_BUILD_DIR)/utilities/active-port $(1)/usr/sbin/
$(BBFDM_INSTALL_CORE_PLUGIN) ./files/etc/active-port/active-port.json $(1)
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib
$(INSTALL_DIR) $(1)/usr/include
@ -175,6 +198,7 @@ define Build/InstallDev
endef
$(eval $(call BuildPackage,bbf_configmngr))
$(eval $(call BuildPackage,active-port))
$(eval $(call BuildPackage,libbbfdm-api))
$(eval $(call BuildPackage,libbbfdm))
$(eval $(call BuildPackage,bbfdmd))

View file

@ -0,0 +1,109 @@
{
"json_plugin_version": 2,
"Device.IP.ActivePort.{i}.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"description": "This table lists the ports on which TCP connections are listening or established.",
"access": false,
"array": true,
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "active-port",
"method": "dump",
"args": {},
"key": "connections"
}
}
],
"LocalIPAddress": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"description": "Connection local IP address",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "local_ip"
}
]
},
"LocalPort": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"description": "Connection local port",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "local_port"
}
]
},
"RemoteIPAddress": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"description": "The remote IP address of the source of inbound packets",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "remote_ip"
}
]
},
"RemotePort": {
"type": "unsignedInt",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"description": "The remote port of the source of inbound packets",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "remote_port"
}
]
},
"Status": {
"type": "string",
"read": true,
"write": false,
"protocols": [
"cwmp",
"usp"
],
"description": "Current operational status of the connection",
"mapping": [
{
"data": "@Parent",
"type": "json",
"key": "status"
}
]
}
}
}

View file

@ -0,0 +1,15 @@
#!/bin/sh /etc/rc.common
START=64
STOP=10
USE_PROCD=1
PROG=/usr/sbin/active-port
start_service()
{
procd_open_instance "active-port"
procd_set_param command ${PROG}
procd_set_param respawn
procd_close_instance "active-port"
}