mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-25 03:24:14 +08:00
Compare commits
171 Commits
sulu_serve
...
CodecCap
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c5df8adbf | ||
|
|
8f9afae970 | ||
|
|
079abea853 | ||
|
|
83fb67c9a2 | ||
|
|
2391836769 | ||
|
|
d275e37d3b | ||
|
|
773dc75531 | ||
|
|
a9dbead1b3 | ||
|
|
dd4d6e3d94 | ||
|
|
105fbe6b1f | ||
|
|
242a030470 | ||
|
|
7babfc6995 | ||
|
|
b29e32fcb7 | ||
|
|
dcd2fb51c7 | ||
|
|
69d07fe12b | ||
|
|
e4acdd529b | ||
|
|
5c375c19fc | ||
|
|
d00a3d313e | ||
|
|
d8e1e75dd1 | ||
|
|
c1dae8f69f | ||
|
|
64f08670b5 | ||
|
|
4890420a25 | ||
|
|
5c94741584 | ||
|
|
9934ee03c6 | ||
|
|
63a2edb417 | ||
|
|
9a9bef4935 | ||
|
|
0078265697 | ||
|
|
3a7d8b1c51 | ||
|
|
30bfe70fb3 | ||
|
|
243642c35e | ||
|
|
63201030d2 | ||
|
|
ff96e85487 | ||
|
|
da24d924a3 | ||
|
|
7fce1eda88 | ||
|
|
c79ff0f80f | ||
|
|
3aa34e53bc | ||
|
|
fd632de0d9 | ||
|
|
2df2eb0b9e | ||
|
|
2cc92999a6 | ||
|
|
f0bf41c302 | ||
|
|
6972d6d283 | ||
|
|
88a2fa13f2 | ||
|
|
1756adc4b8 | ||
|
|
4187ed6f9d | ||
|
|
ed3c62e3c9 | ||
|
|
4bf4158244 | ||
|
|
4c95640376 | ||
|
|
7142dd0632 | ||
|
|
68f6cbc200 | ||
|
|
68d3ed8556 | ||
|
|
e901bc12ba | ||
|
|
dfc004dc6e | ||
|
|
c6d3812b92 | ||
|
|
574c79ae92 | ||
|
|
8b4f3f97f2 | ||
|
|
69ae0f7bf0 | ||
|
|
28c321f158 | ||
|
|
02d7c0f529 | ||
|
|
88c28dc57f | ||
|
|
b2e2441e7b | ||
|
|
d8f85e7acb | ||
|
|
c8cb95b3ed | ||
|
|
1b44b25ebd | ||
|
|
3f23c85333 | ||
|
|
6bfe20624c | ||
|
|
a03eb1aa6a | ||
|
|
d7e50ff2ab | ||
|
|
9d46a90f65 | ||
|
|
ea6d08a7e5 | ||
|
|
b8ddd40178 | ||
|
|
de59b0b4f2 | ||
|
|
fd8e528bf2 | ||
|
|
f564df8ccc | ||
|
|
c746d2570d | ||
|
|
6f1e638de8 | ||
|
|
f5087667f1 | ||
|
|
2b35f223c1 | ||
|
|
f3e9a95442 | ||
|
|
a7f395b78a | ||
|
|
7f23d16dbe | ||
|
|
4bad4e85c4 | ||
|
|
7db0583db1 | ||
|
|
1a6bdab29e | ||
|
|
991984e134 | ||
|
|
4099551ad2 | ||
|
|
5c654616cf | ||
|
|
1b864150db | ||
|
|
6cd2562140 | ||
|
|
083e36f321 | ||
|
|
d4f8c95dea | ||
|
|
35f978ed06 | ||
|
|
6595f891c1 | ||
|
|
bdd7b77952 | ||
|
|
29f63a5b48 | ||
|
|
c904d6097c | ||
|
|
1826aeed60 | ||
|
|
e120749b02 | ||
|
|
3c46f47c36 | ||
|
|
2fa416f872 | ||
|
|
df014b142a | ||
|
|
073e41c9e3 | ||
|
|
02d5148c4d | ||
|
|
ed96a273a0 | ||
|
|
a6d4d56922 | ||
|
|
c3645ffd3e | ||
|
|
f3379af93a | ||
|
|
b86771d08f | ||
|
|
d96d43b1a4 | ||
|
|
5e69f3d66d | ||
|
|
193e74d69b | ||
|
|
cc4cb1f904 | ||
|
|
d59a76796f | ||
|
|
dff67bb214 | ||
|
|
086c29f1c8 | ||
|
|
07e7f218d2 | ||
|
|
da3facef06 | ||
|
|
c6a16aa2a6 | ||
|
|
913ea35d98 | ||
|
|
2405cdd43b | ||
|
|
8ada6569f2 | ||
|
|
0edd8400e7 | ||
|
|
e654ea7788 | ||
|
|
6735d199a0 | ||
|
|
2f06fbd258 | ||
|
|
25220fb547 | ||
|
|
30bb56e9bf | ||
|
|
e62792d397 | ||
|
|
7f81a5167b | ||
|
|
1c3cb6b72a | ||
|
|
2b0aec400a | ||
|
|
4e8f85ffc6 | ||
|
|
dd1fc7ff7d | ||
|
|
97ef5bcc7b | ||
|
|
976244d57f | ||
|
|
a019ac2c4a | ||
|
|
5fff839b53 | ||
|
|
bc21aa4590 | ||
|
|
b4a23934ef | ||
|
|
aa1e866263 | ||
|
|
677007f613 | ||
|
|
a25b0672e0 | ||
|
|
d7403f5711 | ||
|
|
e6427ae2f8 | ||
|
|
245dbaacda | ||
|
|
0c313fef05 | ||
|
|
92032fd1ac | ||
|
|
b40c4279fa | ||
|
|
874151f4d3 | ||
|
|
97f2517211 | ||
|
|
81c30ab502 | ||
|
|
9c9f230054 | ||
|
|
f5f791b0b7 | ||
|
|
6563c53a63 | ||
|
|
473ea18680 | ||
|
|
0fcabc3ab5 | ||
|
|
183a363c00 | ||
|
|
a5d9464b7e | ||
|
|
f81a48aeaa | ||
|
|
15a68f1807 | ||
|
|
a59e08e629 | ||
|
|
45129bb230 | ||
|
|
89123cee31 | ||
|
|
04676cf26b | ||
|
|
76f525ed98 | ||
|
|
9a02ad5175 | ||
|
|
fec2851814 | ||
|
|
aac0616aac | ||
|
|
adfc80948c | ||
|
|
7107087ba2 | ||
|
|
cfc2d5bb57 | ||
|
|
79f65638b1 |
@@ -5,11 +5,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libbbfdm
|
||||
PKG_VERSION:=6.8.10
|
||||
PKG_VERSION:=6.8.33
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bbf.git
|
||||
PKG_SOURCE_VERSION:=7ca14a3fcd848ec9d21878fe80aa567f149cf25b
|
||||
PKG_SOURCE_VERSION:=9bdcb1ac188c44fc2274bf01dd9dce46f572b967
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bulkdata
|
||||
PKG_VERSION:=2.0.3
|
||||
PKG_VERSION:=2.0.5
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bulkdata.git
|
||||
PKG_SOURCE_VERSION:=85d7486a21a9eb0e0f345b587b3ac506edcb72fe
|
||||
PKG_SOURCE_VERSION:=33a6648de9ee0af33c44518656b56b0a30b6c1ab
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -34,7 +34,7 @@ define Package/$(PKG_NAME)
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=BBF BulkData Collection
|
||||
DEPENDS:=+libubus +libuci +libubox +libjson-c +libcurl +libblobmsg-json
|
||||
DEPENDS:=+libubus +libuci +libubox +libjson-c +libcurl +libblobmsg-json +zlib
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
|
||||
@@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dectmngr
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=3.5.4
|
||||
PKG_VERSION:=3.5.5
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=54ebb54162fae9fdd6e327e430cf57aa217c176d
|
||||
PKG_SOURCE_VERSION:=c5695bc92f7f22089c9a85d3e1f4dac7c12ca900
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
|
||||
BIN
dectmngr/files/etc/dspg/04130011.bin
Normal file
BIN
dectmngr/files/etc/dspg/04130011.bin
Normal file
Binary file not shown.
Binary file not shown.
@@ -19,7 +19,7 @@ define Package/easy-qos
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Easy QoS
|
||||
DEPENDS:=@TARGET_iopsys_brcm63xx_arm
|
||||
DEPENDS:=@(TARGET_iopsys_brcm63xx_arm||TARGET_iopsys_econet)
|
||||
endef
|
||||
|
||||
define Package/easy-qos/description
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=easy-soc-libs
|
||||
PKG_VERSION:=6.5.5
|
||||
PKG_VERSION:=6.6.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=ce37bf403ab6d15b84fe2078b77fa3a2aad4973a
|
||||
PKG_SOURCE_VERSION:=c8c406568822b170e373a54fbf32323e960259ff
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/easy-soc-libs.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
@@ -13,7 +13,7 @@ LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/endptmngr.git
|
||||
PKG_SOURCE_VERSION:=7d43e471f0ffc4a54eb2ac35eced4b72fca4dafb
|
||||
PKG_SOURCE_VERSION:=0901382048bb7ce01fc1767fef75e54692f56743
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=evoice
|
||||
PKG_VERSION:=0.2.14
|
||||
PKG_VERSION:=0.2.29
|
||||
|
||||
LOCAL_DEV=0
|
||||
LOCAL_DEV_EVOICE_DIR=~/voip/evoice
|
||||
@@ -13,7 +13,7 @@ LOCAL_DEV_EVOICE_DIR=~/voip/evoice
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/evoice.git
|
||||
PKG_SOURCE_VERSION:=cd21c95c150a841e441472b2623fbf8aabe74996
|
||||
PKG_SOURCE_VERSION:=ee4e9e00ec1c54b41e15a3de38f6a733634622dd
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -22,7 +22,6 @@ PKG_LICENSE:=PROPRIETARY IOPSYS
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_BUILD_DEPENDS:=bbf
|
||||
|
||||
# All config variable that are passed to the make invocation, directly or
|
||||
# indirectly. This ensures that the package is rebuilt on config-changes.
|
||||
#PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
|
||||
@@ -34,7 +33,7 @@ define Package/$(PKG_NAME)
|
||||
SUBMENU:=Telephony
|
||||
TITLE:=Ensemble Voice
|
||||
URL:=
|
||||
DEPENDS:= +libubox +libubus +libpicoevent +libuci +libstdcpp +libopenssl\
|
||||
DEPENDS:= +libubox +libubus +libpicoevent +libuci +libstdcpp +libopenssl +libjson-c\
|
||||
+TARGET_iopsys_brcm63xx_arm:bcmkernel\
|
||||
+TARGET_iopsys_econet:kmod-voip_driver\
|
||||
+TARGET_iopsys_econet:voip_app
|
||||
@@ -65,10 +64,12 @@ ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
-I$(IDIR)/bcm963xx/xchg/bos/publicInc\
|
||||
-I$(IDIR)/bcm963xx/bcmdrivers/broadcom/include/bcm963xx
|
||||
TRG=SVrgBcmFxs
|
||||
JSONFILE=codecs_brcm.json
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_econet),y)
|
||||
TARGET_PLATFORM=ECONET
|
||||
TONES_INI_REQUIRED=y
|
||||
TRG=SVrgMtekOwrt
|
||||
JSONFILE=codecs_airoha.json
|
||||
endif
|
||||
|
||||
# disable temporarily some not important warnings, force PIC
|
||||
@@ -95,6 +96,9 @@ define Package/evoice/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(if $(TONES_INI_REQUIRED),,$(RM) $(1)/etc/evoice/tones.ini)
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(1)/lib/voice/$(JSONFILE) $(1)/lib/voice/codecs_evoice.json
|
||||
$(RM) $(1)/lib/voice/codecs_brcm.json
|
||||
$(RM) $(1)/lib/voice/codecs_airoha.json
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/_bin/a_openwrt/evoice $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/_bin/a_openwrt/libvoiceservice.so $(1)/usr/lib/bbfdm/
|
||||
|
||||
@@ -39,51 +39,33 @@ config SIPNetwork 'Network1'
|
||||
list CodecList '1CodecProfile5'
|
||||
list CodecList '1CodecProfile4'
|
||||
|
||||
config Capabilities 'Capabilities'
|
||||
option FacilityActions 'CW_ACTIVE,CFU_ACTIVE'
|
||||
|
||||
config CapabilitiesCodec 'Codec1'
|
||||
option Codec 'G.711ALaw'
|
||||
|
||||
config CapabilitiesCodec 'Codec2'
|
||||
option Codec 'G.711MuLaw'
|
||||
|
||||
config CapabilitiesCodec 'Codec3'
|
||||
option Codec 'G.726'
|
||||
|
||||
config CapabilitiesCodec 'Codec4'
|
||||
option Codec 'G.722'
|
||||
|
||||
config CapabilitiesCodec 'Codec5'
|
||||
option Codec 'G.729'
|
||||
|
||||
config CodecProfile '1CodecProfile1'
|
||||
option Enable '1'
|
||||
option Codec 'Codec1'
|
||||
option Codec 'G.711ALaw'
|
||||
option PacketizationPeriod '20'
|
||||
option SilenceSupression '1'
|
||||
|
||||
config CodecProfile '1CodecProfile2'
|
||||
option Enable '1'
|
||||
option Codec 'Codec2'
|
||||
option Codec 'G.711MuLaw'
|
||||
option PacketizationPeriod '20'
|
||||
option SilenceSupression '1'
|
||||
|
||||
config CodecProfile '1CodecProfile3'
|
||||
option Enable '1'
|
||||
option Codec 'Codec3'
|
||||
option Codec 'G.726'
|
||||
option PacketizationPeriod '20'
|
||||
option SilenceSupression '0'
|
||||
|
||||
config CodecProfile '1CodecProfile4'
|
||||
option Enable '1'
|
||||
option Codec 'Codec4'
|
||||
option Codec 'G.722'
|
||||
option PacketizationPeriod '20'
|
||||
option SilenceSupression '0'
|
||||
|
||||
config CodecProfile '1CodecProfile5'
|
||||
option Enable '1'
|
||||
option Codec 'Codec5'
|
||||
option Codec 'G.729'
|
||||
option PacketizationPeriod '20'
|
||||
option SilenceSupression '0'
|
||||
|
||||
@@ -149,7 +131,7 @@ config IncomingMap 'IncomingMap2'
|
||||
option Line 'Line2'
|
||||
|
||||
config IncomingMap 'IncomingMap3'
|
||||
option Enable '1'
|
||||
option Enable '0'
|
||||
option Extension 'Extension2'
|
||||
option Line 'Line1'
|
||||
|
||||
|
||||
@@ -74,6 +74,13 @@ config codecs 'map_codec'
|
||||
option ptime 'voice.CodecProfile@.PacketizationPeriod'
|
||||
option dtx 'voice.CodecProfile@.SilenceSupression'
|
||||
|
||||
config fxsinfo 'map_fxs'
|
||||
option Enable 'voice.FXS@.Enable'
|
||||
option DialType 'voice.FXS@.DialType'
|
||||
option TransmitGain 'voice.FXS@.TransmitGain'
|
||||
option ReceiveGain 'voice.FXS@.ReceiveGain'
|
||||
option EchoCancellationEnable 'voice.FXS@.EchoCancellationEnable'
|
||||
|
||||
config extensioninfo 'map_ext'
|
||||
option Enable 'voice.Extension@.Enable'
|
||||
option Internal_Number_Phone 'voice.Extension@.ExtensionNumber'
|
||||
|
||||
@@ -10,6 +10,12 @@ VOICE_UCI_CONFIG=voice
|
||||
start_service() {
|
||||
[ "$(db -q get hw.board.hasVoice)" = "1" ] || return
|
||||
|
||||
|
||||
which endptmngr >/dev/null 2>&1 && {
|
||||
echo "evoice can't be started since endptmngr is installed. Please remove endptmngr and retry"
|
||||
return
|
||||
}
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command $NAME
|
||||
procd_set_param respawn "5" "0" "3"
|
||||
|
||||
28
evoice/files/lib/voice/codecs_airoha.json
Normal file
28
evoice/files/lib/voice/codecs_airoha.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"G.711ALaw": {
|
||||
"BitRate": 64000,
|
||||
"PacketizationPeriod": "20",
|
||||
"SilenceSuppression": 0
|
||||
},
|
||||
"G.711MuLaw": {
|
||||
"BitRate": 64000,
|
||||
"PacketizationPeriod": "20",
|
||||
"SilenceSuppression": 0
|
||||
},
|
||||
"G.726": {
|
||||
"BitRate": 32000,
|
||||
"PacketizationPeriod": "20",
|
||||
"SilenceSuppression": 0
|
||||
},
|
||||
"G.729": {
|
||||
"BitRate": 8000,
|
||||
"PacketizationPeriod": "20",
|
||||
"SilenceSuppression": 0
|
||||
},
|
||||
"G.722": {
|
||||
"BitRate": 64000,
|
||||
"PacketizationPeriod": "20",
|
||||
"SilenceSuppression": 0
|
||||
}
|
||||
}
|
||||
|
||||
28
evoice/files/lib/voice/codecs_brcm.json
Normal file
28
evoice/files/lib/voice/codecs_brcm.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"G.711ALaw": {
|
||||
"BitRate": 64000,
|
||||
"PacketizationPeriod": "30",
|
||||
"SilenceSuppression": 1
|
||||
},
|
||||
"G.711MuLaw": {
|
||||
"BitRate": 64000,
|
||||
"PacketizationPeriod": "30",
|
||||
"SilenceSuppression": 1
|
||||
},
|
||||
"G.726": {
|
||||
"BitRate": 32000,
|
||||
"PacketizationPeriod": "30",
|
||||
"SilenceSuppression": 1
|
||||
},
|
||||
"G.729": {
|
||||
"BitRate": 8000,
|
||||
"PacketizationPeriod": "30",
|
||||
"SilenceSuppression": 1
|
||||
},
|
||||
"G.722": {
|
||||
"BitRate": 64000,
|
||||
"PacketizationPeriod": "30",
|
||||
"SilenceSuppression": 1
|
||||
}
|
||||
}
|
||||
|
||||
BIN
evoice/files/usr/share/evoice/sounds/activated.g711a
Normal file
BIN
evoice/files/usr/share/evoice/sounds/activated.g711a
Normal file
Binary file not shown.
1
evoice/files/usr/share/evoice/sounds/activated.g722
Normal file
1
evoice/files/usr/share/evoice/sounds/activated.g722
Normal file
File diff suppressed because one or more lines are too long
BIN
evoice/files/usr/share/evoice/sounds/deactivated.g711a
Normal file
BIN
evoice/files/usr/share/evoice/sounds/deactivated.g711a
Normal file
Binary file not shown.
1
evoice/files/usr/share/evoice/sounds/deactivated.g722
Normal file
1
evoice/files/usr/share/evoice/sounds/deactivated.g722
Normal file
File diff suppressed because one or more lines are too long
@@ -12,7 +12,7 @@ PKG_VERSION:=1.0
|
||||
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/fdtextract.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=0ebaf1e7d1f09318ae75d0f475a25280742b790e
|
||||
PKG_SOURCE_VERSION:=e3cefda3b26c9aea3021b20725ce7b31b33eebc4
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
|
||||
@@ -44,7 +44,15 @@ MODULE_INCLUDE=-I$(PKG_BUILD_DIR)
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
LINUX_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx/kernel/linux-4.19
|
||||
MODULES_SUBDIR:=lib/modules/4.19.225
|
||||
# This assumes that the MODULES_SUBDIR set by OpenWrt is of the form
|
||||
# lib/modules/4.19.235-abcdef where 4.19.235 is the version of our fake bcmlinux kernel
|
||||
# and abcdef the git-commit.
|
||||
# The kernel compiled by the Broadcom SDK has a uname -r of 4.19.235, i.e. without the git-commit.
|
||||
# The assignment below removes the part after the - which puts modules in the right directory as
|
||||
# long as the bcmlinux version matches the kernel version in the BCM SDK.
|
||||
# So, this will only stop working in the time window where the BCM SDK has been updated
|
||||
# but bcmlinux has not yet been updated.
|
||||
MODULES_SUBDIR:=$(firstword $(subst -, ,$(MODULES_SUBDIR)))
|
||||
TARGET_CROSS:=$(CONFIG_BRCM_ALT_TOOLCHAIN_BASE)/$(CONFIG_BRCM_ALT_ARM_TOOLCHAIN_TOPDIR)/bin/$(CONFIG_BRCM_ALT_ARM_TOOLCHAIN_PREFIX)-
|
||||
|
||||
ifeq ($(CONFIG_BCM_CHIP_ID),$(filter $(CONFIG_BCM_CHIP_ID),"63158" "6856" "6858"))
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
#
|
||||
# Copyright (C) 2020-2022 IOPSYS Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# This is free software, licensed under the BSD-3-Clause
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=8.5.4
|
||||
PKG_VERSION:=9.0.3
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/icwmp.git
|
||||
PKG_SOURCE_VERSION:=58a32f910bc4043454880177621f8eddfc1f93f7
|
||||
PKG_SOURCE_VERSION:=304db5eb064d89cf4e4df0bb81fa22b88933d602
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
@@ -17,6 +17,7 @@ config acs 'acs'
|
||||
config cpe 'cpe'
|
||||
option enable '1'
|
||||
option default_wan_interface 'wan'
|
||||
option default_lan_interface 'lan'
|
||||
option log_to_console 'disable'
|
||||
option log_to_file 'disable'
|
||||
# log_severity: INFO (Default)
|
||||
@@ -31,7 +32,7 @@ config cpe 'cpe'
|
||||
option amd_version '5'
|
||||
# compression possible configs: InstanceNumber, InstanceAlias
|
||||
option instance_mode 'InstanceNumber'
|
||||
option session_timeout '60'
|
||||
option session_timeout '300'
|
||||
option notification '1'
|
||||
option exec_download '0'
|
||||
option periodic_notify_enable '1'
|
||||
|
||||
@@ -71,6 +71,206 @@ enable_dhcp_option43() {
|
||||
fi
|
||||
}
|
||||
|
||||
convert_to_hex() {
|
||||
local val=""
|
||||
local optval="${1}"
|
||||
OPTIND=1
|
||||
while getopts ":" opt "-$optval"
|
||||
do
|
||||
temp=$(printf "%X" "'${OPTARG:-:}")
|
||||
val="${val}:${temp}"
|
||||
done
|
||||
|
||||
echo "${val}"
|
||||
}
|
||||
|
||||
configure_send_op125() {
|
||||
local sendopt="${1}"
|
||||
local intf="${2}"
|
||||
local uci="${3}"
|
||||
local hex_oui=""
|
||||
local hex_serial=""
|
||||
local hex_class=""
|
||||
local oui_len=0
|
||||
local serial_len=0
|
||||
local class_len=0
|
||||
|
||||
if [ "${uci}" = "network" ]; then
|
||||
local opt125="125:00:00:0D:E9"
|
||||
else
|
||||
local opt125="125,00:00:0D:E9"
|
||||
fi
|
||||
|
||||
config_get oui cpe manufacturer_oui ""
|
||||
if [ -z "${oui}" ]; then
|
||||
oui=$(db -q get device.deviceinfo.ManufacturerOUI)
|
||||
fi
|
||||
|
||||
oui=$(echo "${oui}" | tr 'a-f' 'A-F')
|
||||
|
||||
config_get serial cpe serial_number ""
|
||||
if [ -z "${serial}" ]; then
|
||||
serial=$(db -q get device.deviceinfo.SerialNumber)
|
||||
fi
|
||||
|
||||
config_get class cpe product_class ""
|
||||
if [ -z "${class}" ]; then
|
||||
class=$(db -q get device.deviceinfo.ProductClass)
|
||||
fi
|
||||
|
||||
oui_len=$(echo -n "${oui}" | wc -m)
|
||||
serial_len=$(echo -n "${serial}" | wc -m)
|
||||
class_len=$(echo -n "${class}" | wc -m)
|
||||
|
||||
if [ ${oui_len} -eq 0 ] || [ ${serial_len} -eq 0 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
opt125_len=$((oui_len + serial_len + class_len))
|
||||
if [ ${class_len} -gt 0 ]; then
|
||||
opt125_len=$((opt125_len + 6))
|
||||
else
|
||||
opt125_len=$((opt125_len + 4))
|
||||
fi
|
||||
|
||||
hex_opt125_len=$(printf "%X" "${opt125_len}")
|
||||
opt125="${opt125}:${hex_opt125_len}"
|
||||
hex_oui=$(convert_to_hex "${oui}")
|
||||
if [ -z "${hex_oui}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
hex_oui_len=$(printf "%X" "${oui_len}")
|
||||
if [ "${uci}" = "network" ]; then
|
||||
opt125="${opt125}:01:${hex_oui_len}${hex_oui}"
|
||||
else
|
||||
opt125="${opt125}:04:${hex_oui_len}${hex_oui}"
|
||||
fi
|
||||
|
||||
hex_serial=$(convert_to_hex "${serial}")
|
||||
if [ -z "${hex_serial}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
hex_serial_len=$(printf "%X" "${serial_len}")
|
||||
if [ "${uci}" = "network" ]; then
|
||||
opt125="${opt125}:02:${hex_serial_len}${hex_serial}"
|
||||
else
|
||||
opt125="${opt125}:05:${hex_serial_len}${hex_serial}"
|
||||
fi
|
||||
|
||||
if [ ${class_len} -gt 0 ]; then
|
||||
hex_class=$(convert_to_hex "${class}")
|
||||
if [ -z "${hex_class}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
hex_class_len=$(printf "%X" "${class_len}")
|
||||
if [ "${uci}" = "network" ]; then
|
||||
opt125="${opt125}:03:${hex_class_len}${hex_class}"
|
||||
else
|
||||
opt125="${opt125}:06:${hex_class_len}${hex_class}"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ "${uci}" = "network" ]; then
|
||||
new_send_opt="$sendopt $opt125"
|
||||
uci -q set network.$intf.sendopts="$new_send_opt"
|
||||
else
|
||||
uci -q add_list dhcp.$intf.dhcp_option="$opt125"
|
||||
fi
|
||||
}
|
||||
|
||||
enable_dnsmasq_option125() {
|
||||
local lan="${1}"
|
||||
local send125_present=0
|
||||
local opt125="125,"
|
||||
|
||||
local proto="$(uci -q get dhcp.$lan.dhcpv4)"
|
||||
if [ "${proto}" = "server" ]; then
|
||||
opt_list="$(uci -q get dhcp.$lan.dhcp_option)"
|
||||
|
||||
for sopt in $opt_list; do
|
||||
if [[ "$sopt" == "$opt125"* ]]; then
|
||||
send125_present=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${send125_present} -eq 0 ]; then
|
||||
configure_send_op125 "" "${lan}" "dhcp"
|
||||
ubus call uci commit '{"config":"dhcp"}'
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
enable_disable_dhcp_option125() {
|
||||
local wan="${1}"
|
||||
local action="${2}"
|
||||
|
||||
local reqopts="$(uci -q get network.$wan.reqopts)"
|
||||
local sendopts="$(uci -q get network.$wan.sendopts)"
|
||||
local proto="$(uci -q get network.$wan.proto)"
|
||||
local newreqopts=""
|
||||
local newsendopts=""
|
||||
local req125_present=0
|
||||
local send125_present=0
|
||||
local network_uci_update=0
|
||||
local opt125="125:"
|
||||
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
125) req125_present=1 ;;
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
for sopt in $sendopts; do
|
||||
if [[ "$sopt" == "$opt125"* ]]; then
|
||||
send125_present=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "${proto}" == "dhcp" ]; then
|
||||
if [ "${action}" == "enable" ]; then
|
||||
if [ ${req125_present} -eq 0 ]; then
|
||||
newreqopts="$reqopts 125"
|
||||
uci -q set network.$wan.reqopts="$newreqopts"
|
||||
network_uci_update=1
|
||||
fi
|
||||
|
||||
if [ ${send125_present} -eq 0 ]; then
|
||||
configure_send_op125 "${sendopts}" "${wan}" "network"
|
||||
network_uci_update=1
|
||||
fi
|
||||
else
|
||||
if [ ${req125_present} -eq 1 ]; then
|
||||
newreqopts=$(echo ${reqopts/125/})
|
||||
uci -q set network.$wan.reqopts="$newreqopts"
|
||||
network_uci_update=1
|
||||
fi
|
||||
|
||||
if [ ${send125_present} -eq 1 ]; then
|
||||
for sopt in $sendopts; do
|
||||
if [[ "$sopt" == "$opt125"* ]]; then
|
||||
newsendopts=$(echo ${sendopts/"${sopt}"/})
|
||||
uci -q set network.$wan.sendopts="$newreqopts"
|
||||
network_uci_update=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ${network_uci_update} -eq 1 ]; then
|
||||
uci commit network
|
||||
ubus call network reload
|
||||
fi
|
||||
}
|
||||
|
||||
wait_for_resolvfile() {
|
||||
local time=$1
|
||||
local tm=1
|
||||
@@ -197,11 +397,21 @@ boot() {
|
||||
config_load cwmp
|
||||
config_get dhcp_discovery acs dhcp_discovery "0"
|
||||
|
||||
config_get wan_interface cpe default_wan_interface "wan"
|
||||
if [ "${dhcp_discovery}" == "enable" ] || [ "${dhcp_discovery}" == "1" ]; then
|
||||
# Set dhcp option 43 if not already configured
|
||||
config_get wan_interface cpe default_wan_interface "wan"
|
||||
enable_dhcp_option43 "${wan_interface}"
|
||||
fi
|
||||
|
||||
config_get lan_interface cpe default_lan_interface ""
|
||||
if [ -n "${lan_interface}" ]; then
|
||||
# Set dhcp_option 125 if not already configured
|
||||
enable_disable_dhcp_option125 "${wan_interface}" "enable"
|
||||
enable_dnsmasq_option125 "${lan_interface}"
|
||||
else
|
||||
# Remove dhcp option 125 if exists
|
||||
enable_disable_dhcp_option125 "${wan_interface}" "disable"
|
||||
fi
|
||||
|
||||
config_get ssl_capath acs ssl_capath
|
||||
|
||||
@@ -259,6 +469,7 @@ reload_service() {
|
||||
ret="0"
|
||||
if [ "$enable_cwmp" = "0" ]; then
|
||||
stop
|
||||
start
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ieee1905
|
||||
PKG_VERSION:=4.10.5
|
||||
PKG_VERSION:=4.10.7
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=287aeb7120b9904d4c481ceb6ba2fa6c73d4f8a2
|
||||
PKG_SOURCE_VERSION:=b50f79061a95840d89a6129aa0a95aff82b5a1b7
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/ieee1905.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -2,7 +2,7 @@ config ieee1905 'ieee1905'
|
||||
option enabled '1'
|
||||
option extension '1'
|
||||
list extmodule 'map'
|
||||
option registrar '2 5'
|
||||
option registrar '2 5 6'
|
||||
# option macaddress '0a:1b:2c:3d:4e:50'
|
||||
|
||||
config al-iface
|
||||
@@ -24,3 +24,9 @@ config ap
|
||||
option encryption 'sae-mixed'
|
||||
option key '1234567890'
|
||||
|
||||
config ap
|
||||
option band '6'
|
||||
option ssid 'IOWRT-6GHz'
|
||||
option encryption 'sae-mixed'
|
||||
option key '1234567890'
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ validate_ap_section() {
|
||||
local section="$1"
|
||||
|
||||
uci_validate_section ieee1905 $section "${1}" \
|
||||
'band:or("2", "5", "60")' \
|
||||
'band:or("2", "5", "60", "6")' \
|
||||
'ssid:string' \
|
||||
'encryption:or("psk2", "sae-mixed", "sae", string)' \
|
||||
'key:string' \
|
||||
|
||||
@@ -50,8 +50,8 @@ CONFIG_PACKAGE_wifimngr=y
|
||||
|
||||
# Multi-AP #
|
||||
CONFIG_PACKAGE_ieee1905=y
|
||||
CONFIG_PACKAGE_map-agent=y
|
||||
CONFIG_PACKAGE_map-controller=y
|
||||
CONFIG_PACKAGE_map-agent=m
|
||||
CONFIG_PACKAGE_map-controller=m
|
||||
CONFIG_PACKAGE_map-topology=y
|
||||
CONFIG_PACKAGE_wfadatad-collector=y
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ function genconfig {
|
||||
econet="target/linux/feeds/iopsys-econet"
|
||||
x86="target/linux/feeds/iopsys-x86"
|
||||
armvirt="target/linux/feeds/iopsys-armvirt"
|
||||
mediatek="target/linux/feeds/iopsys-mediatek"
|
||||
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
@@ -117,9 +118,11 @@ function genconfig {
|
||||
iopsys_x86=$(cd $x86; ./genconfig)
|
||||
[ -e $armvirt/genconfig ] &&
|
||||
iopsys_armvirt=$(cd $armvirt; ./genconfig)
|
||||
[ -e $mediatek/genconfig ] &&
|
||||
iopsys_mediatek=$(cd $mediatek; ./genconfig)
|
||||
|
||||
if [ "$profile" == "LIST" ]; then
|
||||
for list in iopsys_brcm63xx_arm iopsys_ramips iopsys_econet iopsys_x86 iopsys_armvirt; do
|
||||
for list in iopsys_brcm63xx_arm iopsys_ramips iopsys_econet iopsys_x86 iopsys_armvirt iopsys_mediatek; do
|
||||
echo "$list based boards:"
|
||||
for b in ${!list}; do
|
||||
echo -e "\t$b"
|
||||
@@ -167,6 +170,14 @@ function genconfig {
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_mediatek; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_mediatek"
|
||||
target_config_path="$mediatek/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
git remote -v | grep -qE '(git@|ssh://)' && {
|
||||
@@ -319,20 +330,25 @@ function genconfig {
|
||||
fi
|
||||
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
if [ "$target" = "iopsys_ramips" ]; then
|
||||
subtarget="mt7621"
|
||||
case "$target" in
|
||||
iopsys_ramips | iopsys_econet | iopsys_mediatek | iopsys_brcm63xx_arm)
|
||||
# This assumes the device name to be unique within one target,
|
||||
# which is a fair assumption to make.
|
||||
local mk_file="$(grep -Fx --files-with-matches "define Device/${BOARDTYPE}" "$target_config_path/../image/"*.mk)"
|
||||
if [ -z "$mk_file" ]; then
|
||||
echo "Error determining subtarget for $target / ${BOARDTYPE}"
|
||||
return 1
|
||||
fi
|
||||
local subtarget="$(basename "${mk_file%.mk}")"
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
|
||||
echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${BOARDTYPE}=y" >> .config
|
||||
elif [ "$target" = "iopsys_econet" ]; then
|
||||
subtarget="en7562"
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
|
||||
echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${BOARDTYPE}=y" >> .config
|
||||
else
|
||||
;;
|
||||
*)
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${BOARDTYPE}=y" >> .config
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "$CUSTOMERS $BOARDTYPE" > $CURRENT_CONFIG_FILE
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ function genconfig_min {
|
||||
econet="target/linux/feeds/iopsys-econet"
|
||||
x86="target/linux/feeds/iopsys-x86"
|
||||
armvirt="target/linux/feeds/iopsys-armvirt"
|
||||
mediatek="target/linux/feeds/iopsys-mediatek"
|
||||
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
@@ -116,9 +117,11 @@ function genconfig_min {
|
||||
iopsys_x86=$(cd $x86; ./genconfig)
|
||||
[ -e $armvirt/genconfig ] &&
|
||||
iopsys_armvirt=$(cd $armvirt; ./genconfig)
|
||||
[ -e $mediatek/genconfig ] &&
|
||||
iopsys_mediatek=$(cd $mediatek; ./genconfig)
|
||||
|
||||
if [ "$profile" == "LIST" ]; then
|
||||
for list in iopsys_brcm63xx_arm iopsys_ramips iopsys_econet iopsys_x86 iopsys_armvirt; do
|
||||
for list in iopsys_brcm63xx_arm iopsys_ramips iopsys_econet iopsys_x86 iopsys_armvirt iopsys_mediatek; do
|
||||
echo "$list based boards:"
|
||||
for b in ${!list}; do
|
||||
echo -e "\t$b"
|
||||
@@ -166,6 +169,14 @@ function genconfig_min {
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_mediatek; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_mediatek"
|
||||
target_config_path="$mediatek/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
git remote -v | grep -qE '(git@|ssh://)' && {
|
||||
@@ -310,20 +321,25 @@ function genconfig_min {
|
||||
fi
|
||||
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
if [ "$target" = "iopsys_ramips" ]; then
|
||||
subtarget="mt7621"
|
||||
case "$target" in
|
||||
iopsys_ramips | iopsys_econet | iopsys_mediatek | iopsys_brcm63xx_arm)
|
||||
# This assumes the device name to be unique within one target,
|
||||
# which is a fair assumption to make.
|
||||
local mk_file="$(grep -Fx --files-with-matches "define Device/${BOARDTYPE}" "$target_config_path/../image/"*.mk)"
|
||||
if [ -z "$mk_file" ]; then
|
||||
echo "Error determining subtarget for $target / ${BOARDTYPE}"
|
||||
return 1
|
||||
fi
|
||||
local subtarget="$(basename "${mk_file%.mk}")"
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
|
||||
echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${BOARDTYPE}=y" >> .config
|
||||
elif [ "$target" = "iopsys_econet" ]; then
|
||||
subtarget="en7562"
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
|
||||
echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${BOARDTYPE}=y" >> .config
|
||||
else
|
||||
;;
|
||||
*)
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${BOARDTYPE}=y" >> .config
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "$CUSTOMERS $BOARDTYPE" > $CURRENT_CONFIG_FILE
|
||||
|
||||
|
||||
@@ -1,344 +1,282 @@
|
||||
# this is a developer helper script to install firmware on a remote host with SSH
|
||||
|
||||
function upd_usage {
|
||||
echo "usage: $0 iopupgrade -t <host> -f <file> [opts] "
|
||||
echo ""
|
||||
echo " Default host is 192.168.1.1"
|
||||
echo " Default firmware file is the newest one found"
|
||||
echo " Default is to not keep configuration"
|
||||
echo "opts:"
|
||||
echo ""
|
||||
echo " -i Interactive use, Allows to select firmware file"
|
||||
echo " -n Do not do the final reboot of the target board"
|
||||
echo " -c Keep configuration"
|
||||
echo " -x Force install even if firmware is not for this board"
|
||||
echo " -b Force install of bootloader regardless of version installed"
|
||||
echo " -s Use sysupgade. old upgrade method, needed for old releases that do not have iopu"
|
||||
echo "usage: $0 ssh_upgrade [-t <host>] [-f <file>] [opts] "
|
||||
echo ""
|
||||
echo " Default host is 192.168.1.1"
|
||||
echo " Default firmware file is the latest one (last.{itb,pkgtb})"
|
||||
echo " Default is to not keep configuration"
|
||||
echo "opts:"
|
||||
echo ""
|
||||
echo " -i Interactive use, allows to select firmware file"
|
||||
echo " -n Do not do the final reboot of the target board"
|
||||
echo " -c Keep configuration"
|
||||
echo " -x Force install even if firmware is not for this board"
|
||||
echo " -b Force install of bootloader regardless of version installed"
|
||||
}
|
||||
|
||||
function set_config_string {
|
||||
eval `grep $1 .config`
|
||||
eval $(grep $1 .config)
|
||||
}
|
||||
|
||||
function upd_ask_ok {
|
||||
echo "Will Continue with the following settings"
|
||||
echo "-----------------------------------------"
|
||||
printf "%20s: %s\n" "Firmare file" "$upd_fw_base"
|
||||
printf "%20s: %s\n" "Host ip" "$upd_host"
|
||||
printf "%20s: " "Reboot"; if [ "$upd_noreboot" == "0" ] ;then printf "Yes\n" ;else printf "No\n";fi
|
||||
printf "%20s: " "Keep config"; if [ "$upd_keepconf" == "1" ] ;then printf "Yes\n" ;else printf "No\n";fi
|
||||
printf "%20s: " "Force bootloader"; if [ "$upd_forceboot" == "1" ] ;then printf "Yes\n" ;else printf "No\n";fi
|
||||
printf "%20s: " "Force image upgrade"; if [ "$upd_forceimage" == "1" ] ;then printf "Yes\n" ;else printf "No\n";fi
|
||||
printf "%20s: " "Use sysupgrade"; if [ "$upd_sysupgrade" == "1" ] ;then printf "Yes\n" ;else printf "No\n";fi
|
||||
echo "-----------------------------------------"
|
||||
echo "Will continue with the following settings:"
|
||||
echo "-----------------------------------------"
|
||||
printf "%20s: %s\n" "Firmware file" "$upd_fw_base"
|
||||
printf "%20s: %s\n" "Host IP" "$upd_host"
|
||||
printf "%20s: " "Reboot"
|
||||
if [ "$upd_noreboot" == "0" ]; then printf "Yes\n"; else printf "No\n"; fi
|
||||
printf "%20s: " "Keep config"
|
||||
if [ "$upd_keepconf" == "1" ]; then printf "Yes\n"; else printf "No\n"; fi
|
||||
printf "%20s: " "Force bootloader"
|
||||
if [ "$upd_forceboot" == "1" ]; then printf "Yes\n"; else printf "No\n"; fi
|
||||
printf "%20s: " "Force image upgrade"
|
||||
if [ "$upd_forceimage" == "1" ]; then printf "Yes\n"; else printf "No\n"; fi
|
||||
echo "-----------------------------------------"
|
||||
|
||||
if [ "$upd_sysupgrade" == "0" ]
|
||||
then
|
||||
if [ "$upd_keepconf" == "1" ] ;then echo "keeping config is just a fantasy it's not yet implemented, try sysupgrade";fi
|
||||
fi
|
||||
echo -n "Continue? [Y/n/q]:"
|
||||
read answer
|
||||
|
||||
echo -n "Continue? [Y/n/q]:"
|
||||
read answer
|
||||
|
||||
case $answer in
|
||||
n|N)
|
||||
return 1;;
|
||||
q|Q)
|
||||
exit 1;;
|
||||
y|Y|*)
|
||||
return 0;;
|
||||
esac
|
||||
case $answer in
|
||||
n | N)
|
||||
return 1
|
||||
;;
|
||||
q | Q)
|
||||
exit 1
|
||||
;;
|
||||
y | Y | *)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select_file {
|
||||
dialog --keep-tite --title "To select a file, use TAB/ARROW to highlight then press SPACEBAR -> RETURN" \
|
||||
--fselect "${upd_fw:-bin/targets/$CONFIG_TARGET_BOARD/$CONFIG_TARGET_SUBTARGET/}" \
|
||||
$((lines - 10)) $((cols - 5)) \
|
||||
2>$tempfile
|
||||
|
||||
dialog --keep-tite --title "To select file use TAB/ARROW to hilight then press SPACEBAR -> RETURN" \
|
||||
--fselect "bin/targets/$CONFIG_TARGET_BOARD/generic/" \
|
||||
$((lines -10)) $((cols -5)) \
|
||||
2> $tempfile
|
||||
|
||||
new_file=$(cat $tempfile)
|
||||
if [ -n "$new_file" ]
|
||||
then
|
||||
upd_fw="$new_file"
|
||||
upd_fw_base=$(basename $upd_fw);
|
||||
fi
|
||||
new_file=$(cat $tempfile)
|
||||
if [ -n "$new_file" ]; then
|
||||
upd_fw="$new_file"
|
||||
upd_fw_base=$(basename $upd_fw)
|
||||
fi
|
||||
}
|
||||
|
||||
function upd_select_target {
|
||||
dialog --keep-tite --title "Input the hostname/IP of the target board" \
|
||||
--inputbox "Name/IP" \
|
||||
$((lines - 10)) $((cols - 5)) \
|
||||
"$upd_host" \
|
||||
2>$tempfile
|
||||
|
||||
dialog --keep-tite --title "Input the name/ip number of target board" \
|
||||
--inputbox "Name/IP" \
|
||||
$((lines -10)) $((cols -5)) \
|
||||
"$upd_host" \
|
||||
2> $tempfile
|
||||
|
||||
new_file=$(cat $tempfile)
|
||||
if [ -n "$new_file" ]
|
||||
then
|
||||
upd_host="$new_file"
|
||||
fi
|
||||
new_file=$(cat $tempfile)
|
||||
if [ -n "$new_file" ]; then
|
||||
upd_host="$new_file"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function upd_select_reboot {
|
||||
dialog --keep-tite --radiolist "Should the board reboot after download finished" \
|
||||
$((lines -5)) $((cols -5)) $((lines -5 -5)) \
|
||||
"Reboot" "Restart board after done" `if [ "$upd_noreboot" == "0" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
"No reboot" "Continue running old system" `if [ "$upd_noreboot" == "1" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
2> $tempfile
|
||||
dialog --keep-tite --radiolist "Should the board reboot after download finished" \
|
||||
$((lines - 5)) $((cols - 5)) $((lines - 5 - 5)) \
|
||||
"Reboot" "Restart board after done" $(if [ "$upd_noreboot" == "0" ]; then echo "ON"; else echo "OFF"; fi) \
|
||||
"No reboot" "Continue running old system" $(if [ "$upd_noreboot" == "1" ]; then echo "ON"; else echo "OFF"; fi) \
|
||||
2>$tempfile
|
||||
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
"No reboot")
|
||||
upd_noreboot=1
|
||||
;;
|
||||
upd_noreboot=1
|
||||
;;
|
||||
"Reboot")
|
||||
upd_noreboot=0
|
||||
;;
|
||||
esac
|
||||
upd_noreboot=0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select_config {
|
||||
dialog --keep-tite --radiolist "Should the configuration be keept" \
|
||||
$((lines -5)) $((cols -5)) $((lines -5 -5)) \
|
||||
"Keep" "Keep the config from old system" `if [ "$upd_keepconf" == "1" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
"Default" "Use default config for new system" `if [ "$upd_keepconf" == "0" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
2> $tempfile
|
||||
dialog --keep-tite --radiolist "Should the configuration be kept" \
|
||||
$((lines - 5)) $((cols - 5)) $((lines - 5 - 5)) \
|
||||
"Keep" "Keep the config from old system" $(if [ "$upd_keepconf" == "1" ]; then echo "ON"; else echo "OFF"; fi) \
|
||||
"Default" "Use default config for new system" $(if [ "$upd_keepconf" == "0" ]; then echo "ON"; else echo "OFF"; fi) \
|
||||
2>$tempfile
|
||||
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
"Keep")
|
||||
upd_keepconf=1
|
||||
;;
|
||||
upd_keepconf=1
|
||||
;;
|
||||
"Default")
|
||||
upd_keepconf=0
|
||||
;;
|
||||
esac
|
||||
upd_keepconf=0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select_forceboot {
|
||||
dialog --keep-tite --radiolist "Should the boot loader be updated reagardless of version installed" \
|
||||
$((lines -5)) $((cols -5)) $((lines -5 -5)) \
|
||||
"Force" "Alwasy update boot loader" `if [ "$upd_forceboot" == "1" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
"Version check" "Only upgrade if version is newer" `if [ "$upd_forceboot" == "0" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
2> $tempfile
|
||||
dialog --keep-tite --radiolist "Should the boot loader be updated regardless of the version installed" \
|
||||
$((lines - 5)) $((cols - 5)) $((lines - 5 - 5)) \
|
||||
"Force" "Always update boot loader" $(if [ "$upd_forceboot" == "1" ]; then echo "ON"; else echo "OFF"; fi) \
|
||||
"Version check" "Only upgrade if version is newer" $(if [ "$upd_forceboot" == "0" ]; then echo "ON"; else echo "OFF"; fi) \
|
||||
2>$tempfile
|
||||
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
"Force")
|
||||
upd_forceboot=1
|
||||
;;
|
||||
upd_forceboot=1
|
||||
;;
|
||||
"Version check")
|
||||
upd_forceboot=0
|
||||
;;
|
||||
esac
|
||||
upd_forceboot=0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select_forceimage {
|
||||
dialog --keep-tite --radiolist "Should the image be stored in flash even if sanity checks would reject it" \
|
||||
$((lines -5)) $((cols -5)) $((lines -5 -5)) \
|
||||
"Force" "Dissable sanity check and force use of image (dangerous)" `if [ "$upd_forceimage" == "1" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
"Only compatible" "Normal checks apply" `if [ "$upd_forceimage" == "0" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
2> $tempfile
|
||||
dialog --keep-tite --radiolist "Should the image be stored in flash even if sanity checks would reject it" \
|
||||
$((lines - 5)) $((cols - 5)) $((lines - 5 - 5)) \
|
||||
"Force" "Disable sanity check and force use of image (dangerous)" $(if [ "$upd_forceimage" == "1" ]; then echo "ON"; else echo "OFF"; fi) \
|
||||
"Only compatible" "Normal checks apply" $(if [ "$upd_forceimage" == "0" ]; then echo "ON"; else echo "OFF"; fi) \
|
||||
2>$tempfile
|
||||
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
"Force")
|
||||
upd_forceimage=1
|
||||
;;
|
||||
upd_forceimage=1
|
||||
;;
|
||||
"Only compatible")
|
||||
upd_forceimage=0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select_sysupgrade {
|
||||
dialog --keep-tite --radiolist "Use the old way to upgrade a board" \
|
||||
$((lines -5)) $((cols -5)) $((lines -5 -5)) \
|
||||
"iopu" "Use the iop upgrade methode" `if [ "$upd_sysupgrade" == "0" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
"sysupgrade" "Use the old sysupgrade methode" `if [ "$upd_sysupgrade" == "1" ] ;then echo "ON" ;else echo "OFF";fi` \
|
||||
2> $tempfile
|
||||
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
"iopu")
|
||||
upd_sysupgrade=0
|
||||
;;
|
||||
"sysupgrade")
|
||||
upd_sysupgrade=1
|
||||
;;
|
||||
esac
|
||||
upd_forceimage=0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function upd_select {
|
||||
dialog --keep-tite --ok-label "Select" --cancel-label "Done" --menu "Select item to change" \
|
||||
$((lines - 5)) $((cols - 5)) $((lines - 5 - 5)) \
|
||||
"Firmware file" "$upd_fw_base" \
|
||||
"Host IP" "$upd_host" \
|
||||
"Reboot" $(if [ "$upd_noreboot" == "0" ]; then printf "Yes\n"; else printf "No\n"; fi) \
|
||||
"Keep config" $(if [ "$upd_keepconf" == "1" ]; then printf "Yes\n"; else printf "No\n"; fi) \
|
||||
"Force bootloader" $(if [ "$upd_forceboot" == "1" ]; then printf "Yes\n"; else printf "No\n"; fi) \
|
||||
"Force image upgrade" $(if [ "$upd_forceimage" == "1" ]; then printf "Yes\n"; else printf "No\n"; fi) \
|
||||
2>$tempfile
|
||||
|
||||
dialog --keep-tite --ok-label "Select" --cancel-label "Done" --menu "Select Item to change" \
|
||||
$((lines -5)) $((cols -5)) $((lines -5 -5)) \
|
||||
"Firmare file" "$upd_fw_base"\
|
||||
"Host ip" "$upd_host" \
|
||||
"Reboot" `if [ "$upd_noreboot" == "0" ] ;then printf "Yes\n" ;else printf "No\n";fi` \
|
||||
"Keep config" `if [ "$upd_keepconf" == "1" ] ;then printf "Yes\n" ;else printf "No\n";fi` \
|
||||
"Force bootloader" `if [ "$upd_forceboot" == "1" ] ;then printf "Yes\n" ;else printf "No\n";fi` \
|
||||
"Force image upgrade" `if [ "$upd_forceimage" == "1" ] ;then printf "Yes\n" ;else printf "No\n";fi` \
|
||||
"sysupgrade" `if [ "$upd_sysupgrade" == "1" ] ;then printf "Yes\n" ;else printf "No\n";fi` \
|
||||
2> $tempfile
|
||||
|
||||
|
||||
case $(cat $tempfile) in
|
||||
"Firmare file")
|
||||
upd_select_file
|
||||
;;
|
||||
"Host ip")
|
||||
upd_select_target
|
||||
;;
|
||||
case $(cat $tempfile) in
|
||||
"Firmware file")
|
||||
upd_select_file
|
||||
;;
|
||||
"Host IP")
|
||||
upd_select_target
|
||||
;;
|
||||
"Reboot")
|
||||
upd_select_reboot
|
||||
;;
|
||||
upd_select_reboot
|
||||
;;
|
||||
"Keep config")
|
||||
upd_select_config
|
||||
;;
|
||||
upd_select_config
|
||||
;;
|
||||
"Force bootloader")
|
||||
upd_select_forceboot
|
||||
;;
|
||||
upd_select_forceboot
|
||||
;;
|
||||
"Force image upgrade")
|
||||
upd_select_forceimage
|
||||
;;
|
||||
"sysupgrade")
|
||||
upd_select_sysupgrade
|
||||
;;
|
||||
upd_select_forceimage
|
||||
;;
|
||||
*)
|
||||
return
|
||||
;;
|
||||
esac
|
||||
upd_select
|
||||
return
|
||||
;;
|
||||
esac
|
||||
upd_select
|
||||
}
|
||||
function upd_select_start {
|
||||
lines=$(tput lines)
|
||||
cols=$(tput cols)
|
||||
tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/test$$
|
||||
trap "rm -f $tempfile" 0 1 2 5 15
|
||||
upd_select
|
||||
lines=$(tput lines)
|
||||
cols=$(tput cols)
|
||||
tempfile="$(mktemp)"
|
||||
trap "rm -f $tempfile" 0 1 2 5 15
|
||||
upd_select
|
||||
|
||||
}
|
||||
|
||||
function ssh_upgrade {
|
||||
upd_noreboot=0
|
||||
upd_forceboot=0
|
||||
upd_keepconf=0
|
||||
upd_forceimage=0
|
||||
upd_fw_base=""
|
||||
upd_fw=""
|
||||
upd_host="192.168.1.1"
|
||||
upd_sysupgrade=1
|
||||
do_dialog=0
|
||||
upd_noreboot=0
|
||||
upd_forceboot=0
|
||||
upd_keepconf=0
|
||||
upd_forceimage=0
|
||||
upd_fw_base=""
|
||||
upd_fw=""
|
||||
upd_host="192.168.1.1"
|
||||
do_dialog=0
|
||||
|
||||
while getopts "f:hnxt:iscb" opt; do
|
||||
case $opt in
|
||||
n)
|
||||
upd_noreboot=1
|
||||
;;
|
||||
x)
|
||||
upd_forceimage=1
|
||||
;;
|
||||
b)
|
||||
upd_forceboot=1
|
||||
;;
|
||||
c)
|
||||
upd_keepconf=1
|
||||
;;
|
||||
v)
|
||||
verbose=$OPTARG
|
||||
;;
|
||||
f)
|
||||
upd_fw=$OPTARG
|
||||
;;
|
||||
t)
|
||||
upd_host=$OPTARG
|
||||
;;
|
||||
i)
|
||||
do_dialog=1
|
||||
;;
|
||||
s)
|
||||
upd_sysupgrade=1
|
||||
;;
|
||||
h)
|
||||
upd_usage
|
||||
exit 1
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "$upd_fw" ]
|
||||
then
|
||||
upd_fw_base=$(basename $upd_fw);
|
||||
else
|
||||
set_config_string CONFIG_TARGET_BOARD
|
||||
firmwares=$(cd bin/targets/$CONFIG_TARGET_BOARD/generic/; ls -t *[0-9].y[3])
|
||||
|
||||
# if target uses pkgtb
|
||||
if [ -z "$firmwares"]
|
||||
then
|
||||
# pkgtb files can not be streamed so copy over the file witch scp
|
||||
use_scp=1
|
||||
firmwares=$(cd bin/targets/$CONFIG_TARGET_BOARD/generic/; ls -t last.pkgtb)
|
||||
fi
|
||||
|
||||
for upd_fw_base in $firmwares
|
||||
do
|
||||
#echo "firmware $upd_fw"
|
||||
break
|
||||
while getopts "f:hnxt:icb" opt; do
|
||||
case $opt in
|
||||
n)
|
||||
upd_noreboot=1
|
||||
;;
|
||||
x)
|
||||
upd_forceimage=1
|
||||
;;
|
||||
b)
|
||||
upd_forceboot=1
|
||||
;;
|
||||
c)
|
||||
upd_keepconf=1
|
||||
;;
|
||||
v)
|
||||
verbose=$OPTARG
|
||||
;;
|
||||
f)
|
||||
upd_fw=$OPTARG
|
||||
;;
|
||||
t)
|
||||
upd_host=$OPTARG
|
||||
;;
|
||||
i)
|
||||
do_dialog=1
|
||||
;;
|
||||
h)
|
||||
upd_usage
|
||||
exit 1
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
upd_fw="bin/targets/$CONFIG_TARGET_BOARD/generic/$upd_fw_base"
|
||||
fi
|
||||
|
||||
[ $do_dialog -eq 1 ] && upd_select_start
|
||||
|
||||
if ! upd_ask_ok
|
||||
then
|
||||
upd_select_start
|
||||
if ! upd_ask_ok
|
||||
then
|
||||
exit 1
|
||||
if [ -z "$upd_fw" ]; then
|
||||
set_config_string CONFIG_TARGET_BOARD
|
||||
set_config_string CONFIG_TARGET_SUBTARGET
|
||||
upd_fw="$(realpath -q --canonicalize-existing --relative-to=. "bin/targets/$CONFIG_TARGET_BOARD/$CONFIG_TARGET_SUBTARGET/"last.{pkgtb,itb})"
|
||||
if [ -z "$upd_fw" ] && [ $do_dialog -eq 0 ]; then
|
||||
echo "Could not find image. Check that last.{itb,pkgtb} exists or specify an image using -f <image> or -i (interactive)." >&2
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
upd_fw_base="$(basename "$upd_fw")"
|
||||
|
||||
if [ ! -f $upd_fw ]
|
||||
then
|
||||
echo "firmware file $firmware do not exist"
|
||||
exit 1
|
||||
fi
|
||||
[ $do_dialog -eq 1 ] && upd_select_start
|
||||
|
||||
if [ $upd_sysupgrade -eq 0 ]
|
||||
then
|
||||
extra_args=""
|
||||
[ $upd_noreboot -eq 1 ] && extra_args="$extra_args -n"
|
||||
[ $upd_forceimage -eq 1 ] && extra_args="$extra_args -x"
|
||||
[ $upd_forceboot -eq 1 ] && extra_args="$extra_args -b"
|
||||
|
||||
file_size_kb=`du -k "$upd_fw" | cut -f1`
|
||||
if [ "$use_scp" == "1" ]
|
||||
then
|
||||
scp $upd_fw root@$upd_host:/tmp/ &&
|
||||
ssh -o ConnectTimeout=60 root@$upd_host "iopu $extra_arg -f /tmp/$upd_fw_base"
|
||||
else
|
||||
cat $upd_fw | pv -s ${file_size_kb}k | ssh root@$upd_host "iopu $extra_args"
|
||||
if ! upd_ask_ok; then
|
||||
upd_select_start
|
||||
if ! upd_ask_ok; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
extra_args=""
|
||||
[ $upd_noreboot -eq 1 ] && extra_args="$extra_args -d"
|
||||
[ $upd_keepconf -eq 0 ] && extra_args="$extra_args -n"
|
||||
|
||||
scp $upd_fw root@$upd_host:/tmp/ &&
|
||||
ssh -o ConnectTimeout=60 root@$upd_host "sysupgrade -v $extra_args /tmp/$upd_fw_base" &&
|
||||
echo "sysupgrade done!"
|
||||
fi
|
||||
if [ ! -f $upd_fw ]; then
|
||||
echo "Firmware file $firmware does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
extra_args=""
|
||||
[ $upd_noreboot -eq 1 ] && extra_args="$extra_args --no-reboot"
|
||||
[ $upd_forceimage -eq 1 ] && extra_args="$extra_args --force"
|
||||
[ $upd_keepconf -eq 0 ] && extra_args="$extra_args -n"
|
||||
[ $upd_forceboot -eq 1 ] && extra_args="$extra_args --force-loader-upgrade"
|
||||
|
||||
pv "$upd_fw" |
|
||||
ssh \
|
||||
-o ConnectTimeout=60 \
|
||||
root@"$upd_host" \
|
||||
sh -c "cat > '/tmp/$upd_fw_base' && (set -x && sysupgrade -v $extra_args /tmp/$upd_fw_base)" ||
|
||||
echo "Sysupgrade failed" >&2 && return 1
|
||||
}
|
||||
|
||||
register_command "ssh_upgrade" "-h <host> -f <file> [opts] Install firmware on remote host with SSH"
|
||||
|
||||
|
||||
|
||||
@@ -13,5 +13,22 @@ config AGENT_ISLAND_PREVENTION
|
||||
config AGENT_EASYMESH_R2_CERT
|
||||
bool "Compile for WFA test bed"
|
||||
|
||||
|
||||
config AGENT_EASYMESH_VENDOR_EXT
|
||||
bool "Enable extra features through Easymesh vendor extension"
|
||||
default y
|
||||
|
||||
config AGENT_EASYMESH_VENDOR_EXT_OUI_DEFAULT
|
||||
string
|
||||
default "\\\\x11\\\\x22\\\\x33"
|
||||
|
||||
config AGENT_EASYMESH_VENDOR_EXT_OUI
|
||||
string "Vendor OUI in '\\\\xAB\\\\xCD\\\\xEF' format"
|
||||
default AGENT_EASYMESH_VENDOR_EXT_OUI_DEFAULT
|
||||
help
|
||||
Extra features not covered by the base Easymesh specification can be
|
||||
enabled through AGENT_EASYMESH_VENDOR_EXT. Please provide the Vendor's OUI
|
||||
through which such features would be exposed.
|
||||
|
||||
endmenu
|
||||
endif
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-agent
|
||||
PKG_VERSION:=2.10.0.2
|
||||
PKG_VERSION:=2.10.3.14
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=78face98267fc46d7d227979b35fcb39a2e175c9
|
||||
PKG_SOURCE_VERSION:=449eb907b121b7224cbfedcf51246e438f2b30d6
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
@@ -71,6 +71,11 @@ ifeq ($(CONFIG_AGENT_EASYMESH_R2_CERT),y)
|
||||
TARGET_CFLAGS += -DEASYMESH_R2_CERT
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_AGENT_EASYMESH_VENDOR_EXT),y)
|
||||
TARGET_CFLAGS += -DEASYMESH_VENDOR_EXT_OUI=\\\"$(CONFIG_AGENT_EASYMESH_VENDOR_EXT_OUI)\\\"
|
||||
endif
|
||||
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
define Package/map-agent/install
|
||||
@@ -78,6 +83,8 @@ define Package/map-agent/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/lib/wifi
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/script/* $(1)/lib/wifi/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/mapagent $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
|
||||
@@ -215,6 +215,10 @@ validate_agent_config() {
|
||||
return 0
|
||||
}
|
||||
|
||||
create_dir() {
|
||||
mkdir -p /var/run/multiap
|
||||
}
|
||||
|
||||
start_service() {
|
||||
[ -f /usr/sbin/dynbhd ] && start_dynbhd_service
|
||||
|
||||
@@ -234,6 +238,7 @@ start_service() {
|
||||
[ "$ts" -eq 1 ] && create_map #|| remove_map
|
||||
|
||||
procd_open_instance
|
||||
create_dir
|
||||
procd_set_param command "/usr/sbin/mapagent" "-d"
|
||||
procd_set_param respawn
|
||||
# procd_set_param stdout 1
|
||||
|
||||
@@ -1,924 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# functions
|
||||
# wireless_teardown - tear down ifaces based on mapagent config
|
||||
# setup_network - prepare /etc/config/network if necessary
|
||||
# setup_wireless - prepare /etc/config/wireless based on mapagent config
|
||||
# write_credentials - write bBSS credentials to fBSS
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/wifi/traffic_separation
|
||||
|
||||
MAPFILE="/tmp/multiap.backhaul"
|
||||
|
||||
diff=0
|
||||
onbrd_bssid=0
|
||||
onbrd_band=0
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: $0 [wireless_teardown|setup_network|setup_wireless|write_credentials]
|
||||
Platform specific Multi-AP script to prepare network and wifi subsystem based on
|
||||
mapagent configuration.
|
||||
wireless_teardown - tear down ifaces in /etc/config/wireless
|
||||
setup_network - prepare /etc/config/network
|
||||
setup_wireless - prepare /etc/config/wireless
|
||||
write_credentials - write bBSS credentials to fBSS
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
type_to_multi_ap () {
|
||||
type="$1"
|
||||
|
||||
if [ "$type" = "backhaul" ]; then
|
||||
echo "1"
|
||||
return
|
||||
elif [ "$type" = "fronthaul" ]; then
|
||||
echo "2"
|
||||
return
|
||||
elif [ "$type" = "combined" ]; then
|
||||
echo "3"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "0"
|
||||
}
|
||||
|
||||
get_type_by_section() {
|
||||
section="$1"
|
||||
|
||||
config_get type $section type "0"
|
||||
|
||||
echo "$(type_to_multi_ap $type)"
|
||||
}
|
||||
|
||||
sync_credentials() {
|
||||
bands=""
|
||||
json_init
|
||||
mapagent_process_fh() {
|
||||
local section=$1
|
||||
local dev=$2
|
||||
|
||||
multi_ap=$(get_type_by_section $section)
|
||||
[ "$multi_ap" == "0" ] && return
|
||||
|
||||
config_get device $section device
|
||||
|
||||
[ "$dev" != "$device" ] && return
|
||||
|
||||
config_get band $section band
|
||||
config_get ssid $section ssid
|
||||
config_get encryption $section encryption
|
||||
config_get key $section key
|
||||
|
||||
section=$(uci add ieee1905 ap)
|
||||
[ "$section" == "" ] && return
|
||||
|
||||
uci -q set ieee1905.${section}.band=$band
|
||||
uci -q set ieee1905.${section}.ssid="$ssid"
|
||||
uci -q set ieee1905.${section}.encryption=$encryption
|
||||
uci -q set ieee1905.${section}.key="$key"
|
||||
json_select "$band" > /dev/null
|
||||
if [ "$?" = "0" ]; then
|
||||
json_get_keys keys
|
||||
|
||||
for key in ${keys};
|
||||
do
|
||||
json_get_var val "$key"
|
||||
uci -q set ieee1905.${section}.$key="$val"
|
||||
done
|
||||
json_select ..
|
||||
fi
|
||||
}
|
||||
|
||||
mapagent_process_radio() {
|
||||
local section=$1
|
||||
|
||||
config_get device $section device
|
||||
config_get band $section band
|
||||
config_get dedicated_backhaul $section dedicated_backhaul 0
|
||||
|
||||
[ "$dedicated_backhaul" != "0" ] && return
|
||||
|
||||
for b in $bands; do
|
||||
if [ "$b" == "$band" ]; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
config_foreach mapagent_process_fh ap $device
|
||||
bands="$bands $band"
|
||||
}
|
||||
|
||||
ieee1905_del_ap() {
|
||||
append_value() {
|
||||
local section=$1
|
||||
local key=$2
|
||||
shift
|
||||
shift
|
||||
|
||||
while [ "$key" != "" ]; do
|
||||
val=$(uci -q get ieee1905.$section.$key)
|
||||
[ "$val" = "" ] && {
|
||||
key=$1
|
||||
shift
|
||||
continue
|
||||
}
|
||||
json_add_string "$key" ${val}
|
||||
key=$1
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
local section=$1
|
||||
local band
|
||||
|
||||
config_get band $section band
|
||||
json_select "$band" > /dev/null
|
||||
rc=$?
|
||||
[ "$rc" != "0" ] && json_add_object "$band"
|
||||
append_value $section "manufacturer" "model_name" "device_name" "model_number" "serial_number" "device_type" "os_version"
|
||||
if [ "$rc" != "0" ]; then
|
||||
json_close_object
|
||||
else
|
||||
json_select ..
|
||||
fi
|
||||
|
||||
uci -q delete ieee1905.${section}
|
||||
}
|
||||
|
||||
config_load ieee1905
|
||||
config_foreach ieee1905_del_ap ap
|
||||
|
||||
config_load mapagent
|
||||
config_foreach mapagent_process_radio radio
|
||||
|
||||
uci commit ieee1905
|
||||
json_cleanup
|
||||
}
|
||||
|
||||
write_credentials() {
|
||||
config_load mapagent
|
||||
|
||||
mapagent_apply_wireless() {
|
||||
write_wireless() {
|
||||
local section=$1
|
||||
local map_ifname=$2
|
||||
local bk_ssid="$3"
|
||||
local bk_key="$4"
|
||||
|
||||
config_get ifname $section ifname
|
||||
|
||||
#echo found device=$device map=$multi_ap ifname=$ifname mapifname=$map_ifname
|
||||
|
||||
[ "$ifname" != "$map_ifname" ] && return
|
||||
|
||||
#echo applying bk_ssid = "$bk_ssid" bk_key = "$bk_key"
|
||||
|
||||
uci -q set wireless.${section}.multi_ap_backhaul_ssid="$bk_ssid"
|
||||
uci -q set wireless.${section}.multi_ap_backhaul_key="$bk_key"
|
||||
}
|
||||
config_load wireless
|
||||
|
||||
config_foreach write_wireless wifi-iface "$1" "$2" "$3"
|
||||
}
|
||||
|
||||
mapagent_find_fbss() {
|
||||
local section=$1
|
||||
local dev=$2
|
||||
local bk_ssid="$3"
|
||||
local bk_key="$4"
|
||||
|
||||
multi_ap=$(get_type_by_section $section)
|
||||
[ "$multi_ap" == "0" ] && return
|
||||
|
||||
config_get device $section device
|
||||
|
||||
#echo found dev=$dev device=$device map=$multi_ap
|
||||
|
||||
[ "$device" != "$dev" ] && return
|
||||
[ "$multi_ap" != "2" ] && return
|
||||
|
||||
config_get ifname $section ifname
|
||||
|
||||
#echo applying bk_ssid = "$bk_ssid" bk_key = "$bk_key"
|
||||
|
||||
# subshell in hopes to maintain mapagent config loaded
|
||||
(mapagent_apply_wireless $ifname "$bk_ssid" "$bk_key")
|
||||
}
|
||||
|
||||
mapagent_find_bbss() {
|
||||
local section=$1
|
||||
local dev=$2
|
||||
|
||||
multi_ap=$(get_type_by_section $section)
|
||||
[ "$multi_ap" == "0" ] && return
|
||||
|
||||
config_get device $section device
|
||||
config_get enabled $section enabled "1"
|
||||
|
||||
#echo found dev=$dev device=$device map=$multi_ap
|
||||
|
||||
[ "$enabled" == "0" ] && return
|
||||
[ "$device" != "$dev" ] && return
|
||||
[ "$multi_ap" != "1" ] && return
|
||||
|
||||
config_get ssid $1 ssid
|
||||
config_get key $1 key
|
||||
|
||||
#echo found ssid="$ssid" key="$key"
|
||||
|
||||
config_foreach mapagent_find_fbss ap $dev "$ssid" "$key"
|
||||
}
|
||||
|
||||
mapagent_process_radio() {
|
||||
local section=$1
|
||||
|
||||
config_get device $section device
|
||||
|
||||
#echo found dev=$dev
|
||||
|
||||
config_foreach mapagent_find_bbss ap $device
|
||||
}
|
||||
|
||||
|
||||
config_foreach mapagent_process_radio radio
|
||||
|
||||
uci commit wireless
|
||||
}
|
||||
|
||||
set_network() {
|
||||
local ifname=$1
|
||||
local num=$2
|
||||
local bssid=$3
|
||||
|
||||
wpa_cli -i $ifname set_n $num bssid $bssid
|
||||
}
|
||||
|
||||
bsta_steer() {
|
||||
local ifname=$1
|
||||
local bssid=$2
|
||||
|
||||
rc=$(wpa_cli -i $ifname set_n 0 bssid $bssid)
|
||||
[ "$rc" == "FAIL" ] && {
|
||||
echo "1"
|
||||
return;
|
||||
}
|
||||
|
||||
rc=$(wpa_cli -i $ifname roam $bssid)
|
||||
[ "$rc" == "FAIL" ] && {
|
||||
echo "1"
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
write_bsta_config() {
|
||||
local ifname=$1
|
||||
|
||||
#echo diff = $diff > /dev/console
|
||||
|
||||
|
||||
config_load mapagent
|
||||
|
||||
mapagent_apply_wl_bsta() {
|
||||
apply_config() {
|
||||
local section=$1
|
||||
local bsta=$2
|
||||
local bssid=$3
|
||||
|
||||
config_get ifname $section ifname
|
||||
|
||||
[ "$bsta" == "$ifname" ] || return
|
||||
#echo setting diff = $diff > /dev/console
|
||||
old_bssid="$(uci -q get wireless.${section}.bssid)"
|
||||
|
||||
[ "$old_bssid" == "$bssid" ] && break
|
||||
|
||||
uci -q set wireless.${section}.bssid=$bssid
|
||||
wpa_cli -i "$bsta" set_n 0 bssid $bssid
|
||||
wpa_cli -i "$bsta" save_config
|
||||
echo 1
|
||||
}
|
||||
config_load wireless
|
||||
|
||||
config_foreach apply_config wifi-iface $1 $2
|
||||
uci commit wireless
|
||||
}
|
||||
|
||||
mapagent_process_bk() {
|
||||
local section=$1
|
||||
local bsta=$2
|
||||
|
||||
|
||||
config_get ifname $section ifname
|
||||
#echo bsta = $bsta > /dev/console
|
||||
|
||||
[ "$bsta" == "$ifname" ] || return
|
||||
#echo found ifname=$ifname > /dev/console
|
||||
|
||||
config_get bssid $section bssid
|
||||
config_get band $section band
|
||||
ret=$(mapagent_apply_wl_bsta $ifname $bssid)
|
||||
[ "$ret" == "1" ] && {
|
||||
diff=1
|
||||
onbrd_bssid=$bssid
|
||||
onbrd_band=$band
|
||||
}
|
||||
}
|
||||
|
||||
mapagent_apply_bssid_same_band() {
|
||||
apply_config() {
|
||||
local section=$1
|
||||
local bsta=$2
|
||||
|
||||
config_get ifname $section ifname
|
||||
|
||||
[ "$bsta" == "$ifname" ] || return
|
||||
uci -q set wireless.${section}.bssid=$bssid
|
||||
}
|
||||
|
||||
config_get band $1 band
|
||||
config_get onboarded $1 onboarded "0"
|
||||
|
||||
[ "$onbrd_band" != "$band" -o "$onboarded" = "1" ] && return
|
||||
|
||||
config_get ifname $1 ifname
|
||||
|
||||
config_load wireless
|
||||
config_foreach apply_config wifi-iface $ifname $onbrd_bssid
|
||||
uci commit wireless
|
||||
}
|
||||
|
||||
config_foreach mapagent_process_bk bsta $ifname
|
||||
|
||||
#echo result diff = $diff > /dev/console
|
||||
[ "$diff" == "1" ] && {
|
||||
(config_foreach mapagent_apply_bssid_same_band bsta)
|
||||
#ubus call uci commit '{"config":"wireless"}'
|
||||
#echo reloading wireless > /dev/console
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
teardown_iface() {
|
||||
config_load mapagent
|
||||
|
||||
local iface=$1
|
||||
|
||||
mapagent_teardown_wireless() {
|
||||
write_wireless() {
|
||||
local section=$1
|
||||
local map_ifname=$2
|
||||
|
||||
config_get ifname $section ifname
|
||||
|
||||
[ "$ifname" != "$map_ifname" ] && return
|
||||
|
||||
uci -q set wireless.${section}.disabled="1"
|
||||
uci -q set wireless.${section}.ssid="DISABLED-SSID"
|
||||
uci -q set wireless.${section}.key="DISABLED-KEY"
|
||||
uci -q delete wireless.${section}.multi_ap_backhaul_ssid
|
||||
uci -q delete wireless.${section}.multi_ap_backhaul_key
|
||||
}
|
||||
|
||||
config_load wireless
|
||||
|
||||
config_foreach write_wireless wifi-iface $1
|
||||
}
|
||||
|
||||
mapagent_teardown_bss() {
|
||||
local section=$1
|
||||
local iface=$2
|
||||
|
||||
multi_ap=$(get_type_by_section $section)
|
||||
[ "$multi_ap" == "0" ] && return
|
||||
|
||||
config_get ifname $section ifname
|
||||
|
||||
[ "$iface" != "$ifname" ] && return
|
||||
|
||||
config_get ifname $section ifname
|
||||
uci -q set mapagent.${section}.enabled="0"
|
||||
uci -q set mapagent.${section}.ssid="DISABLED-SSID"
|
||||
uci -q set mapagent.${section}.key="DISABLED-KEY"
|
||||
|
||||
# subshell in hopes to maintain mapagent config loaded
|
||||
(mapagent_teardown_wireless $ifname)
|
||||
}
|
||||
|
||||
|
||||
config_foreach mapagent_teardown_bss ap $iface
|
||||
|
||||
uci commit wireless
|
||||
uci commit mapagent
|
||||
}
|
||||
|
||||
bsta_to_wireless() {
|
||||
config_load mapagent
|
||||
|
||||
mapagent_find_lowest_prio_onboarded() {
|
||||
mapagent_process_bk() {
|
||||
config_get priority $1 priority "2"
|
||||
config_get onboarded $1 onboarded "0"
|
||||
|
||||
[ "$onboarded" = "0" ] && return
|
||||
|
||||
if [ -z "$sec" -o "$prio" = "-1" -o "$priority" -lt "$prio" ]; then
|
||||
sec=$1
|
||||
prio=$priority
|
||||
fi
|
||||
}
|
||||
|
||||
local sec=""
|
||||
local prio="-1"
|
||||
|
||||
config_foreach mapagent_process_bk bsta
|
||||
echo $sec
|
||||
}
|
||||
|
||||
mapagent_enable_best() {
|
||||
#echo 1=$1 best=$best > /dev/console
|
||||
if [ "$1" = "$best" ]; then
|
||||
uci -q set mapagent.$1.enabled='1'
|
||||
else
|
||||
uci -q set mapagent.$1.enabled='0'
|
||||
fi
|
||||
}
|
||||
|
||||
mapagent_bsta_to_wireless() {
|
||||
mapagent_apply_wl_bsta() {
|
||||
apply_config() {
|
||||
local section=$1
|
||||
local bsta=$2
|
||||
local ssid="$3"
|
||||
local key="$4"
|
||||
local encryption=$5
|
||||
local enabled=$6
|
||||
local bssid=$7
|
||||
local disabled="0"
|
||||
|
||||
config_get ifname $section ifname
|
||||
|
||||
[ -z "$enabled" -o "$enabled" = "0" ] && disabled="1"
|
||||
|
||||
[ "$bsta" == "$ifname" ] || return
|
||||
|
||||
uci -q set wireless.${section}.ssid="$ssid"
|
||||
uci -q set wireless.${section}.key="$key"
|
||||
uci -q set wireless.${section}.encryption=$encryption
|
||||
uci -q set wireless.${section}.bssid="$bssid"
|
||||
uci -q set wireless.${section}.default_disabled='0'
|
||||
|
||||
[ "$disabled" != "1" ] && return
|
||||
wpa_cli -i "$bsta" disconnect > /dev/null 2>&1
|
||||
wpa_cli -i "$bsta" disable_network 0 > /dev/null 2>&1
|
||||
wpa_cli -i "$bsta" save_config > /dev/null 2>&1
|
||||
|
||||
echo 1
|
||||
}
|
||||
|
||||
config_load wireless
|
||||
|
||||
config_foreach apply_config wifi-iface $@
|
||||
uci commit wireless
|
||||
}
|
||||
|
||||
mapagent_find_other_creds() {
|
||||
#echo "trying to find other creds for $2" > /dev/console
|
||||
local other_section="$2"
|
||||
|
||||
config_get band $1 band
|
||||
config_get onboarded $1 onboarded "0"
|
||||
|
||||
[ "$4" != "$band" -o "$onboarded" = "0" ] && return
|
||||
|
||||
config_get ssid $1 ssid
|
||||
config_get key $1 key
|
||||
config_get encryption $1 encryption
|
||||
config_get enabled $1 enabled "0"
|
||||
config_get bssid $1 bssid
|
||||
|
||||
uci -q set mapagent.${other_section}.ssid="$ssid"
|
||||
uci -q set mapagent.${other_section}.key="$key"
|
||||
uci -q set mapagent.${other_section}.encryption=$encryption
|
||||
uci -q set mapagent.${other_section}.bssid="$bssid"
|
||||
uci commit mapagent
|
||||
(mapagent_apply_wl_bsta "$3" "$ssid" "$key" $encryption "$5" "$bssid")
|
||||
}
|
||||
|
||||
config_get band $1 band
|
||||
config_get ifname $1 ifname
|
||||
config_get onboarded $1 onboarded "0"
|
||||
config_get enabled $1 enabled "0"
|
||||
|
||||
if [ "$onboarded" = "0" ]; then
|
||||
config_foreach mapagent_find_other_creds bsta $1 $ifname $band $enabled
|
||||
else
|
||||
config_get ssid $1 ssid
|
||||
config_get key $1 key
|
||||
config_get encryption $1 encryption
|
||||
config_get bssid $1 bssid
|
||||
|
||||
(mapagent_apply_wl_bsta $ifname "$ssid" "$key" $encryption $enabled "$bssid")
|
||||
fi
|
||||
}
|
||||
|
||||
# best=$(mapagent_find_lowest_prio_onboarded)
|
||||
#
|
||||
# [ -z "$best" ] && return
|
||||
#
|
||||
# band=$1
|
||||
# sec=""
|
||||
# prio=""
|
||||
#
|
||||
# config_foreach mapagent_enable_best bsta $best
|
||||
# uci commit mapagent
|
||||
config_load mapagent
|
||||
|
||||
diff=$(config_foreach mapagent_bsta_to_wireless bsta)
|
||||
|
||||
# [ "$diff" != "" ] && {
|
||||
|
||||
ubus call uci commit '{"config":"wireless"}'
|
||||
# }
|
||||
}
|
||||
|
||||
|
||||
sync_mapcontroller_from_wireless() {
|
||||
ubus -t 5 wait_for wifi
|
||||
[ "$?" != "0" ] && return
|
||||
|
||||
[ ! -f "/etc/config/wireless" ] && return
|
||||
|
||||
status=$(ubus -S call wifi status)
|
||||
|
||||
device_to_band() {
|
||||
local ifname=$1
|
||||
json_load "$status"
|
||||
json_select "radios"
|
||||
json_get_keys keys
|
||||
|
||||
for key in $keys; do
|
||||
json_select $key
|
||||
json_get_var name name
|
||||
|
||||
if [ "$name" != "$ifname" ]; then
|
||||
json_select ..
|
||||
continue
|
||||
fi
|
||||
|
||||
json_get_var band band
|
||||
|
||||
if [ "$band" == "5GHz" ]; then
|
||||
echo "5"
|
||||
elif [ "$band" == "2.4GHz" ]; then
|
||||
echo "2"
|
||||
fi
|
||||
|
||||
break
|
||||
done
|
||||
|
||||
json_cleanup
|
||||
}
|
||||
|
||||
wireless_process_iface() {
|
||||
local section=$1
|
||||
local type="ap"
|
||||
local enabled="1"
|
||||
|
||||
config_get multi_ap $section multi_ap 0
|
||||
[ "$multi_ap" != "1" ] && [ "$multi_ap" != "2" ] && return
|
||||
|
||||
config_get mode $section mode "ap"
|
||||
[ "$mode" != "ap" ] && return
|
||||
|
||||
config_get device $section device
|
||||
band=$(device_to_band $device)
|
||||
[ "$band" == "" ] && return
|
||||
|
||||
config_get ssid $section ssid
|
||||
config_get key $section key
|
||||
config_get encryption $section encryption
|
||||
config_get start_disabled $section start_disabled "0"
|
||||
config_get network $section network
|
||||
|
||||
|
||||
cntlr_section=$(uci add mapcontroller ${type})
|
||||
uci -q set mapcontroller.${cntlr_section}.ssid="$ssid"
|
||||
uci -q set mapcontroller.${cntlr_section}.key="$key"
|
||||
uci -q set mapcontroller.${cntlr_section}.encryption="$encryption"
|
||||
uci -q set mapcontroller.${cntlr_section}.band="$band"
|
||||
uci -q set mapcontroller.${cntlr_section}.vid="1"
|
||||
uci -q set mapcontroller.${cntlr_section}.network="$network"
|
||||
|
||||
[ "$multi_ap" == "1" ] && map_type="backhaul" || map_type="fronthaul"
|
||||
uci -q set mapcontroller.${cntlr_section}.type="$map_type"
|
||||
|
||||
[ "$start_disabled" == "1" ] && enabled="0"
|
||||
uci -q set mapcontroller.${cntlr_section}.enabled="$enabled"
|
||||
}
|
||||
|
||||
mapcontroller_teardown() {
|
||||
local section=$1
|
||||
|
||||
uci delete mapcontroller.$1
|
||||
}
|
||||
|
||||
config_load mapcontroller
|
||||
config_foreach mapcontroller_teardown ap
|
||||
|
||||
config_load wireless
|
||||
config_foreach wireless_process_iface wifi-iface
|
||||
uci commit mapcontroller
|
||||
}
|
||||
|
||||
bsta_scan_on_enabled() {
|
||||
local onboarded_bands=""
|
||||
|
||||
mapagent_onboarded_bands() {
|
||||
config_get band $1 band
|
||||
config_get onboarded $1 onboarded "0"
|
||||
|
||||
[ "$onboarded" = "0" ] && return
|
||||
|
||||
onboarded_bands="$onboarded_bands $band"
|
||||
}
|
||||
|
||||
mapagent_enable_bk() {
|
||||
config_get ifname $1 ifname
|
||||
config_get band $1 band
|
||||
config_get enabled $1 enabled
|
||||
|
||||
[ "$enabled" = "0" ] && return
|
||||
|
||||
for onboarded_band in $onboarded_bands
|
||||
do
|
||||
[ "$onboarded_band" != "$band" ] && continue
|
||||
|
||||
logger -t multiap "bsta_scan_on_enabled $ifname $band"
|
||||
wpa_cli -i "$ifname" enable_network 0 > /dev/null 2>&1
|
||||
wpa_cli -i "$ifname" reconnect > /dev/null 2>&1
|
||||
wpa_cli -i "$ifname" save_config > /dev/null 2>&1
|
||||
done
|
||||
}
|
||||
|
||||
config_load mapagent
|
||||
config_foreach mapagent_onboarded_bands bsta
|
||||
config_foreach mapagent_enable_bk bsta
|
||||
}
|
||||
|
||||
bsta_enable_all() {
|
||||
mapagent_enable_bk() {
|
||||
config_get ifname $1 ifname
|
||||
uci -q set mapagent.$1.enabled="1"
|
||||
}
|
||||
|
||||
config_load mapagent
|
||||
|
||||
config_foreach mapagent_enable_bk bsta
|
||||
uci commit mapagent
|
||||
bsta_scan_on_enabled
|
||||
}
|
||||
|
||||
bsta_clear_all_bssid() {
|
||||
mapagent_remove_bssid() {
|
||||
uci -q set mapagent.$1.enabled="1"
|
||||
uci -q del mapagent.$1.bssid
|
||||
}
|
||||
|
||||
wireless_remove_bssid() {
|
||||
config_get mode $1 mode
|
||||
config_get ifname $1 ifname
|
||||
|
||||
[ "$mode" != "sta" ] && return
|
||||
|
||||
uci -q del wireless.$1.bssid
|
||||
wpa_cli -i "$ifname" bssid 0 00:00:00:00:00:00 > /dev/null 2>&1
|
||||
wpa_cli -i "$ifname" save_config > /dev/null 2>&1
|
||||
}
|
||||
|
||||
config_load mapagent
|
||||
config_foreach mapagent_remove_bssid bsta
|
||||
uci commit mapagent
|
||||
|
||||
config_load wireless
|
||||
config_foreach wireless_remove_bssid wifi-iface
|
||||
uci commit wireless
|
||||
}
|
||||
|
||||
# arg1 = ifname arg2 = bssid
|
||||
bsta_blacklist_bssid_set() {
|
||||
local ifname="$1"
|
||||
shift
|
||||
local bssid="$@"
|
||||
|
||||
return
|
||||
|
||||
wpa_cli -i "$ifname" set_network 0 bssid_ignore "$bssid" > /dev/null 2>&1
|
||||
wpa_cli -i "$ifname" save_config > /dev/null 2>&1
|
||||
}
|
||||
|
||||
bsta_blacklist_bssid_clear() {
|
||||
mapagent_blacklist_by_band() {
|
||||
config_get ifname $1 ifname
|
||||
|
||||
wpa_cli -i "$ifname" set_network 0 bssid_ignore "" > /dev/null 2>&1
|
||||
wpa_cli -i "$ifname" save_config > /dev/null 2>&1
|
||||
}
|
||||
|
||||
return
|
||||
|
||||
config_load mapagent
|
||||
config_foreach mapagent_blacklist_by_band bsta
|
||||
}
|
||||
|
||||
bsta_disable_lower_priority() {
|
||||
config_load mapagent
|
||||
|
||||
mapagent_get_priority() {
|
||||
config_get ifname $1 ifname
|
||||
|
||||
[ "$ifname" != "$2" ] && return
|
||||
|
||||
config_get priority $1 priority "2"
|
||||
|
||||
echo "$priority"
|
||||
}
|
||||
|
||||
mapagent_disable_lower_bk() {
|
||||
mapagent_apply_wl_bsta() {
|
||||
apply_config() {
|
||||
local section="$1"
|
||||
local bsta="$2"
|
||||
local enabled="$3"
|
||||
|
||||
config_get ifname $section ifname
|
||||
|
||||
[ "$bsta" == "$ifname" ] || return
|
||||
|
||||
[ "$enabled" != "0" ] && return
|
||||
|
||||
wpa_cli -i "$ifname" disconnect > /dev/null 2>&1
|
||||
wpa_cli -i "$ifname" disable_network 0 > /dev/null 2>&1
|
||||
wpa_cli -i "$ifname" save_config > /dev/null 2>&1
|
||||
}
|
||||
local ifname="$1"
|
||||
local enabled="$2"
|
||||
|
||||
[ "$enabled" != "0" ] && return
|
||||
|
||||
config_load wireless
|
||||
|
||||
config_foreach apply_config wifi-iface $ifname $enabled
|
||||
}
|
||||
|
||||
local enabled="1"
|
||||
|
||||
config_get ifname $1 ifname
|
||||
config_get priority $1 priority
|
||||
|
||||
[ "$ifname" != "$2" -a "$priority" -gt "$3" ] && enabled="0"
|
||||
|
||||
uci -q set mapagent.$1.enabled="$enabled"
|
||||
|
||||
(mapagent_apply_wl_bsta $ifname $enabled) > /dev/null
|
||||
}
|
||||
|
||||
local bsta=$1
|
||||
|
||||
prio=$(config_foreach mapagent_get_priority bsta $bsta)
|
||||
#echo bsta $bsta has prio $prio > /dev/console
|
||||
|
||||
config_foreach mapagent_disable_lower_bk bsta $bsta $prio
|
||||
uci commit mapagent
|
||||
|
||||
# ubus call uci commit '{"config":"wireless"}'
|
||||
}
|
||||
|
||||
|
||||
bsta_use_link() {
|
||||
config_load mapagent
|
||||
|
||||
mapagent_disable_bk() {
|
||||
local bsta="$2"
|
||||
|
||||
config_get ifname $1 ifname
|
||||
config_get enabled $1 enabled
|
||||
|
||||
[ "$bsta" = "$ifname" ] && return
|
||||
|
||||
wpa_cli -i "$ifname" disconnect > /dev/null 2>&1
|
||||
wpa_cli -i "$ifname" disable_network 0 > /dev/null 2>&1
|
||||
wpa_cli -i "$ifname" save_config > /dev/null 2>&1
|
||||
}
|
||||
|
||||
local bsta=$1
|
||||
|
||||
config_foreach mapagent_disable_bk bsta $bsta
|
||||
}
|
||||
|
||||
bsta_swap_to_link() {
|
||||
bsta_disable_lower_priority $1
|
||||
bsta_use_link $1
|
||||
|
||||
wpa_cli -i "$1" enable_network 0 > /dev/null
|
||||
wpa_cli -i "$1" reconnect > /dev/null
|
||||
wpa_cli -i "$1" save_config > /dev/null
|
||||
}
|
||||
|
||||
set_uplink_backhaul_info() {
|
||||
local ul_1905id=$1
|
||||
local ul_mac=$2
|
||||
|
||||
(
|
||||
flock -x 200
|
||||
json_load "$(cat $MAPFILE)"
|
||||
json_add_string "backhaul_device_id" "$ul_1905id"
|
||||
json_add_string "backhaul_macddr" "$ul_mac"
|
||||
json_dump > "$MAPFILE"
|
||||
json_cleanup
|
||||
) 200>/var/lock/map.backhaul.lock
|
||||
}
|
||||
|
||||
set_uplink() {
|
||||
local type=$1
|
||||
local ifname=$2
|
||||
local hwaddr
|
||||
|
||||
hwaddr="$(ifconfig $ifname | grep -i hwaddr | awk '{print $5}' | awk '{print tolower($0)}')"
|
||||
|
||||
json_init
|
||||
json_add_string "type" "$type"
|
||||
json_add_string "ifname" "$ifname"
|
||||
json_add_string "macaddr" "$hwaddr"
|
||||
(
|
||||
flock -x 200
|
||||
json_dump > "$MAPFILE"
|
||||
) 200>/var/lock/map.backhaul.lock
|
||||
json_cleanup
|
||||
|
||||
config_load mapagent
|
||||
|
||||
island_prevention="$(uci -q get mapagent.agent.island_prevention)"
|
||||
|
||||
if [ "$island_prevention" = "1" -a "$type" = "eth" ]; then
|
||||
ubus call map.agent toggle_fh '{"enable":true, "prevent_island":true, "ifname":"all"}'
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
unset_uplink() {
|
||||
local type=${1:-wifi}
|
||||
|
||||
config_load mapagent
|
||||
|
||||
island_prevention="$(uci -q get mapagent.agent.island_prevention)"
|
||||
|
||||
if [ "$island_prevention" = "1" -a "$type" = "eth" ]; then
|
||||
ubus call map.agent toggle_fh '{"enable":false, "prevent_island":true, "ifname":"all"}'
|
||||
fi
|
||||
|
||||
(
|
||||
flock -x 200
|
||||
json_load "$(cat $MAPFILE)"
|
||||
json_get_var bk_type type
|
||||
json_cleanup
|
||||
|
||||
[ "$type" = "$bk_type" ] && rm -f "$MAPFILE" > /dev/null 2>&1
|
||||
) 200>/var/lock/map.backhaul.lock
|
||||
}
|
||||
|
||||
func=$1
|
||||
shift
|
||||
|
||||
case "$func" in
|
||||
wireless_teardown) wireless_teardown;;
|
||||
setup_network) setup_network;;
|
||||
setup_wireless) setup_wireless;;
|
||||
write_credentials) write_credentials;;
|
||||
sync_credentials) sync_credentials;;
|
||||
bsta_steer) bsta_steer $@;;
|
||||
set_network) set_network $@;;
|
||||
write_bsta_config) write_bsta_config $@;;
|
||||
teardown_iface) teardown_iface $@;;
|
||||
bsta_to_wireless) bsta_to_wireless $@;;
|
||||
sync_mapcontroller_from_wireless) sync_mapcontroller_from_wireless $@;;
|
||||
ts) ts_sub $@;;
|
||||
bsta_enable_all) bsta_enable_all $@;;
|
||||
bsta_clear_all_bssid) bsta_clear_all_bssid $@;;
|
||||
bsta_blacklist_bssid_set) bsta_blacklist_bssid_set $@;;
|
||||
bsta_blacklist_bssid_clear) bsta_blacklist_bssid_clear $@;;
|
||||
bsta_disable_lower_priority) bsta_disable_lower_priority $@;;
|
||||
bsta_scan_on_enabled) bsta_scan_on_enabled $@;;
|
||||
bsta_use_link) bsta_use_link $@;;
|
||||
bsta_swap_to_link) bsta_swap_to_link $@;;
|
||||
set_uplink) set_uplink $@;;
|
||||
set_uplink_backhaul_info) set_uplink_backhaul_info $@;;
|
||||
unset_uplink) unset_uplink $@;;
|
||||
--help|help) usage;;
|
||||
*) usage; exit 1;;
|
||||
esac
|
||||
|
||||
@@ -1,243 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
AL_BRIDGE=${AL_BRIDGE-"br-lan"}
|
||||
PRIMARY_VID=${PRIMARY_VID-1}
|
||||
|
||||
### Traffic Separation ###
|
||||
|
||||
dbg() {
|
||||
logger -t traffic_separation $@
|
||||
}
|
||||
|
||||
ts_sub() {
|
||||
ts_usage() {
|
||||
cat <<EOF
|
||||
Usage: $0 [create|reload]
|
||||
Traffic Separation related functions.
|
||||
create vid - create vlan configuration with vlan_id
|
||||
reload - reload network with new configuration
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
ts_create() {
|
||||
_net_setup() {
|
||||
local name=$1
|
||||
local vid=$2
|
||||
local proto=$3
|
||||
local dev=$4
|
||||
local port_dev=$5
|
||||
|
||||
[ -z "$(uci -q get network.${name})" ] || return
|
||||
|
||||
local ip_addr="192.168.${vid}.1"
|
||||
local br_dev="${AL_BRIDGE/-/_}"
|
||||
local tag=":t"
|
||||
|
||||
[ "${vid}" = "${PRIMARY_VID}" ] && {
|
||||
tag=""
|
||||
|
||||
# Global options
|
||||
[ -z "$(uci -q get network.${br_dev}.vlan_filtering)" ] && {
|
||||
uci -q set network.${br_dev}.vlan_filtering=1;
|
||||
}
|
||||
|
||||
uci -q delete network.lan.proto
|
||||
uci -q delete network.lan.ipaddr
|
||||
uci -q delete network.lan.netmask
|
||||
uci -q delete network.lan.ip6assign
|
||||
}
|
||||
|
||||
uci -q set network.${name}="interface"
|
||||
uci -q set network.${name}.device="$dev"
|
||||
uci -q set network.${name}.is_lan="1"
|
||||
|
||||
if [ "$proto" = "static" ] ; then
|
||||
uci -q set network.${name}.proto="static"
|
||||
# TODO vid > 255
|
||||
uci -q set network.${name}.ipaddr="${ip_addr}"
|
||||
uci -q set network.${name}.netmask="255.255.255.0"
|
||||
uci -q set network.${name}.ip6assign '60'
|
||||
else
|
||||
uci -q set network.${name}.proto="dhcp"
|
||||
fi
|
||||
|
||||
uci -q add network bridge-vlan
|
||||
uci -q set network.@bridge-vlan[-1].device="$AL_BRIDGE"
|
||||
uci -q set network.@bridge-vlan[-1].vlan="$vid"
|
||||
|
||||
for port in $(uci -q get network.${br_dev}.ports) ; do
|
||||
echo $port | grep -q eth || continue
|
||||
uci -q add_list network.@bridge-vlan[-1].ports="${port}${tag}"
|
||||
done
|
||||
|
||||
uci -q add_list network.${br_dev}.ports="$port_dev"
|
||||
uci -q add_list network.@bridge-vlan[-1].ports="$port_dev"
|
||||
|
||||
uci -q commit network
|
||||
}
|
||||
|
||||
_dhcp_setup() {
|
||||
local name=$1
|
||||
|
||||
[ -n "$(uci -q get dhcp.${name})" ] && return
|
||||
|
||||
uci -q set dhcp.${name}=dhcp
|
||||
uci -q set dhcp.${name}.interface="${name}"
|
||||
uci -q set dhcp.${name}.start="100"
|
||||
uci -q set dhcp.${name}.limit="150"
|
||||
uci -q set dhcp.${name}.leasetime="1h"
|
||||
uci -q set dhcp.${name}.dhcpv4="server"
|
||||
uci -q set dhcp.${name}.dhcpv6="server"
|
||||
uci -q set dhcp.${name}.ra="server"
|
||||
uci -q set dhcp.${name}.ra_slaac="1"
|
||||
uci -q add_list dhcp.${name}.ra_flags="managed-config"
|
||||
uci -q add_list dhcp.${name}.ra_flags="other-config"
|
||||
|
||||
uci -q commit dhcp
|
||||
}
|
||||
|
||||
_firewall_setup() {
|
||||
local name=$1
|
||||
local network=$1
|
||||
local vid=$2
|
||||
local zone_exist=0
|
||||
|
||||
config_load firewall
|
||||
|
||||
_process_zone() {
|
||||
local section=$1
|
||||
local new_name=$2
|
||||
local name
|
||||
|
||||
config_get name $section name
|
||||
|
||||
[ "$name" == "$new_name" ] && zone_exist=1
|
||||
}
|
||||
|
||||
config_foreach _process_zone zone $name
|
||||
|
||||
[ "$zone_exist" != "0" ] && return
|
||||
|
||||
[ "${vid}" = "${PRIMARY_VID}" ] && {
|
||||
uci -q delete firewall.lan
|
||||
}
|
||||
|
||||
uci -q add firewall zone
|
||||
uci -q set firewall.@zone[-1].name="$name"
|
||||
uci -q add_list firewall.@zone[-1].network="$network"
|
||||
uci -q set firewall.@zone[-1].input='ACCEPT'
|
||||
uci -q set firewall.@zone[-1].output='ACCEPT'
|
||||
uci -q set firewall.@zone[-1].forward='ACCEPT'
|
||||
|
||||
uci -q add firewall forwarding
|
||||
uci -q set firewall.@forwarding[-1].src="$name"
|
||||
uci -q set firewall.@forwarding[-1].dest="wan"
|
||||
|
||||
uci -q commit firewall
|
||||
}
|
||||
|
||||
vid=$1
|
||||
|
||||
[ -n "$vid" ] || {
|
||||
cat <<EOF
|
||||
VID required to configure.
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
ip link show sink${vid} 2> /dev/null || {
|
||||
ip link add sink${vid} type veth peer name sink_peer${vid}
|
||||
}
|
||||
|
||||
ip link set sink${vid} up
|
||||
ip link set sink_peer${vid} up
|
||||
|
||||
proto="dhcp"
|
||||
[ -x "/usr/sbin/mapcontroller" ] && proto="static" ;
|
||||
_net_setup "vlan${vid}" ${vid} ${proto} "sink${vid}" "sink_peer${vid}"
|
||||
|
||||
[ -x "/usr/sbin/mapcontroller" ] && {
|
||||
_dhcp_setup vlan${vid}
|
||||
_firewall_setup vlan${vid} ${vid}
|
||||
}
|
||||
}
|
||||
|
||||
ts_reload() {
|
||||
local dhcp_reload=$1
|
||||
restart=""
|
||||
# workaround for missing backhaul wifi.ap.* ubus obj's:
|
||||
# iterate in config and setup bh
|
||||
# config_load wireless
|
||||
|
||||
# _setup_bh_iface() {
|
||||
# local sec=$1
|
||||
# local iface=$2
|
||||
# local bridge=$3
|
||||
|
||||
# config_get ifname $sec ifname
|
||||
|
||||
# config_get mode $sec mode
|
||||
# config_get multi_ap $sec multi_ap "0"
|
||||
# [ "$mode" = "ap" -a "$multi_ap" = "1" ] && {
|
||||
# ts_create bh $ifname 1 2 br-map
|
||||
# }
|
||||
#}
|
||||
|
||||
# config_foreach _setup_bh_iface wifi-iface
|
||||
|
||||
bridge_verify_vid_mapping() {
|
||||
local section=$1
|
||||
|
||||
check__port_vid() {
|
||||
local port="$1"
|
||||
local vlan="$2"
|
||||
|
||||
added=$(bridge vlan show dev $port | grep -w "$vlan")
|
||||
if [ "$added" = "" ]; then
|
||||
restart="1"
|
||||
break
|
||||
fi
|
||||
}
|
||||
|
||||
config_get vlan "$section" vlan "0"
|
||||
|
||||
[ "$vlan" = "0" ] && continue
|
||||
|
||||
config_list_foreach "$section" "ports" check_port_vid "$vlan"
|
||||
[ "$restart" = "1" ] && break
|
||||
}
|
||||
|
||||
|
||||
|
||||
config_load network
|
||||
config_foreach bridge_verify_vid_mapping bridge-vlan
|
||||
|
||||
|
||||
[ -n "dhcp_reload" ] && /etc/init.d/dnsmasq reload
|
||||
if [ "$restart" = "1" ]; then
|
||||
dbg "trigger network restart"
|
||||
/etc/init.d/network restart
|
||||
else
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
fi
|
||||
/etc/init.d/firewall reload
|
||||
|
||||
|
||||
#for sink in $(ubus list network.interface.sink*) ; do
|
||||
# local sink_vlan=${sink/network.interface./}_vlan
|
||||
#done
|
||||
}
|
||||
|
||||
local func=$1
|
||||
shift
|
||||
|
||||
case "$func" in
|
||||
create) dbg "create $@"; ts_create $@;;
|
||||
reload) dbg "reload $@"; ts_reload $@;;
|
||||
--help|help) ts_usage;;
|
||||
*) ts_usage; exit 1;;
|
||||
esac
|
||||
}
|
||||
@@ -6,5 +6,21 @@ config CONTROLLER_SYNC_DYNAMIC_CNTLR_CONFIG
|
||||
bool "Support Dynamic Controller configuration sync"
|
||||
default y if MULTIAP_DYNAMIC_CNTLR_SYNC_CONFIG
|
||||
|
||||
config CONTROLLER_EASYMESH_VENDOR_EXT
|
||||
bool "Enable extra features through Easymesh vendor extension"
|
||||
default y
|
||||
|
||||
config CONTROLLER_EASYMESH_VENDOR_EXT_OUI_DEFAULT
|
||||
string
|
||||
default "\\\\x11\\\\x22\\\\x33"
|
||||
|
||||
config CONTROLLER_EASYMESH_VENDOR_EXT_OUI
|
||||
string "Vendor OUI in '\\\\xAB\\\\xCD\\\\xEF' format"
|
||||
default CONTROLLER_EASYMESH_VENDOR_EXT_OUI_DEFAULT
|
||||
help
|
||||
Extra features not covered by the base Easymesh specification can be
|
||||
enabled through CONTROLLER_EASYMESH_VENDOR_EXT. Please provide the Vendor's OUI
|
||||
through which such features would be exposed.
|
||||
|
||||
endmenu
|
||||
endif
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=map-controller
|
||||
PKG_VERSION:=2.11.0.2
|
||||
PKG_VERSION:=2.11.0.4
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=f74c6625967c6ab7f413a70fe72a876e5757ac22
|
||||
PKG_SOURCE_VERSION:=a4a626539ede73c1c4eb1ad768331524a8ee9ce8
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
@@ -49,6 +49,10 @@ ifeq ($(CONFIG_CONTROLLER_SYNC_DYNAMIC_CNTLR_CONFIG),y)
|
||||
TARGET_CFLAGS += -DCONTROLLER_SYNC_DYNAMIC_CNTLR_CONFIG
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CONTROLLER_EASYMESH_VENDOR_EXT),y)
|
||||
TARGET_CFLAGS += -DEASYMESH_VENDOR_EXT_OUI=\\\"$(CONFIG_CONTROLLER_EASYMESH_VENDOR_EXT_OUI)\\\"
|
||||
endif
|
||||
|
||||
define Package/map-controller/install
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(CP) ./files/* $(1)/
|
||||
|
||||
22
map-topology/Config.in
Normal file
22
map-topology/Config.in
Normal file
@@ -0,0 +1,22 @@
|
||||
if (PACKAGE_map-topology)
|
||||
|
||||
menu "Configurations"
|
||||
|
||||
config TOPOLOGYD_EASYMESH_VENDOR_EXT
|
||||
bool "Enable extra features through Easymesh vendor extension"
|
||||
default y
|
||||
|
||||
config TOPOLOGYD_EASYMESH_VENDOR_EXT_OUI_DEFAULT
|
||||
string
|
||||
default "\\\\x11\\\\x22\\\\x33"
|
||||
|
||||
config TOPOLOGYD_EASYMESH_VENDOR_EXT_OUI
|
||||
string "Vendor OUI in '\\\\xAB\\\\xCD\\\\xEF' format"
|
||||
default TOPOLOGYD_EASYMESH_VENDOR_EXT_OUI_DEFAULT
|
||||
help
|
||||
Extra features not covered by the base Easymesh specification can be
|
||||
enabled through TOPOLOGYD_EASYMESH_VENDOR_EXT. Please provide the Vendor's OUI
|
||||
through which such features would be exposed.
|
||||
|
||||
endmenu
|
||||
endif
|
||||
@@ -6,11 +6,11 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=map-topology
|
||||
PKG_VERSION:=2.5.1.1
|
||||
PKG_VERSION:=2.5.1.4
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_VERSION:=58a75b5847ef807063b62cadef7048ecbdb44288
|
||||
PKG_SOURCE_VERSION:=488ce1ce576b57c9b3c4d7c034969bf65e66216f
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/map-topology.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz
|
||||
@@ -31,6 +31,10 @@ define Package/map-topology
|
||||
TITLE:=Utility to build topology of a multi-AP network
|
||||
endef
|
||||
|
||||
define Package/map-topology/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-Wno-error=deprecated-declarations \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
@@ -44,6 +48,11 @@ endef
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
ifeq ($(CONFIG_TOPOLOGYD_EASYMESH_VENDOR_EXT),y)
|
||||
TARGET_CFLAGS += -DEASYMESH_VENDOR_EXT_OUI=\\\"$(CONFIG_TOPOLOGYD_EASYMESH_VENDOR_EXT_OUI)\\\"
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/map-topology/* $(PKG_BUILD_DIR)/
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
config global 'global'
|
||||
option ageing_timer '1440'
|
||||
option reboot_persistent '0'
|
||||
list ifname 'br-lan'
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=obuspa
|
||||
PKG_VERSION:=5.0.0.17
|
||||
PKG_VERSION:=5.0.0.21
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=cd47bcaf1cc82dfd5c10ea76491fd0dae4436cc6
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/fork/obuspa.git
|
||||
PKG_SOURCE_VERSION:=c71da7f9b66f4d7fd240e6eb7078044c6b43b72b
|
||||
PKG_MAINTAINER:=Vivek Dutta <vivek.dutta@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -100,6 +100,7 @@ define Package/obuspa/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/obuspa
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/json
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/obuspa $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) ./files/etc/init.d/obuspa $(1)/etc/init.d/
|
||||
$(INSTALL_DATA) ./files/etc/config/obuspa $(1)/etc/config/
|
||||
@@ -107,6 +108,7 @@ define Package/obuspa/install
|
||||
$(INSTALL_DATA) ./files/etc/obuspa/dmcaching_exclude.json $(1)/etc/obuspa/dmcaching_exclude.json
|
||||
$(INSTALL_DATA) ./files/etc/bbfdm/json/USPAgent.json $(1)/etc/bbfdm/json/USPAgent.json
|
||||
$(INSTALL_DATA) ./files/etc/bbfdm/json/TransferComplete.json $(1)/etc/bbfdm/json/TransferComplete.json
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-fix-upgrade-uci $(1)/etc/uci-defaults/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,obuspa))
|
||||
|
||||
@@ -11,7 +11,7 @@ config obuspa 'global'
|
||||
#option log_dest '/var/log/obuspa'
|
||||
|
||||
# Adds Device.LocalAgent.MTP.
|
||||
config mtp
|
||||
config mtp 'agent_mtp'
|
||||
option Protocol 'MQTT'
|
||||
option ResponseTopicConfigured '/usp/endpoint'
|
||||
option mqtt 'localmqtt'
|
||||
@@ -31,12 +31,21 @@ config controller 'localcontroller'
|
||||
option assigned_role_name 'full_access'
|
||||
|
||||
# Add Device.LocalAgent.Subscription.
|
||||
#config subscription
|
||||
# option ID 'default-boot-event-ACS'
|
||||
# option NotifType 'Event'
|
||||
# option ReferenceList 'Device.Boot!'
|
||||
# option Persistent 'true'
|
||||
# option controller 'localcontroller'
|
||||
#config subscription 'sub_event'
|
||||
# option ID 'uci-sub-events'
|
||||
# option NotifType 'Event'
|
||||
# list ReferenceList 'Device.Boot!'
|
||||
# list ReferenceList 'Device.LocalAgent.TransferComplete!'
|
||||
# option Persistent 'true'
|
||||
# option controller 'localcontroller'
|
||||
|
||||
#config subscription 'sub_op_comp'
|
||||
# option ID 'uci-sub-op_complete'
|
||||
# option NotifType 'OperationComplete'
|
||||
# list ReferenceList 'Device.DeviceInfo.FirmwareImage.*.Download()'
|
||||
# list ReferenceList 'Device.DeviceInfo.FirmwareImage.*.Activate()'
|
||||
# option Persistent 'true'
|
||||
# option controller 'localcontroller'
|
||||
|
||||
#config challenge 'admin'
|
||||
# option Description 'Request to get Administrative access'
|
||||
|
||||
@@ -175,13 +175,13 @@ get_role_index_from_json()
|
||||
validate_obuspa_section()
|
||||
{
|
||||
uci_validate_section ${CONFIGURATION} obuspa "${1}" \
|
||||
'enabled:bool:true' \
|
||||
'enabled:bool:1' \
|
||||
'trust_cert:file' \
|
||||
'client_cert:file' \
|
||||
'interface:string' \
|
||||
'ifname:string' \
|
||||
'debug:bool:false' \
|
||||
'prototrace:bool:false' \
|
||||
'debug:bool:0' \
|
||||
'prototrace:bool:0' \
|
||||
'log_level:uinteger' \
|
||||
'log_dest:string' \
|
||||
'db_file:string' \
|
||||
@@ -197,7 +197,7 @@ validate_localagent_section()
|
||||
validate_controller_section()
|
||||
{
|
||||
uci_validate_section ${CONFIGURATION} controller "${1}" \
|
||||
'Enable:bool:true' \
|
||||
'Enable:bool:1' \
|
||||
'EndpointID:string' \
|
||||
'assigned_role_name:string' \
|
||||
'Protocol:or("STOMP","CoAP","MQTT", "WebSocket")' \
|
||||
@@ -215,17 +215,17 @@ validate_controller_section()
|
||||
validate_subscription_section()
|
||||
{
|
||||
uci_validate_section ${CONFIGURATION} subscription "${1}" \
|
||||
'Enable:bool:true' \
|
||||
'Enable:bool:1' \
|
||||
'NotifType:or("ValueChange","ObjectCreation","ObjectDeletion","OperationComplete","Event")' \
|
||||
'ReferenceList:list(string)' \
|
||||
'Persistent:bool:true' \
|
||||
'Persistent:bool:1' \
|
||||
'controller:string'
|
||||
}
|
||||
|
||||
validate_mtp_section()
|
||||
{
|
||||
uci_validate_section ${CONFIGURATION} mtp "${1}" \
|
||||
'Enable:bool:true' \
|
||||
'Enable:bool:1' \
|
||||
'Protocol:or("STOMP","CoAP","MQTT", "WebSocket")' \
|
||||
'ResponseTopicConfigured:string' \
|
||||
'Destination:string' \
|
||||
@@ -239,19 +239,20 @@ validate_mtp_section()
|
||||
validate_stomp_connection_section()
|
||||
{
|
||||
uci_validate_section ${CONFIGURATION} stomp "${1}" \
|
||||
'Enable:bool:true' \
|
||||
'Enable:bool:1' \
|
||||
'Host:host' \
|
||||
'Port:port:61613' \
|
||||
'Username:string' \
|
||||
'Password:string' \
|
||||
'EnableEncryption:bool:true' \
|
||||
'EnableEncryption:bool:1' \
|
||||
'EnableHeartbeats:bool:1' \
|
||||
'VirtualHost:string:/'
|
||||
}
|
||||
|
||||
validate_mqtt_client_section()
|
||||
{
|
||||
uci_validate_section ${CONFIGURATION} mqtt "${1}" \
|
||||
'Enable:bool:true' \
|
||||
'Enable:bool:1' \
|
||||
'BrokerAddress:host' \
|
||||
'BrokerPort:port:1883' \
|
||||
'Username:string' \
|
||||
@@ -264,7 +265,7 @@ validate_mqtt_client_section()
|
||||
validate_challenge_section()
|
||||
{
|
||||
uci_validate_section ${CONFIGURATION} challenge "${1}" \
|
||||
'Enable:bool:true' \
|
||||
'Enable:bool:1' \
|
||||
'Description:string' \
|
||||
'role_name:string' \
|
||||
'Role:string' \
|
||||
@@ -336,6 +337,15 @@ configure_localagent()
|
||||
db_set Device.LocalAgent.EndpointID "${EndpointID}"
|
||||
}
|
||||
|
||||
update_reset_reason()
|
||||
{
|
||||
[ -f "/tmp/reset_reason" ] || return 0;
|
||||
|
||||
if grep -qwi "defaultreset" /tmp/reset_reason; then
|
||||
db_set Internal.Reboot.Cause "FactoryReset"
|
||||
fi
|
||||
}
|
||||
|
||||
configure_controller()
|
||||
{
|
||||
local EndpointID Enable
|
||||
@@ -572,7 +582,7 @@ configure_mtp() {
|
||||
|
||||
configure_stomp_connection() {
|
||||
local Host Username Password Enable Port VirtualHost
|
||||
local EnableEncryption
|
||||
local EnableEncryption EnableHeartbeats
|
||||
|
||||
validate_stomp_connection_section "${1}" || {
|
||||
log "Validation of stomp section failed"
|
||||
@@ -593,6 +603,7 @@ configure_stomp_connection() {
|
||||
db_set "${BASEPATH}.Enable" "${Enable}"
|
||||
db_set "${BASEPATH}.Port" "${Port}"
|
||||
db_set "${BASEPATH}.EnableEncryption" "${EnableEncryption}"
|
||||
db_set "${BASEPATH}.EnableHeartbeats" "${EnableHeartbeats}"
|
||||
db_set "${BASEPATH}.VirtualHost" "${VirtualHost}"
|
||||
db_set
|
||||
}
|
||||
@@ -724,8 +735,9 @@ db_init()
|
||||
global_init
|
||||
config_foreach configure_challenges challenge
|
||||
global_init
|
||||
update_reset_reason
|
||||
|
||||
# [ -f "${DB_DUMP}" ] && rm -f ${DB_DUMP}
|
||||
[ -f "${DB_DUMP}" ] && rm -f ${DB_DUMP}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
18
obuspa/files/etc/uci-defaults/01-fix-upgrade-uci
Normal file
18
obuspa/files/etc/uci-defaults/01-fix-upgrade-uci
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
fix_stomp_section() {
|
||||
local encryption
|
||||
|
||||
config_get_bool encryption $1 encryption ""
|
||||
if [ -n "${encryption}" ]; then
|
||||
uci_set obuspa $1 encryption ""
|
||||
uci_set obuspa $1 EnableEncryption "$encryption"
|
||||
fi
|
||||
}
|
||||
|
||||
# fix the stomp encryption parameter
|
||||
config_load obuspa
|
||||
config_foreach fix_stomp_section stomp
|
||||
uci_commit
|
||||
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ponmngr
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_VERSION:=1.0.1
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
@@ -17,11 +17,12 @@ include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ponmngr
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=ponmngr packets manager daemon
|
||||
TITLE:=PON Manager
|
||||
DEPENDS:=@(TARGET_iopsys_brcm63xx_arm||TARGET_iopsys_econet)
|
||||
endef
|
||||
|
||||
define Package/ponmngr/description
|
||||
Configures pon
|
||||
Configures PON
|
||||
endef
|
||||
|
||||
#define Build/Prepare
|
||||
@@ -32,7 +33,12 @@ define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/ponmngr/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(CP) ./files/common/* $(1)/
|
||||
ifneq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),)
|
||||
$(CP) ./files/broadcom/* $(1)/
|
||||
else ifneq ($(CONFIG_TARGET_iopsys_econet),)
|
||||
$(CP) ./files/airoha/* $(1)/
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ponmngr))
|
||||
|
||||
25
ponmngr/files/airoha/lib/xpon/airoha.sh
Normal file
25
ponmngr/files/airoha/lib/xpon/airoha.sh
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
set_serial_number() {
|
||||
vendor_id=$1
|
||||
vssn=$2
|
||||
|
||||
/userfs/bin/omcicfgCmd set sn ${vendor_id}${vssn}
|
||||
}
|
||||
|
||||
init_xpon() {
|
||||
procd_open_instance ponmgr_cfg
|
||||
procd_set_param command /userfs/bin/ponmgr_cfg
|
||||
procd_close_instance
|
||||
procd_open_instance omci
|
||||
procd_set_param command /userfs/bin/omci
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
deinit_xpon() {
|
||||
killall -9 omci 2>/dev/null
|
||||
killall -9 ponmgr_cfg 2>/dev/null
|
||||
}
|
||||
|
||||
30
ponmngr/files/broadcom/lib/xpon/broadcom.sh
Normal file
30
ponmngr/files/broadcom/lib/xpon/broadcom.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
set_serial_number() {
|
||||
vendor_id=$1
|
||||
vssn=$2
|
||||
|
||||
vendor_id="$(echo $vendor_id | hexdump -e '4/1 "%02X" "\n"')"
|
||||
vendor_id=${vendor_id:0:8}
|
||||
|
||||
bs /b/c gpon onu_sn={vendor_id=$vendor_id,vendor_specific=$vssn}
|
||||
}
|
||||
|
||||
init_xpon() {
|
||||
procd_open_instance pon_msgd
|
||||
procd_set_param command bcm_msgd -c gpon
|
||||
procd_close_instance
|
||||
|
||||
procd_open_instance pon_daemon
|
||||
procd_set_param command omcid start -n
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
deinit_xpon() {
|
||||
# stopping omcid does not bring down the pon link, which should happen
|
||||
# if ANI is disabled or stopped (go to O1)
|
||||
gponctl stop
|
||||
}
|
||||
38
ponmngr/files/common/etc/init.d/xpon
Executable file
38
ponmngr/files/common/etc/init.d/xpon
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=19
|
||||
STOP=91
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
. /lib/functions.sh
|
||||
include /lib/xpon
|
||||
|
||||
configure_serial_number() {
|
||||
serial_number="$(uci -q get xpon.ani.serial_number)"
|
||||
if [ ${#serial_number} -eq 12 ]; then
|
||||
vendor_id="${serial_number:0:4}"
|
||||
vssn="${serial_number:4:8}"
|
||||
else
|
||||
macaddr="$(fw_printenv -n ethaddr | tr -d ':' | tr 'a-z' 'A-Z')"
|
||||
vendor_id="IOPS"
|
||||
vssn="${macaddr:4:8}"
|
||||
fi
|
||||
|
||||
set_serial_number $vendor_id $vssn
|
||||
}
|
||||
|
||||
start_service() {
|
||||
if [ "$(uci -q get xpon.ani.enable)" == "1" ]; then
|
||||
configure_serial_number
|
||||
init_xpon
|
||||
fi
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
deinit_xpon
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "xpon"
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=19
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
. /lib/functions.sh
|
||||
include /lib/xpon
|
||||
|
||||
start_service() {
|
||||
if [ "$(uci -q get xpon.ani.enable)" == "1" ]; then
|
||||
init_xpon
|
||||
fi
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
# stopping omcid does not bring down the pon link, which should happen
|
||||
# if ANI is disabled or stopped (go to O1)
|
||||
deinit_xpon
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "xpon"
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
init_xpon() {
|
||||
procd_open_instance pon_msgd
|
||||
procd_set_param command bcm_msgd -c gpon
|
||||
procd_close_instance
|
||||
procd_open_instance pon_daemon
|
||||
procd_set_param command omcid start -n
|
||||
procd_close_instance
|
||||
|
||||
}
|
||||
|
||||
deinit_xpon() {
|
||||
gponctl stop
|
||||
}
|
||||
|
||||
@@ -30,17 +30,25 @@ populate_config_from_db() {
|
||||
}
|
||||
|
||||
populate_config_from_device_tree() {
|
||||
for port in $(find /proc/device-tree/ -name "port@*"); do
|
||||
port="$(cat $port/label)"
|
||||
for path in $(find /proc/device-tree/ -name "port@*"); do
|
||||
port="$(cat $path/label)"
|
||||
[ -n "$port" ] || continue
|
||||
[ "$port" = "cpu" ] && continue
|
||||
speed=1000
|
||||
if [ -e "$path/phy-mode" ]; then
|
||||
phymode="$(cat $path/phy-mode)"
|
||||
case "$phymode" in
|
||||
10000*) speed=10000 ;;
|
||||
2500*) speed=2500 ;;
|
||||
esac
|
||||
fi
|
||||
PORT="$(echo $port | tr '[a-z]' '[A-Z]')"
|
||||
uci add ports ethport
|
||||
uci rename ports.@ethport[-1]="$PORT"
|
||||
uci set ports.@ethport[-1].enabled=1
|
||||
uci set ports.@ethport[-1].name="$PORT"
|
||||
uci set ports.@ethport[-1].ifname="$port"
|
||||
uci set ports.@ethport[-1].speed=1000
|
||||
uci set ports.@ethport[-1].speed="$speed"
|
||||
uci set ports.@ethport[-1].duplex="full"
|
||||
uci set ports.@ethport[-1].autoneg=1
|
||||
uci set ports.@ethport[-1].eee=0
|
||||
@@ -65,7 +73,7 @@ fi
|
||||
|
||||
touch /etc/config/ports
|
||||
|
||||
if [ -f /sbin/db ] && [ -f /etc/board-db/config/hw ]; then
|
||||
if [ -f /sbin/db -a -n "$(db get hw.board.ethernetPortOrder 2>/dev/null)" ]; then
|
||||
populate_config_from_db
|
||||
elif [ -d /proc/device-tree/ ]; then
|
||||
populate_config_from_device_tree
|
||||
|
||||
@@ -27,7 +27,7 @@ define Package/qosmngr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=QoS Manager
|
||||
DEPENDS:=@(TARGET_iopsys_brcm63xx_arm) +libuci +libubox +libubus +libblobmsg-json +libjson-c +libqos
|
||||
DEPENDS:=@(TARGET_iopsys_brcm63xx_arm||TARGET_iopsys_econet) +libuci +libubox +libubus +libblobmsg-json +libjson-c +libqos
|
||||
endef
|
||||
|
||||
define Package/qosmngr/description
|
||||
|
||||
@@ -7,20 +7,15 @@ BR_RULE=""
|
||||
BR6_RULE=""
|
||||
|
||||
POLICER_COUNT=0
|
||||
INTF_NAME=""
|
||||
Q_COUNT=0
|
||||
ITER=0
|
||||
PREV_ORDER=""
|
||||
CURR_ORDER=""
|
||||
MAX_ORDER=""
|
||||
|
||||
SP_Q_PRIO=7
|
||||
|
||||
# Function to handle a queue order and
|
||||
# update total number of queues
|
||||
handle_q_order() {
|
||||
qid="$1" #queue section ID
|
||||
local qid="$1" #queue section ID
|
||||
|
||||
config_get is_enable "$qid" "enable"
|
||||
config_get is_enable "$qid" "enable" 1
|
||||
|
||||
# No need to configure disabled queues
|
||||
if [ $is_enable == '0' ]; then
|
||||
@@ -36,7 +31,7 @@ handle_q_order() {
|
||||
# Create precedence file containing queue order per
|
||||
# interface.
|
||||
local precedence_file="/tmp/qos/$ifname/q_order"
|
||||
local q_no=$(cat /tmp/qos/queue_stats/$ifname/q_idx)
|
||||
local q_no=$(cat /tmp/qos/$ifname/q_idx)
|
||||
|
||||
config_get precedence "$qid" "precedence"
|
||||
value=${precedence}_q${q_no}
|
||||
@@ -44,71 +39,32 @@ handle_q_order() {
|
||||
|
||||
# Update the number of queues per interface.
|
||||
q_no=$((q_no + 1))
|
||||
echo $q_no > /tmp/qos/queue_stats/$ifname/q_idx
|
||||
echo $q_no > /tmp/qos/$ifname/q_idx
|
||||
}
|
||||
|
||||
# Function to check if values are greater than (total number
|
||||
# of queue -1) and map them to corresponding value.
|
||||
configure_precedence_to_file() {
|
||||
order="$1"
|
||||
line="$2"
|
||||
order_file="$3"
|
||||
|
||||
if [ $order == "$PREV_ORDER" ]; then
|
||||
queue_id=${line#*_}
|
||||
val=${CURR_ORDER}_${queue_id}
|
||||
echo $val >> $order_file
|
||||
else
|
||||
PREV_ORDER=$order
|
||||
queue_id=${line#*_}
|
||||
val=${MAX_ORDER}_${queue_id}
|
||||
echo $val >> $order_file
|
||||
CURR_ORDER=$MAX_ORDER
|
||||
MAX_ORDER=$((MAX_ORDER - 1))
|
||||
fi
|
||||
}
|
||||
|
||||
# Fucntion to map queue precedence per interface
|
||||
# ranging from 1-X to 0-(no of queues -1)
|
||||
map_queue_precedence() {
|
||||
# Sort queue, lower value in uci means higher precedence, so this
|
||||
# function sorts the precedence in decending order
|
||||
sort_q_by_precedence() {
|
||||
ifname="$1"
|
||||
total_q=$(cat /tmp/qos/queue_stats/$ifname/q_idx)
|
||||
q_no=`expr $total_q - 1`
|
||||
|
||||
MAX_ORDER=$q_no
|
||||
|
||||
local precedence_file="/tmp/qos/$ifname/q_precedence"
|
||||
local order_file="/tmp/qos/$ifname/q_order"
|
||||
local tmp_order_file="/tmp/qos/$ifname/q_order.tmp"
|
||||
|
||||
sort -n -r -k1 $order_file >> $precedence_file
|
||||
rm $order_file
|
||||
|
||||
while read line
|
||||
do
|
||||
order=${line%_*}
|
||||
if [ $order -gt $q_no ]; then
|
||||
ITER=$((ITER + 1))
|
||||
configure_precedence_to_file $order $line $order_file
|
||||
else
|
||||
if [ $ITER == '0' ]; then
|
||||
echo $line >> $order_file
|
||||
else
|
||||
configure_precedence_to_file $order $line $order_file
|
||||
fi
|
||||
fi
|
||||
|
||||
done < $precedence_file
|
||||
sort -n -k1 $order_file > $tmp_order_file
|
||||
cp $tmp_order_file $order_file
|
||||
rm -f $tmp_order_file
|
||||
}
|
||||
|
||||
map_precedence() {
|
||||
sort_by_precedence() {
|
||||
for interf in $(db -q get hw.board.ethernetPortOrder); do
|
||||
map_queue_precedence $interf
|
||||
sort_q_by_precedence $interf
|
||||
done
|
||||
}
|
||||
|
||||
# function to handle a queue section
|
||||
handle_queue() {
|
||||
qid="$1" #queue section ID
|
||||
local qid="$1" #queue section ID
|
||||
local intf_name="$2"
|
||||
|
||||
config_get is_enable "$qid" "enable"
|
||||
|
||||
@@ -124,33 +80,35 @@ handle_queue() {
|
||||
fi
|
||||
|
||||
# This is to get the qid per interface.
|
||||
if [ "$INTF_NAME" == $ifname ]; then
|
||||
Q_COUNT=$((Q_COUNT + 1))
|
||||
else
|
||||
Q_COUNT='0'
|
||||
if [ "$intf_name" != "$ifname" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
INTF_NAME=$ifname
|
||||
local precedence_file="/tmp/qos/$ifname/q_order"
|
||||
|
||||
local total_q=$(cat /tmp/qos/queue_stats/$ifname/q_idx)
|
||||
q_no=`expr $total_q - 1` local
|
||||
precedence_file="/tmp/qos/$ifname/q_order"
|
||||
local temp_order=0
|
||||
while read -r line; do
|
||||
line_qid=${line: -1}
|
||||
if [ "$line_qid" == "$Q_COUNT" ]; then
|
||||
break
|
||||
fi
|
||||
temp_order=$((temp_order + 1))
|
||||
done < "$precedence_file"
|
||||
|
||||
# TR181 suggests lower the precedence value higher the priority
|
||||
# but in the chip its the opposite ie lower the value, lower
|
||||
# the priority of queue on this chip. So we need to reverse the
|
||||
# precedence value.
|
||||
precedence="$(grep -i q${Q_COUNT} $precedence_file)"
|
||||
precedence=${precedence%_*}
|
||||
order=`expr $q_no - $precedence`
|
||||
# for sp queue, no matter what the precedence value is configured in the uci file
|
||||
# broadcom recommends that the highest precedence queue should have priority value
|
||||
#7, the next priority q 6 and so on.
|
||||
# Here, we have the index of the queue when sorted by precedence value in the file
|
||||
# precedence_file so the order is calculated accordingly.
|
||||
local order=`expr $SP_Q_PRIO - $temp_order`
|
||||
|
||||
config_get sc_alg "$qid" "scheduling"
|
||||
config_get wgt "$qid" "weight"
|
||||
config_get wgt "$qid" "weight" 1
|
||||
config_get rate "$qid" "rate"
|
||||
config_get bs "$qid" "burst_size"
|
||||
config_get qsize "$qid" "queue_size" 1024
|
||||
|
||||
salg=1
|
||||
local salg=1
|
||||
|
||||
case "$sc_alg" in
|
||||
"SP") salg=1
|
||||
@@ -163,31 +121,15 @@ handle_queue() {
|
||||
;;
|
||||
esac
|
||||
|
||||
# ignore precedence value in case of WRR
|
||||
# ignore precedence value in case of WRR, broadcom recommends that WRR queue should
|
||||
# always have precedence value set to 0
|
||||
if [ $salg -eq 2 ]; then
|
||||
order=0
|
||||
fi
|
||||
|
||||
# Call tmctl which is a broadcomm command to configure queues on a port.
|
||||
tmctl setqcfg --devtype 0 --if $ifname --qid $Q_COUNT --priority $order --qsize $qsize --weight $wgt --schedmode $salg --shapingrate $rate --burstsize $bs
|
||||
|
||||
# In BCM968 chips, the counters for queues are read, on other model, its read and reset. So, to maintain counter
|
||||
# value and uniform behaviour, we are storing counter value for each queue in files
|
||||
local d_name="/tmp/qos/queue_stats/${ifname}/q_${Q_COUNT}"
|
||||
mkdir $d_name
|
||||
local f_name="$d_name/txPackets"
|
||||
touch $f_name
|
||||
echo 0 > $f_name
|
||||
f_name="$d_name/txBytes"
|
||||
touch $f_name
|
||||
echo 0 > $f_name
|
||||
f_name="$d_name/droppedPackets"
|
||||
touch $f_name
|
||||
echo 0 > $f_name
|
||||
f_name="$d_name/droppedBytes"
|
||||
touch $f_name
|
||||
echo 0 > $f_name
|
||||
|
||||
Q_COUNT=$((Q_COUNT + 1))
|
||||
}
|
||||
|
||||
#function to handle a policer section
|
||||
@@ -1092,28 +1034,20 @@ configure_classify() {
|
||||
|
||||
pre_configure_queue() {
|
||||
# Delete queues
|
||||
rm -rf /tmp/qos/queue_stats
|
||||
|
||||
for intf in $(db get hw.board.ethernetPortOrder); do
|
||||
rm -rf /tmp/qos/$intf
|
||||
|
||||
mkdir -p /tmp/qos/queue_stats/$intf
|
||||
touch /tmp/qos/queue_stats/$intf/q_idx
|
||||
echo 0 > /tmp/qos/queue_stats/$intf/q_idx
|
||||
mkdir -p /tmp/qos/$intf
|
||||
touch /tmp/qos/$intf/q_order
|
||||
touch /tmp/qos/$intf/q_idx
|
||||
echo 0 > /tmp/qos/$intf/q_idx
|
||||
|
||||
# tm initialization pushing ahead of delcfg as
|
||||
# porttminit bydefault configures all queue as SP configuration.
|
||||
# that was causing WRR queue configuration failure.
|
||||
tmctl porttminit --devtype 0 --if $intf --flag 0 --numqueues 8
|
||||
tmctl porttminit --devtype 0 --if $intf --numqueues 8
|
||||
|
||||
i=0
|
||||
for i in 0 1 2 3 4 5 6 7; do
|
||||
tmctl delqcfg --devtype 0 --if $intf --qid $i &>/dev/null
|
||||
done
|
||||
|
||||
mkdir -p /tmp/qos/$intf
|
||||
touch /tmp/qos/$intf/q_order
|
||||
touch /tmp/qos/$intf/q_precedence
|
||||
done
|
||||
}
|
||||
|
||||
@@ -1121,8 +1055,15 @@ configure_queue() {
|
||||
# Load UCI file
|
||||
config_load qos
|
||||
config_foreach handle_q_order queue
|
||||
map_precedence
|
||||
config_foreach handle_queue queue
|
||||
sort_by_precedence
|
||||
for interf in $(db -q get hw.board.ethernetPortOrder); do
|
||||
Q_COUNT=0
|
||||
# sp queue have max priority value = no. of queue configured on the port
|
||||
# hence read and update SP_Q_PRIO here
|
||||
local q_no=$(cat /tmp/qos/$interf/q_idx)
|
||||
SP_Q_PRIO=`expr $q_no - 1`
|
||||
config_foreach handle_queue queue $interf
|
||||
done
|
||||
}
|
||||
|
||||
configure_policer() {
|
||||
|
||||
80
skopeo/Makefile
Normal file
80
skopeo/Makefile
Normal file
@@ -0,0 +1,80 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=skopeo
|
||||
PKG_VERSION:=1.9.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_NAME:=skopeo
|
||||
PKG_SOURCE_URL:=https://github.com/containers/skopeo.git
|
||||
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION)-$(PKG_RELEASE).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
HOST_BUILD_DEPENDS:=golang/host
|
||||
HOST_BUILD_PARALLEL:=1
|
||||
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
GO_PKG:=github.com/containers/skopeo
|
||||
GO_PKG_BUILD_PKG:=github.com/containers/skopeo/cmd/skopeo
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
GOLANG_PACKAGE_MK:=$(wildcard $(TOPDIR)/feeds/*/lang/golang/golang-package.mk)
|
||||
GOLANG_HOST_PACKAGE_MK:=$(wildcard $(TOPDIR)/feeds/*/lang/golang/golang-host-build.mk)
|
||||
|
||||
# verify that there is only one single file returned
|
||||
ifneq (1,$(words $(GOLANG_PACKAGE_MK)))
|
||||
ifeq (0,$(words $(GOLANG_PACKAGE_MK)))
|
||||
$(error did not find golang-package.mk in any feed)
|
||||
else
|
||||
$(error found multiple golang-package.mk files in the feeds)
|
||||
endif
|
||||
else
|
||||
$(info found golang-package.mk at $(GOLANG_PACKAGE_MK))
|
||||
endif
|
||||
|
||||
include $(GOLANG_PACKAGE_MK)
|
||||
include $(GOLANG_HOST_PACKAGE_MK)
|
||||
|
||||
define Package/skopeo
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Command line utility for container image management
|
||||
URL:=https://github.com/containers/skopeo
|
||||
DEPENDS:=$(GO_ARCH_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/skopeo/description
|
||||
skopeo is a command line utility that performs various operations on container images and image repositories.
|
||||
endef
|
||||
|
||||
define Package/skopeo/conffiles
|
||||
/etc/containers/policy.json
|
||||
endef
|
||||
|
||||
GO_PKG_TAGS=exclude_graphdriver_devicemapper,exclude_graphdriver_btrfs,containers_image_openpgp
|
||||
GO_PKG_BUILD_VARS += GO111MODULE=auto
|
||||
|
||||
define Build/Compile
|
||||
$(call GoPackage/Build/Compile)
|
||||
$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
|
||||
endef
|
||||
|
||||
define Package/skopeo/install
|
||||
$(call GoPackage/Package/Install/Bin,$(1))
|
||||
$(INSTALL_DIR) $(1)/etc/containers
|
||||
$(INSTALL_DATA) ./files/etc/containers/policy.json $(1)/etc/containers/policy.json
|
||||
endef
|
||||
|
||||
$(eval $(call GoBinHostBuild))
|
||||
$(eval $(call HostBuild))
|
||||
$(eval $(call GoBinPackage,skopeo))
|
||||
$(eval $(call BuildPackage,skopeo))
|
||||
15
skopeo/files/etc/containers/policy.json
Normal file
15
skopeo/files/etc/containers/policy.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"default": [
|
||||
{
|
||||
"type": "insecureAcceptAnything"
|
||||
}
|
||||
],
|
||||
"transports":
|
||||
{
|
||||
"docker-daemon":
|
||||
{
|
||||
"": [{"type":"insecureAcceptAnything"}]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
126
sulu-builder/Config.in
Normal file
126
sulu-builder/Config.in
Normal file
@@ -0,0 +1,126 @@
|
||||
menu "Configuration"
|
||||
depends on PACKAGE_sulu-builder
|
||||
|
||||
menu "SULU_CORE"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_CORE_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default y
|
||||
|
||||
config SULU_CORE_URL
|
||||
string "SULU url"
|
||||
default "https://dev.iopsys.eu/websdk/sulu.git"
|
||||
|
||||
config SULU_CORE_VERSION
|
||||
string "SULU repo version"
|
||||
default "944f4e2217e478c04f1ef56ae67c66d82ece7994"
|
||||
endmenu
|
||||
|
||||
menu "SULU_PLUGIN_LCM"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_PLUGIN_LCM_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default y
|
||||
|
||||
config SULU_PLUGIN_LCM_NAME
|
||||
depends on SULU_PLUGIN_LCM_ENABLE
|
||||
string "Plugin_name"
|
||||
default "sulu-lcm"
|
||||
|
||||
config SULU_PLUGIN_LCM_URL
|
||||
depends on SULU_PLUGIN_LCM_ENABLE
|
||||
string "URL"
|
||||
default "https://dev.iopsys.eu/websdk/sulu-lcm.git"
|
||||
|
||||
config SULU_PLUGIN_LCM_VERSION
|
||||
depends on SULU_PLUGIN_LCM_ENABLE
|
||||
string "Version"
|
||||
default "f8a96f1c55904082c0658ee63aebe1e67a097f42"
|
||||
endmenu
|
||||
|
||||
menu "SULU_PLUGIN_MULTIAP"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_PLUGIN_MULTIAP_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default y
|
||||
|
||||
config SULU_PLUGIN_MULTIAP_NAME
|
||||
depends on SULU_PLUGIN_MULTIAP_ENABLE
|
||||
string "Plugin_name"
|
||||
default "sulu-multi-ap"
|
||||
|
||||
config SULU_PLUGIN_MULTIAP_URL
|
||||
depends on SULU_PLUGIN_MULTIAP_ENABLE
|
||||
string "URL"
|
||||
default "https://dev.iopsys.eu/websdk/sulu-multi-ap.git"
|
||||
|
||||
config SULU_PLUGIN_MULTIAP_VERSION
|
||||
depends on SULU_PLUGIN_MULTIAP_ENABLE
|
||||
string "Version"
|
||||
default "89b4e4b95d3a94b88782f5cdc9d1eafd5728a1f7"
|
||||
endmenu
|
||||
|
||||
menu "SULU_THEME_IOPSYS"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_THEME_IOPSYS_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default y
|
||||
|
||||
config SULU_THEME_IOPSYS_NAME
|
||||
depends on SULU_THEME_IOPSYS_ENABLE
|
||||
string "Plugin_name"
|
||||
default "sulu-theme-iopsys"
|
||||
|
||||
config SULU_THEME_IOPSYS_URL
|
||||
depends on SULU_THEME_IOPSYS_ENABLE
|
||||
string "URL"
|
||||
default "https://dev.iopsys.eu/websdk/sulu-theme-iopsys.git"
|
||||
|
||||
config SULU_THEME_IOPSYS_VERSION
|
||||
depends on SULU_THEME_IOPSYS_ENABLE
|
||||
string "Version"
|
||||
default "e80fea80cdf8d49db0ae70b5c26a5dab49b8a20d"
|
||||
endmenu
|
||||
|
||||
menu "SULU_PLUGIN_CUSTOM"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_PLUGIN_CUSTOM_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default n
|
||||
|
||||
config SULU_PLUGIN_CUSTOM_NAME
|
||||
depends on SULU_PLUGIN_CUSTOM_ENABLE
|
||||
string "Plugin_name"
|
||||
default "custom_app"
|
||||
|
||||
config SULU_PLUGIN_CUSTOM_URL
|
||||
depends on SULU_PLUGIN_CUSTOM_ENABLE
|
||||
string "URL"
|
||||
default ""
|
||||
|
||||
config SULU_PLUGIN_CUSTOM_VERSION
|
||||
depends on SULU_PLUGIN_CUSTOM_ENABLE
|
||||
string "Version"
|
||||
endmenu
|
||||
|
||||
menu "SULU_THEME_CUSTOM"
|
||||
depends on PACKAGE_sulu-builder
|
||||
config SULU_THEME_CUSTOM_ENABLE
|
||||
bool "Enable this plugin"
|
||||
default n
|
||||
|
||||
config SULU_THEME_CUSTOM_NAME
|
||||
depends on SULU_THEME_CUSTOM_ENABLE
|
||||
string "Plugin_name"
|
||||
default "plugin_theme_custom"
|
||||
|
||||
config SULU_THEME_CUSTOM_URL
|
||||
depends on SULU_THEME_CUSTOM_ENABLE
|
||||
string "URL"
|
||||
default ""
|
||||
|
||||
config SULU_THEME_CUSTOM_VERSION
|
||||
depends on SULU_THEME_CUSTOM_ENABLE
|
||||
string "Version"
|
||||
endmenu
|
||||
endmenu
|
||||
155
sulu-builder/Makefile
Normal file
155
sulu-builder/Makefile
Normal file
@@ -0,0 +1,155 @@
|
||||
#
|
||||
# Copyright (C) 2021-2022 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-builder
|
||||
PKG_VERSION:=1.1.4
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-builder.git
|
||||
PKG_SOURCE_VERSION:=ca38b2086cee7ba83b41eec56539e9432271a349
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=PROPRIETARY IOPSYS
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_BUILD_DEPENDS:=node-yarn/host
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/${PKG_NAME}
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Build sulu from source
|
||||
DEPENDS:=+nginx +mosquitto-auth-shadow
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/${PKG_NAME}/description
|
||||
SULU-CE ReactJS based Web UI builder.
|
||||
endef
|
||||
|
||||
define Package/${PKG_NAME}/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
# Sulu core and other dependent needs to be updated in Config.in
|
||||
SULU_DL_FILE:=sulu-${PKG_VERSION}-${CONFIG_SULU_CORE_VERSION}.tar.gz
|
||||
define Download/sulu_core
|
||||
FILE:=$(SULU_DL_FILE)
|
||||
URL:=$(CONFIG_SULU_CORE_URL)
|
||||
PROTO:=git
|
||||
SUBDIR:=core
|
||||
VERSION:=${CONFIG_SULU_CORE_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_CORE_ENABLE),y)
|
||||
$(eval $(call Download,sulu_core))
|
||||
endif
|
||||
|
||||
SULU_PLUGIN_LCM_DL:=${CONFIG_SULU_PLUGIN_LCM_NAME}_plugin-${CONFIG_SULU_PLUGIN_LCM_VERSION}.tar.gz
|
||||
define Download/sulu_plugin_lcm
|
||||
FILE:=${SULU_PLUGIN_LCM_DL}
|
||||
URL:=${CONFIG_SULU_PLUGIN_LCM_URL}
|
||||
PROTO:=git
|
||||
SUBDIR:=plugins/${CONFIG_SULU_PLUGIN_LCM_NAME}
|
||||
VERSION:=${CONFIG_SULU_PLUGIN_LCM_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_LCM_ENABLE),y)
|
||||
$(eval $(call Download,sulu_plugin_lcm))
|
||||
endif
|
||||
|
||||
SULU_PLUGIN_MULTIAP_DL:=${CONFIG_SULU_PLUGIN_MULTIAP_NAME}_plugin-${CONFIG_SULU_PLUGIN_MULTIAP_VERSION}.tar.gz
|
||||
define Download/sulu_plugin_multiap
|
||||
FILE:=${SULU_PLUGIN_MULTIAP_DL}
|
||||
URL:=${CONFIG_SULU_PLUGIN_MULTIAP_URL}
|
||||
PROTO:=git
|
||||
SUBDIR:=plugins/${CONFIG_SULU_PLUGIN_MULTIAP_NAME}
|
||||
VERSION:=${CONFIG_SULU_PLUGIN_MULTIAP_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_MULTIAP_ENABLE),y)
|
||||
$(eval $(call Download,sulu_plugin_multiap))
|
||||
endif
|
||||
|
||||
SULU_THEME_IOPSYS_DL:=${CONFIG_SULU_THEME_IOPSYS_NAME}_plugin-${CONFIG_SULU_THEME_IOPSYS_VERSION}.tar.gz
|
||||
define Download/sulu_theme_iopsys
|
||||
FILE:=${SULU_THEME_IOPSYS_DL}
|
||||
URL:=${CONFIG_SULU_THEME_IOPSYS_URL}
|
||||
PROTO:=git
|
||||
SUBDIR:=plugins/${CONFIG_SULU_THEME_IOPSYS_NAME}
|
||||
VERSION:=${CONFIG_SULU_THEME_IOPSYS_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_THEME_IOPSYS_ENABLE),y)
|
||||
$(eval $(call Download,sulu_theme_iopsys))
|
||||
endif
|
||||
|
||||
SULU_PLUGIN_CUSTOM_DL:=${CONFIG_SULU_PLUGIN_CUSTOM_NAME}_plugin-${CONFIG_SULU_PLUGIN_CUSTOM_VERSION}.tar.gz
|
||||
define Download/sulu_plugin_custom
|
||||
FILE:=${SULU_PLUGIN_CUSTOM_DL}
|
||||
URL:=${CONFIG_SULU_PLUGIN_CUSTOM_URL}
|
||||
PROTO:=git
|
||||
SUBDIR:=plugins/${CONFIG_SULU_PLUGIN_CUSTOM_NAME}
|
||||
VERSION:=${CONFIG_SULU_PLUGIN_CUSTOM_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_CUSTOM_ENABLE),y)
|
||||
$(eval $(call Download,sulu_plugin_custom))
|
||||
endif
|
||||
|
||||
SULU_THEME_CUSTOM_DL:=${CONFIG_SULU_THEME_CUSTOM_NAME}_plugin-${CONFIG_SULU_THEME_CUSTOM_VERSION}.tar.gz
|
||||
define Download/sulu_theme_custom
|
||||
FILE:=${SULU_THEME_CUSTOM_DL}
|
||||
URL:=${CONFIG_SULU_THEME_CUSTOM_URL}
|
||||
PROTO:=git
|
||||
SUBDIR:=plugins/${CONFIG_SULU_THEME_CUSTOM_NAME}
|
||||
VERSION:=${CONFIG_SULU_THEME_CUSTOM_VERSION}
|
||||
HASH:=skip
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_SULU_THEME_CUSTOM_ENABLE),y)
|
||||
$(eval $(call Download,sulu_theme_custom))
|
||||
endif
|
||||
|
||||
define Build/Prepare
|
||||
$(Build/Prepare/Default)
|
||||
tar xzf $(DL_DIR)/${SULU_DL_FILE} -C $(PKG_BUILD_DIR)
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_LCM_ENABLE),y)
|
||||
tar xzf $(DL_DIR)/${SULU_PLUGIN_LCM_DL} -C $(PKG_BUILD_DIR)
|
||||
endif
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_MULTIAP_ENABLE),y)
|
||||
tar xzf $(DL_DIR)/${SULU_PLUGIN_MULTIAP_DL} -C $(PKG_BUILD_DIR)
|
||||
endif
|
||||
ifeq ($(CONFIG_SULU_THEME_IOPSYS_ENABLE),y)
|
||||
tar xzf $(DL_DIR)/${SULU_THEME_IOPSYS_DL} -C $(PKG_BUILD_DIR)
|
||||
endif
|
||||
ifeq ($(CONFIG_SULU_PLUGIN_CUSTOM_ENABLE),y)
|
||||
tar xzf $(DL_DIR)/${SULU_PLUGIN_CUSTOM_DL} -C $(PKG_BUILD_DIR)
|
||||
endif
|
||||
ifeq ($(CONFIG_SULU_THEME_CUSTOM_ENABLE),y)
|
||||
tar xzf $(DL_DIR)/${SULU_THEME_CUSTOM_DL} -C $(PKG_BUILD_DIR)
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/${PKG_NAME}/install
|
||||
$(INSTALL_DIR) $(1)/sulu
|
||||
$(INSTALL_DIR) $(1)/sulu/config
|
||||
$(INSTALL_DIR) $(1)/etc/nginx/
|
||||
$(INSTALL_DIR) $(1)/etc/mosquitto/conf.d/
|
||||
$(CP) $(PKG_BUILD_DIR)/build/dist/* $(1)/sulu
|
||||
$(CP) $(PKG_BUILD_DIR)/build/src/config/widgets/*.json $(1)/sulu/config/
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,${PKG_NAME}))
|
||||
|
||||
27
sulu-builder/files/etc/init.d/sulu
Executable file
27
sulu-builder/files/etc/init.d/sulu
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t sulu.init -p debug
|
||||
}
|
||||
|
||||
start_service() {
|
||||
procd_open_instance sulu
|
||||
# append sulu connection injection
|
||||
procd_close_instance
|
||||
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_config_trigger "config.change" "obuspa" /etc/init.d/sulu reload
|
||||
}
|
||||
3
sulu-builder/files/etc/mosquitto/conf.d/obuspa.conf
Normal file
3
sulu-builder/files/etc/mosquitto/conf.d/obuspa.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
listener 1883 127.0.0.1
|
||||
allow_anonymous true
|
||||
|
||||
5
sulu-builder/files/etc/mosquitto/conf.d/sulu.conf
Normal file
5
sulu-builder/files/etc/mosquitto/conf.d/sulu.conf
Normal file
@@ -0,0 +1,5 @@
|
||||
listener 9001
|
||||
protocol websockets
|
||||
plugin /usr/lib/mosquitto_auth_shadow.so
|
||||
require_certificate false
|
||||
allow_anonymous false
|
||||
18
sulu-builder/files/etc/nginx/conf.d/sulu.locations
Normal file
18
sulu-builder/files/etc/nginx/conf.d/sulu.locations
Normal file
@@ -0,0 +1,18 @@
|
||||
location /config/ {
|
||||
autoindex on;
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
if ($request_method = 'GET') {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
|
||||
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
|
||||
}
|
||||
}
|
||||
10
sulu-builder/files/etc/uci-defaults/90-sulu-set-nginx-conf
Normal file
10
sulu-builder/files/etc/uci-defaults/90-sulu-set-nginx-conf
Normal file
@@ -0,0 +1,10 @@
|
||||
mkdir -p /tmp/sulu
|
||||
|
||||
uci -q get nginx._sulu && exit 0
|
||||
|
||||
uci -q set nginx._sulu=server
|
||||
uci -q add_list nginx._sulu.listen='8080'
|
||||
uci -q add_list nginx._sulu.listen='[::]:8080'
|
||||
uci -q set nginx._sulu.root='/sulu'
|
||||
uci -q set nginx._sulu.server_name='_sulu'
|
||||
uci -q add_list nginx._sulu.include='conf.d/sulu.locations'
|
||||
@@ -1,59 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2021 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu-server
|
||||
PKG_VERSION:=0.0.1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-server.git
|
||||
PKG_SOURCE_VERSION:=a93a29eab7d018ca24cd32fb8b183c5c62c11a78
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=PROPRIETARY IOPSYS
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
PKG_BUILD_DEPENDS:=node-yarn/host
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/sulu-server
|
||||
SECTION:=sulu
|
||||
CATEGORY:=Utilities
|
||||
MENU=1
|
||||
TITLE:=Express based SULU-server
|
||||
DEPENDS:=+nginx +node
|
||||
endef
|
||||
|
||||
define Package/sulu-server/description
|
||||
Express based web server for SULU.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
$(Build/Prepare/Default)
|
||||
echo "PORT=7071" >>$(PKG_BUILD_DIR)/.env
|
||||
echo "JWT_SECRET=d10365eff77ca1aebd6421b3a8c742c7881959283198ddd764c7c685ba6b70124e09633e05e57640c030c192c5bea4293f5f968538d6c636e4e6b0ff0d0e4ecc" >>$(PKG_BUILD_DIR)/.env
|
||||
echo "RESOURCES_PATH=/sulu-server" >>$(PKG_BUILD_DIR)/.env
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
cd $(PKG_BUILD_DIR) && yarn install && yarn build:dev-clean
|
||||
endef
|
||||
|
||||
define Package/sulu-server/install
|
||||
$(INSTALL_DIR) $(1)/sulu-server
|
||||
$(INSTALL_DIR) $(1)/etc/nginx/conf.d
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/sbin/
|
||||
$(INSTALL_DIR) $(1)/sulu-server/secret
|
||||
$(INSTALL_DIR) $(1)/sulu-server/private
|
||||
$(CP) $(PKG_BUILD_DIR)/dist/* $(1)/sulu-server/
|
||||
$(CP) $(PKG_BUILD_DIR)/.env $(1)/sulu-server/
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,sulu-server))
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
START=99
|
||||
STOP=01
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t sulu-server.init -p debug
|
||||
}
|
||||
|
||||
start_service() {
|
||||
procd_open_instance sulu-server
|
||||
procd_set_param limits cpu="1"
|
||||
procd_set_param command /sbin/sulu-server
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "obuspa" "mosquitto"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
location / {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
proxy_pass http://127.0.0.1:7071;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
mkdir -p /tmp/sulu-server
|
||||
|
||||
uci -q get nginx._sulu && exit 0
|
||||
|
||||
uci -q set nginx._sulu_server=server
|
||||
uci -q add_list nginx._sulu_server.listen='7070 ssl'
|
||||
uci -q add_list nginx._sulu_server.listen='[::]:7070 ssl'
|
||||
uci -q set nginx._sulu_server.root='/sulu-server'
|
||||
uci -q set nginx._sulu_server.server_name='_sulu_server'
|
||||
uci -q add_list nginx._sulu_server.include='conf.d/sulu_server.locations'
|
||||
uci -q set nginx._sulu_server.uci_manage_ssl='self-signed'
|
||||
uci -q set nginx._sulu_server.ssl_certificate='/etc/nginx/conf.d/_lan.crt'
|
||||
uci -q set nginx._sulu_server.ssl_certificate_key='/etc/nginx/conf.d/_lan.key'
|
||||
uci -q set nginx._sulu_server.ssl_session_cache='shared:SSL:32k'
|
||||
uci -q set nginx._sulu_server.ssl_session_timeout='64m'
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd /sulu-server/ && node /sulu-server/index.js
|
||||
@@ -5,11 +5,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sulu
|
||||
PKG_VERSION:=1.0.12
|
||||
PKG_VERSION:=1.1.4
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu.git
|
||||
PKG_SOURCE_VERSION:=fc82a32ab3cdcb18dc3aa7b907c62d8bed29b4ff
|
||||
PKG_SOURCE_VERSION:=ca38b2086cee7ba83b41eec56539e9432271a349
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
@@ -28,7 +28,7 @@ define Package/sulu
|
||||
CATEGORY:=Utilities
|
||||
MENU=1
|
||||
TITLE:=SULU-CE ReactJS based Web UI Package
|
||||
DEPENDS:=+nginx
|
||||
DEPENDS:=+nginx +mosquitto-auth-shadow
|
||||
endef
|
||||
|
||||
define Package/sulu/description
|
||||
@@ -39,6 +39,7 @@ define Package/sulu/install
|
||||
$(INSTALL_DIR) $(1)/sulu
|
||||
$(INSTALL_DIR) $(1)/sulu/config
|
||||
$(INSTALL_DIR) $(1)/etc/nginx/
|
||||
$(INSTALL_DIR) $(1)/etc/mosquitto/conf.d/
|
||||
$(CP) $(PKG_BUILD_DIR)/dist/* $(1)/sulu
|
||||
$(CP) $(PKG_BUILD_DIR)/config/* $(1)/sulu/config
|
||||
$(CP) ./files/* $(1)/
|
||||
|
||||
3
sulu/files/etc/mosquitto/conf.d/obuspa.conf
Normal file
3
sulu/files/etc/mosquitto/conf.d/obuspa.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
listener 1883 127.0.0.1
|
||||
allow_anonymous true
|
||||
|
||||
5
sulu/files/etc/mosquitto/conf.d/sulu.conf
Normal file
5
sulu/files/etc/mosquitto/conf.d/sulu.conf
Normal file
@@ -0,0 +1,5 @@
|
||||
listener 9001
|
||||
protocol websockets
|
||||
plugin /usr/lib/mosquitto_auth_shadow.so
|
||||
require_certificate false
|
||||
allow_anonymous false
|
||||
@@ -1,9 +1,22 @@
|
||||
if PACKAGE_swmodd
|
||||
|
||||
menu "Configuration"
|
||||
depends on PACKAGE_swmodd
|
||||
|
||||
config SWMOD_HOST_IS_EXECENV
|
||||
bool "Enable host system as execution environment"
|
||||
default n
|
||||
config SWMODD_LXC_SUPPORT
|
||||
bool "Handles LXC based containers"
|
||||
default n
|
||||
depends on PACKAGE_swmodd
|
||||
select PACKAGE_liblxc
|
||||
|
||||
config SWMODD_OCI_SUPPORT
|
||||
bool "Handles OCI containers"
|
||||
default y
|
||||
depends on PACKAGE_swmodd
|
||||
select PACKAGE_crun
|
||||
|
||||
config SWMODD_REGISTRY_PULL_SUPPORT
|
||||
bool "Add support to pull images from container image registries (i.e: docker.io, quay.io)"
|
||||
default n
|
||||
depends on PACKAGE_swmodd
|
||||
select PACKAGE_skopeo
|
||||
select PACKAGE_umoci
|
||||
endmenu
|
||||
endif
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=swmodd
|
||||
PKG_VERSION:=2.1.5
|
||||
PKG_VERSION:=2.1.16
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=2f953ea76b5779a73a540777dfb450982802e4f8
|
||||
PKG_SOURCE_VERSION:=5124ea8051c06e8c3563b384660b08db199c93eb
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/swmodd.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
@@ -30,8 +30,9 @@ define Package/swmodd
|
||||
SUBMENU:=TRx69
|
||||
TITLE:= Software Modules Daemon
|
||||
DEPENDS:=+libuci +libubox +ubus +libuuid +opkg +libcurl \
|
||||
+PACKAGE_liblxc:liblxc +PACKAGE_liblxc:cgroupfs-mount \
|
||||
+@BUSYBOX_CONFIG_BUSYBOX +@BUSYBOX_CONFIG_FEATURE_SHOW_SCRIPT
|
||||
+PACKAGE_liblxc:liblxc +@BUSYBOX_CONFIG_BUSYBOX \
|
||||
+@BUSYBOX_CONFIG_FEATURE_SHOW_SCRIPT +@BUSYBOX_CONFIG_SCRIPT \
|
||||
+swmodd-cgroup +jq
|
||||
endef
|
||||
|
||||
define Package/swmodd/description
|
||||
@@ -42,21 +43,28 @@ define Package/swmodd/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/swmodd-cgroup
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:= Cgroup mount handler for Software modules daemon
|
||||
DEPENDS:=+@CONFIG_KERNEL_CGROUPS
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-D_GNU_SOURCE \
|
||||
-Wall -Werror
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_crun),y)
|
||||
MAKE_FLAGS += \
|
||||
SWMOD_CRUN="yes"
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PACKAGE_liblxc),y)
|
||||
MAKE_FLAGS += \
|
||||
SWMOD_LXC="yes"
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SWMOD_HOST_IS_EXECENV),y)
|
||||
MAKE_FLAGS += \
|
||||
SWMOD_HOST_IS_EXECENV="yes"
|
||||
endif
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/swmodd/* $(PKG_BUILD_DIR)/
|
||||
@@ -67,7 +75,6 @@ define Package/swmodd/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||
$(INSTALL_DIR) $(1)/etc/swmod
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) ./files/etc/init.d/swmodd $(1)/etc/init.d/swmodd
|
||||
$(INSTALL_BIN) ./files/etc/config/swmodd $(1)/etc/config/swmodd
|
||||
@@ -79,6 +86,21 @@ ifeq ($(CONFIG_PACKAGE_liblxc),y)
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/templates/lxc-iopsys $(1)/usr/share/lxc/templates/lxc-iopsys
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/opkg_offline.sh $(1)/usr/share/swmodd/opkg_offline
|
||||
endif
|
||||
ifeq ($(CONFIG_PACKAGE_crun),y)
|
||||
$(INSTALL_DIR) $(1)/etc/swmodd
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./files/etc/swmodd/run.sh $(1)/etc/swmodd/run.sh
|
||||
$(INSTALL_BIN) ./files/etc/init.d/crun $(1)/etc/init.d/crun
|
||||
$(INSTALL_BIN) ./files/etc/config/crun $(1)/etc/config/crun
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/crun_create $(1)/usr/sbin/crun_create
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/01-fix-bundle-path $(1)/etc/uci-defaults/01-fix-bundle-path
|
||||
endif
|
||||
endef
|
||||
|
||||
define Package/swmodd-cgroup/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/etc/init.d/swmodd_cgroup $(1)/etc/init.d/swmodd_cgroup
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,swmodd-cgroup))
|
||||
$(eval $(call BuildPackage,swmodd))
|
||||
|
||||
2
swmodd/files/etc/config/crun
Normal file
2
swmodd/files/etc/config/crun
Normal file
@@ -0,0 +1,2 @@
|
||||
config global global
|
||||
option enable '1'
|
||||
@@ -1,4 +1,5 @@
|
||||
config globals 'globals'
|
||||
option enabled '1'
|
||||
option debug '1'
|
||||
option log_level '3'
|
||||
option enabled '1'
|
||||
option debug '1'
|
||||
option log_level '3'
|
||||
option lan_bridge 'br-lan'
|
||||
|
||||
190
swmodd/files/etc/init.d/crun
Normal file
190
swmodd/files/etc/init.d/crun
Normal file
@@ -0,0 +1,190 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=01
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t crun.init -p info
|
||||
}
|
||||
|
||||
is_container_running() {
|
||||
crun list |tail -n +2|grep -wq "^${1}"
|
||||
return $?
|
||||
}
|
||||
|
||||
configure_crun_container() {
|
||||
local name type autostart du_status requested_state url username password
|
||||
local BRIDGE BUNDLE
|
||||
local RUNNER="/etc/swmodd/run.sh"
|
||||
|
||||
BUNDLE="${2}"
|
||||
BRIDGE="${3}"
|
||||
|
||||
config_get name ${1} name ""
|
||||
config_get type ${1} type ""
|
||||
config_get_bool autostart ${1} autostart 1
|
||||
config_get du_status ${1} du_status ""
|
||||
config_get requested_state ${1} requested_state ""
|
||||
config_get url ${1} url ""
|
||||
config_get username ${1} username ""
|
||||
config_get password ${1} password ""
|
||||
|
||||
if [ -z "${name}" ] || [ -z "${type}" ] || [ -z "${du_status}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ "${type}" != "crun" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ "${du_status}" == "Installing" ]; then
|
||||
local result
|
||||
log "Pull image from registry"
|
||||
uci_set ocicontainer ${1} du_status Installing_start
|
||||
uci_set ocicontainer ${1} username ""
|
||||
uci_set ocicontainer ${1} password ""
|
||||
result=$(${RUNNER} -b "${BUNDLE}" -n "${name}" -r "${url}" -l "${username}:${password}")
|
||||
if [ "$?" -eq 0 ]; then
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer ${1} description "${result}"
|
||||
fi
|
||||
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_vendor")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer ${1} vendor "${result}"
|
||||
fi
|
||||
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_version")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer ${1} version "${result}"
|
||||
fi
|
||||
|
||||
uci_set ocicontainer ${1} du_status Installing_success
|
||||
du_status="Installed"
|
||||
else
|
||||
uci_set ocicontainer ${1} du_status Installing_failed
|
||||
uci_set ocicontainer ${1} fault_string "${result}"
|
||||
return 0;
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${du_status}" == "Uninstalling" ]; then
|
||||
ubus call service delete "{\"name\":\"crun\",\"instance\":\"${name}\"}"
|
||||
if is_container_running "${name}"; then
|
||||
crun kill --all "${name}" 9
|
||||
fi
|
||||
${RUNNER} -c -n "${name}"
|
||||
if [ -d "${BUNDLE:?}/${name:?}" ]; then
|
||||
rm -rf "${BUNDLE:?}/${name:?}"
|
||||
fi
|
||||
|
||||
# If directory still exists then uninstall failed
|
||||
if [ -d "${BUNDLE}/${name}" ]; then
|
||||
uci_set ocicontainer ${1} du_status Uninstalling_failed
|
||||
uci_set ocicontainer ${1} fault_string "Failed to remove ${BUNDLE}/${name}"
|
||||
else
|
||||
uci_set ocicontainer ${1} du_status Uninstalling_success
|
||||
fi
|
||||
# Delete the uci config section after uninstall
|
||||
log "CRUN container ${name} removed"
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ ! -d "${BUNDLE:?}/${name:?}" ]; then
|
||||
log "Crun container {${BUNDLE:?}/${name:?}} not available"
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ "${du_status}" != "Installed" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ "${autostart}" -eq 0 ]; then
|
||||
ubus call service delete "{\"name\":\"crun\",\"instance\":\"${name}\"}"
|
||||
# stop the container if not enabled
|
||||
crun kill --all "${name}" 9
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if is_container_running "${name}"; then
|
||||
log "Container [$name] req_status [${requested_state}]"
|
||||
if [ "${requested_state}" == "Idle" ]; then
|
||||
crun pause "${name}"
|
||||
elif [ "${requested_state}" == "Active" ]; then
|
||||
${RUNNER} -u -n "${name}" -i "${BRIDGE}"
|
||||
crun resume "${name}"
|
||||
fi
|
||||
else
|
||||
${RUNNER} -U -b "${BUNDLE}" -n "${name}"
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer ${1} description "${result}"
|
||||
fi
|
||||
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_vendor")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer ${1} vendor "${result}"
|
||||
fi
|
||||
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_version")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer ${1} version "${result}"
|
||||
fi
|
||||
fi
|
||||
|
||||
procd_open_instance "${name}"
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_set_param command "${RUNNER}"
|
||||
procd_append_param command -b "${BUNDLE}" -n "${name}" -i "${BRIDGE}"
|
||||
procd_set_param respawn
|
||||
procd_close_instance "${name}"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local bundle bridge
|
||||
|
||||
# Check if crun present
|
||||
if ! command -v crun >/dev/null 2>&1; then
|
||||
log "CRUN binary not found"
|
||||
return 0;
|
||||
fi
|
||||
|
||||
config_load swmodd
|
||||
config_get bundle globals oci_bundle_root ""
|
||||
config_get bridge globals lan_bridge "br-lan"
|
||||
|
||||
if [ -z "${bundle}" ] || [ -z "${bridge}" ]; then
|
||||
log "Empty bundle path or bridge"
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ -f "${bundle}/ocicontainer" ]; then
|
||||
UCI_CONFIG_DIR="${bundle}"
|
||||
config_load ocicontainer
|
||||
config_foreach configure_crun_container du_eu_assoc "${bundle}" "${bridge}"
|
||||
uci_commit
|
||||
# Add a timer for DuStateChange!
|
||||
(sleep 5 && ubus -t 5 call swmodules reload) &
|
||||
fi
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
local cid
|
||||
|
||||
cid="$(crun list|tail -n +2 |awk '{printf $1 " "}')"
|
||||
for f in $cid; do
|
||||
crun kill --all "${f}" 9
|
||||
done
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "crun" "network"
|
||||
}
|
||||
@@ -12,46 +12,97 @@ validate_globals_section()
|
||||
'enabled:bool:1' \
|
||||
'debug:bool:false' \
|
||||
'log_level:uinteger:1' \
|
||||
'lxc_bundle_root:string' \
|
||||
'oci_bundle_root:string' \
|
||||
'sock:string'
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enabled debug log_level sock
|
||||
start_lxc_container() {
|
||||
config_get name "${1}" name ""
|
||||
config_get type "${1}" type ""
|
||||
config_get autostart "${1}" autostart "0"
|
||||
config_get timeout "${1}" timeout "300"
|
||||
|
||||
# creating fallback shared mount-point
|
||||
mkdir -p /tmp/swmodd_dw
|
||||
if [ -z "${name}" ] || [ -z "${type}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ "${type}" != "lxc" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
state=$(lxc-ls -f | tail -n +2 | grep -w "${name}" | cut -d " " -f 2)
|
||||
if [ -z "${state}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ "${autostart}" == "0" ]; then
|
||||
if [ "${state}" == "RUNNING" ]; then
|
||||
# stop the container if running
|
||||
lxc-stop -n "${name}" -t "${timeout}" &
|
||||
return 0;
|
||||
elif [ "${state}" == "FROZEN" ]; then
|
||||
# first unfreeze then stop
|
||||
lxc-unfreeze -n "${name}"
|
||||
lxc-stop -n "${name}" -t "${timeout}" &
|
||||
return 0;
|
||||
fi
|
||||
else
|
||||
if [ "${state}" == "FROZEN" ]; then
|
||||
# unfreeze the container
|
||||
lxc-unfreeze -n "${name}"
|
||||
elif [ "${state}" == "STOPPED" ]; then
|
||||
# start the container
|
||||
lxc-start -n "${name}"
|
||||
return 0;
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enabled debug log_level sock lxc_bundle_root oci_bundle_root
|
||||
|
||||
config_load swmodd
|
||||
|
||||
validate_globals_section || {
|
||||
log "Validation of uci globals failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
[ "${enabled}" -eq 0 ] && return 0
|
||||
|
||||
# Create the bundle paths if not present
|
||||
[ -n "${lxc_bundle_root}" ] && mkdir -p "${lxc_bundle_root}"
|
||||
[ -n "${oci_bundle_root}" ] && mkdir -p "${oci_bundle_root}"
|
||||
|
||||
procd_open_instance swmodd
|
||||
procd_set_param command ${PROG}
|
||||
|
||||
if [ "${debug}" -eq 1 ]; then
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_append_param command -l ${log_level}
|
||||
procd_append_param command -l "${log_level}"
|
||||
fi
|
||||
|
||||
if [ -f "${sock}" ]; then
|
||||
procd_append_param command -s ${sock}
|
||||
procd_append_param command -s "${sock}"
|
||||
fi
|
||||
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
service_stop ${PROG}
|
||||
# Auto-start the lxc containers
|
||||
if [ -f "${lxc_bundle_root}/lxccontainer" ]; then
|
||||
UCI_CONFIG_DIR="${lxc_bundle_root}"
|
||||
config_load lxccontainer
|
||||
config_foreach start_lxc_container container
|
||||
fi
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "swmodd"
|
||||
}
|
||||
|
||||
56
swmodd/files/etc/init.d/swmodd_cgroup
Normal file
56
swmodd/files/etc/init.d/swmodd_cgroup
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=01
|
||||
|
||||
log() {
|
||||
echo "swmodd_cgroup: ${@}" >/dev/console
|
||||
}
|
||||
|
||||
cgroup_remounting_required()
|
||||
{
|
||||
if ! mount |grep -q '/sys/fs/cgroup '; then
|
||||
return 1;
|
||||
fi
|
||||
|
||||
if grep -v '^#' /etc/fstab | grep -q cgroup; then
|
||||
log "fstab mounted system, remounting of cgroup not required"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -d /sys/fs/cgroup ] && [ ! -e /proc/cgroups ]; then
|
||||
log "cgroup fs not found"
|
||||
return 1
|
||||
fi
|
||||
|
||||
umount /sys/fs/cgroup
|
||||
return 0;
|
||||
}
|
||||
|
||||
mount_cgroup()
|
||||
{
|
||||
|
||||
if ! cgroup_remounting_required; then
|
||||
log "cgroup remounting not required"
|
||||
return 1
|
||||
fi
|
||||
|
||||
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
|
||||
cd /sys/fs/cgroup
|
||||
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
|
||||
mkdir -p $sys
|
||||
if ! mountpoint -q $sys; then
|
||||
if ! mount -n -t cgroup -o $sys cgroup $sys; then
|
||||
rm -f $sys || true
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e /sys/fs/cgroup/memory/memory.use_hierarchy ]; then
|
||||
echo 1 > /sys/fs/cgroup/memory/memory.use_hierarchy
|
||||
fi
|
||||
}
|
||||
|
||||
boot()
|
||||
{
|
||||
mount_cgroup
|
||||
}
|
||||
262
swmodd/files/etc/swmodd/run.sh
Normal file
262
swmodd/files/etc/swmodd/run.sh
Normal file
@@ -0,0 +1,262 @@
|
||||
#!/bin/sh
|
||||
|
||||
VETHNAME=""
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t crun.runner -p info
|
||||
echo "${@}"
|
||||
}
|
||||
|
||||
check_binary() {
|
||||
if [ -z "${1}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if ! command -v "${1}" >/dev/null 2>&1;then
|
||||
log "${1} not present in system"
|
||||
exit 1
|
||||
fi
|
||||
return 0;
|
||||
}
|
||||
|
||||
check_binary crun
|
||||
check_binary script
|
||||
|
||||
get_veth_name() {
|
||||
local name
|
||||
|
||||
name="cr$1"
|
||||
VETHNAME="${name:0:15}"
|
||||
}
|
||||
|
||||
clean_container_network() {
|
||||
local name
|
||||
|
||||
name="${1}"
|
||||
# clean up
|
||||
if ip netns list|grep -qw "${name}"; then
|
||||
get_veth_name "${name}"
|
||||
ip netns del "${name}"
|
||||
ip link delete "${VETHNAME}" type veth peer name eth0
|
||||
fi
|
||||
}
|
||||
|
||||
setup_container_network() {
|
||||
local name bridge_name
|
||||
|
||||
if [ "$#" -lt 2 ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
name="${1}"
|
||||
bridge_name="${2}"
|
||||
|
||||
clean_container_network "${name}"
|
||||
get_veth_name "${name}"
|
||||
# Add a namespace
|
||||
ip netns add "${name}"
|
||||
# Add a veth pair
|
||||
ip link add "${VETHNAME}" type veth peer name eth0 netns "$name"
|
||||
# Make veth on network side up
|
||||
ip netns exec "$name" ip link set dev eth0 up
|
||||
# Create loopback interface
|
||||
ip netns exec "$name" ip link set lo up
|
||||
# Make veth on host side up
|
||||
ip link set dev "${VETHNAME}" up
|
||||
# Link with host bridge
|
||||
brctl addif "${bridge_name}" "${VETHNAME}"
|
||||
# Get Ip from bridge and make the link ready
|
||||
ip netns exec "$name" udhcpc -i eth0 -x hostname:"CRUN-${name}"
|
||||
if [ "${du_status}" != "Installed" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
run_container() {
|
||||
local bundle name bridge
|
||||
|
||||
bundle="${1}"
|
||||
name="${2}"
|
||||
bridge="${3}"
|
||||
|
||||
if [ ! -d "${bundle:?}/${name:?}" ]; then
|
||||
log "Bundle does not exists"
|
||||
return 1
|
||||
fi
|
||||
|
||||
setup_container_network "${name}" "${bridge}"
|
||||
|
||||
script -q -c "crun run -b ${bundle}/${name} ${name}" /dev/null
|
||||
}
|
||||
|
||||
update_network_ns() {
|
||||
local type
|
||||
json_select $2
|
||||
json_get_var type type
|
||||
if [ "${type}" == "network" ]; then
|
||||
json_add_string path "/var/run/netns/${NAME}"
|
||||
break;
|
||||
fi
|
||||
json_select ..
|
||||
}
|
||||
|
||||
nginx_hack() {
|
||||
# replace nginx user to root user
|
||||
if [ -f "${BUNDLE:?}/${NAME:?}/rootfs/etc/nginx/nginx.conf" ]; then
|
||||
sed -i 's/^user .*;$/user root;/' "${BUNDLE}/${NAME}/rootfs/etc/nginx/nginx.conf"
|
||||
fi
|
||||
}
|
||||
|
||||
update_config_json() {
|
||||
|
||||
if [ ! -f "${BUNDLE:?}/${NAME:?}/config.json" ]; then
|
||||
log "config.json not found or bundle missing"
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
if [ -f "/usr/share/libubox/jshn.sh" ]; then
|
||||
. /usr/share/libubox/jshn.sh
|
||||
else
|
||||
log "jshn.sh missing in the system"
|
||||
exit 1;
|
||||
fi
|
||||
cd "${BUNDLE}/${NAME}"
|
||||
if cat config.json |jq '.linux.namespaces[] |select (.type == "network") |.path' |grep -q ${NAME}; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
mv config.json config_orig.json
|
||||
json_init
|
||||
json_load_file "config_orig.json"
|
||||
json_select linux
|
||||
json_for_each_item update_network_ns namespaces
|
||||
json_dump >config.json
|
||||
|
||||
nginx_hack
|
||||
}
|
||||
|
||||
pull_image_from_registry() {
|
||||
local temp disksize exsize
|
||||
|
||||
if [ -z "${BUNDLE}" -o -z "${NAME}" -o -z "${REGURL}" ]; then
|
||||
log "Information missing for installation"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "${BUNDLE}/${NAME}" ]; then
|
||||
log "Container with same name already present"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
check_binary skopeo
|
||||
check_binary umoci
|
||||
temp="$(mktemp -d)"
|
||||
if [ ! -d "${temp}" ]; then
|
||||
log "Failed to create temp directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "${temp}"
|
||||
OPTS=""
|
||||
INSPECT_OPT=""
|
||||
if [ "${#LOGIN}" -gt 3 ]; then
|
||||
OPTS="--src-creds ${LOGIN}"
|
||||
INSPECT_OPT="--creds ${LOGIN}"
|
||||
fi
|
||||
if ! skopeo --command-timeout 4m copy ${OPTS} ${REGURL} oci:${NAME}_tmp:latest >/dev/null 2>&1; then
|
||||
log "Failed to download image"
|
||||
cd -
|
||||
rm -rf "${temp}"
|
||||
exit 1
|
||||
fi
|
||||
if ! umoci unpack --image ${NAME}_tmp:latest ${NAME} >/dev/null 2>&1; then
|
||||
log "Failed to unpack image"
|
||||
cd -
|
||||
rm -rf "${temp}"
|
||||
exit 1
|
||||
fi
|
||||
rm -rf "${NAME}_tmp"
|
||||
if [ ! -f "${NAME}/config.json" ]; then
|
||||
log "Failed to pull the image config missing"
|
||||
cd -
|
||||
rm -rf "${temp}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check disk available space before copy
|
||||
disksize=$(df -P -k ${BUNDLE} |tail -n +2 |awk '{print $4}')
|
||||
exsize=$(du -s ${temp} |awk '{print $1}')
|
||||
if [ "${disksize}" -lt "${exsize}" ]; then
|
||||
log "Disk space ${disksize} less that required ${exists}"
|
||||
cd -
|
||||
rm -rf "${temp}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mv ${NAME} ${BUNDLE}/
|
||||
if [ "$?" -ne 0 ]; then
|
||||
log "Failed ${name} move in ${BUNDLE}"
|
||||
cd -
|
||||
rm -rf "${temp}"
|
||||
rm -rf ${BUNDLE}/${NAME}
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd -
|
||||
rm -rf "${temp}"
|
||||
update_config_json
|
||||
}
|
||||
|
||||
clean=0
|
||||
net_update=0
|
||||
update_json=0
|
||||
while getopts b:n:i:r:l:cuU options
|
||||
do
|
||||
case "${options}" in
|
||||
b) BUNDLE=${OPTARG};;
|
||||
n) NAME=${OPTARG};;
|
||||
i) BRIDGE=${OPTARG};;
|
||||
r) REGURL=${OPTARG};;
|
||||
l) LOGIN=${OPTARG};;
|
||||
c) clean=1;;
|
||||
u) net_update=1;;
|
||||
U) update_json=1;;
|
||||
*) log "Invalid options";;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "${NAME}" ]; then
|
||||
log "Emtpy container name"
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ "${update_json}" -eq 1 ]; then
|
||||
update_config_json
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ -n "${REGURL}" ]; then
|
||||
pull_image_from_registry
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ "$clean" -eq 1 ]; then
|
||||
clean_container_network "${NAME}"
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ -z "${BRIDGE}" ]; then
|
||||
log "Empty bridge name"
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ "${net_update}" -eq 1 ]; then
|
||||
get_veth_name "${NAME}"
|
||||
brctl addif "${BRIDGE}" "${VETHNAME}"
|
||||
return 0;
|
||||
fi
|
||||
|
||||
if [ -n "${BUNDLE}" ] ; then
|
||||
run_container "${BUNDLE}" "${NAME}" "${BRIDGE}"
|
||||
fi
|
||||
43
swmodd/files/etc/uci-defaults/01-fix-bundle-path
Normal file
43
swmodd/files/etc/uci-defaults/01-fix-bundle-path
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
lxc=""
|
||||
lxc_bundle=""
|
||||
oci_bundle=""
|
||||
|
||||
if [ -f "/etc/lxc/lxc.conf" ]; then
|
||||
lxc=$(cat /etc/lxc/lxc.conf |grep "lxc.lxcpath"| cut -d "=" -f 2)
|
||||
fi
|
||||
|
||||
config_load swmodd
|
||||
config_get lxc_bundle globals lxc_bundle_root ""
|
||||
config_get oci_bundle globals oci_bundle_root ""
|
||||
|
||||
if [ -n "${lxc_bundle}" ]; then
|
||||
# if lxc_bundle_root define in swmodd, update it in lxc path
|
||||
mkdir -p /etc/lxc
|
||||
echo "lxc.lxcpath = ${lxc_bundle}" > /etc/lxc/lxc.conf
|
||||
elif [ -n "${lxc}" ]; then
|
||||
# if lxc_bundle_root not define in swmodd, update it with lxc path
|
||||
uci_set swmodd globals lxc_bundle_root ${lxc}
|
||||
uci_commit
|
||||
else
|
||||
mkdir -p /etc/lxc
|
||||
echo "lxc.lxcpath = /srv/" > /etc/lxc/lxc.conf
|
||||
uci_set swmodd globals lxc_bundle_root "/srv/"
|
||||
uci_commit
|
||||
fi
|
||||
|
||||
if [ -z "${oci_bundle}" ] && [ -n "${lxc_bundle}" ]; then
|
||||
# if oci_bundle_root not defined in swmodd, update it with lxc_bundle_root if defined
|
||||
uci_set swmodd globals oci_bundle_root ${lxc_bundle}
|
||||
uci_commit
|
||||
elif [ -z "${oci_bundle}" ] && [ -n "${lxc}" ]; then
|
||||
# if oci_bundle_root not defined in swmodd, update it with lxc path
|
||||
uci_set swmodd globals oci_bundle_root ${lxc}
|
||||
uci_commit
|
||||
elif [ -z "${oci_bundle}" ]; then
|
||||
uci_set swmodd globals oci_bundle_root "/srv/"
|
||||
uci_commit
|
||||
fi
|
||||
@@ -6,13 +6,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=twamp
|
||||
PKG_VERSION:=1.2.0
|
||||
PKG_VERSION:=1.2.1
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/twamp-light.git
|
||||
PKG_SOURCE_VERSION:=4dfc8609fb0cefaaf9e86b559b1e10488117cf07
|
||||
PKG_SOURCE_VERSION:=b0111c35ff4908edd82c5d5f4a3c0d6809605b94
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
@@ -41,7 +41,7 @@ TARGET_CFLAGS += \
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/twamp/* $(PKG_BUILD_DIR)/
|
||||
$(CP) -rf ~/git/twamp-light/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
@@ -58,6 +58,7 @@ define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_BIN) ./files/etc/init.d/twampd $(1)/etc/init.d/twampd
|
||||
$(INSTALL_BIN) ./files/etc/firewall.twamp $(1)/etc/firewall.twamp
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/92-twampfirewall $(1)/etc/uci-defaults/92-twampfirewall
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/93-twamp_fix_reflector $(1)/etc/uci-defaults/93-twamp_fix_reflector
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
|
||||
config twamp 'twamp'
|
||||
option enable '0'
|
||||
#Log levels: Critical=0, Error=1, Warning=2, Notice=3, Info=4, Debug=5
|
||||
option log_level '4'
|
||||
option log_level '3'
|
||||
|
||||
config twamp_reflector 'reflector_1'
|
||||
option enable '0'
|
||||
option interface 'wan'
|
||||
option port '862'
|
||||
option max_ttl '1'
|
||||
|
||||
@@ -29,7 +29,7 @@ function configure_firewall()
|
||||
|
||||
function delete_rule()
|
||||
{
|
||||
while iptables -w 1 -L zone_${1}_input --line-numbers | grep "TWAMP reflector port" > /dev/null; do
|
||||
while iptables -w 1 -L zone_${1}_input --line-numbers | grep "TWAMP reflector port" > /dev/null 2>&1; do
|
||||
iptables -w 1 -D zone_${1}_input $(iptables -w 1 -L zone_${1}_input --line-numbers | grep "TWAMP reflector port" | head -1|awk '{print $1}');
|
||||
done
|
||||
}
|
||||
|
||||
22
twamp/files/etc/uci-defaults/93-twamp_fix_reflector
Normal file
22
twamp/files/etc/uci-defaults/93-twamp_fix_reflector
Normal file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
function rename_section()
|
||||
{
|
||||
local enable inst
|
||||
|
||||
config_get interface ${1} interface ""
|
||||
if [ -z "${interface}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
inst="$(echo ${1}|cut -d '_' -f 2)"
|
||||
uci_rename twamp ${1} "${interface}_${inst}"
|
||||
}
|
||||
|
||||
config_load twamp
|
||||
config_foreach rename_section twamp_reflector
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=umoci
|
||||
PKG_VERSION:=0.0.1
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=0.4.7
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
@@ -10,7 +10,7 @@ PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_NAME:=umoci
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://github.com/opencontainers/umoci.git
|
||||
PKG_SOURCE_VERSION:=2cec49f54b72684ef170f11c708c56140f298bf7
|
||||
PKG_SOURCE_VERSION:=17f38511d61846e2fb8ec01a1532f3ef5525e71d
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
@@ -18,11 +18,12 @@ PKG_BUILD_PARALLEL:=1
|
||||
PKG_USE_MIPS16:=0
|
||||
|
||||
GO_PKG:=github.com/opencontainers/umoci/
|
||||
GO_PKG_LDFLAGS_X:=main.gitCommit=$(PKG_SOURCE_VERSION) main.version=$(PKG_SOURCE_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
GOLANG_PACKAGE_MK:=$(wildcard $(TOPDIR)/feeds/*/lang/golang/golang-package.mk)
|
||||
GOLANG_HOST_PACKAGE_MK:=$(wildcard $(TOPDIR)/feeds/*/lang/golang/golang-host-build.mk)
|
||||
|
||||
# verify that there is only one single file returned
|
||||
ifneq (1,$(words $(GOLANG_PACKAGE_MK)))
|
||||
@@ -36,6 +37,7 @@ $(info found golang-package.mk at $(GOLANG_PACKAGE_MK))
|
||||
endif
|
||||
|
||||
include $(GOLANG_PACKAGE_MK)
|
||||
include $(GOLANG_HOST_PACKAGE_MK)
|
||||
|
||||
define Package/umoci
|
||||
SECTION:=utils
|
||||
@@ -61,5 +63,7 @@ define Package/umoci/install
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/umoci $(1)/usr/bin
|
||||
endef
|
||||
|
||||
$(eval $(call GoBinHostBuild))
|
||||
$(eval $(call HostBuild))
|
||||
$(eval $(call GoBinPackage,umoci))
|
||||
$(eval $(call BuildPackage,umoci))
|
||||
|
||||
@@ -6,13 +6,13 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=urlfilter
|
||||
PKG_VERSION:=1.1.3
|
||||
PKG_VERSION:=1.1.4
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/urlfilter.git
|
||||
PKG_SOURCE_VERSION:=5a64642ac33e629151788b3ff1de920776bcd2ed
|
||||
PKG_SOURCE_VERSION:=e55a2c2c7c992eb5071e82734bdc8850b71b02e0
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=uspd
|
||||
PKG_VERSION:=2.2.12
|
||||
PKG_VERSION:=2.2.14
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/uspd.git
|
||||
PKG_SOURCE_VERSION:=b18e7cbad2c295a1dcea64fca42439f0c9cd73a2
|
||||
PKG_SOURCE_VERSION:=1c3b886bb5e654049ae81cda726dffae950369c7
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wfa-capi
|
||||
PKG_VERSION:=1.1.2
|
||||
PKG_VERSION:=1.1.3
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=ce29c2d69d0ca96b61f2de5d1ba107c8d31cb5ef
|
||||
PKG_SOURCE_VERSION:=64d9101c8e4930cbd3fe6ce471fb4cfd2b9b80dc
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/wfa-capi.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wfadatad
|
||||
PKG_VERSION:=2.8.0.1
|
||||
PKG_VERSION:=2.10.0.0
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=01fd303670eef525e35c5337c4cf15418588273f
|
||||
PKG_SOURCE_VERSION:=b75a1271c718e4fb2a45b5ac4fe73d192c864713
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/wfadatad.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wifimngr
|
||||
PKG_VERSION:=14.0.9
|
||||
PKG_VERSION:=14.2.3
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=beeffd6651723c049ea32af74d927a9baa6ee2c5
|
||||
PKG_SOURCE_VERSION:=f57015819a20d8d172899b1831fa29a9578011e8
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/wifimngr.git
|
||||
PKG_MAINTAINER:=Anjan Chanda <anjan.chanda@iopsys.eu>
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
|
||||
Reference in New Issue
Block a user