obuspa: reduce ubus calls to uspd

- Reduce number of ubus calls to uspd on obuspa_get
 - Add uci option to enable/disable obuspa
This commit is contained in:
sverma 2020-01-24 17:15:54 +05:30
parent 871a3c3907
commit 1335405ccc
3 changed files with 9 additions and 3 deletions

View file

@ -5,10 +5,10 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=obuspa
PKG_VERSION:=2.0.0
PKG_VERSION:=2.0.1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=9c7921c8e39acfc31f563bd08220faba1012a834
PKG_SOURCE_VERSION:=ae498582d76a138fdd7b77d413a9a035d3987403
PKG_SOURCE_URL:=https://dev.iopsys.eu/fork/obuspa.git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz

View file

@ -3,6 +3,7 @@
# details, always defined in groups
config obuspa
option enable 'true'
option cert '/etc/obuspa/rootCA.pem'
option interface 'wan'
option debug 'false'

View file

@ -26,6 +26,7 @@ db_set() {
validate_obuspa_section()
{
uci_validate_section obuspa obuspa "${1}" \
'enable:bool:true' \
'cert:string:"/etc/obuspa/rootCA.pem"' \
'interface:string:wan' \
'debug:bool:false'
@ -163,13 +164,17 @@ configure_connection() {
}
configure_obuspa() {
local cert interface debug
local enable cert interface debug
validate_obuspa_section "${1}" || {
log "Validation of section failed"
return 1;
}
[ ${enable} -eq 0 ] && \
echo "obuspa not enabled" >>/dev/console && \
exit
if [ ${debug} -eq 1 ]; then
# Forward stdout of the command to logd
procd_set_param stdout 1