mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
obuspa: Option to set max controllers
This commit is contained in:
parent
45d3cce3e6
commit
16aeb4e6fe
4 changed files with 63 additions and 9 deletions
|
|
@ -22,4 +22,12 @@ config OBUSPA_CONTROLLER_MTP_VERIFY
|
||||||
config OBUSPA_ENABLE_TEST_CONTROLLER
|
config OBUSPA_ENABLE_TEST_CONTROLLER
|
||||||
bool "Adds a test controller by default"
|
bool "Adds a test controller by default"
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config OBUSPA_MAX_CONTROLLERS_NUM
|
||||||
|
int "The maximum number of controllers to be supported"
|
||||||
|
range 1 10
|
||||||
|
default 5
|
||||||
|
help
|
||||||
|
This value must be in range of 1 to 10. (default 5)
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=obuspa
|
PKG_NAME:=obuspa
|
||||||
PKG_VERSION:=7.0.5.8
|
PKG_VERSION:=7.0.5.9
|
||||||
|
|
||||||
LOCAL_DEV:=0
|
LOCAL_DEV:=0
|
||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git
|
PKG_SOURCE_URL:=https://dev.iopsys.eu/bbf/obuspa.git
|
||||||
PKG_SOURCE_VERSION:=d11c8505ffddb4c840d630632b0bb7dda04ca5b2
|
PKG_SOURCE_VERSION:=810536113fc431e8f6385bb3fde52d240b5ad19d
|
||||||
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
||||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||||
PKG_MIRROR_HASH:=skip
|
PKG_MIRROR_HASH:=skip
|
||||||
|
|
@ -81,6 +81,10 @@ else
|
||||||
CMAKE_OPTIONS += -DENABLE_WEBSOCKETS=OFF
|
CMAKE_OPTIONS += -DENABLE_WEBSOCKETS=OFF
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef $(CONFIG_OBUSPA_MAX_CONTROLLERS_NUM)
|
||||||
|
TARGET_CFLAGS += -DOBUSPA_MAX_CONTROLLERS_NUM=$(CONFIG_OBUSPA_MAX_CONTROLLERS_NUM)
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(LOCAL_DEV),1)
|
ifeq ($(LOCAL_DEV),1)
|
||||||
define Build/Prepare
|
define Build/Prepare
|
||||||
$(CP) -rf ~/git/obuspa/* $(PKG_BUILD_DIR)/
|
$(CP) -rf ~/git/obuspa/* $(PKG_BUILD_DIR)/
|
||||||
|
|
|
||||||
|
|
@ -92,10 +92,10 @@ get_base_path()
|
||||||
count=0
|
count=0
|
||||||
|
|
||||||
if [ -f "${DB_DUMP}" ]; then
|
if [ -f "${DB_DUMP}" ]; then
|
||||||
path=$(grep "${refpath}\d.Alias \"${value}\"" ${DB_DUMP})
|
path=$(grep -E "${refpath}\d+.Alias \"${value}\"" ${DB_DUMP})
|
||||||
path=${path%.*}
|
path=${path%.*}
|
||||||
if [ -z "${path}" ]; then
|
if [ -z "${path}" ]; then
|
||||||
path=$(grep -o "${refpath}\d" ${DB_DUMP} |sort -r|head -n 1)
|
path=$(grep -oE "${refpath}\d+" ${DB_DUMP} |sort -r|head -n 1)
|
||||||
if [ -n "${path}" ]; then
|
if [ -n "${path}" ]; then
|
||||||
count=${path##*.}
|
count=${path##*.}
|
||||||
count=$(( count + 1 ))
|
count=$(( count + 1 ))
|
||||||
|
|
@ -122,9 +122,9 @@ get_refrence_path()
|
||||||
path=""
|
path=""
|
||||||
|
|
||||||
if [ -f "${DB_DUMP}" ]; then
|
if [ -f "${DB_DUMP}" ]; then
|
||||||
path=$(grep "${dmref}\d.Alias " ${DB_DUMP}|grep -w "${value}")
|
path=$(grep -E "${dmref}\d+.Alias " ${DB_DUMP}|grep -w "${value}")
|
||||||
elif [ -f "${RESET_FILE}" ]; then
|
elif [ -f "${RESET_FILE}" ]; then
|
||||||
path=$(grep "${dmref}\d.Alias " ${RESET_FILE}|grep -w "${value}")
|
path=$(grep -E "${dmref}\d+.Alias " ${RESET_FILE}|grep -w "${value}")
|
||||||
fi
|
fi
|
||||||
path=${path%.*}
|
path=${path%.*}
|
||||||
echo "${path}"
|
echo "${path}"
|
||||||
|
|
@ -728,13 +728,13 @@ get_instances_from_db_dump()
|
||||||
{
|
{
|
||||||
local obj inst
|
local obj inst
|
||||||
|
|
||||||
obj="${1}\d"
|
obj="${1}\d+"
|
||||||
if [ ! -f "${DB_DUMP}" ]; then
|
if [ ! -f "${DB_DUMP}" ]; then
|
||||||
echo ""
|
echo ""
|
||||||
return 0;
|
return 0;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
inst="$(grep -oe "${obj}" "${DB_DUMP}"|uniq)"
|
inst="$(grep -oE "${obj}" "${DB_DUMP}"|uniq)"
|
||||||
echo "$inst"
|
echo "$inst"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -942,7 +942,7 @@ check_n_delete_db()
|
||||||
r="${3}"
|
r="${3}"
|
||||||
sec="${sec/${t}_/cpe-}"
|
sec="${sec/${t}_/cpe-}"
|
||||||
|
|
||||||
path=$(grep "${r}\d.Alias \"${sec}\"" ${DB_DUMP})
|
path=$(grep -E "${r}\d+.Alias \"${sec}\"" ${DB_DUMP})
|
||||||
path=${path%.*}
|
path=${path%.*}
|
||||||
|
|
||||||
delete_sql_db_entry_with_pattern "${path}"
|
delete_sql_db_entry_with_pattern "${path}"
|
||||||
|
|
|
||||||
42
obuspa/patches/0011-max_controllers.patch
Normal file
42
obuspa/patches/0011-max_controllers.patch
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
diff --git a/src/core/mqtt.c b/src/core/mqtt.c
|
||||||
|
index 04a1a9c..8cb2ad7 100644
|
||||||
|
--- a/src/core/mqtt.c
|
||||||
|
+++ b/src/core/mqtt.c
|
||||||
|
@@ -234,6 +234,8 @@ void HandleMqttDisconnect(mqtt_client_t *client);
|
||||||
|
#define DEFINE_MQTT_TrustCertVerifyCallbackIndex(index) \
|
||||||
|
int MQTT_TrustCertVerifyCallback_##index (int preverify_ok, X509_STORE_CTX *x509_ctx) \
|
||||||
|
{\
|
||||||
|
+ if (index >= MAX_MQTT_CLIENTS) \
|
||||||
|
+ return 0; \
|
||||||
|
return DEVICE_SECURITY_TrustCertVerifyCallbackWithCertChain(preverify_ok, x509_ctx, &mqtt_clients[index].cert_chain);\
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -244,6 +246,11 @@ DEFINE_MQTT_TrustCertVerifyCallbackIndex(1);
|
||||||
|
DEFINE_MQTT_TrustCertVerifyCallbackIndex(2);
|
||||||
|
DEFINE_MQTT_TrustCertVerifyCallbackIndex(3);
|
||||||
|
DEFINE_MQTT_TrustCertVerifyCallbackIndex(4);
|
||||||
|
+DEFINE_MQTT_TrustCertVerifyCallbackIndex(5);
|
||||||
|
+DEFINE_MQTT_TrustCertVerifyCallbackIndex(6);
|
||||||
|
+DEFINE_MQTT_TrustCertVerifyCallbackIndex(7);
|
||||||
|
+DEFINE_MQTT_TrustCertVerifyCallbackIndex(8);
|
||||||
|
+DEFINE_MQTT_TrustCertVerifyCallbackIndex(9);
|
||||||
|
// Add more, with incrementing indexes here, if you change MAX_MQTT_CLIENTS
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------
|
||||||
|
@@ -254,10 +261,15 @@ ssl_verify_callback_t* mqtt_verify_callbacks[] = {
|
||||||
|
MQTT_TrustCertVerifyCallbackIndex(2),
|
||||||
|
MQTT_TrustCertVerifyCallbackIndex(3),
|
||||||
|
MQTT_TrustCertVerifyCallbackIndex(4),
|
||||||
|
+ MQTT_TrustCertVerifyCallbackIndex(5),
|
||||||
|
+ MQTT_TrustCertVerifyCallbackIndex(6),
|
||||||
|
+ MQTT_TrustCertVerifyCallbackIndex(7),
|
||||||
|
+ MQTT_TrustCertVerifyCallbackIndex(8),
|
||||||
|
+ MQTT_TrustCertVerifyCallbackIndex(9),
|
||||||
|
// Add more, with incrementing indexes here, if you change MAX_MQTT_CLIENTS
|
||||||
|
};
|
||||||
|
|
||||||
|
-USP_COMPILEASSERT( ((sizeof(mqtt_verify_callbacks)/sizeof(ssl_verify_callback_t*)) == MAX_MQTT_CLIENTS),
|
||||||
|
+USP_COMPILEASSERT( ((sizeof(mqtt_verify_callbacks)/sizeof(ssl_verify_callback_t*)) >= MAX_MQTT_CLIENTS),
|
||||||
|
"There must be MAX_MQTT_CLIENTS callbacks defined");
|
||||||
|
|
||||||
|
/*********************************************************************//**
|
||||||
Loading…
Add table
Reference in a new issue