mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-01-28 01:47:19 +01:00
update sulu to version 5.2.0
This commit is contained in:
parent
a582d6d115
commit
28da651279
11 changed files with 13 additions and 1074 deletions
|
|
@ -5,11 +5,11 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-base
|
||||
PKG_VERSION:=5.1.8
|
||||
PKG_VERSION:=5.2.0
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu.git
|
||||
PKG_SOURCE_VERSION:=24cb862a27b4282668b434044a20fdc2c437316b
|
||||
PKG_SOURCE_VERSION:=13cad13a10f199bfd08bd47d6fa7b6a7a26deb33
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
SULU_MOD:=core
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-builder
|
||||
PKG_VERSION:=5.1.8
|
||||
PKG_VERSION:=5.2.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-builder.git
|
||||
PKG_SOURCE_VERSION:=89f778534565e4ee9cea80fe881e9739c83d4c57
|
||||
PKG_SOURCE_VERSION:=67546201059c780a43af47ee6f118f309a51e213
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/sulu-$(PKG_VERSION)/sulu-builder-$(PKG_SOURCE_VERSION)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,14 @@
|
|||
{
|
||||
"object": "Device.",
|
||||
"perm": ["PERMIT_ALL"]
|
||||
},
|
||||
{
|
||||
"object": "Device.Firewall.Enable",
|
||||
"perm": ["PERMIT_GET", "PERMIT_SUBS_VAL_CHANGE", "PERMIT_OBJ_INFO"]
|
||||
},
|
||||
{
|
||||
"object": "Device.Firewall.Chain.*.Rule.",
|
||||
"perm": ["PERMIT_NONE"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-theme-genexis
|
||||
PKG_VERSION:=5.1.8
|
||||
PKG_VERSION:=5.2.0
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/gnx/sulu-theme-genexis
|
||||
|
|
|
|||
|
|
@ -22,13 +22,8 @@ define Build/Compile
|
|||
endef
|
||||
|
||||
define Package/sulu-vendorext/install
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU.json $(1) sysmngr
|
||||
$(BBFDM_INSTALL_MS_PLUGIN) ./extn/X_GENEXIS_EU_wan.json $(1) sysmngr
|
||||
|
||||
$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) suluvendorext
|
||||
$(BBFDM_INSTALL_MS_DM) ./extn/X_IOWRT_EU_MAPController.json $(1) suluvendorext
|
||||
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,sulu-vendorext))
|
||||
|
|
|
|||
|
|
@ -1,140 +0,0 @@
|
|||
{
|
||||
"Device.DeviceInfo.X_GENEXIS_EU.": {
|
||||
"type": "object",
|
||||
"version": "1.00",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": false,
|
||||
"is_primary_node": {
|
||||
"type": "boolean",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "heimgard",
|
||||
"section": {
|
||||
"name": "routeragent"
|
||||
},
|
||||
"option": {
|
||||
"name": "is_master"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"meshmode": {
|
||||
"type": "string",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"rpc": "get",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "meshmode",
|
||||
"method": "status",
|
||||
"key": "mode"
|
||||
}
|
||||
},
|
||||
{
|
||||
"rpc": "set",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "meshmode",
|
||||
"method": "change_meshmode",
|
||||
"args": {
|
||||
"mode": "@Value"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"wizardHasBeenUsed": {
|
||||
"type": "boolean",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "heimgard",
|
||||
"section": {
|
||||
"name": "settings"
|
||||
},
|
||||
"option": {
|
||||
"name": "wizard_executed"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"LocalTimeZone": {
|
||||
"type": "string",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "system",
|
||||
"section": {
|
||||
"name": "@system[0]"
|
||||
},
|
||||
"option": {
|
||||
"name": "timezone"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"LocalTimeZoneName": {
|
||||
"type": "string",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "system",
|
||||
"section": {
|
||||
"name": "@system[0]"
|
||||
},
|
||||
"option": {
|
||||
"name": "zonename"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,487 +0,0 @@
|
|||
{
|
||||
"Device.DeviceInfo.X_GENEXIS_EU.Wan.": {
|
||||
"type": "object",
|
||||
"version": "1.00",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": false,
|
||||
"proto": {
|
||||
"type": "string",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"rpc": "get",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "get",
|
||||
"args": {
|
||||
"param": "proto"
|
||||
},
|
||||
"key": "proto"
|
||||
}
|
||||
},
|
||||
{
|
||||
"rpc": "set",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "set",
|
||||
"args": {
|
||||
"param": "proto",
|
||||
"value": "@Value"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"ipaddr": {
|
||||
"type": "string",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"rpc": "get",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "status",
|
||||
"args": {},
|
||||
"key": "ipaddr"
|
||||
}
|
||||
},
|
||||
{
|
||||
"rpc": "set",
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "network",
|
||||
"section": {
|
||||
"name": "wan"
|
||||
},
|
||||
"option": {
|
||||
"name": "ipaddr"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"netmask": {
|
||||
"type": "string",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"rpc": "get",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "status",
|
||||
"args": {},
|
||||
"key": "netmask"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "network",
|
||||
"section": {
|
||||
"name": "wan"
|
||||
},
|
||||
"option": {
|
||||
"name": "netmask"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"gateway": {
|
||||
"type": "string",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"rpc": "get",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "status",
|
||||
"args": {},
|
||||
"key": "gateway"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "network",
|
||||
"section": {
|
||||
"name": "wan"
|
||||
},
|
||||
"option": {
|
||||
"name": "gateway"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"peerdns": {
|
||||
"type": "boolean",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "network",
|
||||
"section": {
|
||||
"name": "wan"
|
||||
},
|
||||
"option": {
|
||||
"name": "peerdns"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"dns": {
|
||||
"type": "string",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "network",
|
||||
"section": {
|
||||
"name": "wan"
|
||||
},
|
||||
"option": {
|
||||
"name": "dns"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"hostname": {
|
||||
"type": "string",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "network",
|
||||
"section": {
|
||||
"name": "wan"
|
||||
},
|
||||
"option": {
|
||||
"name": "hostname"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"NAT": {
|
||||
"type": "string",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "firewall",
|
||||
"section": {
|
||||
"name": "wan"
|
||||
},
|
||||
"option": {
|
||||
"name": "masq"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"mtu": {
|
||||
"type": "unsignedInt",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "network",
|
||||
"section": {
|
||||
"name": "wan"
|
||||
},
|
||||
"option": {
|
||||
"name": "mtu"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"vid": {
|
||||
"type": "unsignedInt",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"rpc": "get",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "get",
|
||||
"args": {
|
||||
"param": "vid"
|
||||
},
|
||||
"key": "vid"
|
||||
}
|
||||
},
|
||||
{
|
||||
"rpc": "set",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "set",
|
||||
"args": {
|
||||
"param": "vid",
|
||||
"value": "@Value"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"rpc": "get",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "get",
|
||||
"args": {
|
||||
"param": "username"
|
||||
},
|
||||
"key": "username"
|
||||
}
|
||||
},
|
||||
{
|
||||
"rpc": "set",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "set",
|
||||
"args": {
|
||||
"param": "username",
|
||||
"value": "@Value"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"rpc": "get",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "get",
|
||||
"args": {
|
||||
"param": "password"
|
||||
},
|
||||
"key": "password"
|
||||
}
|
||||
},
|
||||
{
|
||||
"rpc": "set",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "set",
|
||||
"args": {
|
||||
"param": "password",
|
||||
"value": "@Value"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"service": {
|
||||
"type": "string",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"rpc": "get",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "get",
|
||||
"args": {
|
||||
"param": "service"
|
||||
},
|
||||
"key": "service"
|
||||
}
|
||||
},
|
||||
{
|
||||
"rpc": "set",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "set",
|
||||
"args": {
|
||||
"param": "service",
|
||||
"value": "@Value"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"ac": {
|
||||
"type": "string",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"rpc": "get",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "get",
|
||||
"args": {
|
||||
"param": "ac"
|
||||
}
|
||||
},
|
||||
"key": "ac"
|
||||
},
|
||||
{
|
||||
"rpc": "set",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "set",
|
||||
"args": {
|
||||
"param": "ac",
|
||||
"value": "@Value"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"keepalive": {
|
||||
"type": "string",
|
||||
"version": "1.00",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"rpc": "get",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "get",
|
||||
"args": {
|
||||
"param": "keepalive"
|
||||
},
|
||||
"key": "keepalive"
|
||||
}
|
||||
},
|
||||
{
|
||||
"rpc": "set",
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "genexis.wan",
|
||||
"method": "set",
|
||||
"args": {
|
||||
"param": "keepalive",
|
||||
"value": "@Value"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
config ota 'ota'
|
||||
# Allow firmware upgrades, defaults true
|
||||
option firmware 'true'
|
||||
# Allow download of arbituary files
|
||||
option file_download 'true'
|
||||
# Allow to download software packages
|
||||
option software 'false'
|
||||
# Allow to download personalization files (isp/customer settings)
|
||||
option customer_settings 'false'
|
||||
option mirror_url '$fwenv$upgrade_ota_url|https://upgradeserver$'
|
||||
option crontab_entry "$(date +%M) * * * *"
|
||||
list softwarelist 'ping_container'
|
||||
list softwarelist 'pingcom_ota'
|
||||
option interval 'nightly'
|
||||
option registry_service_enabled '$fwenv$registry_service_enabled|1$'
|
||||
option registry_service_url '$fwenv$registry_service_url|https://registry.hc-apis.com$'
|
||||
option verbose_level '6'
|
||||
|
||||
config routeragent 'routeragent'
|
||||
option is_master 'false'
|
||||
option onboarded 'false'
|
||||
|
||||
config containers 'containers'
|
||||
list 'cnt_list' 'f-secure'
|
||||
list 'cnt_list' 'lxc_hello_world'
|
||||
|
||||
config services 'state'
|
||||
option mwan3 'disable'
|
||||
|
||||
config links 'help_support'
|
||||
option support_link 'https://genexis.eu/solutions/support-services/'
|
||||
option faq_link ''
|
||||
option contact_link 'https://genexis.eu/contact'
|
||||
option contact_phone ''
|
||||
option livechat_link ''
|
||||
option contact_times 'Monday – Friday from 09:00 – 17:00'
|
||||
|
|
@ -1,198 +0,0 @@
|
|||
#!/bin/sh
|
||||
# shellcheck disable=SC1091,SC3043,SC3043
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/functions/network.sh
|
||||
|
||||
persistent_file="/tmp/sulu.json"
|
||||
|
||||
init_json() {
|
||||
json_init
|
||||
[ -f "${persistent_file}" ] && json_load_file "${persistent_file}"
|
||||
json_add_int "schema_version" "1"
|
||||
if ! json_select "network" >/dev/null; then
|
||||
json_add_object "network"
|
||||
fi
|
||||
|
||||
if ! json_select "wan" >/dev/null; then
|
||||
local current_dev=""
|
||||
local current_proto=""
|
||||
local current_vid=""
|
||||
local current_mtu=""
|
||||
local current_username=""
|
||||
local current_password=""
|
||||
local default_gw_interface=""
|
||||
# Load current settings
|
||||
network_find_wan default_gw_interface
|
||||
[ -z "${default_gw_interface}" ] && default_gw_interface="wan"
|
||||
current_dev="$(uci -q get network."${default_gw_interface}".device)"
|
||||
current_proto="$(uci -q get network."${default_gw_interface}".proto || echo "dhcp")"
|
||||
current_vid="$(uci -q get network."${current_dev}".vid)"
|
||||
current_mtu="$(uci -q get network."${default_gw_interface}".mtu)"
|
||||
if [ "pppoe" = "${current_proto}" ]; then
|
||||
current_username="$(uci -q get network."${default_gw_interface}".username)"
|
||||
current_password="$(uci -q get network."${default_gw_interface}".password)"
|
||||
fi
|
||||
json_add_array "wan"
|
||||
json_add_object
|
||||
json_add_string "name" "wan"
|
||||
json_add_string "proto" "${current_proto}"
|
||||
[ -n "${current_vid}" ] && json_add_int "vlan_id" "${current_vid}"
|
||||
[ -n "${current_mtu}" ] && json_add_int "mtu" "${current_mtu}"
|
||||
[ -n "${current_username}" ] && json_add_string "username" "${current_username}"
|
||||
[ -n "${current_password}" ] && json_add_string "password" "${current_password}"
|
||||
json_close_object
|
||||
fi
|
||||
json_close_object
|
||||
json_close_object
|
||||
if ! json_select "netmode" >/dev/null; then
|
||||
json_add_object "netmode"
|
||||
fi
|
||||
json_close_object
|
||||
}
|
||||
|
||||
save_and_exit() {
|
||||
json_dump >"${persistent_file}"
|
||||
exit 0
|
||||
}
|
||||
|
||||
save_userconf() {
|
||||
json_dump >"${persistent_file}"
|
||||
# reload opconf to apply changes from persistent file, discarding output
|
||||
opconf "${persistent_file}" > /dev/null 2>&1
|
||||
# Commit network changes
|
||||
ubus call uci commit '{"config": "network"}'
|
||||
}
|
||||
|
||||
# Create skeleton file if it doesn't exists after that load in $persistent_file
|
||||
init_json
|
||||
|
||||
go_L2() {
|
||||
logger -s -p user.info -t "netmode" "User has manually chosen L2; switching to Layer2 mode"
|
||||
local old_cb
|
||||
json_set_namespace set_wan_param old_cb
|
||||
init_json
|
||||
json_select "netmode"
|
||||
json_add_string "current" "layer2"
|
||||
json_select ..
|
||||
save_userconf
|
||||
json_set_namespace old_cb
|
||||
}
|
||||
|
||||
# Set netmode in uboot to correct mode, remove marker so network config is regenerated and reboot
|
||||
go_L3() {
|
||||
logger -p user.info -t "netmode" "User has manually chosen L3; switching to Layer3/Full mode"
|
||||
local old_cb
|
||||
json_set_namespace set_wan_param old_cb
|
||||
init_json
|
||||
json_select "network"
|
||||
json_select "wan"
|
||||
if ! json_is_a 1 object; then
|
||||
json_add_object
|
||||
else
|
||||
json_select 1
|
||||
fi
|
||||
json_add_string "name" "wan"
|
||||
json_add_string "proto" "dhcp"
|
||||
json_add_int "vlan_id" 0
|
||||
json_close_object
|
||||
json_select ..
|
||||
json_select ..
|
||||
json_select "netmode"
|
||||
json_add_string "current" "layer3"
|
||||
json_select ..
|
||||
save_userconf
|
||||
json_set_namespace old_cb
|
||||
}
|
||||
|
||||
go_pppoe() {
|
||||
local username="${1}"
|
||||
local password="${2}"
|
||||
local enable_vid="${3:-1}"
|
||||
local vid="${4:-0}"
|
||||
local mtu="${5:-1500}"
|
||||
local old_cb
|
||||
json_set_namespace set_wan_param old_cb
|
||||
init_json
|
||||
logger -p user.info -t "netmode" "User has manually chosen pppoe; switching to pppoe mode"
|
||||
logger -p user.info -t "netmode" "params - username:${username} password:${password} enable:${enable_vid} vid:${vid} mtu:${mtu}"
|
||||
json_select "network"
|
||||
json_select "wan"
|
||||
if ! json_is_a 1 object; then
|
||||
json_add_object
|
||||
else
|
||||
json_select 1
|
||||
fi
|
||||
json_add_string "name" "wan"
|
||||
json_add_string "proto" "pppoe"
|
||||
json_add_int "vlan_id" "${vid}"
|
||||
json_add_string "username" "${username}"
|
||||
json_add_string "password" "${password}"
|
||||
json_add_int "mtu" "${mtu}"
|
||||
json_close_object
|
||||
json_select ..
|
||||
json_select ..
|
||||
json_select "netmode"
|
||||
json_add_string "current" "pppoe"
|
||||
save_userconf
|
||||
json_set_namespace old_cb
|
||||
}
|
||||
|
||||
# shellcheck disable=SC3043
|
||||
set_wan_param() {
|
||||
local name="${1:?}"
|
||||
local value="${2:?}"
|
||||
# shellcheck disable=SC2034
|
||||
local old_cb
|
||||
json_set_namespace set_wan_param old_cb
|
||||
init_json
|
||||
json_select "network"
|
||||
json_select "wan"
|
||||
if ! json_is_a 1 object; then
|
||||
json_add_object
|
||||
else
|
||||
json_select 1
|
||||
fi
|
||||
json_add_string "name" "wan"
|
||||
case "${name}" in
|
||||
proto | username | password)
|
||||
json_add_string "${name}" "${value}"
|
||||
;;
|
||||
vid | vland_id)
|
||||
json_add_int "vlan_id" "${value}"
|
||||
;;
|
||||
mtu)
|
||||
json_add_int "mtu" "${value}"
|
||||
;;
|
||||
*)
|
||||
logger "sulu_functions: Unkown name '${name}' in set_wan_param"
|
||||
;;
|
||||
esac
|
||||
json_close_object
|
||||
json_select ..
|
||||
json_select ..
|
||||
logger -s "sulu_functions Name: '${name}'='${value}'"
|
||||
save_userconf
|
||||
json_set_namespace old_cb
|
||||
}
|
||||
# shellcheck disable=SC3043
|
||||
# Parses all jsons in /opconf, returns active variable_name
|
||||
get_wan_value() {
|
||||
local variable_name="${1:?}"
|
||||
local value_from_opconf=""
|
||||
local final_config=""
|
||||
local json_file=""
|
||||
|
||||
case "${variable_name}" in
|
||||
"vid")
|
||||
variable_name="vlan_id"
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
for json_file in /opconf/*.json ${persistent_file}; do
|
||||
value_from_opconf="$(jsonfilter -e "@.network.wan[@.name='wan'].${variable_name}" <"${json_file}")"
|
||||
[ -n "${value_from_opconf}" ] && final_config="${value_from_opconf}"
|
||||
done
|
||||
echo "${final_config}"
|
||||
}
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
#!/bin/sh
|
||||
# shellcheck disable=SC3043,SC1091,SC2140
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/functions/network.sh
|
||||
. /lib/sulu_functions.sh
|
||||
|
||||
cidr_to_netmask() {
|
||||
value=$((0xffffffff ^ ((1 << (32 - $1)) - 1)))
|
||||
echo "$(((value >> 24) & 0xff)).$(((value >> 16) & 0xff)).$(((value >> 8) & 0xff)).$((value & 0xff))"
|
||||
}
|
||||
|
||||
# setValue() - Set the value of the given WAN parameter.
|
||||
#
|
||||
# Args:
|
||||
# $1 - The parameter name.
|
||||
# $2 - The new value of the parameter.
|
||||
#
|
||||
# Notes:
|
||||
# If the parameter name is "vid", the value of the "vid" option is read from
|
||||
# the appropriate section (based on the value of the "device" option in the
|
||||
# "network.wan" section). Otherwise, the value of the parameter is read from
|
||||
# the "network.wan" section.
|
||||
#
|
||||
# If the parameter name is "vid", it is checked if the value is 0, 1 or empty.
|
||||
# If so, it does not create a new vlan interface. Otherwise, it creates a new
|
||||
# vlan interface with the given vid.
|
||||
setValue() {
|
||||
local paramName="${1}"
|
||||
local paramValue="${2}"
|
||||
local default_gw_interface=""
|
||||
network_find_wan default_gw_interface
|
||||
if [ -z "${default_gw_interface}" ]; then
|
||||
default_gw_interface=wan
|
||||
fi
|
||||
case "$paramName" in
|
||||
"vid")
|
||||
set_wan_param "vid" "$paramValue"
|
||||
;;
|
||||
"username")
|
||||
set_wan_param "username" "$paramValue"
|
||||
;;
|
||||
"password")
|
||||
set_wan_param "password" "$paramValue"
|
||||
;;
|
||||
"mtu")
|
||||
set_wan_param "mtu" "$paramValue"
|
||||
;;
|
||||
"proto")
|
||||
set_wan_param "proto" "${paramValue}"
|
||||
touch /tmp/netmode_changed
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
list)
|
||||
json_init
|
||||
json_add_object "status"
|
||||
json_close_object
|
||||
json_add_object "get"
|
||||
json_add_string "param" ""
|
||||
json_close_object
|
||||
json_add_object "set"
|
||||
json_add_string "param" ""
|
||||
json_close_object
|
||||
json_dump
|
||||
|
||||
;;
|
||||
call)
|
||||
case "$2" in
|
||||
status)
|
||||
network_find_wan default_gw_interface
|
||||
wan_json="$(ubus call network.interface."${default_gw_interface}" status)"
|
||||
ipaddr="$(echo "$wan_json" | jsonfilter -e '@["ipv4-address"][0].address')"
|
||||
netmask="$(echo "$wan_json" | jsonfilter -e '@["ipv4-address"][0].mask')"
|
||||
gateway="$(echo "$wan_json" | jsonfilter -e '@["route"][0].nexthop')"
|
||||
if [ -n "$netmask" ]; then
|
||||
netmask=$(cidr_to_netmask "$netmask")
|
||||
fi
|
||||
json_init
|
||||
json_add_string ipaddr "$ipaddr"
|
||||
json_add_string netmask "$netmask"
|
||||
json_add_string gateway "$gateway"
|
||||
json_dump
|
||||
;;
|
||||
get)
|
||||
read -r input
|
||||
_param=$(echo "$input" | jsonfilter -e '@.param')
|
||||
value="$(get_wan_value "$_param")"
|
||||
|
||||
json_init
|
||||
json_add_string "$_param" "${value}"
|
||||
json_dump
|
||||
;;
|
||||
|
||||
set)
|
||||
read -r input
|
||||
_param="$(echo "$input" | jsonfilter -e '@.param')"
|
||||
value="$(echo "$input" | jsonfilter -e '@.value')"
|
||||
logger -t "genexis.wan" "_param: ${_param} value: ${value}"
|
||||
json_init
|
||||
reply="$(set_wan_param "$_param" "$value")"
|
||||
json_add_string "status" "${reply}"
|
||||
json_dump
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
#!/bin/sh
|
||||
# shellcheck disable=SC3043,SC1091
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/sulu_functions.sh
|
||||
|
||||
init_json
|
||||
|
||||
get_netmode() {
|
||||
local _netmode
|
||||
if [ -f "${persistent_file}" ]; then
|
||||
json_init
|
||||
json_load_file "${persistent_file}"
|
||||
if json_select netmode; then
|
||||
json_get_var _netmode current "unknown"
|
||||
json_select ..
|
||||
fi
|
||||
else
|
||||
_netmode="unknown"
|
||||
fi
|
||||
|
||||
case "${_netmode}" in
|
||||
extender | layer2)
|
||||
echo "bridge"
|
||||
;;
|
||||
layer3)
|
||||
echo "router"
|
||||
;;
|
||||
pppoe)
|
||||
echo "pppoe"
|
||||
;;
|
||||
*)
|
||||
ifstatus wan >/dev/null 2>&1 && echo "router" || echo "unknown"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
netmode="$(get_netmode)"
|
||||
|
||||
case "$1" in
|
||||
list)
|
||||
echo '{ "status" : {}, "change_meshmode" : {"mode":"String"}}'
|
||||
;;
|
||||
call)
|
||||
mode=""
|
||||
case "$2" in
|
||||
status)
|
||||
if [ -z "${netmode}" ]; then
|
||||
echo "{\"status\":\"Mode unknown\"}"
|
||||
else
|
||||
echo "{\"mode\":\"${netmode}\"}"
|
||||
fi
|
||||
;;
|
||||
change_meshmode)
|
||||
# Read the JSON object provided for the arguments
|
||||
read -r input
|
||||
|
||||
json_load "${input}"
|
||||
|
||||
json_get_var mode mode
|
||||
|
||||
if [ "${mode}" = "${netmode}" ] && [ "${mode}" != "pppoe" ] && [ ! -f /tmp/netmode_changed ]; then
|
||||
echo '{"status":"no_change"}' && return
|
||||
fi
|
||||
|
||||
if [ "${mode}" = "bridge" ]; then
|
||||
echo '{"status": "ok"}'
|
||||
go_L2
|
||||
elif [ "${mode}" = "router" ]; then
|
||||
echo '{"status": "ok"}'
|
||||
go_L3
|
||||
elif [ "${mode}" = "pppoe" ]; then
|
||||
username="$(get_wan_value "username")"
|
||||
password="$(get_wan_value "password")"
|
||||
vid="$(get_wan_value "vlan_id")"
|
||||
mtu="$(get_wan_value "mtu")"
|
||||
|
||||
enable=0
|
||||
if [ "${vid}" -gt 0 ]; then
|
||||
enable=1
|
||||
fi
|
||||
|
||||
echo '{"status": "ok"}'
|
||||
logger "'${username}' '${password}' '${enable}' '${vid}' '${mtu}'"
|
||||
go_pppoe "${username}" "${password}" "${enable}" "${vid}" "${mtu}"
|
||||
else
|
||||
echo '{"status":"Wrong value"}'
|
||||
fi
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
;;
|
||||
*) ;;
|
||||
esac
|
||||
Loading…
Add table
Reference in a new issue