mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-21 09:33:50 +08:00
Compare commits
1 Commits
add_libblo
...
vcs
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab5f60a18a |
78
ated/Makefile
Normal file
78
ated/Makefile
Normal file
@@ -0,0 +1,78 @@
|
||||
#
|
||||
# Copyright (C) 2019 iopsys Software Solutions AB. All rights reserved.
|
||||
#
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# version 2 as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ated
|
||||
PKG_VERSION:=1.2.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=f614cba983d827d5185c60a6a5a35530621d44d2
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/mediatek/ated.git
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
# support parallel build
|
||||
#PKG_BUILD_PARALLEL:=1
|
||||
|
||||
#re create configure scripts if not present.
|
||||
#PKG_FIXUP:=autoreconf
|
||||
|
||||
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
|
||||
# this way we don't need to pick out the resulting files from the build dir.
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ated
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Daemon for handling wifi calibration
|
||||
URL:=
|
||||
DEPENDS:= libc
|
||||
endef
|
||||
|
||||
define Package/ated/description
|
||||
Daemon for handling wifi calibration
|
||||
endef
|
||||
|
||||
#TARGET_CFLAGS += -I$(LINUX_DIR)/include -I$(LINUX_DIR)/arch/mips/include
|
||||
|
||||
MAKE_FLAGS += \
|
||||
v=2 \
|
||||
m=3
|
||||
|
||||
|
||||
#TARGET_CPPFLAGS := \
|
||||
# -I$(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx \
|
||||
# -I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
|
||||
# $(TARGET_CPPFLAGS)
|
||||
|
||||
# we donot wwant to have any install.
|
||||
define Build/Install/Default
|
||||
endef
|
||||
|
||||
define Package/ated/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ated $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ated))
|
||||
@@ -1,3 +1,5 @@
|
||||
if PACKAGE_libbbfdm
|
||||
|
||||
config BBF_VENDOR_EXTENSION
|
||||
bool "Enable Vendor Extension"
|
||||
default y
|
||||
@@ -10,6 +12,10 @@ config BBF_VENDOR_PREFIX
|
||||
string "Vendor Prefix"
|
||||
default "X_IOPSYS_EU_"
|
||||
|
||||
config BBF_TR181
|
||||
bool "Enable TR-181 Data Model Support"
|
||||
default y
|
||||
|
||||
config BBF_TR104
|
||||
bool "Enable TR-104 Data Model Support"
|
||||
default y
|
||||
@@ -18,18 +24,4 @@ config BBF_TR143
|
||||
bool "Enable TR-143 Data Model Support"
|
||||
default y
|
||||
|
||||
config BBF_TR471
|
||||
bool "Enable TR-471 Data Model Support"
|
||||
default y
|
||||
|
||||
config BBFDM_ENABLE_JSON_PLUGIN
|
||||
bool "Enable json plugin to extend datamodel"
|
||||
default y
|
||||
|
||||
config BBFDM_ENABLE_DOTSO_PLUGIN
|
||||
bool "Enable shared library plugin to extend datamodel"
|
||||
default y
|
||||
|
||||
config BBF_MAX_OBJECT_INSTANCES
|
||||
int "Maximum number of instances per object"
|
||||
default 255
|
||||
endif
|
||||
|
||||
186
bbf/Makefile
186
bbf/Makefile
@@ -1,82 +1,41 @@
|
||||
#
|
||||
# Copyright (C) 2022 IOPSYS
|
||||
# Copyright (C) 2021 IOPSYS
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libbbfdm
|
||||
PKG_VERSION:=6.8.49
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_VERSION:=6.0.6
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bbf.git
|
||||
PKG_SOURCE_VERSION:=87ae46df8b4e221b8894fd861d2eb785ae1f3bf3
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=9842552d421adb529b8771b8f9dc41ddc89f5b62
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=LGPL-2.1
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/libbbf_api
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=BBF datamodel library, provides API to extend datamodel using DotSO plugins
|
||||
ABI_VERSION:=1.0
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/default
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=Library for broadband forum data model support
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libcurl +libbbf_api \
|
||||
+BBF_TR471:obudpst
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
SUBMENU:=BBF
|
||||
TITLE:=Library for libbbfdm API
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c
|
||||
endef
|
||||
|
||||
define Package/libbbfdm
|
||||
$(Package/libbbfdm/default)
|
||||
TITLE += (internal)
|
||||
VARIANT:=internal
|
||||
endef
|
||||
|
||||
define Package/libbbfdm-mbedtls
|
||||
$(Package/libbbfdm/default)
|
||||
TITLE += (mbedtls)
|
||||
DEPENDS += +PACKAGE_libbbfdm-mbedtls:libmbedtls
|
||||
VARIANT:=mbedtls
|
||||
DEFAULT_VARIANT:=1
|
||||
endef
|
||||
|
||||
define Package/libbbfdm-openssl
|
||||
$(Package/libbbfdm/default)
|
||||
TITLE += (openssl)
|
||||
DEPENDS += +PACKAGE_libbbfdm-openssl:libopenssl
|
||||
CONFLICTS := libbbfdm-mbedtls
|
||||
VARIANT:=openssl
|
||||
endef
|
||||
|
||||
define Package/libbbfdm-wolfssl
|
||||
$(Package/libbbfdm/default)
|
||||
TITLE += (wolfssl)
|
||||
DEPENDS += +PACKAGE_libbbfdm-wolfssl:libwolfssl
|
||||
CONFLICTS := libbbfdm-mbedtls libbbfdm-openssl
|
||||
VARIANT:=wolfssl
|
||||
endef
|
||||
|
||||
define Package/userinterface
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=Package to add Device.UserInterface. datamodel support
|
||||
endef
|
||||
|
||||
define Package/userinterface/description
|
||||
Package to add Device.UserInterface. datamodel support using libbbf JSON Plugin
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
SUBMENU:=BBF
|
||||
TITLE:=Library for broadband-forum data model
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c +libtrace +libbbf_api +libopenssl +libcurl
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/config
|
||||
@@ -98,116 +57,71 @@ define Build/Prepare
|
||||
endef
|
||||
endif
|
||||
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_TR181=ON
|
||||
TARGET_CFLAGS += \
|
||||
-D_GNU_SOURCE \
|
||||
-Wall -Werror \
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR181),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr181
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR104),y)
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_TR104=ON
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr104
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR143),y)
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_TR143=ON
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-tr143
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_TR471),y)
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_TR471=ON
|
||||
ifeq ($(CONFIG_PACKAGE_libopenssl),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-libopenssl
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBF_VENDOR_EXTENSION),y)
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_VENDOR_EXTENSION=ON
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-vendor-extension
|
||||
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_VENDOR_LIST:String="$(CONFIG_BBF_VENDOR_LIST)" \
|
||||
-DBBF_VENDOR_PREFIX:String="$(CONFIG_BBF_VENDOR_PREFIX)" \
|
||||
-DBBF_MAX_OBJECT_INSTANCES:Integer=$(CONFIG_BBF_MAX_OBJECT_INSTANCES)
|
||||
CONFIGURE_ARGS += \
|
||||
BBF_VENDOR_LIST="$(CONFIG_BBF_VENDOR_LIST)" \
|
||||
BBF_VENDOR_PREFIX="$(CONFIG_BBF_VENDOR_PREFIX)"
|
||||
|
||||
endif ##CONFIG_BBF_VENDOR_EXTENSION
|
||||
|
||||
ifeq ($(CONFIG_BBFDM_ENABLE_JSON_PLUGIN),y)
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_JSON_PLUGIN=ON
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BBFDM_ENABLE_DOTSO_PLUGIN),y)
|
||||
CMAKE_OPTIONS += \
|
||||
-DBBF_DOTSO_PLUGIN=ON
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),openssl)
|
||||
CMAKE_OPTIONS += -DWITH_OPENSSL=ON
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),wolfssl)
|
||||
CMAKE_OPTIONS += -DWITH_WOLFSSL=ON
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),mbedtls)
|
||||
CMAKE_OPTIONS += -DWITH_MBEDTLS=ON
|
||||
endif
|
||||
|
||||
define Package/libbbf_api/install
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/.libs/libbbf_api.so* $(1)/lib/
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/default/install
|
||||
define Package/libbbfdm/install
|
||||
$(INSTALL_DIR) $(1)/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/.libs/libbbfdm.so* $(1)/lib/
|
||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/* $(1)/usr/share/bbfdm
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/dmmap
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/json
|
||||
$(INSTALL_DIR) $(1)/usr/share/bbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
|
||||
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm.so $(1)/lib/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/* $(1)/usr/share/bbfdm
|
||||
$(LN) /usr/share/bbfdm/bbf.diag $(1)/usr/libexec/rpcd/bbf.diag
|
||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/bbf $(1)/lib/upgrade/keep.d/bbf
|
||||
endef
|
||||
|
||||
define Package/libbbfdm/default/prerm
|
||||
define Package/libbbfdm/prerm
|
||||
#!/bin/sh
|
||||
rm -rf /etc/bbfdm/dmmap/*
|
||||
rm -rf /etc/bbfdm/*
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/userinterface/install
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/json
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DATA) ./files/etc/bbfdm/json/UserInterface.json $(1)/etc/bbfdm/json/
|
||||
$(INSTALL_DATA) ./files/etc/config/userinterface $(1)/etc/config/userinterface
|
||||
$(INSTALL_BIN) ./files/etc/init.d/userinterface $(1)/etc/init.d/userinterface
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/93-userinterface-firewall $(1)/etc/uci-defaults/93-userinterface-firewall
|
||||
$(INSTALL_BIN) ./files/etc/firewall.userinterface $(1)/etc/firewall.userinterface
|
||||
endef
|
||||
|
||||
Package/libbbfdm-openssl/prerm = $(Package/libbbfdm/default/prerm)
|
||||
Package/libbbfdm-wolfssl/prerm = $(Package/libbbfdm/default/prerm)
|
||||
Package/libbbfdm-mbedtls/prerm = $(Package/libbbfdm/default/prerm)
|
||||
|
||||
Package/libbbfdm-openssl/install = $(Package/libbbfdm/default/install)
|
||||
Package/libbbfdm-wolfssl/install = $(Package/libbbfdm/default/install)
|
||||
Package/libbbfdm-mbedtls/install = $(Package/libbbfdm/default/install)
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/include/libbbfdm
|
||||
$(INSTALL_DIR) $(1)/usr/include/libbbf_api
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/include/*.h $(1)/usr/include/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/*.h $(1)/usr/include/libbbfdm/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libbbf_api/*.h $(1)/usr/include/libbbf_api/
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbfdm.so $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/*.h $(1)/usr/include/libbbfdm/
|
||||
$(CP) $(PKG_BUILD_DIR)/libbbf_api/*.h $(1)/usr/include/libbbf_api/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/.libs/libbbfdm.{a,so*} $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/.libs/libbbf_api.{a,so*} $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,userinterface))
|
||||
$(eval $(call BuildPackage,libbbf_api))
|
||||
$(eval $(call BuildPackage,libbbfdm))
|
||||
$(eval $(call BuildPackage,libbbfdm-openssl))
|
||||
$(eval $(call BuildPackage,libbbfdm-wolfssl))
|
||||
$(eval $(call BuildPackage,libbbfdm-mbedtls))
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
{
|
||||
"Device.UserInterface.": {
|
||||
"type": "object",
|
||||
"version": "2.0",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": false,
|
||||
"Device.UserInterface.RemoteAccess.": {
|
||||
"type": "object",
|
||||
"version": "2.0",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": false,
|
||||
"Enable": {
|
||||
"type": "boolean",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"version": "2.0",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "userinterface",
|
||||
"section": {
|
||||
"name": "remote_access"
|
||||
},
|
||||
"option": {
|
||||
"name": "enable"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Port": {
|
||||
"type": "unsignedInt",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"version": "2.0",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"range": [
|
||||
{
|
||||
"max": 65535
|
||||
}
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "userinterface",
|
||||
"section": {
|
||||
"name": "remote_access"
|
||||
},
|
||||
"option": {
|
||||
"name": "port"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"SupportedProtocols": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": false,
|
||||
"version": "2.0",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"list": {
|
||||
"datatype": "string",
|
||||
"enumerations": [
|
||||
"HTTP",
|
||||
"HTTPS"
|
||||
]
|
||||
},
|
||||
"default": "HTTP"
|
||||
},
|
||||
"Protocol": {
|
||||
"type": "string",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"version": "2.0",
|
||||
"protocols": [
|
||||
"cwmp",
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "userinterface",
|
||||
"section": {
|
||||
"name": "remote_access"
|
||||
},
|
||||
"option": {
|
||||
"name": "protocol"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
config userinterface 'remote_access'
|
||||
option enable '0'
|
||||
option interface 'wan'
|
||||
option port '80'
|
||||
option protocol 'HTTP'
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
IDENTIFIER="REMOTE-ACCESS-WAN"
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t firewall.userinterface -p info
|
||||
}
|
||||
|
||||
if [ ! -f "/etc/config/userinterface" ]; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
exec_cmd() {
|
||||
if ! "$@"; then
|
||||
log "Failed to run [$*]"
|
||||
fi
|
||||
}
|
||||
|
||||
configure_firewall_rule() {
|
||||
local enable port protocol gui_port
|
||||
local zone interface
|
||||
|
||||
config_load userinterface
|
||||
config_get_bool enable remote_access enable 1
|
||||
config_get port remote_access port
|
||||
config_get interface remote_access interface
|
||||
|
||||
if [ "${enable}" -eq "0" ] || [ -z "${port}" ] || [ -z "${interface}" ]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
zone="zone_${interface}_input"
|
||||
iptables -w 1 -t filter -nL "${zone}" 2>/dev/null 1>&2
|
||||
if [ "$?" -eq 0 ]; then
|
||||
iptables -w 1 -I "${zone}" -p tcp -m multiport --dports "${port}" -m conntrack --ctstate NEW,ESTABLISHED -m comment --comment "${IDENTIFIER}" -j ACCEPT
|
||||
fi
|
||||
|
||||
zone="zone_${interface}_output"
|
||||
iptables -w 1 -t filter -nL "${zone}" 2>/dev/null 1>&2
|
||||
if [ "$?" -eq 0 ]; then
|
||||
iptables -w 1 -I "${zone}" -p tcp -m multiport --dports "${port}" -m conntrack --ctstate ESTABLISHED -m comment --comment "${IDENTIFIER}" -j ACCEPT
|
||||
fi
|
||||
}
|
||||
|
||||
delete_firewall_rule() {
|
||||
local zone interface
|
||||
local CMD
|
||||
|
||||
config_load userinterface
|
||||
config_get interface remote_access interface
|
||||
|
||||
# Clean remote interface rules
|
||||
if [ -z "${interface}" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
zone="zone_${interface}_input"
|
||||
CMD="iptables -w 1 -t filter -nL ${zone} --line-numbers"
|
||||
while ${CMD} 2>/dev/null | grep "${IDENTIFIER}"; do
|
||||
rule_num="$(${CMD} | grep "${IDENTIFIER}" | head -1|awk '{print $1}')"
|
||||
if [ -n "${rule_num}" ]; then
|
||||
exec_cmd iptables -w 1 -t filter -D "${zone}" "${rule_num}";
|
||||
fi
|
||||
done
|
||||
|
||||
zone="zone_${interface}_output"
|
||||
CMD="iptables -w 1 -t filter -nL ${zone} --line-numbers"
|
||||
while ${CMD} 2>/dev/null | grep "${IDENTIFIER}"; do
|
||||
rule_num="$(${CMD} | grep "${IDENTIFIER}" | head -1|awk '{print $1}')"
|
||||
if [ -n "${rule_num}" ]; then
|
||||
exec_cmd iptables -w 1 -t filter -D "${zone}" "${rule_num}";
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Delete existing remote access rules
|
||||
delete_firewall_rule
|
||||
|
||||
# Configure the User Interface rule
|
||||
configure_firewall_rule
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=01
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
local enable
|
||||
|
||||
procd_open_instance usp
|
||||
|
||||
config_load userinterface
|
||||
config_get_bool enable global enable 1
|
||||
|
||||
# Inject firewall rules
|
||||
if [ "${enable}" -eq "1" ]; then
|
||||
/etc/firewall.userinterface
|
||||
fi
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger "userinterface"
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOT
|
||||
delete firewall.userinterface
|
||||
set firewall.userinterface=include
|
||||
set firewall.userinterface.path=/etc/firewall.userinterface
|
||||
set firewall.userinterface.reload=1
|
||||
commit firewall
|
||||
EOT
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/etc/bbfdm/sysctl.conf
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2022 iopsys Software Solutions AB
|
||||
# Copyright (C) 2020 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
@@ -8,17 +8,14 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bulkdata
|
||||
PKG_VERSION:=2.0.10
|
||||
PKG_VERSION:=1.0.2
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_VERSION:=150eb3122c969d1646c8ca8c8152154990f91823
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/bulkdata.git
|
||||
PKG_SOURCE_VERSION:=6e85d2032e66df581fae7c72cd83cc89367b8fc8
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
@@ -32,24 +29,21 @@ define Package/$(PKG_NAME)
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=BBF BulkData Collection
|
||||
DEPENDS:=+libubus +libuci +libubox +libjson-c +libcurl +libblobmsg-json +zlib
|
||||
DEPENDS:=+libubus +libuci +libubox +libjson-c +libcurl +curl +libblobmsg-json +libbbfdm +libbbf_api
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
BBF BulkData Collection
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-D_GNU_SOURCE \
|
||||
-Wall -Werror
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
$(CP) -rf ~/git/bulkdata/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
-D_GNU_SOURCE
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bulkdatad $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/json
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bbf_plugin/*.json $(1)/etc/bbfdm/json
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/*.so $(1)/usr/lib/bbfdm
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
|
||||
@@ -1,6 +1,43 @@
|
||||
|
||||
config bulkdata 'bulkdata'
|
||||
option enable '0'
|
||||
#Log levels: Error=1, Warning=2, Info=3, Debug=4
|
||||
#Log levels: Critical=0, Warning=1, Notice=2, Info=3, Debug=4
|
||||
option log_level '3'
|
||||
|
||||
config profile
|
||||
option profile_id '1'
|
||||
option enable '0'
|
||||
option name ''
|
||||
option nbre_of_retained_failed_reports '0'
|
||||
option protocol 'http'
|
||||
option encoding_type ''
|
||||
option reporting_interval '86400'
|
||||
option time_reference '0'
|
||||
option csv_encoding_field_separator ','
|
||||
option csv_encoding_row_separator ' '
|
||||
option csv_encoding_escape_character '"'
|
||||
option csv_encoding_report_format 'column'
|
||||
option csv_encoding_row_time_stamp 'unix'
|
||||
option json_encoding_report_format 'objecthierarchy'
|
||||
option json_encoding_report_time_stamp 'unix'
|
||||
option http_url ''
|
||||
option http_username ''
|
||||
option http_password ''
|
||||
option http_compression 'none'
|
||||
option http_method 'post'
|
||||
option http_use_date_header '1'
|
||||
option http_retry_enable '0'
|
||||
option http_retry_minimum_wait_interval '5'
|
||||
option http_retry_interval_multiplier '2000'
|
||||
option http_persist_across_reboot '0'
|
||||
|
||||
config profile_parameter
|
||||
option profile_id '1'
|
||||
option name ''
|
||||
option reference ''
|
||||
|
||||
config profile_http_request_uri_parameter
|
||||
option profile_id '1'
|
||||
option name ''
|
||||
option reference ''
|
||||
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Bulkdata Software
|
||||
# Copyright (C) 2020 iopsys Software Solutions AB
|
||||
# Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
|
||||
|
||||
START=99
|
||||
STOP=10
|
||||
@@ -7,17 +10,17 @@ USE_PROCD=1
|
||||
PROG="/usr/sbin/bulkdatad"
|
||||
|
||||
start_service() {
|
||||
local enable
|
||||
|
||||
config_load bulkdata
|
||||
config_get_bool enable bulkdata enable 1
|
||||
|
||||
procd_open_instance bulkdata
|
||||
[ "$enable" -eq "1" ] && {
|
||||
local bulkdata_enable=`uci -q get bulkdata.bulkdata.enable`
|
||||
if [ "$bulkdata_enable" = "1" ]; then
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
procd_set_param respawn "3" "7" "0"
|
||||
}
|
||||
procd_close_instance
|
||||
procd_close_instance
|
||||
fi
|
||||
}
|
||||
|
||||
boot() {
|
||||
start
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
PROFILE_COUNT=1
|
||||
|
||||
get_next_count()
|
||||
{
|
||||
local config="$1"
|
||||
local default_name="${2}"
|
||||
local count=${3}
|
||||
local found=0
|
||||
|
||||
if [ -z "$count" ]; then
|
||||
count=1
|
||||
fi
|
||||
|
||||
while [ "${found}" -ne 1 ]; do
|
||||
uci -q get "${config}"."${default_name}"_${count} >/dev/null
|
||||
if [ "$?" -eq 0 ]; then
|
||||
count=$((count + 1))
|
||||
else
|
||||
found=1;
|
||||
fi
|
||||
done
|
||||
|
||||
echo "${default_name}_${count}"
|
||||
}
|
||||
|
||||
translate_profile_id_to_profile_name() {
|
||||
local section="${1}"
|
||||
local profile_id="${2}"
|
||||
local profile_name="${3}"
|
||||
local curr_profile_id
|
||||
|
||||
config_get curr_profile_id "${section}" profile_id
|
||||
|
||||
[ -n "${curr_profile_id}" ] || return
|
||||
|
||||
[ "${curr_profile_id}" != "${profile_id}" ] && return
|
||||
|
||||
uci -q set bulkdata."${section}".profile_name="${profile_name}"
|
||||
uci -q set bulkdata."${section}".profile_id=""
|
||||
}
|
||||
|
||||
update_profile_sections() {
|
||||
local section="${1}"
|
||||
local default="${2}"
|
||||
local profile_name
|
||||
|
||||
config_get profile_id "${section}" profile_id
|
||||
|
||||
[ -n "${profile_id}" ] || return
|
||||
|
||||
case "${section}" in
|
||||
"cfg"*)
|
||||
profile_name="$(get_next_count bulkdata "${default}" ${PROFILE_COUNT})"
|
||||
uci_rename bulkdata "${section}" "${profile_name}"
|
||||
;;
|
||||
esac
|
||||
PROFILE_COUNT=$((PROFILE_COUNT + 1))
|
||||
|
||||
[ -n "$profile_name" ] && section="${profile_name}"
|
||||
|
||||
uci -q set bulkdata."${section}".profile_id=""
|
||||
|
||||
config_foreach translate_profile_id_to_profile_name profile_parameter "${profile_id}" "${profile_name}"
|
||||
config_foreach translate_profile_id_to_profile_name profile_http_request_uri_parameter "${profile_id}" "${profile_name}"
|
||||
}
|
||||
|
||||
config_load bulkdata
|
||||
config_foreach update_profile_sections profile profile
|
||||
uci commit bulkdata
|
||||
|
||||
exit 0
|
||||
40
crashlog/Makefile
Normal file
40
crashlog/Makefile
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# Copyright (C) 2019 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=crashlog
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=none
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/crashlog
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Handling kernel crash logs
|
||||
endef
|
||||
|
||||
define Package/crashlog/description
|
||||
Handling kernel crash logs.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./files/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/crashlog/install
|
||||
$(CP) ./files/* $(1)/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,crashlog))
|
||||
BIN
crashlog/files/etc/dropbear/logid
Normal file
BIN
crashlog/files/etc/dropbear/logid
Normal file
Binary file not shown.
11
crashlog/files/etc/init.d/corelog
Executable file
11
crashlog/files/etc/init.d/corelog
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=01
|
||||
|
||||
start()
|
||||
{
|
||||
if [ -e /proc/sys/kernel/core_pattern ]
|
||||
then
|
||||
echo "|/sbin/logcore %e %s" > /proc/sys/kernel/core_pattern
|
||||
fi
|
||||
}
|
||||
55
crashlog/files/etc/init.d/crashlog
Executable file
55
crashlog/files/etc/init.d/crashlog
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
|
||||
send_log()
|
||||
{
|
||||
nr=$(db get hw.board.serial_number)
|
||||
hw=$(db get hw.board.model_name)
|
||||
fam=$(db get hw.board.iopVerFam)
|
||||
sw=$(db get hw.board.iopVersion)
|
||||
server=$(/sbin/uci get system.crashlog.server)
|
||||
|
||||
while true
|
||||
do
|
||||
scp -S /usr/sbin/logssh /proc/last_kmsg log@${server}:log/${fam}_${hw}_${sw}_${nr}
|
||||
if [ $? == 0 ]
|
||||
then
|
||||
break;
|
||||
fi
|
||||
# wait for another minute then try again
|
||||
sleep 60
|
||||
done
|
||||
}
|
||||
|
||||
fill_in_default()
|
||||
{
|
||||
/sbin/uci add system log
|
||||
/sbin/uci rename system.@log[-1]=crashlog
|
||||
/sbin/uci set system.crashlog.enable=no
|
||||
/sbin/uci set system.crashlog.server="crashlog.iopsys.eu"
|
||||
/sbin/uci commit
|
||||
}
|
||||
|
||||
boot()
|
||||
{
|
||||
# is crashlog enabled ?
|
||||
enable=$(/sbin/uci get system.crashlog.enable)
|
||||
case $enable in
|
||||
0|no|NO|false|FALSE)
|
||||
exit 0
|
||||
;;
|
||||
"")
|
||||
fill_in_default
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# is this boot a result from a crash ?
|
||||
reason=$(cat /etc/boot_reason)
|
||||
case $reason in
|
||||
HW|WD)
|
||||
send_log&
|
||||
;;
|
||||
esac
|
||||
}
|
||||
60
crashlog/files/sbin/logcore
Executable file
60
crashlog/files/sbin/logcore
Executable file
@@ -0,0 +1,60 @@
|
||||
#! /bin/sh
|
||||
|
||||
TMP_CORE=/tmp/new_core
|
||||
# first test if we can contact the log server.
|
||||
# if not abort directly the core file takes up memory
|
||||
alive()
|
||||
{
|
||||
ping -c1 $server
|
||||
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
# drain core file from kernel
|
||||
cat >/dev/null
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
fill_in_default()
|
||||
{
|
||||
/sbin/uci add system log
|
||||
/sbin/uci rename system.@log[-1]=corelog
|
||||
/sbin/uci set system.corelog.enable=no
|
||||
/sbin/uci set system.corelog.server="corelog.iopsys.eu"
|
||||
/sbin/uci commit
|
||||
}
|
||||
|
||||
# is corelog enabled ?
|
||||
enable=$(/sbin/uci get system.corelog.enable)
|
||||
case $enable in
|
||||
0|no|NO|false|FALSE)
|
||||
# drain core file from kernel
|
||||
cat >/dev/null
|
||||
exit 0
|
||||
;;
|
||||
"")
|
||||
fill_in_default
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
server=$(/sbin/uci get system.corelog.server)
|
||||
|
||||
alive
|
||||
|
||||
# dump out the core to disk we need this as scp needs a size before we send data
|
||||
# and this is the only way to know how much data there is
|
||||
cat >$TMP_CORE
|
||||
|
||||
# in case filesystem/memory is full at least kill the core in the kernel memory should give us some
|
||||
# more memory to work with. normally this would do nothing.
|
||||
cat >/dev/null
|
||||
|
||||
nr=$(db get hw.board.serial_number)
|
||||
hw=$(db get hw.board.model_name)
|
||||
fam=$(hw.board.iopVerFam)
|
||||
sw=$(db get hw.board.iopVersion)
|
||||
|
||||
scp -S /usr/sbin/logssh $TMP_CORE log@${server}:log/core_${1}_${2}_${fam}_${hw}_${sw}_${nr}
|
||||
rm $TMP_CORE
|
||||
|
||||
6
crashlog/files/usr/sbin/logssh
Executable file
6
crashlog/files/usr/sbin/logssh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
# we need to have the -y option to dropbear to not halt the scp when
|
||||
# transfering the log file to a new server for the first time.
|
||||
# since we already need this also put in the keyfile
|
||||
|
||||
ssh -y -i /etc/dropbear/logid $@
|
||||
42
crashlog/readme
Normal file
42
crashlog/readme
Normal file
@@ -0,0 +1,42 @@
|
||||
Install scp server.
|
||||
|
||||
Create a user account on a server and make sure it's possible to login to it
|
||||
using ssh.
|
||||
|
||||
For now the user has to be called "log"
|
||||
|
||||
USER is the user name of the account
|
||||
HOME is the user home directory.
|
||||
Both should be changed to the correct value in all following example commands.
|
||||
|
||||
create HOME/bin
|
||||
Put scp_upload in HOME/bin
|
||||
make it executable "chmod a+x HOME/bin/scp_upload"
|
||||
|
||||
create home/.ssh (observer the dot .shh)
|
||||
|
||||
create an empty file HOME/.ssh/authorized_keys
|
||||
|
||||
-------------------------------
|
||||
Now everyhting is setup for use but we have not added any clients.
|
||||
What we need is the public key for the clients.
|
||||
|
||||
For dropbear "dropbearkey -y -f files/etc/dropbear/logid" will generate the public key.
|
||||
|
||||
----------
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCwn9RaDAzxW1dTmIhXgFBnpi1lhj8xhYpCVQiPxxdk9IEmH8zjo4y9j3sPkqKOlRnkwjpZIpLEKBnpQTwVIMCU/AG7nDJX3OH9RfS9mLJQLfFL8HyGCyqDezFWldbyovhJZvdUeK4tAXJWv2W3OVHiz2L8IlncBgP/E9DJElsyhhQHsM96UE6tBkXsvXkoDbMSYXFcLbgiUwBKfmM2BF/aPDL45iznGur7/2j9v95PwJ0gtMu9jjNRq+pXCXhTh3bsnczm0MpZC1aiRc9nJAeGIMmhrf15E4jBKgTnrstzJxGVAdajKeR954KcNsS33cS2Wmui2YjmPbBXjqf1frzJ log@iopsys
|
||||
----------
|
||||
|
||||
The public key should be just one line. Add that line to the
|
||||
HOME/.ssh/authorized_keys file on the scp server. Then add the follwoing as
|
||||
the first text on the same line. that is insert before the key data.
|
||||
|
||||
command="HOME/bin/scp_upload",no-port-forwarding,no-agent-forwarding,no-X11-forwarding
|
||||
|
||||
Do not forget to change HOME to the correct value for the server and there
|
||||
should be one space separating the key data and the above text.
|
||||
---------------------------------
|
||||
Now test to make sure that you can upload new files, not download files
|
||||
and not overwrite files from the client.
|
||||
|
||||
|
||||
53
crashlog/scp_upload
Normal file
53
crashlog/scp_upload
Normal file
@@ -0,0 +1,53 @@
|
||||
#! /bin/bash
|
||||
# authorized_keys command="/home/boxi/my_scp",no-port-forwarding,no-agent-forwarding,no-X11-forwarding
|
||||
|
||||
val=`expr match "$SSH_ORIGINAL_COMMAND" "scp"`
|
||||
if [ $val != 3 ]
|
||||
then
|
||||
echo "only scp is allowed for this rsa key"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#strip out "scp" as getopts barf on anything not an option
|
||||
|
||||
args=${SSH_ORIGINAL_COMMAND:3}
|
||||
|
||||
# we must set args to positional paramters otherwise it's next to impossible
|
||||
# to get to the rest of the line that is not arguments.
|
||||
|
||||
set -- $args
|
||||
while getopts "rftdvpq" Option
|
||||
do
|
||||
case $Option in
|
||||
r ) echo "recursive not allowed";exit 1;;
|
||||
f ) echo "reading files not allowed";exit 1;;
|
||||
t ) ;;
|
||||
d ) ;;
|
||||
v ) ;;
|
||||
p ) ;;
|
||||
q ) ;;
|
||||
* ) ;; # Default.
|
||||
esac
|
||||
done
|
||||
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
file="$*"
|
||||
dir=$(dirname "$file")
|
||||
|
||||
if [ "$dir" != "log" ]
|
||||
then
|
||||
echo "only allowed to write to log/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# try to create uniq files
|
||||
EXTRA=$((0))
|
||||
while [ -e "${file}_${EXTRA}" ]
|
||||
do
|
||||
EXTRA=$((EXTRA +1))
|
||||
done
|
||||
|
||||
logger -t scp_upload "${SSH_ORIGINAL_COMMAND}_${EXTRA}"
|
||||
|
||||
exec ${SSH_ORIGINAL_COMMAND}_${EXTRA}
|
||||
81
crun/Makefile
Normal file
81
crun/Makefile
Normal file
@@ -0,0 +1,81 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=crun
|
||||
PKG_VERSION:=0.20
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/containers/crun.git
|
||||
PKG_SOURCE_DATE:=2021-06-07
|
||||
PKG_SOURCE_VERSION:=8d6a8b5ab80461cfed19f020a36584af13c32038
|
||||
PKG_MIRROR_HASH:=9ca1f0e530b33ce8820bd03329eb6731c5050d6e7f35bd2463d9a81cc00382e0
|
||||
|
||||
PKG_BUILD_DEPENDS:=argp-standalone
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_INSTALL:=1
|
||||
|
||||
PKG_MAINTAINER:=Oskari Rauta <oskari.rauta@gmail.com>
|
||||
PKG_LICENSE:=GPL-2.0-or-later
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/crun
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=crun
|
||||
URL:=https://github.com/containers/crun
|
||||
DEPENDS:=@!arc +libseccomp +libcap
|
||||
endef
|
||||
|
||||
define Package/crun/description
|
||||
A fast and low-memory footprint OCI Container Runtime fully written in C.
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS+= \
|
||||
--disable-systemd \
|
||||
--enable-embedded-yajl \
|
||||
--enable-caps \
|
||||
--enable-dl \
|
||||
--enable-seccomp \
|
||||
--enable-bpf
|
||||
|
||||
define Build/Prepare
|
||||
$(call Build/Prepare/Default)
|
||||
$(SED) '/#include <git-version.h>/d' $(PKG_BUILD_DIR)/src/crun.c
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
$(call Build/Configure/Default)
|
||||
|
||||
$(SED) '/#define PACKAGE \"/d' $(PKG_BUILD_DIR)/config.h
|
||||
$(SED) '/#define VERSION \"/d' $(PKG_BUILD_DIR)/config.h
|
||||
$(SED) '/#define GIT_VERSION \"/d' $(PKG_BUILD_DIR)/config.h
|
||||
$(SED) '/#define PACKAGE_BUGREPORT \"/d' $(PKG_BUILD_DIR)/config.h
|
||||
$(SED) '/#define PACKAGE_NAME \"/d' $(PKG_BUILD_DIR)/config.h
|
||||
$(SED) '/#define PACKAGE_STRING \"/d' $(PKG_BUILD_DIR)/config.h
|
||||
$(SED) '/#define PACKAGE_TARNAME \"/d' $(PKG_BUILD_DIR)/config.h
|
||||
$(SED) '/#define PACKAGE_VERSION \"/d' $(PKG_BUILD_DIR)/config.h
|
||||
|
||||
echo "#define PACKAGE \"$(PKG_NAME)\"" >> $(PKG_BUILD_DIR)/config.h
|
||||
echo "#define VERSION \"$(PKG_VERSION)\"" >> $(PKG_BUILD_DIR)/config.h
|
||||
echo "#define PACKAGE_NAME \"$(PKG_NAME)\"" >> $(PKG_BUILD_DIR)/config.h
|
||||
echo "#define PACKAGE_VERSION \"$(PKG_VERSION)\"" >> $(PKG_BUILD_DIR)/config.h
|
||||
echo "#define PACKAGE_STRING \"$(PKG_NAME) $(PKG_VERSION)\"" >> $(PKG_BUILD_DIR)/config.h
|
||||
echo "#define PACKAGE_TARNAME \"$(PKG_NAME)\"" >> $(PKG_BUILD_DIR)/config.h
|
||||
echo "#define PACKAGE_BUGREPORT \"bugs@openwrt.org\"" >> $(PKG_BUILD_DIR)/config.h
|
||||
echo "#define GIT_VERSION \"$(PKG_SOURCE_VERSION)\"" >> $(PKG_BUILD_DIR)/config.h
|
||||
endef
|
||||
|
||||
define Package/crun/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/crun $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcrun.* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,crun))
|
||||
@@ -1,11 +0,0 @@
|
||||
if PACKAGE_dectmngr
|
||||
|
||||
menu "Configuration"
|
||||
|
||||
config ENABLE_LINE_SETTINGS_EXTENSION
|
||||
bool "Enable Line Settings List extension "
|
||||
default y
|
||||
|
||||
endmenu
|
||||
|
||||
endif
|
||||
@@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dectmngr
|
||||
PKG_RELEASE:=3
|
||||
PKG_VERSION:=3.5.7
|
||||
PKG_VERSION:=3.1.18
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/dectmngr.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=83f89a83cf860bbcf2b7f2e030215db315a5bbbf
|
||||
PKG_SOURCE_VERSION:=0e937cfb839f845cf28922c4dde0572ec2842f85
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
@@ -34,41 +34,29 @@ include $(INCLUDE_DIR)/package.mk
|
||||
define Package/$(PKG_NAME)
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=DECT Manager
|
||||
DEPENDS:= +libubox +ubus +uci +libxml2 +libjson-c
|
||||
DEPENDS:= +libubox +ubus +uci
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
DECT manager is a daemon that provides UBUS RPC objects and sends UBUS events for communication with the DECT chip.
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
rsync -av --exclude=.* ~/git/voip/dectmngr/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-Wall \
|
||||
-Werror \
|
||||
-I$(STAGING_DIR)/usr/include/libxml2
|
||||
|
||||
ifeq ($(CONFIG_ENABLE_LINE_SETTINGS_EXTENSION),y)
|
||||
TARGET_CFLAGS += -DENABLE_LINE_SETTINGS_EXTENSION
|
||||
endif
|
||||
MAKE_FLAGS += \
|
||||
CFLAGS+="-Wall"
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
||||
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/app/dectmngr $(1)/usr/sbin/
|
||||
$(STRIP) $(1)/usr/sbin/dectmngr
|
||||
$(CP) ./files/etc/* $(1)/etc/
|
||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/dect $(1)/lib/upgrade/keep.d/dect
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
config dect 'global'
|
||||
option log_dect_cmbs 'syslog'
|
||||
option log_level 'realtime,warning,error'
|
||||
option log_dect_cmbs '0'
|
||||
|
||||
Binary file not shown.
BIN
dectmngr/files/etc/dspg/04131410.bin
Normal file
BIN
dectmngr/files/etc/dspg/04131410.bin
Normal file
Binary file not shown.
@@ -11,8 +11,6 @@ PROG=/usr/sbin/dectmngr
|
||||
LOG_PATH=/var/log/dectmngr
|
||||
DB_PATH=/etc/dect
|
||||
|
||||
DECT_GPIO=$(db -q get hw.board.dect_gpio)
|
||||
|
||||
# Ask dectmngr to exit nicely and wait for it to clean up, which is a slow process.
|
||||
stop_and_wait_dectmngr() {
|
||||
pidof $NAME && killall -q $NAME
|
||||
@@ -28,42 +26,32 @@ start_service() {
|
||||
local opt_ext=
|
||||
local rfpi=
|
||||
local model_id=
|
||||
local rxtun=
|
||||
|
||||
test $(db get hw.board.hasDect) = "0" && return
|
||||
|
||||
[ -n "$DECT_GPIO" ] && echo 1 > /sys/class/gpio/gpio${DECT_GPIO}/value
|
||||
echo 1 > /sys/class/gpio/gpio14/value
|
||||
|
||||
rfpi=$(db -q get hw.board.dect_rfpi)
|
||||
[ -n "$rfpi" -a ${#rfpi} -eq 14 ] && opt_ext="$opt_ext -rfpi $rfpi"
|
||||
|
||||
model_id=$(db -q get hw.board.dect_model_id)
|
||||
[ -n "$model_id" -a ${#model_id} -eq 8 ] || {
|
||||
echo "Invalid hw.board.dect_model_id:$model_id. Set to 30.3B.06"
|
||||
model_id="30.3B.06"
|
||||
}
|
||||
opt_ext="$opt_ext -model $model_id"
|
||||
|
||||
rxtun=$(db -q get hw.board.dect_rxtun)
|
||||
[ -n "$rxtun" -a ${#rxtun} -eq 2 ] && opt_ext="$opt_ext -rxtun $rxtun"
|
||||
# model_id=$(db -q get hw.board.dect_model_id)
|
||||
# Setting model_id to 0x010203 is a workaround to reduce synchronisation time of some handset
|
||||
# TODO: remove below line and uncomment the line above to get value from db when the problem is solved
|
||||
model_id="01.02.03"
|
||||
[ -n "$model_id" -a ${#model_id} -eq 8 ] && opt_ext="$opt_ext -model $model_id"
|
||||
|
||||
config_load dect
|
||||
config_get log_dect_cmbs global log_dect_cmbs syslog
|
||||
config_get_bool log_dect_cmbs global log_dect_cmbs 0
|
||||
|
||||
procd_open_instance
|
||||
if [ "$log_dect_cmbs" = "none" ]; then
|
||||
if [ $log_dect_cmbs -eq 0 ]; then
|
||||
echo "Starting dectmngr with cmbs logging disabled"
|
||||
procd_set_param command $PROG -comname ttyH0 $opt_ext
|
||||
rm -f $LOG_PATH/*
|
||||
elif [ "$log_dect_cmbs" = "file" ]; then
|
||||
echo "Starting dectmngr with cmbs logging enabled to file"
|
||||
procd_set_param command $PROG -comname ttyH0 -log $LOG_PATH/dect-cmbs.log $opt_ext
|
||||
else
|
||||
echo "Starting dectmngr with cmbs logging enabled to syslog"
|
||||
procd_set_param command $PROG -comname ttyH0 -syslog $opt_ext
|
||||
rm -f $LOG_PATH/*
|
||||
echo "Starting dectmngr with cmbs logging enabled"
|
||||
procd_set_param command $PROG -comname ttyH0 -log $LOG_PATH/dect-cmbs.log $opt_ext
|
||||
fi
|
||||
|
||||
procd_set_param respawn 6 2 3
|
||||
procd_set_param term_timeout 20
|
||||
procd_set_param triggers asterisk
|
||||
@@ -73,25 +61,23 @@ start_service() {
|
||||
stop_service() {
|
||||
test $(db get hw.board.hasDect) = "0" && return
|
||||
|
||||
[ -n "$DECT_GPIO" ] && echo 0 > /sys/class/gpio/gpio${DECT_GPIO}/value
|
||||
echo 0 > /sys/class/gpio/gpio14/value
|
||||
stop_and_wait_dectmngr
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
ubus call dect reload
|
||||
stop_and_wait_dectmngr
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_config_trigger "config.change" "asterisk" /etc/init.d/dectmngr restart
|
||||
procd_add_config_trigger "config.change" "dect" /etc/init.d/dectmngr reload
|
||||
procd_add_reload_trigger asterisk dect
|
||||
}
|
||||
|
||||
boot() {
|
||||
[ -n "$DECT_GPIO" ] && {
|
||||
echo ${DECT_GPIO} > /sys/class/gpio/export
|
||||
echo out > /sys/class/gpio/gpio${DECT_GPIO}/direction
|
||||
}
|
||||
echo 14 > /sys/class/gpio/export
|
||||
echo out > /sys/class/gpio/gpio14/direction
|
||||
|
||||
[ ! -d $LOG_PATH ] && mkdir -p $LOG_PATH
|
||||
[ ! -d $DB_PATH ] && mkdir -p $DB_PATH
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/etc/dect/LA_DB
|
||||
@@ -8,7 +8,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=dslmngr
|
||||
PKG_VERSION:=1.2.0
|
||||
PKG_VERSION:=1.1.2
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
@@ -26,8 +26,14 @@ PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_ramips),y)
|
||||
TARGET_PLATFORM=MEDIATEK
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_linksys),y)
|
||||
TARGET_PLATFORM=MARVELL
|
||||
else ifeq ($(CONFIG_TARGET_intel_mips),y)
|
||||
TARGET_PLATFORM=INTEL
|
||||
else
|
||||
$(info Unexpected CONFIG_TARGET)
|
||||
endif
|
||||
@@ -68,10 +74,6 @@ define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/dslmngr/install
|
||||
$(CP) ./files/common/* $(1)/
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
$(CP) ./files/broadcom/* $(1)/
|
||||
endif
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/dslmngr $(1)/sbin/
|
||||
endef
|
||||
|
||||
@@ -1,311 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
# ATM #
|
||||
check_pvc() {
|
||||
local vpi=$1
|
||||
local vci=$2
|
||||
local ret
|
||||
|
||||
ret=$(xtmctl operate conn --show | awk -v test="$vpi/$vci" '{if ($3==test ) print $5 }')
|
||||
|
||||
case $ret in
|
||||
''|*[!0-9]*) return 0 ;;
|
||||
*) return $ret ;;
|
||||
esac
|
||||
}
|
||||
|
||||
check_xtm_list() {
|
||||
local qclass=$1
|
||||
local pcr scr mbs
|
||||
local ret
|
||||
|
||||
case $# in
|
||||
1)
|
||||
pcr=0
|
||||
scr=0
|
||||
mbs=0
|
||||
;;
|
||||
2)
|
||||
pcr=$2
|
||||
scr=0
|
||||
mbs=0
|
||||
;;
|
||||
4)
|
||||
pcr=$2
|
||||
scr=$3
|
||||
mbs=$4
|
||||
;;
|
||||
esac
|
||||
|
||||
ret=$(xtmctl operate tdte --show | awk -v test="$qclass" -v pcr="$pcr" -v scr="$scr" -v mbs="$mbs" '{if ($2==test && $3==pcr && $4==scr && $5==mbs ) print $1 }')
|
||||
|
||||
case $ret in
|
||||
''|*[!0-9]*) return 0 ;;
|
||||
*) return $ret ;;
|
||||
esac
|
||||
}
|
||||
|
||||
configure_atm_device() {
|
||||
local name vpi vci device link_type encapsulation qos_class pcr mbs scr i
|
||||
|
||||
config_get name $1 name "ATM"
|
||||
config_get vpi $1 vpi "8"
|
||||
config_get vci $1 vci "35"
|
||||
config_get device $1 device "atm0"
|
||||
config_get link_type $1 link_type "eoa"
|
||||
config_get encapsulation $1 encapsulation "llc"
|
||||
config_get qos_class $1 qos_class "ubr"
|
||||
config_get pcr $1 pcr
|
||||
config_get mbs $1 mbs
|
||||
config_get scr $1 scr
|
||||
|
||||
check_pvc $vpi $vci
|
||||
ret=$?
|
||||
|
||||
if [ "$ret" -eq 0 ]; then
|
||||
check_xtm_list $qos_class $pcr $scr $mbs
|
||||
ret=$?
|
||||
|
||||
if [ "$ret" -eq 0 ]; then
|
||||
case $qos_class in # ubr, cbr, gfr, vbr-nrt, vbr-rt, ubr+, abr
|
||||
ubr)
|
||||
xtmctl operate tdte --add "$qos_class"
|
||||
;;
|
||||
ubr_pcr|ubr+)
|
||||
xtmctl operate tdte --add "$qos_class" $pcr
|
||||
;;
|
||||
cbr)
|
||||
xtmctl operate tdte --add "$qos_class" $pcr
|
||||
;;
|
||||
nrtvbr|vbr-nrt)
|
||||
xtmctl operate tdte --add "$qos_class" $pcr $scr $mbs
|
||||
;;
|
||||
rtvbr|vbr-rt)
|
||||
xtmctl operate tdte --add "$qos_class" $pcr $scr $mbs
|
||||
;;
|
||||
gfr)
|
||||
;;
|
||||
abr)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
case $link_type in # EoA, IPoA, PPPoA, CIP
|
||||
EoA|eoa)
|
||||
[ $encapsulation == "vcmux" ] && encapsulation="vcmux_eth" || encapsulation="llcsnap_eth"
|
||||
;;
|
||||
PPPoA|pppoa)
|
||||
[ $encapsulation == "vcmux" ] && encapsulation="vcmux_pppoa" || encapsulation="llcencaps_ppp"
|
||||
;;
|
||||
IPoA|ipoa)
|
||||
[ $encapsulation == "vcmux" ] && encapsulation="vcmux_ipoa" || encapsulation="llcsnap_rtip"
|
||||
;;
|
||||
CIP|cip)
|
||||
;;
|
||||
esac
|
||||
|
||||
check_xtm_list $qos_class $pcr $scr $mbs
|
||||
ret="$?"
|
||||
|
||||
xtmctl operate conn --add 1.$vpi.$vci aal5 $encapsulation 0 1 $ret
|
||||
for i in `seq 0 7`; do
|
||||
xtmctl operate conn --addq 1.$vpi.$vci $i wrr 1 dt # queue priority 0-7
|
||||
done
|
||||
xtmctl operate conn --createnetdev 1.$vpi.$vci $device
|
||||
xtmctl operate intf --state 1 enable
|
||||
fi
|
||||
}
|
||||
|
||||
remove_atm_devices() {
|
||||
local vpi vci rest
|
||||
local vpivci=`xtmctl operate conn --show | grep "ATM\|mode" | awk '{if (NR!=1 && $1!="PTM") {print $3}}'`
|
||||
|
||||
for i in $vpivci
|
||||
do
|
||||
rest=${i#\/}
|
||||
vpi=${rest%%\/*}
|
||||
vci=${rest#*\/}
|
||||
echo "xtmctl operate conn --delete 1.$vpi.$vci"
|
||||
xtmctl operate conn --delete 1.$vpi.$vci
|
||||
echo "xtmctl operate conn --deletenetdev 1.$vpi.$vci"
|
||||
xtmctl operate conn --deletenetdev 1.$vpi.$vci
|
||||
done
|
||||
}
|
||||
|
||||
create_atm_devices() {
|
||||
echo "Creating ATM Device(s)"
|
||||
config_load dsl
|
||||
config_foreach configure_atm_device atm-device
|
||||
}
|
||||
# ATM END #
|
||||
|
||||
# PTM #
|
||||
check_ptm() {
|
||||
local ret
|
||||
local ptmprio=$1
|
||||
local dslat=$2
|
||||
|
||||
if [ "$ptmprio" -eq 2 ]; then
|
||||
ptmprio="high"
|
||||
else
|
||||
ptmprio="low"
|
||||
fi
|
||||
|
||||
ret=$(xtmctl operate conn --show | awk -v dslat="$dslat" -v ptmprio="$ptmprio" '{if ($2 == dslat && $3 == ptmprio ) print $2 }')
|
||||
|
||||
case $ret in
|
||||
''|*[!0-9]*) return 0 ;;
|
||||
*) return $ret ;;
|
||||
esac
|
||||
}
|
||||
|
||||
configure_ptm_device() {
|
||||
local name device priority portid i
|
||||
|
||||
config_get name $1 name "PTM"
|
||||
config_get device $1 device "ptm0"
|
||||
config_get priority $1 priority 1
|
||||
config_get portid $1 portid 1
|
||||
|
||||
check_ptm $priority $portid
|
||||
ret=$?
|
||||
|
||||
if [ "$ret" -eq 0 ]; then
|
||||
xtmctl operate conn --add $portid.$priority
|
||||
|
||||
for i in `seq 0 7`; do
|
||||
xtmctl operate conn --addq $portid.$priority $i wrr 1 dt -1 -1 3000 # queue priority 0-7
|
||||
done
|
||||
echo "xtmctl operate conn --createnetdev $portid.$priority $device"
|
||||
xtmctl operate conn --createnetdev $portid.$priority $device
|
||||
xtmctl operate intf --state 1 enable
|
||||
fi
|
||||
}
|
||||
|
||||
remove_ptm_devices() {
|
||||
local delptm
|
||||
local x=0
|
||||
|
||||
IFS=$'\n'
|
||||
for i in `xtmctl operate conn --show | grep "PTM\|mode"`
|
||||
do
|
||||
if [ $x -eq 1 ]; then
|
||||
delptm=$(echo $i | awk '{if ($1!="ATM") print $2"."$11}')
|
||||
echo "xtmctl operate conn --delete $delptm"
|
||||
xtmctl operate conn --delete $delptm
|
||||
xtmctl operate conn --deletenetdev $delptm
|
||||
fi
|
||||
x=1
|
||||
done
|
||||
unset IFS
|
||||
}
|
||||
|
||||
create_ptm_devices() {
|
||||
echo "Creating PTM Device(s)"
|
||||
config_load dsl
|
||||
config_foreach configure_ptm_device ptm-device
|
||||
}
|
||||
# PTM END #
|
||||
|
||||
prioritize_arp()
|
||||
{
|
||||
ebtables -t nat -D POSTROUTING -j mark --mark-or 0x7 -p ARP >/dev/null
|
||||
ebtables -t nat -A POSTROUTING -j mark --mark-or 0x7 -p ARP >/dev/null
|
||||
}
|
||||
|
||||
xtm_remove_devices() {
|
||||
remove_atm_devices
|
||||
remove_ptm_devices
|
||||
}
|
||||
|
||||
xtm_create_devices() {
|
||||
local tpstc="$(xdslctl info --show | grep TPS-TC)"
|
||||
if echo "$tpstc" | grep -q "ATM Mode"; then
|
||||
create_atm_devices
|
||||
elif echo "$tpstc" | grep -q "PTM Mode"; then
|
||||
create_ptm_devices
|
||||
fi
|
||||
}
|
||||
|
||||
xdsl_configure() {
|
||||
local VDSL=0
|
||||
local GFAST=0
|
||||
local mod=""
|
||||
local modes=""
|
||||
local profile=""
|
||||
|
||||
config_load dsl
|
||||
|
||||
# Modes
|
||||
config_get mode line mode
|
||||
for mod in $mode; do
|
||||
[ $mod == "gdmt" ] && modes="${modes}d"
|
||||
[ $mod == "glite" ] && modes="${modes}l"
|
||||
[ $mod == "t1413" ] && modes="${modes}t"
|
||||
[ $mod == "adsl2" ] && modes="${modes}2"
|
||||
[ $mod == "adsl2p" ] && modes="${modes}p"
|
||||
[ $mod == "annexl" ] && modes="${modes}e"
|
||||
[ $mod == "annexm" ] && modes="${modes}m"
|
||||
[ $mod == "vdsl2" ] && modes="${modes}v" && VDSL=1
|
||||
[ $mod == "gfast" ] && modes="${modes}f" && GFAST=1
|
||||
done
|
||||
|
||||
# VDSL Profiles
|
||||
config_get profile line profile
|
||||
# Capabilities
|
||||
config_get_bool bitswap line bitswap 1
|
||||
[ $bitswap -eq 1 ] && bitswap="on" || bitswap="off"
|
||||
config_get_bool sra line sra 1
|
||||
[ $sra -eq 1 ] && sra="on" || sra="off"
|
||||
# config_get_bool trellis line trellis 1
|
||||
config_get_bool sesdrop line sesdrop 0
|
||||
[ $sesdrop -eq 1 ] && sesdrop="on" || sesdrop="off"
|
||||
# VDSL2 only
|
||||
config_get_bool us0 line us0 1
|
||||
[ $us0 -eq 1 ] && us0="on" || us0="off"
|
||||
# config_get_bool dynamicd line dynamicd 1
|
||||
# config_get_bool dynamicf line dynamicf 1
|
||||
config_get_bool sos line sos 0
|
||||
[ $sos -eq 1 ] && sos="on" || sos="off"
|
||||
|
||||
config_get_bool phyReXmtUs line phyReXmtUs 0
|
||||
config_get_bool phyReXmtDs line phyReXmtDs 1
|
||||
phyReXmt=$(( $((phyReXmtUs<<1)) + phyReXmtDs))
|
||||
|
||||
if [ $VDSL -eq 1 -o $GFAST -eq 1 ]; then
|
||||
echo "xdslctl start --up --mod $modes --profile "$profile" --sra $sra --bitswap $bitswap --us0 $us0 --sesdrop $sesdrop --SOS $sos --phyReXmt $phyReXmt"
|
||||
xdslctl start --up --mod $modes --profile "$profile" --sra $sra --bitswap $bitswap --us0 $us0 --sesdrop $sesdrop --SOS $sos --phyReXmt $phyReXmt
|
||||
# G.Fast hardware to VDSL hardware, to set the driver bit kPhyCfg2EnableGfastVdslMMTimeOut0.
|
||||
# Enable V43 tone for GFAST.
|
||||
echo "xdslctl configure1 --phycfg 0 0 0 0 0 0 0 0 0 0 0 0x1400400 0x1400400"
|
||||
xdslctl configure1 --phycfg 0 0 0 0 0 0 0 0 0 0 0 0x1400400 0x1400400
|
||||
else
|
||||
echo "xdslctl start --up --mod $modes --sra $sra --bitswap $bitswap --sesdrop $sesdrop --SOS $sos --phyReXmt $phyReXmt"
|
||||
xdslctl start --up --mod $modes --sra $sra --bitswap $bitswap --sesdrop $sesdrop --SOS $sos --phyReXmt $phyReXmt
|
||||
fi
|
||||
|
||||
if [ $GFAST -eq 1 ]; then
|
||||
# G.Fast hardware to VDSL hardware, to set the driver bit kPhyCfg2EnableGfastVdslMMTimeOut0.
|
||||
# Enable V43 tone for GFAST.
|
||||
echo "xdslctl configure1 --phycfg 0 0 0 0 0 0 0 0 0 0 0 0x1400400 0x1400400"
|
||||
xdslctl configure1 --phycfg 0 0 0 0 0 0 0 0 0 0 0 0x1400400 0x1400400
|
||||
fi
|
||||
}
|
||||
|
||||
xdsl_stop() {
|
||||
# echo "Stopping DSL"
|
||||
# stop causes IRQ issues
|
||||
# xdslctl stop
|
||||
return 0
|
||||
}
|
||||
|
||||
xdsl_init() {
|
||||
prioritize_arp
|
||||
|
||||
echo "Starting DSL"
|
||||
|
||||
xtmctl start
|
||||
xtmctl operate intf --state 1 enable
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
# OEM specific parameters
|
||||
config oem-parameters 'oem'
|
||||
# option country_code "0000" # 2 bytes hex
|
||||
# option vendor_id "IO" # 4 bytes string
|
||||
# option vendor_suffix "0000" # 2 bytes hex
|
||||
# option sw_version "iopsys" # 16 bytes string
|
||||
# option serial_nr "00000000" # 32 bytes string
|
||||
|
||||
# DSL Modes
|
||||
config dsl-line line
|
||||
list mode gdmt
|
||||
list mode glite
|
||||
list mode t1413
|
||||
list mode adsl2
|
||||
list mode adsl2p
|
||||
list mode annexl
|
||||
list mode annexm
|
||||
list mode vdsl2
|
||||
# VDSL2 profiles
|
||||
list profile 8a
|
||||
list profile 8b
|
||||
list profile 8c
|
||||
list profile 8d
|
||||
list profile 12a
|
||||
list profile 12b
|
||||
list profile 17a
|
||||
list profile 30a
|
||||
option bitswap 1
|
||||
option sra 1
|
||||
option us0 1 # VDSL2 only
|
||||
option sesdrop 0
|
||||
option sos 0
|
||||
option phyReXmtUs 0
|
||||
option phyReXmtDs 1
|
||||
|
||||
config atm-device atm0
|
||||
option name 'ATM'
|
||||
option vpi '8'
|
||||
option vci '35'
|
||||
option device atm0
|
||||
option link_type 'eoa' # EoA, IPoA, PPPoA, CIP
|
||||
option encapsulation 'llc' # llc, vcmux
|
||||
option qos_class 'ubr' # ubr, cbr, gfr, vbr-nrt, vbr-rt, ubr+, abr
|
||||
# option pcr '512'
|
||||
# option scr '256'
|
||||
# option mbs '1024'
|
||||
|
||||
config ptm-device ptm0
|
||||
option name 'PTM'
|
||||
option device 'ptm0'
|
||||
option priority '1'
|
||||
option portid '1'
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
[ "$STATUS" == "up" -o "$STATUS" == "down" ] || exit 0
|
||||
|
||||
. /lib/functions.sh
|
||||
include /lib/dsl
|
||||
|
||||
xtm_remove_devices
|
||||
xtm_create_devices
|
||||
@@ -1,7 +0,0 @@
|
||||
if [ "$STATUS" == "up" ]; then
|
||||
ubus call led.dsl set '{"state":"ok"}'
|
||||
elif [ "$STATUS" == "down" ]; then
|
||||
ubus call led.dsl set '{"state":"off"}'
|
||||
elif [ "$STATUS" == "training" ]; then
|
||||
ubus call led.dsl set '{"state":"alert"}'
|
||||
fi
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
. /lib/functions.sh
|
||||
include /lib/dsl
|
||||
|
||||
START=20
|
||||
USE_PROCD=1
|
||||
|
||||
DSLMNGR=$(which dslmngr)
|
||||
|
||||
start_service() {
|
||||
[ -n "$DSLMNGR" ] && {
|
||||
procd_open_instance
|
||||
procd_set_param command "$DSLMNGR"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
xdsl_configure
|
||||
xtm_create_devices
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
[ -n "$DSLMNGR" ] && service_stop $DSLMNGR
|
||||
|
||||
xtm_remove_devices
|
||||
xdsl_stop
|
||||
}
|
||||
|
||||
boot() {
|
||||
local HASADSL="$(db -q get hw.board.hasAdsl)"
|
||||
local HASVDSL="$(db -q get hw.board.hasVdsl)"
|
||||
[ "$HASADSL" == "1" -o "$HASVDSL" == "1" ] || return
|
||||
|
||||
xdsl_init
|
||||
|
||||
start
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger dsl
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ define Package/easy-qos
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Easy QoS
|
||||
DEPENDS:=@(TARGET_brcmbca||TARGET_airoha)
|
||||
DEPENDS:=@(TARGET_intel_mips||TARGET_iopsys_brcm63xx_arm)
|
||||
endef
|
||||
|
||||
define Package/easy-qos/description
|
||||
@@ -39,7 +39,11 @@ define Package/easy-qos/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(CP) ./files/etc/config/easy_qos $(1)/etc/config/
|
||||
ifeq ($(CONFIG_TARGET_intel_mips),y)
|
||||
$(CP) ./files/etc/init.d/easy_qos.classcfg $(1)/etc/init.d/easy_qos
|
||||
else
|
||||
$(CP) ./files/etc/init.d/easy_qos.iptables $(1)/etc/init.d/easy_qos
|
||||
endif
|
||||
$(CP) ./files/etc/uci-defaults/* $(1)/etc/uci-defaults/
|
||||
$(CP) ./files/etc/firewall.easyqos $(1)/etc/firewall.easyqos
|
||||
endef
|
||||
|
||||
301
easy-qos/files/etc/init.d/easy_qos.classcfg
Executable file
301
easy-qos/files/etc/init.d/easy_qos.classcfg
Executable file
@@ -0,0 +1,301 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
|
||||
RULE_LIST="/tmp/easy_qos_rule.list"
|
||||
CLIENT_LIST="/tmp/easy_qos_class_client.list"
|
||||
BRIDGE_INTF=""
|
||||
|
||||
[ -f /etc/profile.d/intel.sh ] && {
|
||||
. /etc/profile.d/intel.sh
|
||||
sh /etc/profile.d/intel.sh
|
||||
}
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t easy_qos_class -p debug
|
||||
}
|
||||
|
||||
exec_log() {
|
||||
${@}
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
log "Failed to create ${@}";
|
||||
fi
|
||||
}
|
||||
|
||||
exec_class_log() {
|
||||
${@} |grep -i successful
|
||||
if [ "${?}" -ne 0 ]; then
|
||||
log "Failed to create ${@}";
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
get_priority() {
|
||||
local prio=$(echo $1|tr [A-Z] [a-z]);
|
||||
case "${prio}" in
|
||||
"lowest")
|
||||
echo 8;;
|
||||
"low")
|
||||
echo 7;;
|
||||
"besteffort")
|
||||
echo 6;;
|
||||
"normal")
|
||||
echo 5;;
|
||||
"video")
|
||||
echo 4;;
|
||||
"medium")
|
||||
echo 3;;
|
||||
"high")
|
||||
echo 2;;
|
||||
"highest")
|
||||
echo 1;;
|
||||
esac
|
||||
}
|
||||
|
||||
get_mark() {
|
||||
local prio=$(echo $1|tr [A-Z] [a-z]);
|
||||
case "${prio}" in
|
||||
"lowest")
|
||||
echo "0x41/0x3df";;
|
||||
"low")
|
||||
echo "0x82/0x3df";;
|
||||
"besteffort")
|
||||
echo "0xc3/0x3df";;
|
||||
"normal")
|
||||
echo "0x104/0x3df";;
|
||||
"video")
|
||||
echo "0x145/0x3df";;
|
||||
"medium")
|
||||
echo "0x186/0x3df";;
|
||||
"high")
|
||||
echo "0x1c7/0x3df";;
|
||||
"highest")
|
||||
echo "0x208/0x3df";;
|
||||
esac
|
||||
}
|
||||
|
||||
clean_client_entries() {
|
||||
[ -f ${CLIENT_LIST} ] && rm ${CLIENT_LIST}
|
||||
}
|
||||
|
||||
map_client_entries() {
|
||||
local clients ip mac host
|
||||
|
||||
json_load "$(ubus call router.network 'clients')"
|
||||
json_get_keys keys
|
||||
|
||||
for key in ${keys};
|
||||
do
|
||||
json_select ${key}
|
||||
json_get_vars ipaddr macaddr hostname
|
||||
clients="${macaddr} ${ipaddr} ${hostname};${clients}"
|
||||
json_select ..
|
||||
done
|
||||
|
||||
json_init
|
||||
|
||||
IFS=";"
|
||||
for client in ${clients};
|
||||
do
|
||||
macaddr=$(echo ${client} | cut -d" " -f1)
|
||||
json_add_object "${macaddr//:/_}"
|
||||
json_add_string "ip" "$(echo ${client} | cut -d" " -f2)"
|
||||
json_add_string "macaddr" "$(echo ${client} | cut -d" " -f1)"
|
||||
json_add_string "host" "$(echo ${client} | cut -d" " -f3)"
|
||||
json_close_object
|
||||
done
|
||||
|
||||
IFS=' '
|
||||
echo `json_dump` > ${CLIENT_LIST}
|
||||
json_cleanup
|
||||
}
|
||||
|
||||
# Find the IP of a corresponding mac from arp table
|
||||
get_ipaddress() {
|
||||
local clients ip mac host
|
||||
|
||||
json_load "$(cat ${CLIENT_LIST})"
|
||||
json_get_keys keys
|
||||
|
||||
# jshn seems a bit iffy on having : in key, replace by _
|
||||
json_select "${1//:/_}" 2 > /dev/null
|
||||
json_get_var ip ip
|
||||
|
||||
echo "$ip"
|
||||
}
|
||||
|
||||
check_and_create() {
|
||||
iptables -t mangle -C PREROUTING ${@} 2>/dev/null
|
||||
# Create rule if not exists
|
||||
if [ ${?} -ne 0 ]; then
|
||||
exec_log iptables -t mangle -A PREROUTING ${@}
|
||||
else
|
||||
log "Rule exists for ${@}"
|
||||
fi
|
||||
}
|
||||
|
||||
create_ip_rule() {
|
||||
local proto=$1; shift
|
||||
local src_ip=$1; shift
|
||||
local mark=$1; shift
|
||||
local ports=$1;
|
||||
local cmd="";
|
||||
|
||||
cmd="-j EXTMARK --set-mark ${mark}";
|
||||
if [ "${proto}" != "icmp" ]; then
|
||||
if [ -n "${ports}" ]; then
|
||||
cmd="--match multiport --dports ${ports} ${cmd}";
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${proto}" == "icmp" ]; then
|
||||
cmd="-p icmp -m icmp --icmp-type 8 $cmd"
|
||||
elif [ "${proto}" == "all" ]; then
|
||||
cmd="-p all $cmd"
|
||||
else
|
||||
cmd="-p ${proto} -m ${proto} $cmd"
|
||||
fi
|
||||
cmd="-s ${src_ip} $cmd"
|
||||
|
||||
check_and_create ${cmd}
|
||||
}
|
||||
|
||||
is_lan_bridge() {
|
||||
local _section=$1
|
||||
local _type
|
||||
local _is_lan
|
||||
|
||||
config_get _type "$section" "type"
|
||||
config_get _is_lan "$section" "is_lan"
|
||||
|
||||
if [ "${_type}" == "bridge" -a "${_is_lan}" == "1" ]; then
|
||||
BRIDGE_INTF="br-${_section}"
|
||||
fi
|
||||
}
|
||||
|
||||
get_bridge_interface() {
|
||||
config_load network
|
||||
config_foreach is_lan_bridge interface
|
||||
}
|
||||
|
||||
validate_rule_section()
|
||||
{
|
||||
uci_validate_section easy_qos rule "${1}" \
|
||||
'priority:string' \
|
||||
'macaddr:string' \
|
||||
'proto:string:none' \
|
||||
'port:list(uinteger)' \
|
||||
'comment:string:none'
|
||||
}
|
||||
|
||||
# Clear existing rules before applying new rules
|
||||
clear_existing_rules() {
|
||||
# execute the delete rules written onto a file then delete the file
|
||||
[ -f ${RULE_LIST} ] || return 0
|
||||
|
||||
while read line
|
||||
do
|
||||
log "Deleting old classification rules"
|
||||
exec_class_log classcfg -D ${line} -i ${BRIDGE_INTF}
|
||||
done <${RULE_LIST}
|
||||
|
||||
local rule=$(iptables -t mangle -S PREROUTING|grep -m 1 EXTMARK |sed 's/-A/-D/1')
|
||||
while [ -n "${rule}" ]; do
|
||||
exec_log iptables -t mangle ${rule}
|
||||
rule=$(iptables -t mangle -S PREROUTING|grep -m 1 EXTMARK |sed 's/-A/-D/1')
|
||||
done
|
||||
sync
|
||||
|
||||
[ -f ${RULE_LIST} ] && rm ${RULE_LIST}
|
||||
}
|
||||
|
||||
# classcfg -M local_dhcp -i lo -p udp --dport 67:67 --dport 68:68 -j mark --mark 1
|
||||
create_rule() {
|
||||
local proto=$1; shift
|
||||
local mac_addr=$1; shift
|
||||
local mark=$1; shift
|
||||
local ports=$1;
|
||||
local cmd="";
|
||||
# Rule name is uniqe, so we take hash of all the input as rule_name
|
||||
local rule_name="$(echo ${mac_addr}${proto}${mark}${ports} |md5sum |head -c 30)"
|
||||
|
||||
cmd="-j mark --mark ${mark}";
|
||||
|
||||
if [ "${mac_addr}" != "none" ]; then
|
||||
cmd="--smac ${mac_addr} ${cmd}";
|
||||
fi
|
||||
|
||||
if [ "${proto}" != "icmp" ]; then
|
||||
if [ "${ports}" != "none" ]; then
|
||||
IFS=","
|
||||
for port in ${ports};
|
||||
do
|
||||
cmd="--dport ${port}:${port} ${cmd}";
|
||||
done
|
||||
IFS=' '
|
||||
fi
|
||||
fi
|
||||
if [ "${proto}" != "none" ]; then
|
||||
cmd="-p ${proto} $cmd"
|
||||
fi
|
||||
cmd="-i ${BRIDGE_INTF} $cmd"
|
||||
cmd="-A ${rule_name} $cmd"
|
||||
|
||||
# Store the rule_names for cleanup on reload
|
||||
exec_class_log classcfg ${cmd}
|
||||
[ $? -eq 0 ] && \
|
||||
echo ${rule_name} >> ${RULE_LIST}
|
||||
}
|
||||
|
||||
manage_rule() {
|
||||
local cfg="$1"
|
||||
local priority macaddr proto port comment prio_num port_list ip ipmark
|
||||
|
||||
validate_rule_section "${1}" || {
|
||||
log "Validation of section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
prio_num=$(get_priority ${priority})
|
||||
port_list=$(echo ${port}|sed 's/ /,/g')
|
||||
ipmark=$(get_mark ${priority})
|
||||
ip=$(get_ipaddress ${macaddr})
|
||||
|
||||
if [ -n "${prio_num}" ]; then
|
||||
if [ "${proto}" == "none" -o "${proto}" == "tcpudp" ]; then
|
||||
create_rule tcp ${macaddr} ${prio_num} ${port_list}
|
||||
create_rule udp ${macaddr} ${prio_num} ${port_list}
|
||||
if [ -n "${ip}" ]; then
|
||||
create_ip_rule tcp ${ip} ${ipmark} ${port_list}
|
||||
create_ip_rule udp ${ip} ${ipmark} ${port_list}
|
||||
fi
|
||||
else
|
||||
create_rule ${proto} ${macaddr} ${prio_num} ${port_list}
|
||||
if [ -n "${ip}" ]; then
|
||||
create_ip_rule ${proto} ${ip} ${ipmark} ${port_list}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
get_bridge_interface
|
||||
map_client_entries
|
||||
clear_existing_rules
|
||||
config_load easy_qos
|
||||
config_foreach manage_rule rule
|
||||
clean_client_entries
|
||||
}
|
||||
|
||||
start_service() {
|
||||
[ -x /opt/intel/usr/sbin/classcfg ] || exit 0
|
||||
reload_service
|
||||
log "Easy QoS class installed"
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "easy_qos" "network"
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ exec_log() {
|
||||
}
|
||||
|
||||
get_priority() {
|
||||
local prio=$(echo $1|tr 'A-Z' 'a-z');
|
||||
local prio=$(echo $1|tr [A-Z] [a-z]);
|
||||
case "${prio}" in
|
||||
"lowest")
|
||||
echo 0;;
|
||||
@@ -98,7 +98,7 @@ manage_rule() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
protocol=$(echo ${proto}|tr 'A-Z' 'a-z')
|
||||
protocol=$(echo ${proto}|tr [A-Z] [a-z])
|
||||
prio_num=$(get_priority ${priority})
|
||||
if [ -n "${macaddr}" -a -n "${prio_num}" ]; then
|
||||
for p in ${port}; do
|
||||
|
||||
@@ -19,7 +19,7 @@ exec_log() {
|
||||
}
|
||||
|
||||
get_priority() {
|
||||
local prio=$(echo $1|tr 'A-Z' 'a-z');
|
||||
local prio=$(echo $1|tr [A-Z] [a-z]);
|
||||
case "${prio}" in
|
||||
"lowest")
|
||||
echo 0;;
|
||||
|
||||
@@ -19,7 +19,7 @@ include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
-include $(TOPDIR)/.config
|
||||
|
||||
ifneq ($(CONFIG_TARGET_brcmbca),)
|
||||
ifneq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),)
|
||||
LINUX_DIR=$(BUILD_DIR)/bcmkernel/bcm963xx/kernel/linux-4.1
|
||||
LINUX_VERSION := 4.1.52
|
||||
LINUXINCLUDE=-Iarch/$(LINUX_KARCH)/mach-bcm963xx/include
|
||||
@@ -85,7 +85,7 @@ define Build/Compile
|
||||
endef
|
||||
|
||||
|
||||
ifneq ($(CONFIG_TARGET_brcmbca),)
|
||||
ifneq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),)
|
||||
define KernelPackage/easy-soc-events/install-extra
|
||||
cp $(PKG_BUILD_DIR)/easyevent.ko $(FS_DIR)/lib/modules/$(LINUX_VERSION)/extra
|
||||
endef
|
||||
|
||||
5
easy-soc-libs/Config.in
Normal file
5
easy-soc-libs/Config.in
Normal file
@@ -0,0 +1,5 @@
|
||||
# libeasy configuration
|
||||
|
||||
config LIBWIFI_USE_CTRL_IFACE
|
||||
bool "Use UNIX sockets"
|
||||
default n
|
||||
@@ -7,13 +7,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=easy-soc-libs
|
||||
PKG_VERSION:=7.2.26
|
||||
PKG_VERSION:=6.4.5
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=350793b45873480d8981dac540c4145705a7b7ba
|
||||
PKG_SOURCE_VERSION:=23028753fdfc5f4a0e8da33fb6b813e21c5d6c23
|
||||
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
|
||||
@@ -36,63 +36,38 @@ define Package/easy-soc-libs
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
TARGET_WIFI_TYPE=BROADCOM
|
||||
CHIP_ID=$(patsubst "%",%,$(CONFIG_BCM_CHIP_ID))
|
||||
TARGET_CFLAGS +=-DIOPSYS_BROADCOM -DCHIP_$(CHIP_ID) -DCONFIG_BCM9$(CHIP_ID) \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
|
||||
-I$(STAGING_DIR)/usr/include/bcm963xx/userspace/public/include
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_ramips),y)
|
||||
TARGET_PLATFORM=MEDIATEK
|
||||
TARGET_CFLAGS +=-DIOPSYS_MEDIATEK
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_x86),y)
|
||||
TARGET_PLATFORM=TEST
|
||||
TARGET_WIFI_TYPE=TEST
|
||||
TARGET_CFLAGS +=-DIOPSYS_TEST
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_armvirt),y)
|
||||
TARGET_PLATFORM=TEST
|
||||
TARGET_WIFI_TYPE=TEST
|
||||
TARGET_CFLAGS +=-DIOPSYS_TEST
|
||||
else ifeq ($(CONFIG_TARGET_airoha),y)
|
||||
TARGET_PLATFORM=ECONET
|
||||
TARGET_WIFI_TYPE=MEDIATEK MAC80211
|
||||
TARGET_CFLAGS +=-DIOPSYS_ECONET
|
||||
else ifeq ($(CONFIG_TARGET_ipq95xx),y)
|
||||
TARGET_PLATFORM=IPQ95XX
|
||||
TARGET_WIFI_TYPE=MAC80211
|
||||
TARGET_CFLAGS +=-DIPQ95XX
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_mediatek),y)
|
||||
TARGET_PLATFORM=LINUX
|
||||
TARGET_WIFI_TYPE=MAC80211
|
||||
TARGET_CFLAGS +=-DIOPSYS_LINUX
|
||||
else
|
||||
$(info Unexpected CONFIG_TARGET, use default MAC80211)
|
||||
TARGET_PLATFORM=MAC80211
|
||||
TARGET_WIFI_TYPE=MAC80211
|
||||
TARGET_CFLAGS +=-DIOPSYS_MAC80211
|
||||
endif
|
||||
|
||||
export TARGET_PLATFORM
|
||||
|
||||
subdirs := \
|
||||
$(if $(CONFIG_PACKAGE_libeasy),libeasy) \
|
||||
$(if $(CONFIG_PACKAGE_libwifiutils),libwifi) \
|
||||
$(if $(CONFIG_PACKAGE_libwifi),libwifi) \
|
||||
$(if $(CONFIG_PACKAGE_libdsl),libdsl) \
|
||||
$(if $(CONFIG_PACKAGE_libethernet),libethernet) \
|
||||
$(if $(CONFIG_PACKAGE_libqos),libqos)
|
||||
|
||||
ifneq ($(CONFIG_PACKAGE_libwifi),)
|
||||
TARGET_CFLAGS +=-DHAS_WIFI
|
||||
endif
|
||||
|
||||
esl-pkgs := \
|
||||
$(if $(CONFIG_PACKAGE_libeasy),libeasy) \
|
||||
$(if $(CONFIG_PACKAGE_libwifiutils),libwifiutils) \
|
||||
$(if $(CONFIG_PACKAGE_libwifi),libwifi) \
|
||||
$(if $(CONFIG_PACKAGE_libdsl),libdsl) \
|
||||
$(if $(CONFIG_PACKAGE_libethernet),libethernet) \
|
||||
$(if $(CONFIG_PACKAGE_libqos),libqos)
|
||||
|
||||
esl-pkgs-all := \
|
||||
EASY_SOC_LIBS := \
|
||||
libeasy \
|
||||
libwifiutils \
|
||||
libwifi \
|
||||
libdsl \
|
||||
libethernet \
|
||||
@@ -112,7 +87,6 @@ MAKE_FLAGS += \
|
||||
LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
FPIC="$(FPIC)" \
|
||||
PLATFORM="$(TARGET_PLATFORM)" \
|
||||
WIFI_TYPE="$(TARGET_WIFI_TYPE)" \
|
||||
subdirs="$(subdirs)"
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
@@ -142,15 +116,15 @@ define Build/Compile
|
||||
$(Build/Compile/rebuild)
|
||||
touch $(PKG_BUILD_DIR)/.config_$(CONFIG_TARGET_PROFILE)
|
||||
$(call Build/Compile/Default)
|
||||
$(foreach dir,$(esl-pkgs),$(call Build/Compile/$(dir)))
|
||||
$(foreach dir,$(subdirs),$(call Build/Compile/$(dir)))
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(foreach dir,$(esl-pkgs),$(call Build/InstallDev/$(dir),$(1),$(2));)
|
||||
$(foreach dir,$(subdirs),$(call Build/InstallDev/$(dir),$(1),$(2));)
|
||||
endef
|
||||
|
||||
define Package/easy-soc-libs/install
|
||||
:
|
||||
endef
|
||||
|
||||
$(eval $(foreach e,$(esl-pkgs-all),$(call BuildPackage,$(e))))
|
||||
$(eval $(foreach e,$(EASY_SOC_LIBS),$(call BuildPackage,$(e))))
|
||||
|
||||
@@ -6,6 +6,10 @@ define Package/libeasy
|
||||
DEPENDS+=+libnl +libnl-route
|
||||
endef
|
||||
|
||||
define Package/libeasy/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Build/InstallDev/libeasy
|
||||
$(INSTALL_DIR) $(1)/usr/include/easy
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
define Package/libethernet
|
||||
$(call Package/easy-soc-libs)
|
||||
TITLE:= Ethernet library (libethernet)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_airoha:ecnt_api
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_iopsys_ramips:swconfig
|
||||
endef
|
||||
|
||||
define Package/libethernet/config
|
||||
|
||||
@@ -1,53 +1,29 @@
|
||||
|
||||
define Package/libwifiutils
|
||||
$(call Package/easy-soc-libs)
|
||||
TITLE:= WiFi utility library (libwifiutils.so)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy
|
||||
endef
|
||||
|
||||
define Build/InstallDev/libwifiutils
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/wifidefs.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/wifiutils.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifiutils*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libwifiutils/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifiutils*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
define Package/libwifi
|
||||
$(call Package/easy-soc-libs)
|
||||
TITLE:= WiFi library (libwifi)
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +libwifiutils +TARGET_brcmbca:bcmkernel
|
||||
DEPENDS+=+libnl +libnl-route +libeasy +TARGET_iopsys_brcm63xx_arm:bcmkernel
|
||||
endef
|
||||
|
||||
define Package/libwifi/config
|
||||
if PACKAGE_libwifi
|
||||
config LIBWIFI_DEBUG
|
||||
if PACKAGE_libdsl
|
||||
config LIBWIFI_DEBUG
|
||||
depends on PACKAGE_libwifi
|
||||
bool "Enable debugging in libwifi"
|
||||
bool "Enable wifi debugging"
|
||||
default n
|
||||
|
||||
config LIBWIFI_USE_CTRL_IFACE
|
||||
bool "Create UNIX sockets to interface with hostapd/wpa_supplicant"
|
||||
default n
|
||||
endif
|
||||
endef
|
||||
|
||||
|
||||
define Build/InstallDev/libwifi
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/wifiops.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/wifi.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi-7*.so* $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libwifi/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi-7*.so* $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/libwifi/libwifi*.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
|
||||
@@ -7,18 +7,18 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=endptmngr
|
||||
PKG_VERSION:=0.6
|
||||
PKG_VERSION:=0.5
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/endptmngr.git
|
||||
PKG_SOURCE_VERSION:=fb85081443c19b5062bede49c80b1802c0f05d34
|
||||
PKG_SOURCE_VERSION:=debfc47348d6e1fc1c8b126ad50a7f5f8db3e19d
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=PROPRIETARY
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
export BUILD_DIR
|
||||
@@ -30,6 +30,7 @@ PKG_BUILD_PARALLEL:=1
|
||||
# indirectly. This ensures that the package is rebuilt on config-changes.
|
||||
PKG_CONFIG_DEPENDS:=CONFIG_TARGET_BOARD
|
||||
|
||||
export CONFIG_BRCM_SDK_VER_504002
|
||||
export CONFIG_BCM_CHIP_ID
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
@@ -55,10 +56,6 @@ define Build/Prepare
|
||||
endef
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-Wall \
|
||||
-Werror
|
||||
|
||||
define Package/endptmngr/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
|
||||
@@ -7,8 +7,6 @@ USE_PROCD=1
|
||||
NAME=endptmngr
|
||||
|
||||
start_service() {
|
||||
[ "$(db -q get hw.board.hasVoice)" = "1" ] || return
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param env hw_board_hasDect=$(db get hw.board.hasDect)
|
||||
procd_set_param command $NAME
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ethmngr
|
||||
PKG_VERSION:=2.1.0
|
||||
PKG_VERSION:=2.0.1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=5a0ff3bc7c49dcb05129f423ef8e0c4929f6aa03
|
||||
@@ -23,7 +23,7 @@ define Package/ethmngr
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Ethernet status and configration utility
|
||||
DEPENDS:=+(TARGET_brcmbca||TARGET_airoha||TARGET_ipq95xx||TARGET_iopsys_mediatek):libethernet +libuci +libubox +ubus +libpthread +libnl-genl
|
||||
DEPENDS:=+libethernet +libuci +libubox +ubus +libpthread +libnl-genl
|
||||
endef
|
||||
|
||||
define Package/ethmngr/description
|
||||
@@ -37,24 +37,10 @@ TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
ifeq ($(CONFIG_TARGET_brcmbca)$(CONFIG_TARGET_airoha)$(CONFIG_TARGET_ipq95xx)$(CONFIG_TARGET_iopsys_mediatek),)
|
||||
define Build/Compile
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/ethmngr/install
|
||||
$(CP) ./files/common/* $(1)/
|
||||
ifneq ($(CONFIG_TARGET_brcmbca),)
|
||||
$(CP) ./files/broadcom/* $(1)/
|
||||
else ifneq ($(CONFIG_TARGET_airoha),)
|
||||
$(CP) ./files/airoha/* $(1)/
|
||||
else
|
||||
$(CP) ./files/linux/* $(1)/
|
||||
endif
|
||||
ifneq ($(CONFIG_TARGET_brcmbca)$(CONFIG_TARGET_airoha)$(CONFIG_TARGET_ipq95xx)$(CONFIG_TARGET_iopsys_mediatek),)
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/init.d $(1)/usr/sbin
|
||||
$(INSTALL_BIN) ./files/ethmngr.init $(1)/etc/init.d/ethmngr
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ethmngr $(1)/usr/sbin/
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ethmngr))
|
||||
|
||||
@@ -1,208 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
unset -f switchmgr
|
||||
# alias for switchmgr
|
||||
switchmgr() {
|
||||
"/userfs/bin/switchmgr" "$@"
|
||||
}
|
||||
|
||||
unset -f tc3162_get_lan_port
|
||||
# get lan port port by ifname
|
||||
# arg1: port ifname, ex: eth0.1
|
||||
tc3162_get_lan_port() {
|
||||
[[ -z "$1" ]] && return 255
|
||||
|
||||
local ifname="$1"
|
||||
local if_idx=255
|
||||
|
||||
# only for tc3162 eth switch ports (eth0.x, 0 < x < 7)
|
||||
case "${ifname}" in
|
||||
eth0.*)
|
||||
;;
|
||||
*)
|
||||
logger -t "port-management" \
|
||||
"unsupported - ${ifname} is not tc3162 switch port"
|
||||
return 255
|
||||
;;
|
||||
esac
|
||||
|
||||
let "if_idx=$(echo "${ifname}" | cut -f2 -d'.')"
|
||||
[[ -z "${if_idx}" ]] && return 255
|
||||
[[ ${if_idx} -lt 1 || ${if_idx} -gt 6 ]] && {
|
||||
logger -t "port-management" \
|
||||
"incorrect tc3162 lan port index ${if_idx} picked from ifname ${ifname}"
|
||||
return 255
|
||||
}
|
||||
let "if_idx=${if_idx}-1"
|
||||
return ${if_idx}
|
||||
}
|
||||
|
||||
|
||||
unset -f tc3162_get_mapped_port
|
||||
# get mapped switch port by ifname
|
||||
# arg1: port ifname, ex: eth0.1
|
||||
tc3162_get_mapped_port() {
|
||||
[[ -z "$1" ]] && return 255
|
||||
|
||||
local ifname="$1"
|
||||
local if_idx=255
|
||||
local prtmap_procfile="/proc/tc3162/eth_portmap"
|
||||
local lan_prt=255
|
||||
local port=255
|
||||
local prtmap_out_line_num=4
|
||||
local prtmap_out_line=""
|
||||
|
||||
# check "lan port map" marker in portmap output string
|
||||
prtmap_out_line="$(sed -n "${prtmap_out_line_num}p" ${prtmap_procfile})"
|
||||
[[ ${prtmap_out_line} != "lan_port_map" ]] && return 255
|
||||
|
||||
tc3162_get_lan_port "${ifname}"
|
||||
let "if_idx=$?"
|
||||
[[ -z "${if_idx}" || ${if_idx} -eq 255 ]] && return
|
||||
|
||||
# get lan portmapping string "lan_port mapped_port" for ifname by it's index
|
||||
let "prtmap_out_line_num=${prtmap_out_line_num}+1+${if_idx}"
|
||||
prtmap_out_line="$(sed -n "${prtmap_out_line_num}p" ${prtmap_procfile})"
|
||||
|
||||
# get and check lan port index from lan portmapping string
|
||||
lan_prt=$(echo "${prtmap_out_line}" | cut -f 1 -d' ')
|
||||
[[ -z "${lan_prt}" || "${if_idx}" != "${lan_prt}" ]] && return 255
|
||||
|
||||
# get and check mapped port from lan portmapping string
|
||||
let "port=$(echo "${prtmap_out_line}" | cut -f 2 -d' ')"
|
||||
[[ ${port} -lt 0 || ${port} -gt 255 ]] && return 255
|
||||
|
||||
return ${port}
|
||||
}
|
||||
|
||||
unset -f get_max_port_speed
|
||||
# arg1: port ifname, ex: eth0.1
|
||||
get_max_port_speed() {
|
||||
[[ -z "$1" ]] && { echo 0; return; }
|
||||
|
||||
local ifname="$1"
|
||||
local port=255
|
||||
local speed=0
|
||||
|
||||
[[ -d "/sys/class/net/${ifname}" ]] || {
|
||||
logger -t "port-management" "interface ${ifname} is not found"
|
||||
return
|
||||
}
|
||||
|
||||
tc3162_get_lan_port "${ifname}"
|
||||
let "port=$?"
|
||||
[[ -z "${port}" || ${port} -eq 255 ]] && return
|
||||
|
||||
# tc3162 capability for all ports is 1Gbps
|
||||
speed=1000
|
||||
|
||||
echo $speed
|
||||
}
|
||||
|
||||
unset -f power_updown
|
||||
# arg1: port ifname, ex: eth0.1
|
||||
# arg2: port enabled, ex: 0/1/off/on/..
|
||||
power_updown() {
|
||||
[[ -z "$1" ]] && return
|
||||
[[ -z "$2" ]] && return
|
||||
|
||||
local ifname="$1"
|
||||
local enabled="$2"
|
||||
local port=255
|
||||
|
||||
[[ -d "/sys/class/net/${ifname}" ]] || {
|
||||
logger -t "port-management" "interface ${ifname} is not found"
|
||||
return
|
||||
}
|
||||
|
||||
let "enabled=$(get_bool "${enabled}" "-1")"
|
||||
[[ ${enabled} -eq -1 ]] && return
|
||||
|
||||
tc3162_get_lan_port "${ifname}"
|
||||
let "port=$?"
|
||||
[[ -z "${port}" || ${port} -eq 255 ]] && return
|
||||
|
||||
switchmgr phy admin "${port}" "${enabled}"
|
||||
}
|
||||
|
||||
unset -f set_port_settings
|
||||
# arg1: port ifname, ex: eth0.1
|
||||
# arg2: port enabled, ex: 0/1/off/on/..
|
||||
# arg3: port speed, ex: 1000
|
||||
# arg4: port duplex, ex: full
|
||||
# arg5: port autoneg, ex: 0/1/off/on/..
|
||||
# arg6: port eee, ex: 0/1/off/on/..
|
||||
# arg7: port pause, ex: 0/1/off/on/..
|
||||
set_port_settings() {
|
||||
[[ -z "$1" ]] && return
|
||||
[[ -z "$2" ]] && return
|
||||
[[ -z "$3" ]] && return
|
||||
[[ -z "$4" ]] && return
|
||||
[[ -z "$5" ]] && return
|
||||
[[ -z "$6" ]] && return
|
||||
[[ -z "$7" ]] && return
|
||||
|
||||
local ifname="$1"
|
||||
local enabled="$2"
|
||||
local speed="$3"
|
||||
local duplex="$4"
|
||||
local autoneg=$5
|
||||
local eee="$6"
|
||||
local pause="$7"
|
||||
local port=255
|
||||
local speedmode=1
|
||||
local last_speed=0
|
||||
|
||||
[[ -d "/sys/class/net/${ifname}" ]] || {
|
||||
logger -t "port-management" "interface ${ifname} is not found"
|
||||
return
|
||||
}
|
||||
|
||||
let "enabled=$(get_bool "${enabled}" "-1")"
|
||||
[[ ${enabled} -eq -1 ]] && return
|
||||
|
||||
let "autoneg=$(get_bool "${autoneg}" "-1")"
|
||||
[[ ${autoneg} -eq -1 ]] && return
|
||||
|
||||
let "eee=$(get_bool "${eee}" "-1")"
|
||||
[[ ${eee} -eq -1 ]] && return
|
||||
|
||||
let "pause=$(get_bool "${pause}" "-1")"
|
||||
[[ ${pause} -eq -1 ]] && return
|
||||
|
||||
duplex="$(echo "${duplex}" | awk '{print tolower($0)}')"
|
||||
[[ "${duplex}" != "half" && "${duplex}" != "full" ]] && return
|
||||
|
||||
tc3162_get_lan_port "${ifname}"
|
||||
let "port=$?"
|
||||
[[ -z "${port}" || ${port} -eq 255 ]] && return
|
||||
|
||||
last_speed="$(switchmgr phy maxspeed "${port}" | cut -f2 -d':')"
|
||||
[[ -z "${last_speed}" || "${last_speed}" == "*Down*" ]] \
|
||||
&& last_speed=${speed}
|
||||
|
||||
switchmgr phy pause "${port}" "${pause}"
|
||||
|
||||
# set speedmode: speed+duplex+autoneg
|
||||
# FIXME: switchmgr has no separate setting for 1Gbps speed - use autoneg instead
|
||||
if [[ ${autoneg} -eq 1 || ${speed} -gt 100 ]]; then
|
||||
switchmgr phy speedmode ${port} "1"
|
||||
else
|
||||
[[ ${speed} -gt 10 ]] && let "speedmode=2" || let "speedmode=4"
|
||||
[[ "${duplex}" == "half" ]] && let "speedmode=${speedmode}+1"
|
||||
switchmgr phy speedmode "${port}" "${speedmode}"
|
||||
fi
|
||||
|
||||
# TODO: implement MAC control register manipulations (mapped ports used) for
|
||||
# eee settings change
|
||||
# separate (tx/rx) pause (flow control) settings change
|
||||
# set speed to 1Gbps separately from autoneg mode
|
||||
|
||||
# FIXME: workaround for duplex/pause settings being not applied if speed is unchanged
|
||||
[[ ${last_speed} -eq ${speed} ]] && power_updown "${ifname}" 0
|
||||
|
||||
power_updown "${ifname}" ${enabled}
|
||||
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
# arg1: port ifname, ex: eth0
|
||||
get_max_port_speed() {
|
||||
if [ -z "$1" ]; then
|
||||
echo 0
|
||||
return
|
||||
fi
|
||||
|
||||
local ifname="$1"
|
||||
local phycap="$(ethctl $ifname media-type 2>/dev/null | grep 'PHY Capabilities' | awk '{print$NF}' | cut -d'|' -f1)"
|
||||
local speed=1000
|
||||
|
||||
case "$phycap" in
|
||||
10GFD) speed=10000 ;;
|
||||
5GFD) speed=5000 ;;
|
||||
2.5GFD) speed=2500 ;;
|
||||
1GFD|1GHD) speed=1000 ;;
|
||||
100MFD|100MHD) speed=100 ;;
|
||||
10MFD|10MHD) speed=10 ;;
|
||||
esac
|
||||
|
||||
echo $speed
|
||||
}
|
||||
|
||||
# arg1: port name, ex: eth0
|
||||
get_port_number() {
|
||||
[ -z "$1" ] && return
|
||||
local ports="0 1 2 3 4 5 6 7 8"
|
||||
local units="0 1"
|
||||
local port="$1"
|
||||
local ifname
|
||||
|
||||
for unit in $units; do
|
||||
for prt in $ports; do
|
||||
ifname="$(ethswctl getifname $unit $prt 2>/dev/null | awk '{print$NF}')"
|
||||
if [ "$ifname" == "$port" ]; then
|
||||
echo "$unit $prt"
|
||||
return
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
# arg1: port ifname, ex: eth0
|
||||
# arg2: port enabled, ex: 1
|
||||
power_updown() {
|
||||
local ifname="$1"
|
||||
local enabled=$2
|
||||
|
||||
local updown="up"
|
||||
[ $enabled -eq 0 ] && updown="down"
|
||||
ethctl $ifname phy-power $updown >/dev/null
|
||||
}
|
||||
|
||||
# arg1: port ifname, ex: eth0
|
||||
# arg2: port enabled, ex: 1
|
||||
# arg3: port speed, ex: 1000
|
||||
# arg4: port duplex, ex: full
|
||||
# arg5: port autoneg, ex: on
|
||||
# arg6: port eee, ex: 0
|
||||
# arg7: port pause, ex: 0
|
||||
set_port_settings() {
|
||||
local ifname="$1"
|
||||
local enabled=$2
|
||||
local speed="$3"
|
||||
local duplex=$4
|
||||
local autoneg=$5
|
||||
local eee=$6
|
||||
local pause=$7
|
||||
|
||||
[ -d /sys/class/net/$ifname ] || return
|
||||
|
||||
local unitport="$(get_port_number $ifname)"
|
||||
local unit=$(echo $unitport | cut -d ' ' -f 1)
|
||||
local port=$(echo $unitport | cut -d ' ' -f 2)
|
||||
|
||||
[ $autoneg -eq 1 ] && autoneg="on" || autoneg="off"
|
||||
[ "$duplex" == "half" ] && duplex=0 || duplex=1
|
||||
[ "$duplex" == 0 ] && dplx="HD" || dplx="FD"
|
||||
[ "$autoneg" == "on" ] && media_type="auto" || media_type="$speed$dplx"
|
||||
|
||||
phycrossbar="$(ethctl $ifname phy-crossbar | head -1)"
|
||||
crossbartype="$(echo $phycrossbar | awk '{print$2$3}')"
|
||||
# Take only the last PHY Endpoint (non-Serdes) into account as Serdes port number precedes
|
||||
[ "$crossbartype" == "oncrossbar" ] && pyhendpoint="$(echo $phycrossbar | awk '{print$NF}')"
|
||||
|
||||
phycaps="$(ethctl $ifname media-type ${pyhendpoint:+ port $pyhendpoint} | awk -F'PHY Capabilities: ' '{print$2}')"
|
||||
numofcaps="$(echo $phycaps | tr '|' ' ' | wc -w)"
|
||||
|
||||
if [ "$numofcaps" == "1" ]; then
|
||||
logger -t "port-management" "$ifname is capable of $phycaps only; not setting speed/duplex"
|
||||
else
|
||||
logger -t "port-management" "$ifname is capable of $phycaps; setting speed/duplex to $media_type"
|
||||
ethctl $ifname media-type $media_type ${pyhendpoint:+ port $pyhendpoint} &>/dev/null
|
||||
fi
|
||||
|
||||
[ $eee -eq 1 ] && eee="on" || eee="off"
|
||||
ethtool --set-eee $ifname eee $eee 2>/dev/null
|
||||
|
||||
case $pause in
|
||||
off|0)
|
||||
pause=0x0
|
||||
auto=off
|
||||
rx=off
|
||||
tx=off
|
||||
;;
|
||||
on|1)
|
||||
pause=0x2
|
||||
auto=off
|
||||
rx=on
|
||||
tx=on
|
||||
;;
|
||||
auto)
|
||||
pause=0x1
|
||||
auto=on
|
||||
rx=on
|
||||
tx=on
|
||||
;;
|
||||
tx)
|
||||
pause=0x3
|
||||
auto=off
|
||||
rx=off
|
||||
tx=on
|
||||
;;
|
||||
rx)
|
||||
pause=0x4
|
||||
auto=off
|
||||
rx=on
|
||||
tx=off
|
||||
;;
|
||||
esac
|
||||
if [ "$auto" == "on" ]; then
|
||||
# Use ethswctl utility to set pause autoneg
|
||||
# as ethtool is not setting it properly
|
||||
ethswctl -c pause -n $unit -p $port -v $pause 2>&1 >/dev/null
|
||||
else
|
||||
ethtool --pause $ifname autoneg $auto rx $rx tx $tx 2>/dev/null
|
||||
fi
|
||||
|
||||
power_updown $ifname $enabled
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
populate_config_from_db() {
|
||||
. /lib/functions.sh
|
||||
. /lib/network/utils.sh
|
||||
include /lib/ethernet
|
||||
|
||||
portorder="$(db -q get hw.board.ethernetPortOrder)"
|
||||
for port in $portorder; do
|
||||
speed="$(get_max_port_speed $port 2>/dev/null)"
|
||||
speed="${speed:-1000}"
|
||||
|
||||
uci add ports ethport
|
||||
uci rename ports.@ethport[-1]="$(get_port_name $port)"
|
||||
uci set ports.@ethport[-1].enabled=1
|
||||
uci set ports.@ethport[-1].name="$(get_port_name $port)"
|
||||
uci set ports.@ethport[-1].ifname="$port"
|
||||
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
|
||||
if [ "$(db -q get hw.board.ethernetWanPort)" = "$port" ]; then
|
||||
uci set ports.@ethport[-1].pause=1
|
||||
uci set ports.@ethport[-1].uplink=1
|
||||
else
|
||||
uci set ports.@ethport[-1].pause=0
|
||||
fi
|
||||
done
|
||||
|
||||
uci commit ports
|
||||
}
|
||||
|
||||
populate_config_from_device_tree() {
|
||||
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="$speed"
|
||||
uci set ports.@ethport[-1].duplex="full"
|
||||
uci set ports.@ethport[-1].autoneg=1
|
||||
uci set ports.@ethport[-1].eee=0
|
||||
if [ "$port" = "wan" ]; then
|
||||
uci set ports.@ethport[-1].pause=1
|
||||
uci set ports.@ethport[-1].uplink=1
|
||||
else
|
||||
uci set ports.@ethport[-1].pause=0
|
||||
fi
|
||||
done
|
||||
uci commit ports
|
||||
}
|
||||
|
||||
if [ -s "/etc/config/ports" ]; then
|
||||
if uci -q get ports.@ethport[0] >/dev/null; then
|
||||
# exit if there is any valid content
|
||||
exit 0
|
||||
else
|
||||
rm -f /etc/config/ports
|
||||
fi
|
||||
fi
|
||||
|
||||
touch /etc/config/ports
|
||||
|
||||
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
|
||||
fi
|
||||
19
ethmngr/files/ethmngr.init
Normal file
19
ethmngr/files/ethmngr.init
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=95
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/ethmngr
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command ${PROG}
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
@@ -1,95 +0,0 @@
|
||||
# arg1: port ifname, ex: eth0
|
||||
get_max_port_speed() {
|
||||
if [ -z "$1" ]; then
|
||||
echo 0
|
||||
return
|
||||
fi
|
||||
|
||||
local ifname="$1"
|
||||
local phycap="$(ethtool $ifname | grep -A 10 "Supported link modes" | grep 000 | tail -n 1 | awk '{print$NF}')"
|
||||
local speed=1000
|
||||
|
||||
case "$phycap" in
|
||||
10000*) speed=10000 ;;
|
||||
5000*) speed=5000 ;;
|
||||
2500*) speed=2500 ;;
|
||||
1000*) speed=1000 ;;
|
||||
100*) speed=100 ;;
|
||||
10*) speed=10 ;;
|
||||
esac
|
||||
|
||||
echo $speed
|
||||
}
|
||||
|
||||
# arg1: port ifname, ex: eth0
|
||||
# arg2: port enabled, ex: 1
|
||||
power_updown() {
|
||||
local ifname="$1"
|
||||
local enabled=$2
|
||||
|
||||
local updown="up"
|
||||
[ $enabled -eq 0 ] && updown="down"
|
||||
ip link set dev $ifname $updown
|
||||
}
|
||||
|
||||
# arg1: port ifname, ex: eth0
|
||||
# arg2: port enabled, ex: 1
|
||||
# arg3: port speed, ex: 1000
|
||||
# arg4: port duplex, ex: full
|
||||
# arg5: port autoneg, ex: on
|
||||
# arg6: port eee, ex: 0
|
||||
# arg7: port pause, ex: 0
|
||||
set_port_settings() {
|
||||
local ifname="$1"
|
||||
local enabled=$2
|
||||
local speed="$3"
|
||||
local duplex=$4
|
||||
local autoneg=$5
|
||||
local eee=$6
|
||||
local pause=$7
|
||||
|
||||
[ -d /sys/class/net/$ifname ] || return
|
||||
|
||||
[ $autoneg -eq 1 ] && autoneg="on" || autoneg="off"
|
||||
ethtool --change $ifname speed $speed duplex $duplex autoneg $autoneg
|
||||
|
||||
[ $eee -eq 1 ] && eee="on" || eee="off"
|
||||
ethtool --set-eee $ifname eee $eee 2>/dev/null
|
||||
|
||||
case $pause in
|
||||
off|0)
|
||||
pause=0x0
|
||||
auto=off
|
||||
rx=off
|
||||
tx=off
|
||||
;;
|
||||
on|1)
|
||||
pause=0x2
|
||||
auto=off
|
||||
rx=on
|
||||
tx=on
|
||||
;;
|
||||
auto)
|
||||
pause=0x1
|
||||
auto=on
|
||||
rx=on
|
||||
tx=on
|
||||
;;
|
||||
tx)
|
||||
pause=0x3
|
||||
auto=off
|
||||
rx=off
|
||||
tx=on
|
||||
;;
|
||||
rx)
|
||||
pause=0x4
|
||||
auto=off
|
||||
rx=on
|
||||
tx=off
|
||||
;;
|
||||
esac
|
||||
|
||||
ethtool --pause $ifname autoneg $auto rx $rx tx $tx 2>/dev/null
|
||||
|
||||
power_updown $ifname $enabled
|
||||
}
|
||||
106
evoice/Makefile
106
evoice/Makefile
@@ -1,106 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2022 IOPSYS Software Solutions AB
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=evoice
|
||||
PKG_VERSION:=0.2.39
|
||||
|
||||
LOCAL_DEV=0
|
||||
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:=30d65330de0368f73ecf4a2e804c39a2ee280454
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
||||
PKG_LICENSE:=PROPRIETARY IOPSYS
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
# 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
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=Telephony
|
||||
TITLE:=Ensemble Voice
|
||||
URL:=
|
||||
DEPENDS:= +libubox +libubus +libpicoevent +libuci +libstdcpp +libopenssl +libjson-c +libblobmsg-json\
|
||||
+TARGET_brcmbca:bcmkernel\
|
||||
+TARGET_airoha:kmod-voip_driver\
|
||||
+TARGET_airoha:voip_app +libbbf_api
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Ensemble Voice. A stand alone SIP VoIP application.
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
# If you want to build the code from your own local repositiory enable
|
||||
# LOCAL_DEV and set LOCAL_DEV_EVOICE_DIR to your own git repository.
|
||||
define Build/Prepare
|
||||
@echo "======================================================="
|
||||
@echo "DEVELOPMENT BUILD! rsync $(LOCAL_DEV_EVOICE_DIR) to $(PKG_BUILD_DIR)"
|
||||
@echo "======================================================="
|
||||
rsync -a $(LOCAL_DEV_EVOICE_DIR)/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
IDIR = $(STAGING_DIR)/usr/include
|
||||
TONES_INI_REQUIRED=
|
||||
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
TARGET_PLATFORM=BROADCOM
|
||||
BDIR = bcm963xx/userspace/private/apps/voice
|
||||
CC_FLAGS = -I$(IDIR) -I$(IDIR)/$(BDIR)/inc\
|
||||
-I$(IDIR)/bcm963xx/xchg/bos/publicInc\
|
||||
-I$(IDIR)/bcm963xx/bcmdrivers/broadcom/include/bcm963xx
|
||||
TRG=SVrgBcmFxs
|
||||
JSONFILE=codecs_brcm.json
|
||||
else ifeq ($(CONFIG_TARGET_airoha),y)
|
||||
TARGET_PLATFORM=ECONET
|
||||
TONES_INI_REQUIRED=y
|
||||
TRG=SVrgMtekOwrt
|
||||
JSONFILE=codecs_airoha.json
|
||||
endif
|
||||
|
||||
# disable temporarily some not important warnings, force PIC
|
||||
CC_FLAGS_VS=$(CC_FLAGS) -Wno-unused-parameter -Wno-unused-function -fPIC
|
||||
|
||||
export TARGET_PLATFORM
|
||||
|
||||
#used and altered by BIDE makefiles
|
||||
export _XFLAGS
|
||||
|
||||
BIDE_MAKE_OPTS = -r -R -C $(PKG_BUILD_DIR) -f _bld/src/cdabs.mk\
|
||||
SWB=b_gxxqca6 HWA=a_openwrt HWC=c_hosted OSP=p_posix LIF=cerder DBG=dbg
|
||||
|
||||
define Build/Compile
|
||||
@echo "TARGET_PLATFORM=${TARGET_PLATFORM}"
|
||||
+$(MAKE) $(BIDE_MAKE_OPTS) CC_FLAGS="$(CC_FLAGS)" TRG=$(TRG)
|
||||
|
||||
@echo "clean libvoiceservice before building shared lib!"
|
||||
+$(MAKE) $(BIDE_MAKE_OPTS) CC_FLAGS="$(CC_FLAGS_VS)" TRG=libvoiceservice cleanall
|
||||
+$(MAKE) $(BIDE_MAKE_OPTS) CC_FLAGS="$(CC_FLAGS_VS)" TRG=libvoiceservice
|
||||
endef
|
||||
|
||||
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/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,evoice))
|
||||
@@ -1,334 +0,0 @@
|
||||
|
||||
config SIPClient 'Client1'
|
||||
option Enable '1'
|
||||
option RegisterMode 'RFC3261'
|
||||
option AuthUserName '51234'
|
||||
option AuthPassword '51234'
|
||||
option Network 'Network1'
|
||||
option MaxSessions '5'
|
||||
option RegisiterURI '51234@sip-proxy.iopsys.eu'
|
||||
option E164Format '1'
|
||||
|
||||
config SIPClient 'Client2'
|
||||
option Enable '1'
|
||||
option RegisterMode 'RFC3261'
|
||||
option AuthUserName '51235'
|
||||
option AuthPassword '51235'
|
||||
option Network 'Network1'
|
||||
option MaxSessions '5'
|
||||
option RegisiterURI '51235@sip-proxy.iopsys.eu'
|
||||
option E164Format '1'
|
||||
|
||||
config SIPNetwork 'Network1'
|
||||
option Enable '1'
|
||||
option ProxyServer 'sip-proxy.iopsys.eu'
|
||||
option AcceptFromProxyOnly '0'
|
||||
option ProxyServerPort '5060'
|
||||
option ProxyServerTransport 'UDP'
|
||||
option RegistrarServer 'sip-proxy.iopsys.eu'
|
||||
option RegistrarServerPort '5060'
|
||||
option RegistrarServerTransport 'UDP'
|
||||
option RegistrationPeriod '3240'
|
||||
option RegisterExpires '3600'
|
||||
option UserAgentDomain ' '
|
||||
option TimerRegistrationFailed '120'
|
||||
option TimerT1 '500'
|
||||
option VoIPProfile 'VoIPProfile1'
|
||||
option SIPSessionTimerEnable '0'
|
||||
option SIPSessionExpireInterval '1800'
|
||||
option SIPSessionMinimumTimer '90'
|
||||
option SIPSessionRefresher 'NONE'
|
||||
option SIPSessionTimerMode 'REQUEST'
|
||||
option SIPSessionRefreshRequest 'UPDATE'
|
||||
list CodecList '1CodecProfile1'
|
||||
list CodecList '1CodecProfile2'
|
||||
list CodecList '1CodecProfile3'
|
||||
list CodecList '1CodecProfile5'
|
||||
list CodecList '1CodecProfile4'
|
||||
|
||||
config CodecProfile '1CodecProfile1'
|
||||
option Enable '1'
|
||||
option Codec 'G.711ALaw'
|
||||
option PacketizationPeriod '20'
|
||||
option SilenceSupression '1'
|
||||
|
||||
config CodecProfile '1CodecProfile2'
|
||||
option Enable '1'
|
||||
option Codec 'G.711MuLaw'
|
||||
option PacketizationPeriod '20'
|
||||
option SilenceSupression '1'
|
||||
|
||||
config CodecProfile '1CodecProfile3'
|
||||
option Enable '1'
|
||||
option Codec 'G.726'
|
||||
option PacketizationPeriod '20'
|
||||
option SilenceSupression '0'
|
||||
|
||||
config CodecProfile '1CodecProfile4'
|
||||
option Enable '1'
|
||||
option Codec 'G.722'
|
||||
option PacketizationPeriod '20'
|
||||
option SilenceSupression '0'
|
||||
|
||||
config CodecProfile '1CodecProfile5'
|
||||
option Enable '1'
|
||||
option Codec 'G.729'
|
||||
option PacketizationPeriod '20'
|
||||
option SilenceSupression '0'
|
||||
|
||||
config VoIPProfile 'VoIPProfile1'
|
||||
option Enable '1'
|
||||
option DTMFMethod 'RFC4733'
|
||||
option RTP '1RTP'
|
||||
|
||||
config RTP '1RTP'
|
||||
option LocalPortMin '10020'
|
||||
option LocalPortMax '10039'
|
||||
option JitterBufferType 'Static'
|
||||
|
||||
config FXXPorts 'POTS'
|
||||
option Region 'US'
|
||||
|
||||
config FXSPorts 'FXS1'
|
||||
option Enable '1'
|
||||
option DialType 'Tone'
|
||||
option TransmitGain '0'
|
||||
option ReceiveGain '0'
|
||||
option EchoCancellationEnable '1'
|
||||
|
||||
config FXSPorts 'FXS2'
|
||||
option Enable '1'
|
||||
option DialType 'Tone'
|
||||
option TransmitGain '0'
|
||||
option ReceiveGain '0'
|
||||
option EchoCancellationEnable '1'
|
||||
|
||||
config Extension 'Extension1'
|
||||
option Enable '1'
|
||||
option ExtensionNumber '10#'
|
||||
option Provider 'FXS1'
|
||||
option CallingFeatures 'Set1'
|
||||
option Name 'Phone 1'
|
||||
|
||||
config Extension 'Extension2'
|
||||
option Enable '1'
|
||||
option ExtensionNumber '11#'
|
||||
option Provider 'FXS2'
|
||||
option CallingFeatures 'Set1'
|
||||
option Name 'Phone 2'
|
||||
|
||||
config Line 'Line1'
|
||||
option Enable '1'
|
||||
option Provider 'Client1'
|
||||
option CallingFeatures 'Set1'
|
||||
|
||||
config Line 'Line2'
|
||||
option Enable '1'
|
||||
option Provider 'Client2'
|
||||
option CallingFeatures 'Set2'
|
||||
|
||||
config IncomingMap 'IncomingMap1'
|
||||
option Enable '1'
|
||||
option Extension 'Extension1'
|
||||
option Line 'Line1'
|
||||
|
||||
config IncomingMap 'IncomingMap2'
|
||||
option Enable '1'
|
||||
option Extension 'Extension2'
|
||||
option Line 'Line2'
|
||||
|
||||
config IncomingMap 'IncomingMap3'
|
||||
option Enable '0'
|
||||
option Extension 'Extension2'
|
||||
option Line 'Line1'
|
||||
|
||||
config OutgoingMap 'OutgoingMap1'
|
||||
option Enable '1'
|
||||
option Extension 'Extension1'
|
||||
option Line 'Line1'
|
||||
|
||||
config OutgoingMap 'OutgoingMap2'
|
||||
option Enable '1'
|
||||
option Extension 'Extension2'
|
||||
option Line 'Line2'
|
||||
|
||||
config CallingFeatures 'Set1'
|
||||
option CallerIDEnable '1'
|
||||
option CallerIDNameEnable '1'
|
||||
option CallForwardUnconditionalEnable '0'
|
||||
option CallForwardUnconditionalNumber ' '
|
||||
option CallForwardOnBusyEnable '0'
|
||||
option CallForwardOnBusyNumber ' '
|
||||
option CallForwardOnNoAnswerEnable '0'
|
||||
option CallForwardOnNoAnswerRingTimeout '24'
|
||||
option CallForwardOnNoAnswerNumber ' '
|
||||
option CallTransferEnable '1'
|
||||
option MWIEnable '1'
|
||||
option VMWIEnable '1'
|
||||
option LineMessagesWaiting '0'
|
||||
option AnonymousCallRejectionEnable '0'
|
||||
option AnonymousCallEnable '1'
|
||||
option DoNotDisturbEnable '1'
|
||||
option RepeatDialEnable '1'
|
||||
option VoiceMailEnable '1'
|
||||
option CallPickUpEnable '1'
|
||||
option CCBSEnable '1'
|
||||
option CallWaitingEnable '0'
|
||||
|
||||
config CallingFeatures 'Set2'
|
||||
option CallerIDEnable '1'
|
||||
option CallerIDNameEnable '1'
|
||||
option CallForwardUnconditionalEnable '0'
|
||||
option CallForwardUnconditionalNumber ' '
|
||||
option CallForwardOnBusyEnable '0'
|
||||
option CallForwardOnBusyNumber ' '
|
||||
option CallForwardOnNoAnswerEnable '0'
|
||||
option CallForwardOnNoAnswerRingTimeout '24'
|
||||
option CallForwardOnNoAnswerNumber ' '
|
||||
option CallTransferEnable '1'
|
||||
option MWIEnable '1'
|
||||
option VMWIEnable '1'
|
||||
option LineMessagesWaiting '0'
|
||||
option AnonymousCallRejectionEnable '0'
|
||||
option AnonymousCallEnable '1'
|
||||
option DoNotDisturbEnable '1'
|
||||
option RepeatDialEnable '1'
|
||||
option VoiceMailEnable '1'
|
||||
option CallPickUpEnable '1'
|
||||
option CCBSEnable '1'
|
||||
option CallWaitingEnable '1'
|
||||
|
||||
config NumberingPlan 'NumberingPlan1'
|
||||
option MinimumNumberOfDigits '1'
|
||||
option MaximumNumberOfDigits '15'
|
||||
option InterDigitTimerStd '2000'
|
||||
option InterDigitTimerOpen '2000'
|
||||
option TerminationDigit '#'
|
||||
|
||||
config NumberingPlan 'NumberingPlan2'
|
||||
option MinimumNumberOfDigits '5'
|
||||
option MaximumNumberOfDigits '15'
|
||||
option InterDigitTimerStd '2000'
|
||||
option InterDigitTimerOpen '2000'
|
||||
option TerminationDigit ' '
|
||||
list PrefixList '2PrefixInfo1'
|
||||
list PrefixList '2PrefixInfo2'
|
||||
list PrefixList '2PrefixInfo3'
|
||||
list PrefixList '2PrefixInfo4'
|
||||
list PrefixList '2PrefixInfo5'
|
||||
list PrefixList '2PrefixInfo6'
|
||||
list PrefixList '2PrefixInfo7'
|
||||
list PrefixList '2PrefixInfo8'
|
||||
list PrefixList '2PrefixInfo9'
|
||||
|
||||
config NumberingPlan 'NumberingPlan3'
|
||||
option MinimumNumberOfDigits '5'
|
||||
option MaximumNumberOfDigits '15'
|
||||
option InterDigitTimerStd '2000'
|
||||
option InterDigitTimerOpen '2000'
|
||||
option TerminationDigit '#'
|
||||
list PrefixList '3PrefixInfo1'
|
||||
|
||||
config PrefixInfo '2PrefixInfo1'
|
||||
option Enable '1'
|
||||
option PrefixRange '*43#'
|
||||
option PrefixMinNumberOfDigits '4'
|
||||
option PrefixMaxNumberOfDigits '4'
|
||||
option NumberOfDigitsToRemove '0'
|
||||
option PosOfDigitsToRemove '0'
|
||||
option FacilityAction 'CW_ACTIVATE'
|
||||
option FacilityActionArgument ' '
|
||||
|
||||
config PrefixInfo '2PrefixInfo2'
|
||||
option Enable '1'
|
||||
option PrefixRange '#43#'
|
||||
option PrefixMinNumberOfDigits '4'
|
||||
option PrefixMaxNumberOfDigits '4'
|
||||
option NumberOfDigitsToRemove '0'
|
||||
option PosOfDigitsToRemove '0'
|
||||
option FacilityAction 'CW_DEACTIVATE'
|
||||
option FacilityActionArgument ' '
|
||||
|
||||
config PrefixInfo '2PrefixInfo3'
|
||||
option Enable '1'
|
||||
option PrefixRange '*21*(X+)#'
|
||||
option PrefixMinNumberOfDigits '9'
|
||||
option PrefixMaxNumberOfDigits '9'
|
||||
option NumberOfDigitsToRemove '0'
|
||||
option PosOfDigitsToRemove '0'
|
||||
option FacilityAction 'CFU_ACTIVATE'
|
||||
option FacilityActionArgument ' '
|
||||
|
||||
config PrefixInfo '2PrefixInfo4'
|
||||
option Enable '1'
|
||||
option PrefixRange '#21#'
|
||||
option PrefixMinNumberOfDigits '4'
|
||||
option PrefixMaxNumberOfDigits '4'
|
||||
option NumberOfDigitsToRemove '0'
|
||||
option PosOfDigitsToRemove '0'
|
||||
option FacilityAction 'CFU_DEACTIVATE'
|
||||
option FacilityActionArgument ' '
|
||||
|
||||
config PrefixInfo '2PrefixInfo5'
|
||||
option Enable '1'
|
||||
option PrefixRange '*67*(X+)#'
|
||||
option PrefixMinNumberOfDigits '9'
|
||||
option PrefixMaxNumberOfDigits '9'
|
||||
option NumberOfDigitsToRemove '0'
|
||||
option PosOfDigitsToRemove '0'
|
||||
option FacilityAction 'CFB_ACTIVATE'
|
||||
option FacilityActionArgument ' '
|
||||
|
||||
config PrefixInfo '2PrefixInfo6'
|
||||
option Enable '1'
|
||||
option PrefixRange '#67#'
|
||||
option PrefixMinNumberOfDigits '4'
|
||||
option PrefixMaxNumberOfDigits '4'
|
||||
option NumberOfDigitsToRemove '0'
|
||||
option PosOfDigitsToRemove '0'
|
||||
option FacilityAction 'CFB_DEACTIVATE'
|
||||
option FacilityActionArgument ' '
|
||||
|
||||
config PrefixInfo '2PrefixInfo7'
|
||||
option Enable '1'
|
||||
option PrefixRange '*61*(X+(*X+)?)#'
|
||||
option PrefixMinNumberOfDigits '15'
|
||||
option PrefixMaxNumberOfDigits '15'
|
||||
option NumberOfDigitsToRemove '0'
|
||||
option PosOfDigitsToRemove '0'
|
||||
option FacilityAction 'CFNR_ACTIVATE'
|
||||
option FacilityActionArgument ' '
|
||||
|
||||
config PrefixInfo '2PrefixInfo8'
|
||||
option Enable '1'
|
||||
option PrefixRange '#61#'
|
||||
option PrefixMinNumberOfDigits '4'
|
||||
option PrefixMaxNumberOfDigits '4'
|
||||
option NumberOfDigitsToRemove '0'
|
||||
option PosOfDigitsToRemove '0'
|
||||
option FacilityAction 'CFNR_DEACTIVATE'
|
||||
option FacilityActionArgument ' '
|
||||
|
||||
config PrefixInfo '2PrefixInfo9'
|
||||
option Enable '1'
|
||||
option PrefixRange '*31*'
|
||||
option PrefixMinNumberOfDigits '4'
|
||||
option PrefixMaxNumberOfDigits '4'
|
||||
option NumberOfDigitsToRemove '0'
|
||||
option PosOfDigitsToRemove '0'
|
||||
option FacilityAction 'CA_ACTIVATE'
|
||||
option FacilityActionArgument ' '
|
||||
|
||||
config PrefixInfo '3PrefixInfo1'
|
||||
option Enable '1'
|
||||
option PrefixRange '110|112'
|
||||
option PrefixMinNumberOfDigits '7'
|
||||
option PrefixMaxNumberOfDigits '7'
|
||||
option NumberOfDigitsToRemove '0'
|
||||
option PosOfDigitsToRemove '0'
|
||||
option FacilityAction 'X_IOPSYS_EU_EMERGENCY'
|
||||
option FacilityActionArgument ' '
|
||||
|
||||
config DialPlan 'X_IOPSYS_EU_InternalNumber1'
|
||||
option RegExp '1X#'
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,181 +0,0 @@
|
||||
# RO (Main)
|
||||
config account 'map_board'
|
||||
option HW_Has_Voice 'hw.board.hasVoice'
|
||||
option HW_Has_DECT 'hw.board.hasDect'
|
||||
option HW_Nr_Of_POTS_Ports 'hw.board.VoicePorts'
|
||||
option HW_VoiceDSP 'hw.board.VoiceDSP'
|
||||
option ProductID 'device.deviceinfo.ModelName'
|
||||
option I3_VERSION 'device.deviceinfo.SoftwareVersion'
|
||||
option SerialNumber 'device.deviceinfo.SerialNumber'
|
||||
|
||||
config account 'map_pots'
|
||||
option Country 'voice.POTS.Region'
|
||||
|
||||
# Voice Service navigation paths
|
||||
# Not used to initialize internal configuration
|
||||
config navigation 'map_vs'
|
||||
option Account 'voice.Client@.'
|
||||
option Network 'voice.Client@.Network'
|
||||
option VoIPProfile 'voice.Network@.VoIPProfile'
|
||||
option CfAccount 'voice.Line@.CallingFeatures'
|
||||
option CfPhone 'voice.Extension@.CallingFeatures'
|
||||
option CodecList 'voice.Network@.CodecList'
|
||||
option Codec 'voice.Codec@.Codec'
|
||||
option OutgoingMapEnabled 'voice.OutgoingMap@.Enable'
|
||||
option From_Phone 'voice.OutgoingMap@.Extension'
|
||||
option Extension 'voice.Extension@.Provider'
|
||||
option To_Account 'voice.OutgoingMap@.Line'
|
||||
option Line 'voice.Line@.Provider'
|
||||
option LineEnable 'voice.Line@.Enable'
|
||||
option LineProvider 'voice.Line@.Provider'
|
||||
option IncomingMapEnabled 'voice.IncomingMap@.Enable'
|
||||
option From_Account 'voice.IncomingMap@.Line'
|
||||
option To_Phone 'voice.IncomingMap@.Extension'
|
||||
option ExtensionEnable 'voice.Extension@.Enable'
|
||||
option ExtensionProvider 'voice.Extension@.Provider'
|
||||
|
||||
# Registration for account A-Z is associate with SIP.Clienti.Enable
|
||||
# All parameters in this table are written to internal configuration
|
||||
config account 'map_account'
|
||||
option Registration 'voice.Client@.Enable'
|
||||
option Display_Name ''
|
||||
option PhoneNumber 'voice.Client@.RegisiterURI'
|
||||
option Username 'voice.Client@.AuthUserName'
|
||||
option Password 'voice.Client@.AuthPassword'
|
||||
option SIP_Telephone_Syntax 'voice.Client@.E164Format'
|
||||
option Device_Description 'voice.Client@.UserAgent'
|
||||
|
||||
# Network stuff associated with an account.
|
||||
# All parameters in this table are written to internal configuration
|
||||
config network 'map_net'
|
||||
option Enable 'voice.Network@.Enable'
|
||||
option Registration_Server 'voice.Network@.RegistrarServer'
|
||||
option Outbound_Proxy 'voice.Network@.ProxyServer'
|
||||
option Accept_From_Registered 'voice.Network@.AcceptFromProxyOnly'
|
||||
option SIP_Port 'voice.Network@.RegistrarServerPort'
|
||||
option SIP_Transport 'voice.Network@.RegistrarServerTransport'
|
||||
option RegistrationPeriod 'voice.Network@.RegistrationPeriod'
|
||||
option Registration_Interval 'voice.Network@.RegisterExpires'
|
||||
option Reg_Failure_Interval 'voice.Network@.TimerRegistrationFailed'
|
||||
option T1 'voice.Network@.TimerT1'
|
||||
option UserAgentDomain 'voice.Network@.UserAgentDomain'
|
||||
option SIP_SessTmrEnable 'voice.Network@.SIPSessionTimerEnable'
|
||||
option SIP_SessTmrMode 'voice.Network@.SIPSessionTimerMode'
|
||||
option SIP_SessTmrMsg 'voice.Network@.SIPSessionRefreshRequest'
|
||||
option SIP_SessTmrRefresher 'voice.Network@.SIPSessionRefresher'
|
||||
option SIP_MinSE 'voice.Network@.SIPSessionMinimumTimer'
|
||||
option SIP_SessInterval 'voice.Network@.SIPSessionExpireInterval'
|
||||
|
||||
config VoIPProfile 'map_voip'
|
||||
option Enable 'voice.VoIPProfile@.Enable'
|
||||
option DTMF_Method 'voice.VoIPProfile@.DTMFMethod'
|
||||
option RTP 'voice.VoIPProfile@.RTP'
|
||||
|
||||
config RTP 'map_rtp'
|
||||
option RTP_Port_Base 'voice.@RTP@.LocalPortMin'
|
||||
option RTP_Port_End 'voice.@RTP@.LocalPortMax'
|
||||
|
||||
config codecs 'map_codec'
|
||||
option Codec 'voice.CodecProfile@.Codec'
|
||||
option enable 'voice.CodecProfile@.Enable'
|
||||
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'
|
||||
option Display_Name_Phone 'voice.Extension@.Name'
|
||||
|
||||
config capabilities 'map_capa'
|
||||
option Call_Waiting_Enable 'voice.Capabilities@FacilityActions'
|
||||
option Enable_Call_Diversion 'voice.Capabilities@FacilityActions'
|
||||
|
||||
config cs_account 'map_set'
|
||||
option BusyCallWait 'voice.Set@.CallWaitingEnable'
|
||||
option AlwaysDivert 'voice.Set@.CallForwardUnconditionalEnable'
|
||||
option CFU_Number 'voice.Set@.CallForwardUnconditionalNumber'
|
||||
option BusyDivert 'voice.Set@.CallForwardOnBusyEnable'
|
||||
option CFB_Number 'voice.Set@.CallForwardOnBusyNumber'
|
||||
option NoAnswDivert 'voice.Set@.CallForwardOnNoAnswerEnable'
|
||||
option CFNR_Number 'voice.Set@.CallForwardOnNoAnswerNumber'
|
||||
option CFNR_Timeout 'voice.Set@.CallForwardOnNoAnswerRingTimeout'
|
||||
option Enable_Call_Transfer 'voice.Set@.CallTransferEnable'
|
||||
option AnonymousReject 'voice.Set@.AnonymousCallRejectionEnable'
|
||||
option AllowAnonymousConf 'voice.Set@.AnonymousCallEnable'
|
||||
option CallerIDEnable 'voice.Set@.CallerIDEnable'
|
||||
|
||||
config cs_xvendor 'map_np_cs'
|
||||
option np_sc_actCW 'voice.X_IOPSYS_EU_NpSc@.CW_ACT'
|
||||
option np_sc_actCW_output 'voice.X_IOPSYS_EU_NpSc@.CW_OUT'
|
||||
option np_sc_deactCW 'voice.X_IOPSYS_EU_NpSc@.CW_DEACT'
|
||||
option np_sc_isactCW 'voice.X_IOPSYS_EU_NpSc@.CW_ISACT'
|
||||
option np_sc_actCFU 'voice.X_IOPSYS_EU_NpSc@.CFU_ACT'
|
||||
option np_sc_actCFU_output 'voice.X_IOPSYS_EU_NpSc@.CFU_OUT'
|
||||
option np_sc_deactCFU 'voice.X_IOPSYS_EU_NpSc@.CFU_DEACT'
|
||||
option np_sc_actCFB 'voice.X_IOPSYS_EU_NpSc@.CFB_ACT'
|
||||
option np_sc_actCFB_output 'voice.X_IOPSYS_EU_NpSc@.CFB_OUT'
|
||||
option np_sc_deactCFB 'voice.X_IOPSYS_EU_NpSc@.CFB_DEACT'
|
||||
option np_sc_actCFNR 'voice.X_IOPSYS_EU_NpSc@.CFNR_ACT'
|
||||
option np_sc_actCFNR_output 'voice.X_IOPSYS_EU_NpSc@.CFNR_OUT'
|
||||
option np_sc_deactCFNR 'voice.X_IOPSYS_EU_NpSc@.CFNR_DEACT'
|
||||
option np_sc_actRA 'voice.X_IOPSYS_EU_NpSc@.RA_ACT'
|
||||
option np_sc_deactRA 'voice.X_IOPSYS_EU_NpSc@.RA_DEACT'
|
||||
option np_sc_actAC 'voice.X_IOPSYS_EU_NpSc@.AC_ACT'
|
||||
option np_sc_deactAC 'voice.X_IOPSYS_EU_NpSc@.AC_DEACT'
|
||||
option np_sc_actAA 'voice.X_IOPSYS_EU_NpSc@.AA_ACT'
|
||||
option np_sc_deactAA 'voice.X_IOPSYS_EU_NpSc@.AA_DEACT'
|
||||
option np_sc_actAD 'voice.X_IOPSYS_EU_NpSc@.AD_ACT'
|
||||
option np_sc_actAD_output 'voice.X_IOPSYS_EU_NpSc@.AD_OUT'
|
||||
option np_sc_deactAD 'voice.X_IOPSYS_EU_NpSc@.AD_DEACT'
|
||||
option np_sc_actMWSplash 'voice.X_IOPSYS_EU_NpSc@.MWI_SPLASH_ACT'
|
||||
option np_sc_deactMWSplash 'voice.X_IOPSYS_EU_NpSc@.MWI_SPLASH_DEACT'
|
||||
option np_sc_actMWTone 'voice.X_IOPSYS_EU_NpSc@.MWI_TONE_ACT'
|
||||
option np_sc_deactMWTone 'voice.X_IOPSYS_EU_NpSc@.MWI_TONE_DEACT'
|
||||
option np_sc_redial 'voice.X_IOPSYS_EU_NpSc@.REDIAL'
|
||||
option np_sc_setMiscConf 'voice.X_IOPSYS_EU_NpSc@.SET_MISC'
|
||||
|
||||
config cc_xvendor 'map_np_in'
|
||||
option np_in_limitExp 'voice.X_IOPSYS_EU_InternalNumber@.RegExp'
|
||||
|
||||
config cc_xvendor 'map_np_sh'
|
||||
option sh_no_str 'voice.X_IOPSYS_EU_ShortNumber@.RegExp'
|
||||
|
||||
config cc_xvendor 'map_np_eme'
|
||||
option np_eme 'voice.X_IOPSYS_EU_EmergencyNumber@.RegExp'
|
||||
option np_eme_out 'voice.X_IOPSYS_EU_EmergencyNumber@.OutStr'
|
||||
|
||||
config cc_xvendor 'map_np_rn'
|
||||
option np_rn 'voice.X_IOPSYS_EU_RegularNumber@.RegExp'
|
||||
option np_rn_out 'voice.X_IOPSYS_EU_RegularNumber@.OutStr'
|
||||
option np_rn_account 'voice.X_IOPSYS_EU_RegularNumber@.AccStr'
|
||||
|
||||
config cc_xvendor 'map_np_bn'
|
||||
option np_bn 'voice.X_IOPSYS_EU_BarredNumber@.RegExp'
|
||||
option np_bn_out 'voice.X_IOPSYS_EU_BarredNumber@.OutStr'
|
||||
|
||||
config TR104NumberingPlan 'map_np_tr'
|
||||
option min_digits 'voice.NumberingPlan@.MinimumNumberOfDigits'
|
||||
option max_digits 'voice.NumberingPlan@.MaximumNumberOfDigits'
|
||||
option tmo_std 'voice.NumberingPlan@.InterDigitTimerStd'
|
||||
option tmo_open 'voice.NumberingPlan@.InterDigitTimerOpen'
|
||||
option term_digit 'voice.NumberingPlan@.TerminationDigit'
|
||||
option prefix_list 'voice.NumberingPlan@.PrefixList'
|
||||
|
||||
config TR104NumberingPlanPrefix 'map_np_pf'
|
||||
option enable 'voice.@PrefixInfo@.Enable'
|
||||
option range 'voice.@PrefixInfo@.PrefixRange'
|
||||
option prefix_min_digits 'voice.@PrefixInfo@.PrefixMinNumberOfDigits'
|
||||
option prefix_max_digits 'voice.@PrefixInfo@.PrefixMaxNumberOfDigits'
|
||||
option remove_digits 'voice.@PrefixInfo@.NumberOfDigitsToRemove'
|
||||
option remove_pos 'voice.@PrefixInfo@.NumberOfDigitsToRemove'
|
||||
option facility_act 'voice.@PrefixInfo@.FacilityAction'
|
||||
option facility_arg 'voice.@PrefixInfo@.FacilityActionArgument'
|
||||
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
config static_prm 'defaults'
|
||||
option Print_Control '4'
|
||||
option Print_UDP_Addr '192.168.1.3'
|
||||
option Print_UDP_Port '60000'
|
||||
option Verbosity 'On'
|
||||
option Failure_Log 'On'
|
||||
option Message_Log 'On'
|
||||
option Method_Trace 'Off'
|
||||
option Dial_Cache_Size '0'
|
||||
option Reverse_Fax_Detection '0'
|
||||
option DSP_24 '0'
|
||||
option DSP_36 '0'
|
||||
option DSP_43 '0'
|
||||
option Swap_Name_Nr_CID '0'
|
||||
option R_Button_Lower_Lim '100'
|
||||
option R_Button_Upper_Lim '800'
|
||||
option HookOn_Delay '0'
|
||||
option SupportLDD '0'
|
||||
option LDD_Min_Break_Time '41'
|
||||
option LDD_Max_Break_Time '94'
|
||||
option LDD_Percent_Break '55'
|
||||
option Tone_On_Hangup '1'
|
||||
option BusyTone_On_Hangup '1'
|
||||
option Enable_Analouge_Conf '0'
|
||||
option PrackUsage '1'
|
||||
option SIP_SupportedPath '0'
|
||||
option IMS_Access_Network_Info ' '
|
||||
option SIP_Reason_Protocol '0'
|
||||
option SIP_Body_QOST '0'
|
||||
option SIP_HistoryInfo '0'
|
||||
option Customer_Spec2 '1'
|
||||
option UTF8_Enable '0'
|
||||
option RFC3325 '0'
|
||||
option Accept_From_Registered '0'
|
||||
option Polarity_Reversal '0'
|
||||
option Closed_Dial_Plan '0'
|
||||
option Netw_Dial '0'
|
||||
option No_Answer_Tmo '180'
|
||||
option UPnP_Enabled '0'
|
||||
option NAT_Address ' '
|
||||
option NAT_Address_From_SIP '0'
|
||||
option HookOn_Transfer '0'
|
||||
option Enable_Call_Transfer '1'
|
||||
option CallerIDEnable '1'
|
||||
option Multiparty_Transp '0'
|
||||
option Presence_Indication '0'
|
||||
option Login_Note ' '
|
||||
option Login_Description ' '
|
||||
option Logout_Note ' '
|
||||
option Logout_Description ' '
|
||||
option Resolve_Every_Transaction '2'
|
||||
option Translate_Plus '1'
|
||||
option Mid_Call_Services '0'
|
||||
option Account_Restriction '0'
|
||||
option Answering_Machine_Enable '0'
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=68
|
||||
STOP=12
|
||||
|
||||
USE_PROCD=1
|
||||
NAME=evoice
|
||||
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"
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger $VOICE_UCI_CONFIG
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
{
|
||||
"G.711ALaw": [
|
||||
{
|
||||
"BitRate": 64000,
|
||||
"PacketizationPeriod": "20",
|
||||
"SilenceSuppression": false
|
||||
}
|
||||
],
|
||||
"G.711MuLaw": [
|
||||
{
|
||||
"BitRate": 64000,
|
||||
"PacketizationPeriod": "20",
|
||||
"SilenceSuppression": false
|
||||
}
|
||||
],
|
||||
"G.722": [
|
||||
{
|
||||
"BitRate": 64000,
|
||||
"PacketizationPeriod": "20",
|
||||
"SilenceSuppression": false
|
||||
}
|
||||
],
|
||||
"G.726": [
|
||||
{
|
||||
"BitRate": 32000,
|
||||
"PacketizationPeriod": "20",
|
||||
"SilenceSuppression": false
|
||||
},
|
||||
{
|
||||
"BitRate": 24000,
|
||||
"PacketizationPeriod": "20",
|
||||
"SilenceSuppression": false
|
||||
}
|
||||
],
|
||||
"G.729": [
|
||||
{
|
||||
"BitRate": 8000,
|
||||
"PacketizationPeriod": "20",
|
||||
"SilenceSuppression": false
|
||||
}
|
||||
],
|
||||
"AMR": [
|
||||
{
|
||||
"BitRate": 7400,
|
||||
"PacketizationPeriod": "20",
|
||||
"SilenceSuppression": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
{
|
||||
"G.711MuLaw": [
|
||||
{
|
||||
"BitRate": 64000,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
}
|
||||
],
|
||||
"G.711ALaw": [
|
||||
{
|
||||
"BitRate": 64000,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
}
|
||||
],
|
||||
"G.726": [
|
||||
{
|
||||
"BitRate": 16000,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
},
|
||||
{
|
||||
"BitRate": 24000,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
},
|
||||
{
|
||||
"BitRate": 32000,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
},
|
||||
{
|
||||
"BitRate": 40000,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
}
|
||||
],
|
||||
"G.723.1": [
|
||||
{
|
||||
"BitRate": 5300,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
},
|
||||
{
|
||||
"BitRate": 6300,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
}
|
||||
],
|
||||
"G.729": [
|
||||
{
|
||||
"BitRate": 8000,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
}
|
||||
],
|
||||
"iLBC": [
|
||||
{
|
||||
"BitRate": 15200,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
},
|
||||
{
|
||||
"BitRate": 13300,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
}
|
||||
],
|
||||
"G.722": [
|
||||
{
|
||||
"BitRate": 64000,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
}
|
||||
],
|
||||
"AMR": [
|
||||
{
|
||||
"BitRate": 12200,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
},
|
||||
{
|
||||
"BitRate": 10200,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
},
|
||||
{
|
||||
"BitRate": 7950,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
},
|
||||
{
|
||||
"BitRate": 7400,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
},
|
||||
{
|
||||
"BitRate": 6700,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
},
|
||||
{
|
||||
"BitRate": 5900,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
},
|
||||
{
|
||||
"BitRate": 5150,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
},
|
||||
{
|
||||
"BitRate": 4750,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
}
|
||||
],
|
||||
"GSM-EFR": [
|
||||
{
|
||||
"BitRate": 12200,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
}
|
||||
],
|
||||
"GSM-FR": [
|
||||
{
|
||||
"BitRate": 13200,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
}
|
||||
],
|
||||
"GSM-HR": [
|
||||
{
|
||||
"BitRate": 5600,
|
||||
"PacketizationPeriod": "10-30",
|
||||
"SilenceSuppression": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
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:=e3cefda3b26c9aea3021b20725ce7b31b33eebc4
|
||||
PKG_SOURCE_VERSION:=45575262de7a9690bcb2c760f35e2c74e88e1176
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
@@ -38,6 +38,9 @@ define Package/$(PKG_NAME)/description
|
||||
Command to extract sub images from FIT images.
|
||||
endef
|
||||
|
||||
MAKE_FLAGS += \
|
||||
CFLAGS+="-Wall"
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ define KernelPackage/$(PKG_NAME)
|
||||
FILES:=$(PKG_BUILD_DIR)/$(PKG_NAME).$(LINUX_KMOD_SUFFIX)
|
||||
KCONFIG:=CONFIG_PACKAGE_kmod-gryphon-led-kernel-module=y
|
||||
AUTOLOAD:=$(call AutoLoad,60,$(PKG_NAME))
|
||||
DEPENDS:= +(TARGET_brcmbca):bcmkernel
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_URL:=
|
||||
endef
|
||||
@@ -41,33 +40,6 @@ EXTRA_KCONFIG:= CONFIG_RGB_LED=m
|
||||
|
||||
MODULE_INCLUDE=-I$(PKG_BUILD_DIR)
|
||||
|
||||
|
||||
ifeq ($(CONFIG_TARGET_brcmbca),y)
|
||||
LINUX_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx/kernel/linux-4.19
|
||||
# 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"))
|
||||
# These targets use a 64-bit kernel
|
||||
LINUX_KARCH:=arm64
|
||||
TARGET_CROSS:=$(CONFIG_BRCM_ALT_TOOLCHAIN_BASE)/$(CONFIG_BRCM_ALT_AARCH64_TOOLCHAIN_TOPDIR)/bin/$(CONFIG_BRCM_ALT_AARCH64_TOOLCHAIN_PREFIX)-
|
||||
else ifeq ($(CONFIG_BCM_CHIP_ID),$(filter $(CONFIG_BCM_CHIP_ID),"6855" "6756" "47622" "63148" "63178"))
|
||||
# These targets use a 32-bit arm-sfp kernel
|
||||
LINUX_KARCH:=arm
|
||||
TARGET_CROSS:=$(CONFIG_BRCM_ALT_TOOLCHAIN_BASE)/$(CONFIG_BRCM_ALT_ARMSFP_TOOLCHAIN_TOPDIR)/bin/$(CONFIG_BRCM_ALT_ARMSFP_TOOLCHAIN_PREFIX)-
|
||||
endif
|
||||
# For some reason, Broadcom's kernel does not set the include paths correctly when compiling out-of-tree modules
|
||||
EXTRA_KCPPFLAGS:="-I $(LINUX_DIR)/../bcmkernel/include -I $(LINUX_DIR)/arch/arm/mach-bcm963xx/include"
|
||||
endif
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)/kdevlinks/
|
||||
$(CP) -s `pwd`/src/* $(PKG_BUILD_DIR)/kdevlinks/
|
||||
|
||||
@@ -220,6 +220,7 @@ static int canyon_led_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(leds->clock_gpio)) {
|
||||
dev_err(&pdev->dev, "Failed to acquire clock GPIO %ld\n",
|
||||
PTR_ERR(leds->clock_gpio));
|
||||
leds->clock_gpio = NULL;
|
||||
return PTR_ERR(leds->clock_gpio);
|
||||
}
|
||||
|
||||
@@ -227,6 +228,7 @@ static int canyon_led_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(leds->clock_gpio)) {
|
||||
dev_err(&pdev->dev, "Failed to acquire clock GPIO %ld\n",
|
||||
PTR_ERR(leds->clock_gpio));
|
||||
leds->clock_gpio = NULL;
|
||||
return PTR_ERR(leds->clock_gpio);
|
||||
} else {
|
||||
printk(KERN_INFO "Got clock gpio\n");
|
||||
@@ -244,6 +246,7 @@ static int canyon_led_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(leds->data_gpio)) {
|
||||
dev_err(&pdev->dev, "Failed to acquire data GPIO %ld\n",
|
||||
PTR_ERR(leds->data_gpio));
|
||||
leds->data_gpio = NULL;
|
||||
return PTR_ERR(leds->data_gpio);
|
||||
}
|
||||
|
||||
@@ -251,6 +254,7 @@ static int canyon_led_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(leds->data_gpio)) {
|
||||
dev_err(&pdev->dev, "Failed to acquire data GPIO %ld\n",
|
||||
PTR_ERR(leds->data_gpio));
|
||||
leds->data_gpio = NULL;
|
||||
return PTR_ERR(leds->data_gpio);
|
||||
} else {
|
||||
printk(KERN_INFO "Got data gpio\n");
|
||||
|
||||
23
icwmp/Config_cwmp.in
Normal file
23
icwmp/Config_cwmp.in
Normal file
@@ -0,0 +1,23 @@
|
||||
if PACKAGE_icwmp
|
||||
|
||||
choice
|
||||
prompt "Select ACS sever"
|
||||
default CWMP_ACS_MULTI
|
||||
|
||||
config CWMP_ACS_MULTI
|
||||
bool "No specific ACS, follow standard"
|
||||
|
||||
config CWMP_ACS_HDM
|
||||
bool "HDM"
|
||||
endchoice
|
||||
|
||||
config CWMP_DEBUG
|
||||
bool "Compile with debug options"
|
||||
default y
|
||||
|
||||
config CWMP_DEVEL_DEBUG
|
||||
bool "Compile with development debug options"
|
||||
default n
|
||||
|
||||
endif
|
||||
|
||||
116
icwmp/Makefile
116
icwmp/Makefile
@@ -1,73 +1,52 @@
|
||||
#
|
||||
# Copyright (C) 2020-2022 IOPSYS Software Solutions AB
|
||||
# Copyright (C) 2020 iopsys Software Solutions AB
|
||||
#
|
||||
# This is free software, licensed under the BSD-3-Clause
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=9.1.19
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_VERSION:=8.2.0-2021-10-05
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/icwmp.git
|
||||
PKG_SOURCE_VERSION:=9d8389cda16f410826920bb27fd8af4d28c79de9
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=ab875277578d851a9f8eed57883ca05c886b127d
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_LICENSE:=BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_CWMP_ACS_MULTI \
|
||||
CONFIG_CWMP_ACS_HDM \
|
||||
CONFIG_CWMP_DEBUG \
|
||||
CONFIG_CWMP_DEVEL_DEBUG
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Package/icwmp/default
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
SUBMENU:=TRx69
|
||||
TITLE:=TR069 CWMP client
|
||||
DEPENDS:=+libuci +libubox +libblobmsg-json +libubus +libjson-c +libcurl +mxml +libuuid +libbbf_api
|
||||
TITLE:=CWMP client
|
||||
DEPENDS:=+libuci +libmicroxml +libubox +jshn +libubus +libblobmsg-json +libpthread +ubusd +shflags +getopt +zlib +libjson-c +libopenssl +curl +libcurl
|
||||
endef
|
||||
|
||||
define Package/icwmp-openssl
|
||||
$(Package/icwmp/default)
|
||||
TITLE += (openssl)
|
||||
DEPENDS += +PACKAGE_icwmp-openssl:libopenssl
|
||||
VARIANT:=openssl
|
||||
define Package/$(PKG_NAME)/description
|
||||
A free client implementation of CWMP (TR-069) protocol
|
||||
endef
|
||||
|
||||
define Package/icwmp-wolfssl
|
||||
$(Package/icwmp/default)
|
||||
TITLE += (wolfssl)
|
||||
DEPENDS += +PACKAGE_icwmp-wolfssl:libwolfssl
|
||||
CONFLICTS := icwmp-openssl
|
||||
VARIANT:=wolfssl
|
||||
define Package/$(PKG_NAME)/config
|
||||
source "$(SOURCE)/Config_cwmp.in"
|
||||
endef
|
||||
|
||||
define Package/icwmp-mbedtls
|
||||
$(Package/icwmp/default)
|
||||
TITLE += (mbedtls)
|
||||
DEPENDS += +PACKAGE_icwmp-mbedtls:libmbedtls
|
||||
CONFLICTS := icwmp-openssl icwmp-wolfssl
|
||||
VARIANT:=mbedtls
|
||||
DEFAULT_VARIANT:=1
|
||||
endef
|
||||
|
||||
ifeq ($(BUILD_VARIANT),openssl)
|
||||
CMAKE_OPTIONS += -DWITH_OPENSSL=ON
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),wolfssl)
|
||||
CMAKE_OPTIONS += -DWITH_WOLFSSL=ON
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),mbedtls)
|
||||
CMAKE_OPTIONS += -DWITH_MBEDTLS=ON
|
||||
endif
|
||||
|
||||
USE_LOCAL=$(shell ls ./src/ 2>/dev/null >/dev/null && echo 1)
|
||||
ifneq ($(USE_LOCAL),)
|
||||
define Build/Prepare
|
||||
@@ -75,34 +54,47 @@ define Build/Prepare
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/icwmp/default/install
|
||||
TARGET_CFLAGS += \
|
||||
-D_GNU_SOURCE \
|
||||
"-DCWMP_REVISION=\\\"$(PKG_SOURCE_VERSION)\\\""
|
||||
|
||||
ifeq ($(CONFIG_CWMP_ACS_MULTI),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-acs=multi
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CWMP_ACS_HDM),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-acs=hdm
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CWMP_DEBUG),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-debug
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CWMP_DEVEL_DEBUG),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-devel
|
||||
endif
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/etc/icwmpd
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_DIR) $(1)/lib/upgrade/keep.d
|
||||
$(INSTALL_DIR) $(1)/etc/bbfdm/json/
|
||||
$(INSTALL_DIR) $(1)/etc/udhcpc.user.d
|
||||
$(INSTALL_DIR) $(1)/usr/lib/bbfdm
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libcwmpdm.so $(1)/usr/lib/bbfdm/libcwmpdm.so
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/icwmpd $(1)/usr/sbin/icwmpd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/icwmpd $(1)/usr/sbin/icwmpd
|
||||
$(INSTALL_DATA) ./files/etc/config/cwmp $(1)/etc/config/cwmp
|
||||
$(INSTALL_BIN) ./files/etc/firewall.cwmp $(1)/etc/firewall.cwmp
|
||||
$(INSTALL_BIN) ./files/etc/hotplug.d/iface/90-icwmp $(1)/etc/hotplug.d/iface/90-icwmp
|
||||
$(INSTALL_BIN) ./files/etc/init.d/icwmpd $(1)/etc/init.d/icwmpd
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/85-cwmp-set-userid $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/90-cwmpfirewall $(1)/etc/uci-defaults/
|
||||
$(INSTALL_BIN) ./files/etc/uci-defaults/90-icwmp-set-dhcp-reqopts $(1)/etc/uci-defaults/
|
||||
$(INSTALL_DATA) ./files/lib/upgrade/keep.d/icwmp $(1)/lib/upgrade/keep.d/icwmp
|
||||
$(INSTALL_BIN) ./files/etc/icwmpd/update.sh $(1)/etc/icwmpd/update.sh
|
||||
$(INSTALL_DATA) ./files/etc/bbfdm/json/CWMPManagementServer.json $(1)/etc/bbfdm/json/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/files/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user $(1)/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user
|
||||
endef
|
||||
|
||||
Package/icwmp-openssl/install = $(Package/icwmp/default/install)
|
||||
Package/icwmp-wolfssl/install = $(Package/icwmp/default/install)
|
||||
Package/icwmp-mbedtls/install = $(Package/icwmp/default/install)
|
||||
|
||||
$(eval $(call BuildPackage,icwmp-openssl))
|
||||
$(eval $(call BuildPackage,icwmp-wolfssl))
|
||||
$(eval $(call BuildPackage,icwmp-mbedtls))
|
||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
{
|
||||
"json_plugin_version": 1,
|
||||
"Device.CWMPManagementServer.": {
|
||||
"type": "object",
|
||||
"version": "2.15",
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"access": false,
|
||||
"array": false,
|
||||
"dependency": "file:/etc/config/cwmp",
|
||||
"EnableCWMP": {
|
||||
"type": "boolean",
|
||||
"version": "2.15",
|
||||
"read": true,
|
||||
"write": true,
|
||||
"protocols": [
|
||||
"usp"
|
||||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "cwmp",
|
||||
"section": {
|
||||
"name": "cpe"
|
||||
},
|
||||
"option": {
|
||||
"name": "enable"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
config acs 'acs'
|
||||
option url ''
|
||||
option userid '' #$OUI-$SER
|
||||
option passwd 'iopsys'
|
||||
option periodic_inform_enable 'true'
|
||||
option periodic_inform_interval '1800'
|
||||
option periodic_inform_time '0001-01-01T00:00:00Z'
|
||||
option ParameterKey ''
|
||||
option dhcp_discovery 'enable'
|
||||
# compression possible configs: GZIP, Deflate, Disabled
|
||||
option compression 'Disabled'
|
||||
@@ -11,15 +13,15 @@ config acs 'acs'
|
||||
option retry_min_wait_interval '5'
|
||||
# possible configs interval :[1000:65535]
|
||||
option retry_interval_multiplier '2000'
|
||||
option https_ssl_capath ''
|
||||
option ipv6_enable '0'
|
||||
option ip_version '4'
|
||||
|
||||
config cpe 'cpe'
|
||||
option enable '1'
|
||||
option interface 'eth0.1'
|
||||
option default_wan_interface 'wan'
|
||||
option default_lan_interface 'lan'
|
||||
option log_to_console 'disable'
|
||||
option log_to_file 'disable'
|
||||
option log_to_file 'enable'
|
||||
# log_severity: INFO (Default)
|
||||
# log_severity possible configs: EMERG, ALERT, CRITIC ,ERROR, WARNING, NOTICE, INFO, DEBUG
|
||||
option log_severity 'INFO'
|
||||
@@ -32,13 +34,12 @@ config cpe 'cpe'
|
||||
option amd_version '5'
|
||||
# compression possible configs: InstanceNumber, InstanceAlias
|
||||
option instance_mode 'InstanceNumber'
|
||||
option session_timeout '300'
|
||||
option session_timeout '60'
|
||||
option notification '1'
|
||||
option exec_download '0'
|
||||
option periodic_notify_enable '1'
|
||||
option periodic_notify_interval '10'
|
||||
option incoming_rule 'Port_Only'
|
||||
option active_notif_throttle '0'
|
||||
|
||||
config lwn 'lwn'
|
||||
option enable '1'
|
||||
|
||||
@@ -1,41 +1,42 @@
|
||||
#!/bin/sh
|
||||
|
||||
#created by the icwmp package
|
||||
log() {
|
||||
echo "${@}"|logger -t firewall.cwmp -p info
|
||||
}
|
||||
|
||||
if [ ! -f "/var/state/cwmp" ]; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
zone_name=$(uci -c /var/state -q get cwmp.acs.zonename)
|
||||
port=$(uci -q get cwmp.cpe.port)
|
||||
port=$(uci -c /var/state -q get cwmp.acs.port)
|
||||
ipaddr=$(uci -c /var/state -q get cwmp.acs.ip)
|
||||
ip6addr=$(uci -c /var/state -q get cwmp.acs.ip6)
|
||||
incoming_rule=$(uci -q get cwmp.cpe.incoming_rule|tr 'A-Z' 'a-z')
|
||||
ipv6enable=$(uci -c /var/state -q get cwmp.acs.ipv6_enable)
|
||||
incoming_rule=$(uci -q get cwmp.cpe.incoming_rule|tr [A-Z] [a-z])
|
||||
|
||||
if [ -z "${zone_name}" ]; then
|
||||
log "empty firewall zone name"
|
||||
if [ "$zone_name" = "" ]; then
|
||||
exit 0
|
||||
elif [ "$zone_name" = "icwmp" ]; then
|
||||
iptables -nL zone_icwmp_input 2> /dev/null
|
||||
if [ "$?" != 0 ]; then
|
||||
iptables -w 1 -N zone_icwmp_input
|
||||
iptables -w 1 -t filter -A INPUT -j zone_icwmp_input
|
||||
iptables -w 1 -I zone_icwmp_input -p tcp --dport "${port}" -j REJECT
|
||||
if [ $? != 0 ]; then
|
||||
iptables -N zone_icwmp_input
|
||||
iptables -t filter -A INPUT -j zone_icwmp_input
|
||||
iptables -I zone_icwmp_input -p tcp --dport $port -j REJECT
|
||||
else
|
||||
iptables -w 1 -F zone_icwmp_input
|
||||
iptables -w 1 -I zone_icwmp_input -p tcp --dport "${port}" -j REJECT
|
||||
iptables -F zone_icwmp_input
|
||||
iptables -I zone_icwmp_input -p tcp --dport $port -j REJECT
|
||||
fi
|
||||
else
|
||||
iptables -w 1 -F zone_icwmp_input 2> /dev/null
|
||||
iptables -w 1 -t filter -D INPUT -j zone_icwmp_input 2> /dev/null
|
||||
iptables -w 1 -X zone_icwmp_input 2> /dev/null
|
||||
iptables -F zone_icwmp_input 2> /dev/null
|
||||
iptables -t filter -D INPUT -j zone_icwmp_input 2> /dev/null
|
||||
iptables -X zone_icwmp_input 2> /dev/null
|
||||
fi
|
||||
|
||||
cmd="iptables -w 1 -I zone_${zone_name}_input -p tcp"
|
||||
cmd6="ip6tables -w 1 -I zone_${zone_name}_input -p tcp"
|
||||
cmd=""
|
||||
|
||||
if [ "${ipv6enable}" = "1" ]; then
|
||||
cmd="ip6tables"
|
||||
else
|
||||
cmd="iptables"
|
||||
fi
|
||||
|
||||
cmd="${cmd} -I zone_${zone_name}_input -p tcp"
|
||||
|
||||
# default incoming rule is Port only
|
||||
if [ -z "${incoming_rule}" ]; then
|
||||
@@ -45,36 +46,26 @@ fi
|
||||
if [ "${incoming_rule}" = "ip_only" ]; then
|
||||
if [ -n "${ipaddr}" ]; then
|
||||
cmd="${cmd} -s ${ipaddr}"
|
||||
cmd6="${cmd6} -s ${ip6addr}"
|
||||
fi
|
||||
elif [ "${incoming_rule}" = "port_only" ]; then
|
||||
if [ -n "${port}" ]; then
|
||||
cmd="${cmd} --dport ${port}"
|
||||
cmd6="${cmd6} --dport ${port}"
|
||||
fi
|
||||
else
|
||||
if [ -n "${ipaddr}" ]; then
|
||||
cmd="${cmd} -s ${ipaddr}"
|
||||
cmd6="${cmd6} -s ${ip6addr}"
|
||||
fi
|
||||
|
||||
if [ -n "${port}" ]; then
|
||||
cmd="${cmd} --dport ${port}"
|
||||
cmd6="${cmd6} --dport ${port}"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "${cmd}"|grep -q "\-\-dport \|\-s "
|
||||
if [ "$?" -eq 0 ]; then
|
||||
cmd="${cmd} -j ACCEPT -m comment --comment=Open_ACS_port"
|
||||
${cmd}
|
||||
echo ${cmd}|grep -q "\-\-dport \|\-s "
|
||||
if [ "$?" -ne 0 ]; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
echo "${cmd6}"|grep -q "\-\-dport \|\-s "
|
||||
if [ "$?" -eq 0 ]; then
|
||||
cmd6="${cmd6} -j ACCEPT -m comment --comment=Open_ACS_port"
|
||||
${cmd6}
|
||||
fi
|
||||
cmd="${cmd} -j ACCEPT -m comment --comment=Open_ACS_port"
|
||||
|
||||
uci -c /var/state -q set cwmp.cpe.firewall_restart="init"
|
||||
uci -c /var/state -q commit cwmp
|
||||
${cmd}
|
||||
|
||||
120
icwmp/files/etc/hotplug.d/iface/90-icwmp
Normal file
120
icwmp/files/etc/hotplug.d/iface/90-icwmp
Normal file
@@ -0,0 +1,120 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
|
||||
[ "$ACTION" == "ifup" ] || exit 0
|
||||
|
||||
[ -f /etc/config/cwmp ] || exit 0
|
||||
|
||||
handle_icwmp_restart() {
|
||||
[ -f /tmp/switching_mode ] && exit 0
|
||||
[ -f /tmp/wificontrol.txt -a -f /tmp/netmode-conf.pid ] && exit 0
|
||||
|
||||
[ "$INTERFACE" == "loopback" ] && exit 0
|
||||
|
||||
local defwan=$(uci -q get cwmp.cpe.default_wan_interface)
|
||||
[ -n "$defwan" -a "$(uci -q get network.$defwan)" == "interface" -a "$defwan" != "$INTERFACE" ] && exit 0
|
||||
|
||||
local islan="$(uci -q get network.$INTERFACE.is_lan)"
|
||||
[ "$islan" == "1" ] && exit 0
|
||||
|
||||
local proto="$(uci -q get network.$INTERFACE.proto)"
|
||||
[ "$proto" == "none" ] && exit 0
|
||||
|
||||
local ifname="$(uci -q get network.$INTERFACE.ifname)"
|
||||
[ "${ifname:0:1}" == "@" ] && exit 0
|
||||
|
||||
mkdir -p /tmp/ipv4
|
||||
|
||||
network_flush_cache
|
||||
|
||||
local previpaddr=""
|
||||
local curipaddr=""
|
||||
local ipaddrfile=/tmp/ipv4/$INTERFACE-ipaddr
|
||||
previpaddr=$(cat $ipaddrfile 2>/dev/null)
|
||||
network_get_ipaddr curipaddr $INTERFACE
|
||||
[ -n "$curipaddr" ] && echo $curipaddr > $ipaddrfile || rm -f $ipaddrfile
|
||||
|
||||
local prevgateway=""
|
||||
local curgateway=""
|
||||
local gatewayfile=/tmp/ipv4/$INTERFACE-gateway
|
||||
prevgateway=$(cat $gatewayfile 2>/dev/null)
|
||||
network_get_gateway curgateway $INTERFACE
|
||||
[ -n "$curgateway" ] && echo $curgateway > $gatewayfile || rm -f $gatewayfile
|
||||
|
||||
local prevsubnets=""
|
||||
local cursubnets=""
|
||||
local subnetsfile=/tmp/ipv4/$INTERFACE-subnets
|
||||
prevsubnets=$(cat $subnetsfile 2>/dev/null)
|
||||
network_get_subnets cursubnets $INTERFACE
|
||||
[ -n "$cursubnets" ] && echo $cursubnets > $subnetsfile || rm -f $subnetsfile
|
||||
|
||||
local prevdnsservers=""
|
||||
local curdnsservers=""
|
||||
local dnsserverfile=/tmp/ipv4/$INTERFACE-dnsservers
|
||||
prevdnsservers=$(cat $dnsserverfile 2>/dev/null)
|
||||
network_get_dnsserver curdnsservers $INTERFACE
|
||||
[ -n "$curdnsservers" ] && echo $curdnsservers > $dnsserverfile || rm -f $dnsserverfile
|
||||
|
||||
local prevdev=""
|
||||
local curdev=""
|
||||
local devfile=/tmp/ipv4/$INTERFACE-dev
|
||||
prevdev=$(cat $devfile 2>/dev/null)
|
||||
network_get_device curdev $INTERFACE
|
||||
[ -n "$curdev" ] && echo $curdev > $devfile || rm -f $devfile
|
||||
|
||||
local wan_iface=`uci get cwmp.cpe.default_wan_interface`
|
||||
local vendorspecinf=`ubus call network.interface.wan status | jsonfilter -e "@.data.vendorspecinf"`
|
||||
[ -n "$vendorspecinf" ] && {
|
||||
local url=""
|
||||
case $vendorspecinf in
|
||||
http://*|https://*)
|
||||
url="$vendorspecinf"
|
||||
;;
|
||||
*)
|
||||
for optval in $vendorspecinf; do
|
||||
case $optval in
|
||||
1=*)
|
||||
url="$(echo $optval | cut -d"=" -f2-)"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
;;
|
||||
esac
|
||||
if [ ! -f /var/state/cwmp ]; then
|
||||
touch /var/state/cwmp
|
||||
fi
|
||||
uci -q -c /var/state/ get cwmp.acs
|
||||
if [ "$?" -ne 0 ]; then
|
||||
unnamed=`uci -q -c /var/state/ add cwmp acs`
|
||||
uci -c /var/state/ -q rename cwmp.$unnamed='acs'
|
||||
fi
|
||||
[ -n "$url" ] && uci -c /var/state -q set cwmp.acs.dhcp_url="$url"
|
||||
uci -c /var/state commit cwmp
|
||||
}
|
||||
|
||||
local prevopt43url=""
|
||||
local curopt43url=""
|
||||
local opt43urlfile=/tmp/ipv4/$INTERFACE-opt43url
|
||||
prevopt43url=$(cat $opt43urlfile 2>/dev/null)
|
||||
curopt43url="$(uci -c /var/state -q get cwmp.acs.dhcp_url)"
|
||||
[ -n "$curopt43url" ] && echo $curopt43url > $opt43urlfile || rm -f $opt43urlfile
|
||||
|
||||
[ \
|
||||
"$prevdev" == "$curdev" -a \
|
||||
"$previpaddr" = "$curipaddr" -a \
|
||||
"$prevgateway" = "$curgateway" -a \
|
||||
"$prevsubnets" = "$cursubnets" -a \
|
||||
"$prevdnsservers" = "$curdnsservers" \
|
||||
] && {
|
||||
[ "$prevopt43url" = "$curopt43url" ] && exit 0
|
||||
[ -z "$prevopt43url" ] && exit 0
|
||||
}
|
||||
|
||||
echo "Restarting icwmp"|logger -t cwmp.hotplug -p info
|
||||
|
||||
/etc/init.d/icwmpd reload &
|
||||
}
|
||||
|
||||
handle_icwmp_restart
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
. /lib/functions.sh
|
||||
|
||||
log() {
|
||||
echo "$@" |logger -t cwmp.update -p info
|
||||
}
|
||||
|
||||
handle_icwmp_update() {
|
||||
local cwmp_enable
|
||||
config_load cwmp
|
||||
|
||||
config_get_bool cwmp_enable cpe enable 1
|
||||
if [ "$cwmp_enable" = "0" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
ret=$(ubus call service list '{"name":"icwmpd"}' | jsonfilter -qe '@.icwmpd.instances.icwmp.running')
|
||||
|
||||
if [ "$ret" = "true" ]; then
|
||||
# read status from var/state/cwmp
|
||||
status=$(uci -q -c /var/state get cwmp.sess_status.current_status)
|
||||
if [ "$status" != "running" ]; then
|
||||
log "Trigger out of bound inform, since last inform status was failure"
|
||||
ubus -t 10 call tr069 inform >/dev/null 2>&1
|
||||
fi
|
||||
else
|
||||
log "Restarting icwmp tr069 object"
|
||||
/etc/init.d/icwmpd restart
|
||||
fi
|
||||
}
|
||||
|
||||
handle_icwmp_update "$@"
|
||||
@@ -1,268 +1,129 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2015-2019 iopsys Software Solutions AB
|
||||
|
||||
. /lib/functions.sh
|
||||
include /lib/network
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
START=99
|
||||
STOP=00
|
||||
STOP=10
|
||||
|
||||
USE_PROCD=1
|
||||
PROG="/usr/sbin/icwmpd"
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
include /lib/network
|
||||
EXTRA_HELP=" start [GetRPCMethods] Start icwmpd service and send GetRPCMethods"
|
||||
|
||||
log() {
|
||||
echo "${@}"|logger -t cwmp.init -p info
|
||||
}
|
||||
|
||||
regenerate_ssl_link()
|
||||
{
|
||||
local cert_dir all_file rehash
|
||||
validate_url() {
|
||||
# SCHEMA_LIST: contain list of possible schemas that could be present in the acs url
|
||||
# Example: SCHEMA_LIST="http https"
|
||||
SCHEMA_LIST="http"
|
||||
|
||||
cert_dir="${1}"
|
||||
[ ! -d "${cert_dir}" ] && return 0;
|
||||
for schema in $SCHEMA_LIST; do
|
||||
dest=`echo $1 | sed 's/$schema:\/\///g' | cut -f1 -d \/ | cut -f1 -d:`
|
||||
if [ "_$dest" != "_" ]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
### Generate all ssl link for pem certicates ###
|
||||
all_file=$(ls "${cert_dir}"/*.pem 2>/dev/null)
|
||||
if [ -n "${all_file}" ]; then
|
||||
for cfile in $all_file; do
|
||||
rehash="$(openssl x509 -hash -noout -in "${cfile}")"
|
||||
[ -f "${cert_dir}"/"${rehash}".0 ] || \
|
||||
ln -s "${cfile}" "${cert_dir}"/"${rehash}".0
|
||||
done
|
||||
get_acs_url() {
|
||||
local default_acs="http://10.10.1.6:8000/openacs/acs"
|
||||
local acs_dhcp_discovery="$(uci -q get cwmp.acs.dhcp_discovery)"
|
||||
local url="$(uci -q get cwmp.acs.url)"
|
||||
local dhcp_url="$(uci -c /var/state -q get cwmp.acs.dhcp_url)"
|
||||
|
||||
if [ "$acs_dhcp_discovery" == "enable" -a -n "$dhcp_url" -o -z "$url" ]; then
|
||||
url="$dhcp_url"
|
||||
log "ACS URL from DHCP server: $url"
|
||||
[ -n "$url" ] && uci -c /var/state -q set cwmp.acs.url="$url" || url="$default_acs"
|
||||
elif [ -n "$url" ];then
|
||||
url="$(uci -q get cwmp.acs.url)"
|
||||
log "ACS URL from configuration: $url"
|
||||
else
|
||||
url="$default_acs"
|
||||
log "Using default ACS URL: $url"
|
||||
[ -n "$url" ] && uci -c /var/state -q set cwmp.acs.url="$url"
|
||||
fi
|
||||
|
||||
### Generate all ssl link for crt certicates ###
|
||||
all_file=$(ls "${cert_dir}"/*.crt 2>/dev/null)
|
||||
if [ -n "${all_file}" ]; then
|
||||
for cfile in $all_file; do
|
||||
rehash="$(openssl x509 -hash -noout -in "${cfile}")"
|
||||
[ -f "${cert_dir}"/"${rehash}".0 ] || \
|
||||
ln -s "${cfile}" "${cert_dir}"/"${rehash}".0
|
||||
done
|
||||
validate_url "$url"
|
||||
if [ "$?" != "0" ];then
|
||||
echo "Invalid ACS URL: $url"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
enable_dhcp_option43() {
|
||||
local wan="${1}"
|
||||
local wan=$1
|
||||
local discovery=0
|
||||
case $2 in
|
||||
enable|1) discovery=1 ;;
|
||||
esac
|
||||
|
||||
### Ask for DHCP Option 43 only if CWMP is enabled ###
|
||||
local reqopts="$(uci -q get network."${wan}".reqopts)"
|
||||
local proto="$(uci -q get network."${wan}".proto)"
|
||||
local newreqopts=""
|
||||
local option43_present=0
|
||||
|
||||
local enabled
|
||||
local newreqopts=
|
||||
local baseopts=
|
||||
local reqopts="$(uci -q get network.$wan.reqopts)"
|
||||
local proto="$(uci -q get network.$wan.proto)"
|
||||
local tropts="43"
|
||||
local oldreqopts="$reqopts"
|
||||
local ropt iopt
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
43) option43_present=1 ;;
|
||||
*) ;;
|
||||
43) ;;
|
||||
*) baseopts="$baseopts $ropt" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ${option43_present} -eq 1 ]; then
|
||||
return;
|
||||
fi
|
||||
|
||||
newreqopts="$reqopts 43"
|
||||
if [ "${proto}" = "dhcp" ]; then
|
||||
uci -q set network."${wan}".reqopts="$newreqopts"
|
||||
ropt=""
|
||||
reqopts="$baseopts $tropts"
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
43) [ $discovery -eq 1 ] && newreqopts="$newreqopts $ropt" ;;
|
||||
*) newreqopts="$newreqopts $ropt" ;;
|
||||
esac
|
||||
done
|
||||
if [ $proto == "dhcp" ]; then
|
||||
newreqopts="$(echo $newreqopts | tr ' ' '\n' | sort -n | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//')"
|
||||
oldreqopts="$(echo $oldreqopts | tr ' ' '\n' | sort -n | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//')"
|
||||
[ "$newreqopts" == "$oldreqopts" ] && return
|
||||
uci -q set network.$wan.reqopts="$newreqopts"
|
||||
uci commit network
|
||||
ubus call network reload
|
||||
fi
|
||||
########################################################
|
||||
}
|
||||
|
||||
convert_to_hex() {
|
||||
local val=""
|
||||
local optval="${1}"
|
||||
OPTIND=1
|
||||
while getopts ":" opt "-$optval"
|
||||
do
|
||||
temp=$(printf "%02X" "'${OPTARG:-:}")
|
||||
val="${val}:${temp}"
|
||||
done
|
||||
wait_for_option43() {
|
||||
local time=$1
|
||||
local default_wan_interface dhcp_discovery url
|
||||
|
||||
echo "${val}"
|
||||
}
|
||||
config_get default_wan_interface cpe default_wan_interface "wan"
|
||||
config_get dhcp_discovery acs dhcp_discovery "0"
|
||||
config_get url acs url
|
||||
|
||||
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
|
||||
enable_dhcp_option43 $default_wan_interface $dhcp_discovery
|
||||
|
||||
if [ "${uci}" = "network" ]; then
|
||||
local opt125="125:00:00:0D:E9"
|
||||
else
|
||||
local opt125="125,00:00:0D:E9"
|
||||
fi
|
||||
local tm=0
|
||||
|
||||
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 "%02X" "${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 "%02X" "${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 "%02X" "${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 "%02X" "${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
|
||||
if [ "$dhcp_discovery" == "enable" -o "$dhcp_discovery" == "1" ]
|
||||
then
|
||||
log "Waiting for discovery of ACS URL from dhcp server ..."
|
||||
while [ $tm -le $time ]
|
||||
do
|
||||
acs_url=`uci -c /var/state -q get cwmp.acs.dhcp_url`
|
||||
if [ "$acs_url" != "" ]
|
||||
then
|
||||
break
|
||||
else
|
||||
sleep 1
|
||||
fi
|
||||
tm=$((tm+1))
|
||||
done
|
||||
|
||||
if [ ${send125_present} -eq 0 ]; then
|
||||
configure_send_op125 "" "${lan}" "dhcp"
|
||||
ubus call uci commit '{"config":"dhcp"}'
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
set_vendor_id() {
|
||||
local wan="${1}"
|
||||
local proto="$(uci -q get network."${wan}".proto)"
|
||||
|
||||
if [ "${proto}" = "dhcp" ]; then
|
||||
vendorid="$(uci -q get network."${wan}".vendorid)"
|
||||
if [ -z "${vendorid}" ]; then
|
||||
uci -q set network."${wan}".vendorid="dslforum.org"
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
elif [[ $vendorid != *"dslforum.org"* ]]; then
|
||||
uci -q set network."${wan}".vendorid="${vendorid},dslforum.org"
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
enable_dhcp_option125() {
|
||||
local wan="${1}"
|
||||
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 [ ${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
|
||||
fi
|
||||
|
||||
if [ ${network_uci_update} -eq 1 ]; then
|
||||
uci commit network
|
||||
ubus call network reload
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -273,233 +134,70 @@ wait_for_resolvfile() {
|
||||
local resolvfile="$(uci -q get dhcp.@dnsmasq[0].resolvfile)"
|
||||
[ -n "$resolvfile" ] || return
|
||||
|
||||
while [ ! -f "$resolvfile" ]; do
|
||||
while [ ! -f $resolvfile ]; do
|
||||
sleep 1
|
||||
[ "$tm" -ge "$time" ] && break
|
||||
[ $tm -ge $time ] && break
|
||||
tm=$((tm+1))
|
||||
done
|
||||
}
|
||||
|
||||
copy_cwmp_etc_files_to_varstate() {
|
||||
mkdir -p /var/run/icwmpd
|
||||
set_wan_interface() {
|
||||
local l3_device=""
|
||||
local default_wan_interface=""
|
||||
|
||||
if [ -f /etc/icwmpd/icwmpd_backup_session.xml ]; then
|
||||
cp -f /etc/icwmpd/icwmpd_backup_session.xml /var/run/icwmpd/ 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ -f /etc/icwmpd/dm_enabled_notify.xml ]; then
|
||||
cp -f /etc/icwmpd/dm_enabled_notify /var/run/icwmpd/ 2>/dev/null
|
||||
config_get default_wan_interface cpe default_wan_interface "wan"
|
||||
json_load "$(ifstatus $default_wan_interface)"
|
||||
json_get_var l3_device l3_device
|
||||
if [ "$l3_device" != "" ];then
|
||||
uci -q set cwmp.cpe.interface="$l3_device"
|
||||
uci -q commit cwmp
|
||||
fi
|
||||
}
|
||||
|
||||
copy_cwmp_varstate_files_to_etc() {
|
||||
if [ -f /var/run/icwmpd/icwmpd_backup_session.xml ]; then
|
||||
cp -f /var/run/icwmpd/icwmpd_backup_session.xml /etc/icwmpd/ 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ -f /var/run/icwmpd/dm_enabled_notify.xml ]; then
|
||||
cp -f /var/run/icwmpd/dm_enabled_notify /etc/icwmpd/ 2>/dev/null
|
||||
fi
|
||||
|
||||
# move the successful custom notify import marker to persistent storage
|
||||
if [ -f /var/run/icwmpd/icwmpd_notify_import_marker ]; then
|
||||
cp -f /var/run/icwmpd/icwmpd_notify_import_marker /etc/icwmpd/
|
||||
fi
|
||||
}
|
||||
|
||||
validate_acs_section()
|
||||
{
|
||||
uci_validate_section cwmp acs "acs" \
|
||||
'passwd:string' \
|
||||
'periodic_inform_enable:bool' \
|
||||
'periodic_inform_interval:uinteger' \
|
||||
'periodic_inform_time:string' \
|
||||
'url:string' \
|
||||
'dhcp_discovery:string' \
|
||||
'dhcp_url:string' \
|
||||
'compression:or("GZIP","Deflate","Disabled")' \
|
||||
'retry_min_wait_interval:range(1, 65535)' \
|
||||
'retry_interval_multiplier:range(1000, 65535)' \
|
||||
'ipv6_enable:bool' \
|
||||
'ssl_capath:string'
|
||||
|
||||
}
|
||||
|
||||
validate_cpe_section()
|
||||
{
|
||||
uci_validate_section cwmp cpe "cpe" \
|
||||
'interface:string' \
|
||||
'default_wan_interface:string' \
|
||||
'log_to_console:or("enable","disable")' \
|
||||
'log_to_file:or("enable","disable")' \
|
||||
'log_severity:or("EMERG", "ALERT", "CRITIC" ,"ERROR", "WARNING", "NOTICE", "INFO", "DEBUG")' \
|
||||
'log_file_name:string' \
|
||||
'log_max_size:uinteger' \
|
||||
'userid:string' \
|
||||
'passwd:string' \
|
||||
'port:uinteger' \
|
||||
'provisioning_code:string:""' \
|
||||
'amd_version:range(1, 6)' \
|
||||
'instance_mode:or("InstanceNumber","InstanceAlias")' \
|
||||
'session_timeout:uinteger' \
|
||||
'notification:bool' \
|
||||
'exec_download:bool' \
|
||||
'periodic_notify_enable:bool' \
|
||||
'enable:bool' \
|
||||
'periodic_notify_interval:uinteger'
|
||||
}
|
||||
|
||||
validate_defaults() {
|
||||
local ssl_capath
|
||||
config_load cwmp
|
||||
|
||||
validate_acs_section || {
|
||||
log "Validation of acs section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
ssl_capath="${ssl_capath%/}"
|
||||
# Put the cert pem file in keep list
|
||||
if [ -d "${ssl_capath}" ]; then
|
||||
if ! grep "*.pem\|*.crt" /lib/upgrade/keep.d/icwmp; then
|
||||
echo "${ssl_capath}"'/*.pem' >> /lib/upgrade/keep.d/icwmp
|
||||
echo "${ssl_capath}"'/*.crt' >> /lib/upgrade/keep.d/icwmp
|
||||
echo "${ssl_capath}"'/*.0' >> /lib/upgrade/keep.d/icwmp
|
||||
fi
|
||||
fi
|
||||
|
||||
validate_cpe_section || {
|
||||
log "Validation of cpe section failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
boot() {
|
||||
local enable_cwmp="0"
|
||||
local dhcp_discovery="0"
|
||||
|
||||
config_load cwmp
|
||||
config_get_bool enable_cwmp cpe enable 1
|
||||
if [ "$enable_cwmp" = "0" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
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
|
||||
enable_dhcp_option43 "${wan_interface}"
|
||||
# Set dhcp option 60
|
||||
set_vendor_id "${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_dhcp_option125 "${wan_interface}"
|
||||
enable_dnsmasq_option125 "${lan_interface}"
|
||||
fi
|
||||
|
||||
config_get ssl_capath acs ssl_capath
|
||||
|
||||
if [ -n "${ssl_capath}" ]; then
|
||||
regenerate_ssl_link "${ssl_capath}"
|
||||
fi
|
||||
|
||||
# Copy backup data so that if it restart latter on, it gets the info
|
||||
copy_cwmp_etc_files_to_varstate
|
||||
mkdir -p /var/run/icwmpd/
|
||||
touch /var/run/icwmpd/cwmp
|
||||
|
||||
start
|
||||
service_running() {
|
||||
ubus wait_for usp.raw
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enable_cwmp
|
||||
if [ ! -f /tmp/.icwmpd_boot ]; then
|
||||
touch /etc/icwmpd/.icwmpd_boot
|
||||
touch /tmp/.icwmpd_boot
|
||||
else
|
||||
[ -f /sbin/netifd ] && log "Waiting for Network to be started ..." && ubus -t 5 wait_for network.interface
|
||||
[ -f /etc/config/wireless ] && log "Waiting for WiFi to be started ..." && ubus -t 5 wait_for network.wireless
|
||||
[ -f /usr/sbin/dnsmasq ] && log "Waiting for DNS Proxy to be started ..." && ubus -t 5 wait_for dnsmasq
|
||||
[ -f /etc/config/dhcp ] && log "Waiting for DNS Server(s) ..." && wait_for_resolvfile 20
|
||||
[ -f /usr/sbin/asterisk ] && log "Waiting for Voice to be started ..." && ubus -t 5 wait_for asterisk
|
||||
|
||||
config_load cwmp
|
||||
config_get_bool enable_cwmp cpe enable 1
|
||||
log "Waiting for usp.raw to be started"
|
||||
ubus wait_for usp.raw
|
||||
|
||||
if [ "$enable_cwmp" = "0" ]; then
|
||||
return 0
|
||||
config_load cwmp
|
||||
set_wan_interface
|
||||
wait_for_option43 20
|
||||
get_acs_url
|
||||
|
||||
procd_open_instance icwmp
|
||||
procd_set_param command "$PROG"
|
||||
if [ "$1" = "GetRPCMethods" ];then
|
||||
procd_append_param command -g
|
||||
elif [ -f /etc/icwmpd/.icwmpd_boot ]; then
|
||||
procd_append_param command -b
|
||||
fi
|
||||
procd_set_param respawn \
|
||||
${respawn_threshold:-5} \
|
||||
${respawn_timeout:-10} ${respawn_retry:-3}
|
||||
|
||||
procd_close_instance
|
||||
fi
|
||||
|
||||
[ -f /sbin/netifd ] && log "Waiting for Network to be started ..." && ubus -t 5 wait_for network.interface
|
||||
[ -f /usr/sbin/dnsmasq ] && log "Waiting for DNS Proxy to be started ..." && ubus -t 5 wait_for dnsmasq
|
||||
[ -f /etc/config/dhcp ] && log "Waiting for DNS Server(s) ..." && wait_for_resolvfile 20
|
||||
|
||||
validate_defaults || {
|
||||
log "Validation of defaults failed"
|
||||
return 1;
|
||||
}
|
||||
|
||||
procd_open_instance icwmp
|
||||
procd_set_param command "$PROG"
|
||||
procd_append_param command -b
|
||||
procd_set_param respawn \
|
||||
"${respawn_threshold:-5}" \
|
||||
"${respawn_timeout:-10}" "${respawn_retry:-3}"
|
||||
|
||||
procd_set_param watch network.interface
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service()
|
||||
{
|
||||
copy_cwmp_varstate_files_to_etc
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
local ret
|
||||
|
||||
config_load cwmp
|
||||
config_get_bool enable_cwmp cpe enable 1
|
||||
|
||||
ret="0"
|
||||
if [ "$enable_cwmp" = "0" ]; then
|
||||
stop
|
||||
start
|
||||
return 0
|
||||
fi
|
||||
|
||||
tr069_status="$(ubus -t 1 call tr069 status)"
|
||||
ret="$?"
|
||||
if [ "$ret" = "7" ]; then
|
||||
# ubus timed out may be due to uloop is busy in some task so returning
|
||||
return 0
|
||||
fi
|
||||
|
||||
status="$(echo "${tr069_status}" | jsonfilter -qe '@.cwmp.status')"
|
||||
ret="$?"
|
||||
if [ "$status" = "up" ]; then
|
||||
ubus -t 1 call tr069 command '{"command":"reload"}'
|
||||
ret="$?"
|
||||
fi
|
||||
|
||||
if [ "$status" = "init" ] || [ "$ret" -ne "0" ]; then
|
||||
log "Restarting CWMP client"
|
||||
stop
|
||||
start
|
||||
fi
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "cwmp"
|
||||
|
||||
procd_open_trigger
|
||||
json_add_array
|
||||
json_add_string "" "interface.update"
|
||||
json_add_array
|
||||
json_add_array
|
||||
json_add_string "" "run_script"
|
||||
json_add_string "" "/etc/icwmpd/update.sh"
|
||||
json_close_array
|
||||
json_close_array
|
||||
json_add_int "" "2000"
|
||||
json_close_array
|
||||
procd_close_trigger
|
||||
procd_add_config_trigger "config.change" "cwmp" /etc/init.d/icwmpd reload
|
||||
}
|
||||
|
||||
|
||||
@@ -1,41 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
# Copy defaults by the factory to the cwmp UCI user section.
|
||||
config_load cwmp
|
||||
|
||||
# Get Manufacturer OUI.
|
||||
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')
|
||||
# Get factory base MAC.
|
||||
baseMac=$(db -q get hw.board.basemac)
|
||||
|
||||
# Erase colon and space characters.
|
||||
baseMac=${baseMac//:/}
|
||||
baseMac=${baseMac// /}
|
||||
|
||||
# Caseing and fixed length string.
|
||||
mac=$(printf "%12.12X" $((0x$baseMac)))
|
||||
|
||||
# Get system serial number.
|
||||
config_get serial cpe serial_number ""
|
||||
if [ -z "${serial}" ]; then
|
||||
serial=$(db -q get device.deviceinfo.SerialNumber)
|
||||
fi
|
||||
serial=$(db -q get hw.board.serial_number)
|
||||
|
||||
# Get userid values
|
||||
config_get acs_userid acs userid ""
|
||||
config_get cpe_userid cpe userid ""
|
||||
acs_userid=$(uci -q get cwmp.acs.userid)
|
||||
cpe_userid=$(uci -q get cwmp.cpe.userid)
|
||||
|
||||
# Only set if they are empty
|
||||
if [ -z "${acs_userid}" ]; then
|
||||
uci -q set cwmp.acs.userid="${oui}-${serial}"
|
||||
if [ -z "$acs_userid" ]
|
||||
then
|
||||
uci -q set cwmp.acs.userid="${mac:0:6}-${serial}"
|
||||
fi
|
||||
|
||||
if [ -z "${cpe_userid}" ]; then
|
||||
uci -q set cwmp.cpe.userid="${oui}-${serial}"
|
||||
fi
|
||||
|
||||
# Fix the cwmp.cpe.enable parameter
|
||||
# set default to 1 if not defined
|
||||
config_get enable_cwmp cpe enable ""
|
||||
if [ -z "${enable_cwmp}" ]; then
|
||||
uci -q set cwmp.cpe.enable="1"
|
||||
if [ -z "$cpe_userid" ]
|
||||
then
|
||||
uci -q set cwmp.cpe.userid="${mac:0:6}-${serial}"
|
||||
fi
|
||||
|
||||
# No need for commit here, it is done by uci_apply_defaults().
|
||||
|
||||
54
icwmp/files/etc/uci-defaults/90-icwmp-set-dhcp-reqopts
Normal file
54
icwmp/files/etc/uci-defaults/90-icwmp-set-dhcp-reqopts
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
set_cwmp_reqopts() {
|
||||
### Ask for DHCP Option 43 only if CWMP is enabled ###
|
||||
local wan=$(uci -q get cwmp.cpe.default_wan_interface)
|
||||
local dhcp_discovery=$(uci -q get cwmp.acs.dhcp_discovery)
|
||||
local discovery=0
|
||||
case $dhcp_discovery in
|
||||
enable|1) discovery=1 ;;
|
||||
esac
|
||||
|
||||
local newreqopts=
|
||||
local baseopts=
|
||||
local reqopts="$(uci -q get network.$wan.reqopts)"
|
||||
local proto="$(uci -q get network.$wan.proto)"
|
||||
local tropts="43"
|
||||
local oldreqopts="$reqopts"
|
||||
local ropt iopt
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
43) ;;
|
||||
*) baseopts="$baseopts $ropt" ;;
|
||||
esac
|
||||
done
|
||||
ropt=""
|
||||
reqopts="$baseopts $tropts"
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
43) [ $discovery -eq 1 ] && newreqopts="$newreqopts $ropt" ;;
|
||||
*) newreqopts="$newreqopts $ropt" ;;
|
||||
esac
|
||||
done
|
||||
if [ "$proto" == "dhcp" ]; then
|
||||
newreqopts="$(echo $newreqopts | tr ' ' '\n' | sort -n | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//')"
|
||||
oldreqopts="$(echo $oldreqopts | tr ' ' '\n' | sort -n | tr '\n' ' ' | sed 's/^[ \t]*//;s/[ \t]*$//')"
|
||||
[ "$newreqopts" == "$oldreqopts" ] && return
|
||||
uci -q set network.$wan.reqopts="$newreqopts"
|
||||
uci commit network
|
||||
fi
|
||||
}
|
||||
|
||||
regenerate_ssl_link(){
|
||||
local cert_dir="/etc/ssl/certs"
|
||||
local all_file=$(ls $cert_dir/*.pem)
|
||||
for cfile in $all_file
|
||||
do
|
||||
ln -s $cfile $cert_dir/$(openssl x509 -hash -noout -in $cfile).0
|
||||
done
|
||||
}
|
||||
|
||||
set_cwmp_reqopts
|
||||
regenerate_ssl_link
|
||||
@@ -1,2 +1 @@
|
||||
/var/run/icwmpd/icwmpd_backup_session.xml
|
||||
/etc/icwmpd/cwmp
|
||||
/etc/icwmpd/.icwmpd_backup_session.xml
|
||||
|
||||
@@ -1,27 +1,10 @@
|
||||
if (PACKAGE_ieee1905)
|
||||
|
||||
menu "Configuration"
|
||||
menu "Configurations"
|
||||
|
||||
config IEEE1905_EXTENSION_ALLOWED
|
||||
bool "Allow plugins to extend 1905 CMDUs and/or TLVs"
|
||||
default y
|
||||
|
||||
config IEEE1905_PLATFORM_HAS_WIFI
|
||||
bool "Platform has WiFi"
|
||||
default y if PACKAGE_libwifi
|
||||
|
||||
config IEEE1905_CMDU_SA_IS_ALMAC
|
||||
bool "Send CMDUs with SA set to 1905 AL-macaddress instead of interface macaddress"
|
||||
default n
|
||||
|
||||
config IEEE1905_WIFI_EASYMESH
|
||||
bool "Include WiFi-Alliance's Easymesh updates"
|
||||
default y
|
||||
|
||||
config IEEE1905_CMDU_FRAGMENT_TLV_BOUNDARY
|
||||
bool "Fragment large CMDU frame at TLV boundary instead of octet boundary"
|
||||
default y
|
||||
|
||||
endmenu
|
||||
|
||||
endif
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ieee1905
|
||||
PKG_VERSION:=8.0.12
|
||||
PKG_VERSION:=4.0.1
|
||||
|
||||
LOCAL_DEV=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=b265053762a3d6c901872f29fa3e70b8666daf46
|
||||
PKG_SOURCE_VERSION:=c4e6275434c65d64a90edbefa225f582f2ce356e
|
||||
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
|
||||
@@ -35,21 +35,27 @@ define Package/ieee1905/config
|
||||
endef
|
||||
|
||||
define Package/libieee1905
|
||||
$(call Package/ieee1905/Default)
|
||||
TITLE:=libieee1905.so (library for CMDU and TLV handling)
|
||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||
$(call Package/ieee1905/Default,$(1))
|
||||
TITLE+= (library for CMDU and TLV handling)
|
||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl +libwifi \
|
||||
+libjson-c +libblobmsg-json
|
||||
endef
|
||||
|
||||
define Package/ieee1905
|
||||
$(call Package/ieee1905/Default)
|
||||
TITLE:=ieee1905d (daemon implementing 1905.1 and provides cli)
|
||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||
+libjson-c +libblobmsg-json +ubus +libpthread \
|
||||
+libieee1905 +IEEE1905_PLATFORM_HAS_WIFI:libwifi
|
||||
$(call Package/ieee1905/Default,$(1))
|
||||
TITLE+= ieee1905d (daemon implementing 1905.1 and provides cli)
|
||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl +libwifi \
|
||||
+libjson-c +libblobmsg-json +libwifi +ubus +libpthread \
|
||||
+libnl-genl +libieee1905
|
||||
endef
|
||||
|
||||
include $(wildcard plugins/*.mk)
|
||||
|
||||
define Package/map-plugin
|
||||
$(call Package/ieee1905/Default,$(1))
|
||||
TITLE:=Multi-AP (Easymesh) plugin
|
||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl +libwifi \
|
||||
+libjson-c +libblobmsg-json +ieee1905 +libieee1905
|
||||
endef
|
||||
|
||||
define Package/ieee1905/description
|
||||
This package provides IEEE Std 1905.1 stack.
|
||||
@@ -59,39 +65,11 @@ define Package/libieee1905/description
|
||||
This package provides library functions for IEEE Std 1905.1 stack.
|
||||
endef
|
||||
|
||||
plugins := \
|
||||
$(if $(CONFIG_PACKAGE_map-plugin),map) \
|
||||
$(if $(CONFIG_PACKAGE_snoop-plugin),snoop) \
|
||||
$(if $(CONFIG_PACKAGE_topology-plugin),topology)
|
||||
|
||||
|
||||
ppkg:=$(patsubst plugins/%.mk,%-plugin,$(wildcard plugins/*.mk))
|
||||
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/libnl3 \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
ifeq ($(CONFIG_IEEE1905_PLATFORM_HAS_WIFI),y)
|
||||
TARGET_CFLAGS += -DHAS_WIFI
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_IEEE1905_CMDU_SA_IS_ALMAC),y)
|
||||
TARGET_CFLAGS += -DCMDU_SA_IS_ALMAC
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_IEEE1905_WIFI_EASYMESH),y)
|
||||
TARGET_CFLAGS += -DWIFI_EASYMESH
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_IEEE1905_CMDU_FRAGMENT_TLV_BOUNDARY),y)
|
||||
TARGET_CFLAGS += -DIEEE1905_CMDU_FRAGMENT_TLV_BOUNDARY
|
||||
endif
|
||||
|
||||
MAKE_FLAGS += \
|
||||
extmod_subdirs="$(patsubst %,extensions/%,$(plugins))"
|
||||
|
||||
MAKE_PATH:=src
|
||||
|
||||
|
||||
@@ -109,32 +87,43 @@ define Package/libieee1905/install
|
||||
$(CP) $(PKG_BUILD_DIR)/src/libmidgen.so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/map-plugin/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/libmaputil.so $(1)/usr/lib/libmaputil.so
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map.so $(1)/usr/lib/ieee1905/map.so
|
||||
endef
|
||||
|
||||
define Build/InstallDev/map-plugin
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map2.h $(1)/usr/include/map2.h
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map_module.h $(1)/usr/include/map_module.h
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map.so $(1)/usr/lib/ieee1905/map.so
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/libmaputil.so $(1)/usr/lib/libmaputil.so
|
||||
endef
|
||||
|
||||
|
||||
define Build/InstallDev/libieee1905
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||
$(CP) $(PKG_BUILD_DIR)/src/cmdu.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/cmdu_ackq.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/1905_tlvs.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/i1905_wsc.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/bufutil.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/timer_impl.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/i1905_extension.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/libmidgen.so $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/libieee1905.so $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(call Build/InstallDev/libieee1905,$(1),$(2))
|
||||
$(foreach p,$(ppkg),$(call Build/InstallDev/$(p),$(1),$(2)))
|
||||
$(call Build/InstallDev/map-plugin,$(1),$(2))
|
||||
endef
|
||||
|
||||
ifeq ($(LOCAL_DEV),1)
|
||||
define Build/Prepare
|
||||
rsync -r --exclude=.* ~/git/ieee1905/ $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
endif
|
||||
|
||||
$(eval $(call BuildPackage,ieee1905))
|
||||
$(eval $(call BuildPackage,libieee1905))
|
||||
$(eval $(foreach p,$(ppkg),$(call BuildPackage,$(p))))
|
||||
$(eval $(call BuildPackage,map-plugin))
|
||||
|
||||
@@ -2,31 +2,21 @@ config ieee1905 'ieee1905'
|
||||
option enabled '1'
|
||||
option extension '1'
|
||||
list extmodule 'map'
|
||||
option registrar '2 5 6'
|
||||
# option macaddress '0a:1b:2c:3d:4e:50'
|
||||
option registrar '2 5'
|
||||
|
||||
config al-iface
|
||||
option enabled '1'
|
||||
option ifname 'br-lan'
|
||||
option type 'bridge'
|
||||
|
||||
# ap sections are auto-generated/overwritten during onboarding
|
||||
#
|
||||
config ap
|
||||
option band '2'
|
||||
option ssid 'IOWRT-2.4GHz'
|
||||
option encryption 'sae-mixed'
|
||||
option key '1234567890'
|
||||
option ssid 'TestSSID.2'
|
||||
option encryption 'psk2'
|
||||
option key '5555500000'
|
||||
|
||||
config ap
|
||||
option band '5'
|
||||
option ssid 'IOWRT-5GHz'
|
||||
option encryption 'sae-mixed'
|
||||
option key '1234567890'
|
||||
|
||||
config ap
|
||||
option band '6'
|
||||
option ssid 'IOWRT-6GHz'
|
||||
option encryption 'sae-mixed'
|
||||
option key '1234567890'
|
||||
option ssid 'TestSSID.5'
|
||||
option encryption 'psk2'
|
||||
option key '2222200000'
|
||||
|
||||
config al-iface
|
||||
option enabled 1
|
||||
option ifname 'br-lan'
|
||||
option type 'bridge'
|
||||
@@ -5,88 +5,10 @@ STOP=21
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
IS_CFG_VALID=1
|
||||
|
||||
validate_ieee1905_section() {
|
||||
uci_validate_section ieee1905 ieee1905 "ieee1905" \
|
||||
'enabled:bool:true' \
|
||||
'macaddress:or("auto",macaddr)' \
|
||||
'registrar:string' \
|
||||
'extension:bool:false' \
|
||||
'extmodule:list(string)' \
|
||||
|
||||
[ "$?" -ne 0 ] && {
|
||||
logger -s -t "ieee1905" "Validation of ieee1905 section failed"
|
||||
IS_CFG_VALID=0
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
validate_ali_section() {
|
||||
local section="$1"
|
||||
|
||||
uci_validate_section ieee1905 $section "${1}" \
|
||||
'ifname:string' \
|
||||
'type:or("bridge",string)'
|
||||
|
||||
[ "$?" -ne 0 ] && {
|
||||
logger -s -t "ieee1905" "Validation of al-iface section $section failed"
|
||||
IS_CFG_VALID=0
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
validate_ap_section() {
|
||||
local section="$1"
|
||||
|
||||
uci_validate_section ieee1905 $section "${1}" \
|
||||
'band:or("2", "5", "60", "6")' \
|
||||
'ssid:string' \
|
||||
'encryption:or("psk2", "sae-mixed", "sae",
|
||||
"psk", "psk-mixed", "none", string)' \
|
||||
'key:string' \
|
||||
'uuid:string' \
|
||||
'manufacturer:string' \
|
||||
'model_name:string' \
|
||||
'device_name:string' \
|
||||
'model_number:string' \
|
||||
'serial_number:string' \
|
||||
'device_type:string' \
|
||||
'os_version:uinteger'
|
||||
|
||||
[ "$?" -ne 0 ] && {
|
||||
logger -s -t "ieee1905" "Validation of ap section $section failed"
|
||||
IS_CFG_VALID=0
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
validate_ieee1905_config() {
|
||||
IS_CFG_VALID=1
|
||||
|
||||
validate_ieee1905_section &&
|
||||
config_foreach validate_ali_section "al-iface" &&
|
||||
config_foreach validate_ap_section ap
|
||||
|
||||
[ "$IS_CFG_VALID" -ne 1 ] && {
|
||||
logger -s -t "ieee1905" "Validation of ieee1905 UCI file failed"
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load "ieee1905"
|
||||
validate_ieee1905_config || return 1;
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "/usr/sbin/ieee1905d" "-o" "/tmp/ieee1905.log" "-f"
|
||||
procd_set_param command "/usr/sbin/ieee1905d"
|
||||
procd_set_param respawn
|
||||
procd_set_param limits core="unlimited"
|
||||
# procd_set_param env IEEE1905_LOG_CMDU=1
|
||||
# procd_set_param stdout 1
|
||||
# procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
BMAC=$(db -q get hw.board.basemac)
|
||||
BMAC=${BMAC//:/}
|
||||
BMAC=${BMAC// /}
|
||||
BMAC=$(printf "%12.12X" $((0x$BMAC)))
|
||||
|
||||
[ "$BMAC" == "" ] && exit 1
|
||||
|
||||
LMAC=$((0x$BMAC & 0xfeffffffffff))
|
||||
LMAC=$(($LMAC | 0x020000000000))
|
||||
LMAC=$(printf "%12.12X" $LMAC)
|
||||
LMAC=$(echo $LMAC | sed -e 's/[0-9A-F]\{2\}/&:/g' -e 's/:$//')
|
||||
|
||||
mac=$(uci -q get ieee1905.ieee1905.macaddress)
|
||||
|
||||
[ "$mac" != "" ] && exit 0
|
||||
|
||||
uci set ieee1905.ieee1905.macaddress="$LMAC"
|
||||
uci commit ieee1905
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
config_load ieee1905
|
||||
|
||||
ifname_to_list() {
|
||||
local section=$1
|
||||
|
||||
config_get ifname $section ifname # get list or option as space separated values
|
||||
ifname=${ifname//,/\ } # convert csv with space separation
|
||||
uci del ieee1905.${section}.ifname # delete entry
|
||||
for i in ${ifname}; do
|
||||
uci add_list ieee1905.${section}.ifname="$i" # writeback entry as list
|
||||
done
|
||||
}
|
||||
|
||||
config_foreach ifname_to_list al-iface
|
||||
@@ -1,51 +0,0 @@
|
||||
define Package/map-plugin
|
||||
$(call Package/ieee1905/Default)
|
||||
TITLE:=Multi-AP plugin supporting WiFi-Alliance Easymesh standard
|
||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||
+libjson-c +libblobmsg-json +ieee1905 +libieee1905
|
||||
endef
|
||||
|
||||
define Package/map-plugin/config
|
||||
if (PACKAGE_map-plugin)
|
||||
|
||||
menu "Configuration"
|
||||
|
||||
config MULTIAP_EASYMESH_VERSION
|
||||
int "Easymesh version"
|
||||
default 2
|
||||
|
||||
config MULTIAP_DYNAMIC_CNTLR_SYNC_CONFIG
|
||||
bool "Sync configuration between dynamic controllers in the network"
|
||||
default n
|
||||
|
||||
config MULTIAP_FUZZ_1905_CMDUS
|
||||
bool "Include support to fuzz 1905 CMDUs for testing purpose"
|
||||
default n
|
||||
|
||||
endmenu
|
||||
endif
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -DEASYMESH_VERSION=$(CONFIG_MULTIAP_EASYMESH_VERSION)
|
||||
|
||||
ifeq ($(CONFIG_MULTIAP_DYNAMIC_CNTLR_SYNC_CONFIG),y)
|
||||
TARGET_CFLAGS += -DDYNAMIC_CNTLR_SYNC_CONFIG
|
||||
endif
|
||||
|
||||
define Build/InstallDev/map-plugin
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/easymesh.h $(1)/usr/include/easymesh.h
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map_module.h $(1)/usr/include/map_module.h
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/cntlrsync.h $(1)/usr/include/cntlrsync.h
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map.so $(1)/usr/lib/ieee1905/map.so
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/libmaputil.so $(1)/usr/lib/libmaputil.so
|
||||
endef
|
||||
|
||||
define Package/map-plugin/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/libmaputil.so $(1)/usr/lib/libmaputil.so
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/map/map.so $(1)/usr/lib/ieee1905/map.so
|
||||
endef
|
||||
@@ -1,12 +0,0 @@
|
||||
define Package/snoop-plugin
|
||||
$(call Package/ieee1905/Default)
|
||||
TITLE:=Show all received 1905 CMDUs over UBUS
|
||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||
+libjson-c +libblobmsg-json +ieee1905 +libieee1905
|
||||
endef
|
||||
|
||||
define Package/snoop-plugin/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/snoop/snoop.so $(1)/usr/lib/ieee1905/snoop.so
|
||||
endef
|
||||
@@ -1,12 +0,0 @@
|
||||
define Package/topology-plugin
|
||||
$(call Package/ieee1905/Default)
|
||||
TITLE:=Build full network topology of the 1905 nodes only
|
||||
DEPENDS= +libubox +libuci +libubus +libeasy +libnl-genl \
|
||||
+libjson-c +libblobmsg-json +ieee1905 +libieee1905
|
||||
endef
|
||||
|
||||
define Package/topology-plugin/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/lib/ieee1905
|
||||
$(CP) $(PKG_BUILD_DIR)/src/extensions/topology/topology.so $(1)/usr/lib/ieee1905/topology.so
|
||||
endef
|
||||
@@ -9,10 +9,10 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=inbd
|
||||
PKG_VERSION:=1.2.3
|
||||
PKG_VERSION:=1.2.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=d4e910a31039e0c0b7a539311eafcd716c36be77
|
||||
PKG_SOURCE_VERSION:=10f765f3d0fcc226b6ecf0c481598c9e7f76315e
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/iopsys/inbd
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
config TARGET_VERSION
|
||||
string
|
||||
prompt "Software Version"
|
||||
|
||||
config TARGET_CUSTOMER
|
||||
string
|
||||
prompt "Customer ID"
|
||||
@@ -24,10 +24,6 @@ define Package/iop/description
|
||||
This package contains iopsysWrt SDK utilities
|
||||
endef
|
||||
|
||||
define Package/iop/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
true
|
||||
endef
|
||||
|
||||
301
iop/config
301
iop/config
@@ -1,225 +1,107 @@
|
||||
############
|
||||
# Generic #
|
||||
##########
|
||||
|
||||
# Build #
|
||||
CONFIG_BUILD_LOG=y
|
||||
CONFIG_BUILD_NLS=y
|
||||
CONFIG_BUSYBOX_CUSTOM=y
|
||||
CONFIG_CCACHE=y
|
||||
CONFIG_DEBUG=y
|
||||
CONFIG_DEVEL=y
|
||||
# CONFIG_USE_SSTRIP is not set
|
||||
CONFIG_USE_STRIP=y
|
||||
# CONFIG_SIGNED_PACKAGES is not set
|
||||
|
||||
# Image #
|
||||
CONFIG_TARGET_CUSTOMER="IOPSYS"
|
||||
CONFIG_TARGET_ROOTFS_TARGZ=y
|
||||
|
||||
# /etc/banner and /etc/device_info #
|
||||
CONFIG_IMAGEOPT=y
|
||||
CONFIG_VERSIONOPT=y
|
||||
CONFIG_VERSION_MANUFACTURER="IOPSYS"
|
||||
CONFIG_VERSION_MANUFACTURER_URL="https://iopsys.eu/"
|
||||
CONFIG_VERSION_DIST="IOWRT"
|
||||
|
||||
# OpenWrt is given by CONFIG_VERSION_NUMBER which we do not want to override.
|
||||
# disabling CONFIG_VERSION_FILENAMES will hide the OpenWrt version from the image filename
|
||||
# CONFIG_VERSION_FILENAMES is not set
|
||||
|
||||
# CONFIG_VERSION_CODE is set to the IOWRT version instead by the genconfig-script and
|
||||
# CONFIG_VERSION_CODE_FILENAMES will put it into the image filename.
|
||||
CONFIG_VERSION_CODE_FILENAMES=y
|
||||
|
||||
CONFIG_VERSION_HOME_URL="https://iopsys.eu"
|
||||
CONFIG_VERSION_BUG_URL="https://iopsys.eu"
|
||||
CONFIG_VERSION_SUPPORT_URL="https://iopsys.eu"
|
||||
|
||||
# /lib/preinit #
|
||||
CONFIG_PREINITOPT=y
|
||||
# CONFIG_TARGET_PREINIT_SUPPRESS_STDERR is not set
|
||||
CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE=y
|
||||
CONFIG_TARGET_PREINIT_TIMEOUT=1
|
||||
# CONFIG_TARGET_PREINIT_SHOW_NETMSG is not set
|
||||
# CONFIG_TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG is not set
|
||||
CONFIG_TARGET_PREINIT_IFNAME=""
|
||||
CONFIG_TARGET_PREINIT_IP=""
|
||||
CONFIG_TARGET_PREINIT_NETMASK=""
|
||||
CONFIG_TARGET_PREINIT_BROADCAST=""
|
||||
|
||||
# Mirror #
|
||||
CONFIG_LOCALMIRROR="https://download.iopsys.eu/iopsys/mirror/"
|
||||
|
||||
|
||||
##################
|
||||
# IOWRT Add-ons #
|
||||
################
|
||||
|
||||
# EasySoC HAL #
|
||||
CONFIG_PACKAGE_inbd=y
|
||||
CONFIG_PACKAGE_qosmngr=y
|
||||
CONFIG_PACKAGE_libwifiutils=y
|
||||
CONFIG_PACKAGE_wifimngr=y
|
||||
|
||||
# Multi-AP #
|
||||
CONFIG_PACKAGE_ieee1905=y
|
||||
CONFIG_PACKAGE_map-agent=m
|
||||
CONFIG_PACKAGE_map-controller=m
|
||||
CONFIG_PACKAGE_map-topology=y
|
||||
CONFIG_PACKAGE_wfadatad-collector=y
|
||||
|
||||
# Network #
|
||||
CONFIG_PACKAGE_netmode=y
|
||||
CONFIG_PACKAGE_owsd=m
|
||||
CONFIG_PACKAGE_urlfilter=y
|
||||
|
||||
# System #
|
||||
CONFIG_PACKAGE_imonitor=m
|
||||
CONFIG_PACKAGE_questd=y
|
||||
CONFIG_PACKAGE_rulengd=y
|
||||
CONFIG_PACKAGE_usermngr=y
|
||||
|
||||
# TR-x69 #
|
||||
CONFIG_PACKAGE_uspd-mbedtls=y
|
||||
CONFIG_PACKAGE_icwmp-mbedtls=y
|
||||
CONFIG_PACKAGE_obuspa=y
|
||||
CONFIG_PACKAGE_bulkdata=y
|
||||
CONFIG_PACKAGE_periodicstats=y
|
||||
CONFIG_PACKAGE_stunc-mbedtls=m
|
||||
CONFIG_PACKAGE_swmodd=m
|
||||
CONFIG_PACKAGE_twamp=m
|
||||
CONFIG_PACKAGE_udpecho-client=m
|
||||
CONFIG_PACKAGE_udpecho-server=m
|
||||
CONFIG_PACKAGE_xmppc=m
|
||||
|
||||
# WebGUI #
|
||||
CONFIG_PACKAGE_sulu=y
|
||||
|
||||
|
||||
############
|
||||
# Network #
|
||||
##########
|
||||
|
||||
# Protocols #
|
||||
CONFIG_PACKAGE_6in4=y
|
||||
CONFIG_PACKAGE_6rd=y
|
||||
CONFIG_PACKAGE_6to4=y
|
||||
CONFIG_PACKAGE_at=y
|
||||
CONFIG_PACKAGE_atftp=m
|
||||
CONFIG_PACKAGE_atftpd=m
|
||||
CONFIG_PACKAGE_bulkdata=y
|
||||
CONFIG_PACKAGE_chat=y
|
||||
CONFIG_PACKAGE_comgt=y
|
||||
CONFIG_PACKAGE_comgt-directip=y
|
||||
CONFIG_PACKAGE_comgt-ncm=y
|
||||
CONFIG_PACKAGE_ddns-scripts=y
|
||||
CONFIG_PACKAGE_ds-lite=y
|
||||
CONFIG_PACKAGE_ethtool=y
|
||||
CONFIG_PACKAGE_getopt=y
|
||||
CONFIG_PACKAGE_glib2=y
|
||||
CONFIG_PACKAGE_gre=y
|
||||
CONFIG_PACKAGE_icwmp=y
|
||||
CONFIG_PACKAGE_ieee1905=y
|
||||
CONFIG_PACKAGE_map-topology=y
|
||||
CONFIG_PACKAGE_mosquitto-client-ssl=y
|
||||
CONFIG_PACKAGE_mosquitto-ssl=y
|
||||
CONFIG_PACKAGE_wfadatad=y
|
||||
CONFIG_PACKAGE_imonitor=m
|
||||
CONFIG_PACKAGE_inbd=y
|
||||
CONFIG_PACKAGE_ip-full=y
|
||||
CONFIG_PACKAGE_iperf3=y
|
||||
CONFIG_PACKAGE_ipset=y
|
||||
CONFIG_PACKAGE_iptables=y
|
||||
CONFIG_PACKAGE_iptables-mod-conntrack-extra=y
|
||||
CONFIG_PACKAGE_iptables-mod-filter=y
|
||||
CONFIG_PACKAGE_iptables-mod-ipopt=y
|
||||
# CONFIG_PACKAGE_iwatchdog is not set
|
||||
CONFIG_PACKAGE_jq=y
|
||||
CONFIG_PACKAGE_libreswan=m
|
||||
CONFIG_PACKAGE_libwifi=y
|
||||
CONFIG_PACKAGE_lscpu=y
|
||||
CONFIG_PACKAGE_luci-nginx=y
|
||||
# CONFIG_LUCI_JSMIN is not set
|
||||
# CONFIG_LUCI_CSSTIDY is not set
|
||||
CONFIG_PACKAGE_luci-mod-dashboard=y
|
||||
CONFIG_PACKAGE_luci-theme-openwrt-2020=y
|
||||
CONFIG_PACKAGE_map=y
|
||||
CONFIG_PACKAGE_miniupnpd=y
|
||||
CONFIG_PACKAGE_mwan3=y
|
||||
CONFIG_PACKAGE_nand-utils=y
|
||||
CONFIG_PACKAGE_ndisc6=y
|
||||
CONFIG_PACKAGE_netmode=y
|
||||
CONFIG_PACKAGE_ntfs-3g=y
|
||||
CONFIG_PACKAGE_ntpd=y
|
||||
CONFIG_PACKAGE_obuspa=y
|
||||
CONFIG_PACKAGE_odhcp6c=y
|
||||
CONFIG_PACKAGE_odhcpd=y
|
||||
CONFIG_PACKAGE_openssl-util=y
|
||||
CONFIG_OPENSSL_WITH_COMPRESSION=y
|
||||
CONFIG_PACKAGE_openvpn-easy-rsa=y
|
||||
CONFIG_PACKAGE_openvpn-openssl=y
|
||||
CONFIG_PACKAGE_owsd=y
|
||||
CONFIG_PACKAGE_periodicstats=y
|
||||
CONFIG_PACKAGE_peripheral_manager=y
|
||||
CONFIG_PACKAGE_port-management=y
|
||||
CONFIG_PACKAGE_ppp-mod-pppoa=y
|
||||
CONFIG_PACKAGE_ppp-mod-pppoe=y
|
||||
CONFIG_PACKAGE_ppp-mod-pppol2tp=y
|
||||
CONFIG_PACKAGE_ppp-mod-pptp=y
|
||||
CONFIG_PACKAGE_ppp-multilink=y
|
||||
# CONFIG_PACKAGE_ppp is not set
|
||||
CONFIG_PACKAGE_relayd=y
|
||||
CONFIG_PACKAGE_umbim=y
|
||||
CONFIG_PACKAGE_uqmi=y
|
||||
CONFIG_PACKAGE_wwan=y
|
||||
CONFIG_PACKAGE_xl2tpd=y
|
||||
|
||||
# Services #
|
||||
CONFIG_PACKAGE_atftp=m
|
||||
CONFIG_PACKAGE_atftpd=m
|
||||
CONFIG_PACKAGE_ddns-scripts=y
|
||||
CONFIG_PACKAGE_dnsmasq=y
|
||||
CONFIG_PACKAGE_ssdpd=y
|
||||
CONFIG_PACKAGE_mosquitto-client-ssl=y
|
||||
CONFIG_PACKAGE_mosquitto-ssl=y
|
||||
CONFIG_PACKAGE_nginx=y
|
||||
CONFIG_PACKAGE_openvpn-easy-rsa=y
|
||||
CONFIG_PACKAGE_openvpn-openssl=y
|
||||
CONFIG_OPENVPN_openssl_ENABLE_IPROUTE2=y
|
||||
# CONFIG_PACKAGE_qos-scripts is not set
|
||||
CONFIG_PACKAGE_rdnssd=y
|
||||
CONFIG_PACKAGE_vsftpd-tls=m
|
||||
|
||||
# Tools and Utilities #
|
||||
CONFIG_PACKAGE_curl=y
|
||||
CONFIG_PACKAGE_libcurl=y
|
||||
CONFIG_LIBCURL_CRYPTO_AUTH=y
|
||||
# CONFIG_LIBCURL_MBEDTLS is not set
|
||||
CONFIG_LIBCURL_OPENSSL=y
|
||||
CONFIG_PACKAGE_ethtool=y
|
||||
CONFIG_PACKAGE_ip-bridge=y
|
||||
CONFIG_PACKAGE_ip-full=y
|
||||
CONFIG_PACKAGE_iperf3=y
|
||||
CONFIG_PACKAGE_ipset=y
|
||||
CONFIG_PACKAGE_ip6tables-zz-legacy=y
|
||||
CONFIG_PACKAGE_iptables-zz-legacy=y
|
||||
CONFIG_PACKAGE_iptables-mod-conntrack-extra=y
|
||||
CONFIG_PACKAGE_iptables-mod-filter=y
|
||||
CONFIG_PACKAGE_iptables-mod-ipopt=y
|
||||
CONFIG_PACKAGE_ndisc6=y
|
||||
CONFIG_PACKAGE_questd=y
|
||||
CONFIG_PACKAGE_rdisc6=y
|
||||
CONFIG_PACKAGE_rdnssd=y
|
||||
CONFIG_PACKAGE_relayd=y
|
||||
CONFIG_PACKAGE_resolveip=y
|
||||
CONFIG_PACKAGE_tcpdump=y
|
||||
CONFIG_PACKAGE_traceroute6=y
|
||||
|
||||
|
||||
############
|
||||
# System #
|
||||
##########
|
||||
|
||||
CONFIG_PACKAGE_at=y
|
||||
CONFIG_PACKAGE_getopt=y
|
||||
# CONFIG_PACKAGE_iwatchdog is not set
|
||||
CONFIG_PACKAGE_jq=y
|
||||
CONFIG_PACKAGE_libustream-openssl=y
|
||||
# CONFIG_PACKAGE_libustream-wolfssl is not set
|
||||
CONFIG_PACKAGE_lscpu=y
|
||||
CONFIG_PACKAGE_nand-utils=y
|
||||
CONFIG_PACKAGE_openssl-util=y
|
||||
CONFIG_OPENSSL_WITH_COMPRESSION=y
|
||||
CONFIG_PACKAGE_procd-ujail=m
|
||||
CONFIG_PACKAGE_rpcd=y
|
||||
CONFIG_PACKAGE_rpcd-mod-rpcsys=y
|
||||
CONFIG_PACKAGE_rpcd-mod-rrdns=y
|
||||
CONFIG_PACKAGE_rulengd=y
|
||||
CONFIG_PACKAGE_strace=y
|
||||
CONFIG_PACKAGE_sulu=y
|
||||
CONFIG_PACKAGE_swmodd=m
|
||||
CONFIG_PACKAGE_tcpdump=y
|
||||
CONFIG_PACKAGE_terminfo=y
|
||||
CONFIG_PACKAGE_traceroute6=y
|
||||
CONFIG_PACKAGE_uledd=y
|
||||
# The urandom-seed package is very strange. It seeds urandom with urandom...
|
||||
# Disable it. Most SoCs nowadays has HW random generators anyway.
|
||||
# CONFIG_PACKAGE_urandom-seed is not set
|
||||
# CONFIG_PACKAGE_urngd is not set
|
||||
CONFIG_PACKAGE_umbim=y
|
||||
CONFIG_PACKAGE_uqmi=y
|
||||
CONFIG_PACKAGE_urlfilter=y
|
||||
CONFIG_PACKAGE_usb-modeswitch=y
|
||||
CONFIG_PACKAGE_uspd=y
|
||||
CONFIG_PACKAGE_vsftpd-tls=m
|
||||
CONFIG_PACKAGE_wwan=y
|
||||
CONFIG_PACKAGE_wifimngr=y
|
||||
CONFIG_PACKAGE_uuidgen=y
|
||||
CONFIG_PACKAGE_xl2tpd=y
|
||||
CONFIG_PACKAGE_zoneinfo-core=y
|
||||
CONFIG_PACKAGE_zoneinfo-europe=y
|
||||
|
||||
|
||||
################
|
||||
# LuCI WebGUI #
|
||||
##############
|
||||
|
||||
# BEGIN: luci-nginx metapackage with some changes
|
||||
# We do not want libiwinfo-lua on non-WiFi targets, but it is already
|
||||
# depended on by other luci-packages, so no need to take it in explicitly
|
||||
CONFIG_PACKAGE_luci-mod-admin-full=y
|
||||
CONFIG_PACKAGE_luci-app-firewall=y
|
||||
CONFIG_PACKAGE_luci-app-opkg=y
|
||||
CONFIG_PACKAGE_luci-proto-ppp=y
|
||||
CONFIG_PACKAGE_luci-proto-ipv6=y
|
||||
# CONFIG_LUCI_JSMIN is not set
|
||||
# CONFIG_LUCI_CSSTIDY is not set
|
||||
CONFIG_PACKAGE_luci-mod-dashboard=y
|
||||
CONFIG_PACKAGE_luci-theme-openwrt-2020=y
|
||||
CONFIG_PACKAGE_nginx-mod-luci=y
|
||||
|
||||
|
||||
############
|
||||
# BusyBox #
|
||||
##########
|
||||
|
||||
CONFIG_BUSYBOX_CUSTOM=y
|
||||
CONFIG_TARGET_CUSTOMER="IOPSYS"
|
||||
# CONFIG_USE_SSTRIP is not set
|
||||
CONFIG_USE_STRIP=y
|
||||
CONFIG_BUILD_LOG=y
|
||||
CONFIG_BUSYBOX_CONFIG_ADDUSER=y
|
||||
CONFIG_BUSYBOX_CONFIG_ARPING=y
|
||||
CONFIG_BUSYBOX_CONFIG_ASH_IDLE_TIMEOUT=y
|
||||
@@ -239,7 +121,6 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_MODUTILS_ALIAS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_MODUTILS_SYMBOLS=y
|
||||
CONFIG_BUSYBOX_CONFIG_DEFAULT_MODULES_DIR="/lib/modules"
|
||||
CONFIG_BUSYBOX_CONFIG_DEFAULT_DEPMOD_FILE="modules.dep"
|
||||
# CONFIG_BUSYBOX_CONFIG_IP is not set
|
||||
CONFIG_BUSYBOX_CONFIG_LAST_SYSTEM_ID=999
|
||||
CONFIG_BUSYBOX_CONFIG_LOGIN=y
|
||||
# CONFIG_BUSYBOX_CONFIG_LSMOD is not set
|
||||
@@ -303,10 +184,42 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_SQUASHFS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_VOLUMEID_UBIFS=y
|
||||
CONFIG_BUSYBOX_CONFIG_TIMEOUT=y
|
||||
CONFIG_BUSYBOX_CONFIG_NOHUP=y
|
||||
CONFIG_LIBCURL_CRYPTO_AUTH=y
|
||||
# CONFIG_LIBCURL_MBEDTLS is not set
|
||||
CONFIG_LIBCURL_OPENSSL=y
|
||||
CONFIG_OPENVPN_openssl_ENABLE_IPROUTE2=y
|
||||
# CONFIG_SIGNED_PACKAGES is not set
|
||||
CONFIG_KERNEL_DEVTMPFS=y
|
||||
CONFIG_KERNEL_DEVTMPFS_MOUNT=y
|
||||
# CONFIG_BUSYBOX_CONFIG_IP is not set
|
||||
CONFIG_LOCALMIRROR="https://download.iopsys.eu/iopsys/mirror/"
|
||||
|
||||
# Use fw3 iptables-based instead of newer nftables-based fw4
|
||||
# TODO: for now we cannot build an image with fw3 and luci-app-firewall (i.e. fw3)
|
||||
# Enabling luci-app-firewall enables fw4
|
||||
# CONFIG_PACKAGE_luci-app-firewall is not set
|
||||
CONFIG_PACKAGE_firewall=y
|
||||
# CONFIG_PACKAGE_firewall4 is not set
|
||||
# Generation of /etc/banner.
|
||||
CONFIG_IMAGEOPT=y
|
||||
CONFIG_VERSIONOPT=y
|
||||
CONFIG_VERSION_MANUFACTURER="iopsysWrt"
|
||||
CONFIG_VERSION_MANUFACTURER_URL="https://iopsys.eu/"
|
||||
|
||||
# Disable as much as possible of OpenWrt messy "pre-init" stuff.
|
||||
CONFIG_PREINITOPT=y
|
||||
# CONFIG_TARGET_PREINIT_SUPPRESS_STDERR is not set
|
||||
CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE=y
|
||||
CONFIG_TARGET_PREINIT_TIMEOUT=1
|
||||
# CONFIG_TARGET_PREINIT_SHOW_NETMSG is not set
|
||||
# CONFIG_TARGET_PREINIT_SUPPRESS_FAILSAFE_NETMSG is not set
|
||||
CONFIG_TARGET_PREINIT_IFNAME=""
|
||||
CONFIG_TARGET_PREINIT_IP=""
|
||||
CONFIG_TARGET_PREINIT_NETMASK=""
|
||||
CONFIG_TARGET_PREINIT_BROADCAST=""
|
||||
|
||||
# Generate rootfs tar file
|
||||
CONFIG_TARGET_ROOTFS_TARGZ=y
|
||||
|
||||
# The urandom-seed package is very strange. It seeds urandom with urandom...
|
||||
# Disable it. Most SoCs nowadays has HW random generators anyway.
|
||||
# CONFIG_PACKAGE_urandom-seed is not set
|
||||
# CONFIG_PACKAGE_urngd is not set
|
||||
|
||||
# We use OpenSSL, no need to ship multiple TLS libraries
|
||||
CONFIG_PACKAGE_libustream-openssl=y
|
||||
# CONFIG_PACKAGE_libustream-wolfssl is not set
|
||||
|
||||
@@ -2,65 +2,58 @@
|
||||
|
||||
function feeds_update {
|
||||
|
||||
developer=0
|
||||
override=1
|
||||
start=$(date -u +'%s')
|
||||
while getopts "n" opt; do
|
||||
case $opt in
|
||||
n)
|
||||
override=0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
developer=0
|
||||
override=1
|
||||
start=$(date -u +'%s');
|
||||
while getopts "n" opt; do
|
||||
case $opt in
|
||||
n)
|
||||
override=0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
git remote -v | grep -qE '(git@|ssh://)' && developer=1
|
||||
|
||||
cp .config .genconfig_config_bak
|
||||
git remote -v | grep -qE '(git@|ssh://)' && developer=1
|
||||
|
||||
#if -d argument is passed, clone feeds with ssh instead of http
|
||||
if [ $developer == 1 ]; then
|
||||
./scripts/feeds update -g
|
||||
else
|
||||
./scripts/feeds update
|
||||
fi
|
||||
cp .config .genconfig_config_bak
|
||||
|
||||
#if -d argument is passed, clone feeds with ssh instead of http
|
||||
if [ $developer == 1 ]; then
|
||||
./scripts/feeds update -g
|
||||
else
|
||||
./scripts/feeds update
|
||||
fi
|
||||
./scripts/feeds update -ai
|
||||
|
||||
# replace core packages with iopsys versions
|
||||
if [ $override == 1 ]; then
|
||||
# replace core packages with iopsys versions
|
||||
if [ $override == 1 ]; then
|
||||
./scripts/feeds install -f -p openwrt_core -a
|
||||
fi
|
||||
fi
|
||||
|
||||
# targets need to be installed explicitly
|
||||
for target in $(ls ./feeds/targets); do
|
||||
rm -f target/linux/$target
|
||||
./scripts/feeds install -p targets $target
|
||||
done
|
||||
# targets need to be installed explicitly
|
||||
targets="iopsys-brcm63xx-arm iopsys-ramips intel_mips iopsys-x86 iopsys-armvirt iopsys-bcm27xx iopsys-mediatek iopsys-econet"
|
||||
for target in $targets
|
||||
do
|
||||
rm -f target/linux/$target
|
||||
./scripts/feeds install -p targets $target
|
||||
done
|
||||
|
||||
# Workaround for bug in 22.03.0-rc4 where installed target path has been
|
||||
# moved to target/linux/feeds but Config.in and Makefile from installed
|
||||
# targets are not properly included from the new location.
|
||||
# This hack is to be removed once the issues are fixed.
|
||||
# Note that the above block of code might no longer necessary because
|
||||
# targets no longer need to be installed explicitly.
|
||||
echo "Working around installed-target-bug"
|
||||
for f in target/linux/feeds/*; do
|
||||
ln -vsf "feeds/$(basename "$f")" "target/linux/$(basename "$f")"
|
||||
done
|
||||
# install all packages
|
||||
./scripts/feeds install -a
|
||||
|
||||
# install all packages
|
||||
./scripts/feeds install -a
|
||||
# remove broken symlinks ( for packages that are no longer in the feed )
|
||||
find -L package/feeds -maxdepth 2 -type l -delete
|
||||
|
||||
# remove broken symlinks ( for packages that are no longer in the feed )
|
||||
find -L package/feeds -maxdepth 2 -type l -delete
|
||||
cp .genconfig_config_bak .config
|
||||
make defconfig
|
||||
|
||||
cp .genconfig_config_bak .config
|
||||
make defconfig
|
||||
# record when we last run this script
|
||||
touch tmp/.iop_bootstrap
|
||||
|
||||
# record when we last run this script
|
||||
touch tmp/.iop_bootstrap
|
||||
|
||||
# always return true
|
||||
exit 0
|
||||
# always return true
|
||||
exit 0
|
||||
}
|
||||
|
||||
register_command "feeds_update" "Update feeds to point to commit hashes from feeds.conf"
|
||||
|
||||
|
||||
@@ -13,12 +13,14 @@ function genconfig {
|
||||
export DEVELOPER=0
|
||||
target="bogus"
|
||||
target_config_path=""
|
||||
brcmbca_feed="target/linux/feeds/brcmbca"
|
||||
airoha_feed="target/linux/feeds/airoha"
|
||||
x86_feed="target/linux/feeds/iopsys-x86"
|
||||
armvirt_feed="target/linux/feeds/iopsys-armvirt"
|
||||
mediatek_feed="target/linux/feeds/iopsys-mediatek"
|
||||
qualcomm_ipq95xx_feed="target/linux/feeds/ipq95xx"
|
||||
bcm27xx="target/linux/iopsys-bcm27xx"
|
||||
brcm63xx_arm="target/linux/iopsys-brcm63xx-arm"
|
||||
ramips="target/linux/iopsys-ramips"
|
||||
mediatek="target/linux/iopsys-mediatek"
|
||||
econet="target/linux/iopsys-econet"
|
||||
intel_mips="target/linux/intel_mips"
|
||||
x86="target/linux/iopsys-x86"
|
||||
armvirt="target/linux/iopsys-armvirt"
|
||||
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
@@ -84,8 +86,8 @@ function genconfig {
|
||||
|
||||
[ -n "$profile" ] || return
|
||||
|
||||
if [ -n "$TARGET" -a -d "./target/linux/feeds/$TARGET" ]; then
|
||||
local targetpath="./target/linux/feeds/$TARGET"
|
||||
if [ -n "$TARGET" -a -d "./target/linux/$TARGET" ]; then
|
||||
local targetpath="./target/linux/$TARGET"
|
||||
local profiles=
|
||||
local pfound=0
|
||||
|
||||
@@ -108,21 +110,25 @@ function genconfig {
|
||||
return
|
||||
fi
|
||||
|
||||
[ -e $brcmbca_feed/genconfig ] &&
|
||||
brcmbca=$(cd $brcmbca_feed; ./genconfig)
|
||||
[ -e $airoha_feed/genconfig ] &&
|
||||
airoha=$(cd $airoha_feed; ./genconfig)
|
||||
[ -e $x86_feed/genconfig ] &&
|
||||
iopsys_x86=$(cd $x86_feed; ./genconfig)
|
||||
[ -e $armvirt_feed/genconfig ] &&
|
||||
iopsys_armvirt=$(cd $armvirt_feed; ./genconfig)
|
||||
[ -e $mediatek_feed/genconfig ] &&
|
||||
iopsys_mediatek=$(cd $mediatek_feed; ./genconfig)
|
||||
[ -e $qualcomm_ipq95xx_feed/genconfig ] &&
|
||||
ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig)
|
||||
[ -e $brcm63xx_arm/genconfig ] &&
|
||||
iopsys_brcm63xx_arm=$(cd $brcm63xx_arm; ./genconfig)
|
||||
[ -e $ramips/genconfig ] &&
|
||||
iopsys_ramips=$(cd $ramips; ./genconfig)
|
||||
[ -e $mediatek/genconfig ] &&
|
||||
iopsys_mediatek=$(cd $mediatek; ./genconfig)
|
||||
[ -e $econet/genconfig ] &&
|
||||
iopsys_econet=$(cd $econet; ./genconfig)
|
||||
[ -e $intel_mips/genconfig ] &&
|
||||
iopsys_intel_mips=$(cd $intel_mips; ./genconfig)
|
||||
[ -e $x86/genconfig ] &&
|
||||
iopsys_x86=$(cd $x86; ./genconfig)
|
||||
[ -e $armvirt/genconfig ] &&
|
||||
iopsys_armvirt=$(cd $armvirt; ./genconfig)
|
||||
[ -e $bcm27xx/genconfig ] &&
|
||||
iopsys_bcm27xx=$(cd $bcm27xx; ./genconfig)
|
||||
|
||||
if [ "$profile" == "LIST" ]; then
|
||||
for list in brcmbca airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
|
||||
for list in iopsys_brcm63xx_arm iopsys_ramips iopsys_mediatek iopsys_econet iopsys_intel_mips iopsys_x86 iopsys_armvirt iopsys_bcm27xx; do
|
||||
echo "$list based boards:"
|
||||
for b in ${!list}; do
|
||||
echo -e "\t$b"
|
||||
@@ -131,34 +137,18 @@ function genconfig {
|
||||
return
|
||||
fi
|
||||
|
||||
for p in $brcmbca; do
|
||||
for p in $iopsys_brcm63xx_arm; do
|
||||
if [ $p == $profile ]; then
|
||||
target="brcmbca"
|
||||
target_config_path="$brcmbca_feed/config"
|
||||
target="iopsys_brcm63xx_arm"
|
||||
target_config_path="$brcm63xx_arm/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $airoha; do
|
||||
for p in $iopsys_ramips; do
|
||||
if [ $p == $profile ]; then
|
||||
target="airoha"
|
||||
target_config_path="$airoha_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_x86; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_x86"
|
||||
target_config_path="$x86_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_armvirt; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_armvirt"
|
||||
target_config_path="$armvirt_feed/config"
|
||||
target="iopsys_ramips"
|
||||
target_config_path="$ramips/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
@@ -166,18 +156,51 @@ function genconfig {
|
||||
for p in $iopsys_mediatek; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_mediatek"
|
||||
target_config_path="$mediatek_feed/config"
|
||||
target_config_path="$mediatek/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $ipq95xx; do
|
||||
for p in $iopsys_econet; do
|
||||
if [ $p == $profile ]; then
|
||||
target="ipq95xx"
|
||||
target_config_path="$qualcomm_ipq95xx_feed/config"
|
||||
target="iopsys_econet"
|
||||
target_config_path="$econet/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_intel_mips; do
|
||||
if [ $p == $profile ]; then
|
||||
target="intel_mips"
|
||||
target_config_path="$intel_mips/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_x86; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_x86"
|
||||
target_config_path="$x86/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_armvirt; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_armvirt"
|
||||
target_config_path="$armvirt/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_bcm27xx; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_bcm27xx"
|
||||
target_config_path="$bcm27xx/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
git remote -v | grep -qE '(git@|ssh://)' && {
|
||||
@@ -265,22 +288,11 @@ function genconfig {
|
||||
setup_dirs()
|
||||
{
|
||||
git remote -v | grep -q http || {
|
||||
CUSTBRANCH="$(git rev-parse --abbrev-ref HEAD)"
|
||||
if git ls-remote $CUSTREPO -q 2>/dev/null; then
|
||||
if [ ! -d "$CUSTPATH" ]; then
|
||||
echo "Cloning $CUSTBRANCH branch of $CUSTREPO"
|
||||
git clone -b "$CUSTBRANCH" "$CUSTREPO" "$CUSTPATH" 2>/dev/null || {
|
||||
DEFBRANCH="$(git remote show $CUSTREPO | grep 'HEAD branch' | cut -d' ' -f5)"
|
||||
echo "$CUSTBRANCH branch is not found, cloning $DEFBRANCH branch of $CUSTREPO"
|
||||
git clone "$CUSTREPO" "$CUSTPATH"
|
||||
}
|
||||
git clone "$CUSTREPO" "$CUSTPATH"
|
||||
elif [ $IMPORT -eq 1 ]; then
|
||||
cd $CUSTPATH
|
||||
echo "Checking out $CUSTBRANCH branch in $CUSTPATH"
|
||||
git checkout "$CUSTBRANCH" 2>/dev/null || {
|
||||
DEFBRANCH="$(git symbolic-ref refs/remotes/origin/HEAD | cut -d '/' -f4)"
|
||||
echo "Checking out $CUSTBRANCH branch has failed, using $DEFBRANCH branch in $CUSTPATH"
|
||||
}
|
||||
v "git pull"
|
||||
git pull
|
||||
cd - >/dev/null #go back
|
||||
@@ -340,26 +352,36 @@ function genconfig {
|
||||
echo "" >> .config
|
||||
fi
|
||||
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
case "$target" in
|
||||
airoha | iopsys_mediatek | brcmbca | ipq95xx)
|
||||
# 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}")"
|
||||
#special handling for intel_mips/iopsys_ramips which use TARGET_DEVICES
|
||||
if [ "$target" = "intel_mips" ]; then
|
||||
subtarget="xrx500"
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
|
||||
device=$(echo $BOARDTYPE | tr a-z A-Z)
|
||||
echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${device}=y" >> .config
|
||||
elif [ "$target" = "iopsys_ramips" ]; then
|
||||
subtarget="mt7621"
|
||||
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_mediatek" ]; then
|
||||
subtarget="mt7622"
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
|
||||
echo "CONFIG_TARGET_${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
|
||||
elif [ "$target" = "iopsys_bcm27xx" ]; then
|
||||
subtarget="iopsys_bcm2711"
|
||||
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
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo "$CUSTOMERS $BOARDTYPE" > $CURRENT_CONFIG_FILE
|
||||
|
||||
@@ -388,15 +410,12 @@ function genconfig {
|
||||
fi
|
||||
|
||||
# Set target version
|
||||
local git_version
|
||||
if ! git_version="$(git describe --always --dirty --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then
|
||||
echo "ERROR: Failed getting version via git describe, exiting." >&2
|
||||
return 1
|
||||
fi
|
||||
local version="${git_version,,}${CUSTOMERS:+-${CUSTOMERS// /}}"
|
||||
local version_lower="${version,,}"
|
||||
echo "CONFIG_TARGET_VERSION=\"${version_lower}\"" >> .config
|
||||
echo "CONFIG_VERSION_CODE=\"${version_lower}\"" >> .config
|
||||
local GIT_TAG=$(git describe --abbrev=0 --tags)
|
||||
local GIT_REV=$(git rev-parse --short HEAD)
|
||||
local GIT_VER="$GIT_TAG"
|
||||
git describe --contains $GIT_REV >/dev/null 2>&1 || GIT_VER="${GIT_TAG}_${GIT_REV}"
|
||||
echo "CONFIG_TARGET_VERSION=\"${GIT_VER}\"" >> .config
|
||||
echo "CONFIG_VERSION_CODE=\"${GIT_VER}\"" >> .config
|
||||
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
|
||||
|
||||
# Enable Package source tree override if selected
|
||||
|
||||
@@ -12,12 +12,14 @@ function genconfig_min {
|
||||
export DEVELOPER=0
|
||||
target="bogus"
|
||||
target_config_path=""
|
||||
brcmbca_feed="target/linux/feeds/brcmbca"
|
||||
airoha_feed="target/linux/feeds/airoha"
|
||||
x86_feed="target/linux/feeds/iopsys-x86"
|
||||
armvirt_feed="target/linux/feeds/iopsys-armvirt"
|
||||
mediatek_feed="target/linux/feeds/iopsys-mediatek"
|
||||
qualcomm_ipq95xx_feed="target/linux/feeds/ipq95xx"
|
||||
bcm27xx="target/linux/iopsys-bcm27xx"
|
||||
brcm63xx_arm="target/linux/iopsys-brcm63xx-arm"
|
||||
ramips="target/linux/iopsys-ramips"
|
||||
mediatek="target/linux/iopsys-mediatek"
|
||||
econet="target/linux/iopsys-econet"
|
||||
intel_mips="target/linux/intel_mips"
|
||||
x86="target/linux/iopsys-x86"
|
||||
armvirt="target/linux/iopsys-armvirt"
|
||||
|
||||
Red='\033[0;31m' # Red
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
@@ -83,8 +85,8 @@ function genconfig_min {
|
||||
|
||||
[ -n "$profile" ] || return
|
||||
|
||||
if [ -n "$TARGET" -a -d "./target/linux/feeds/$TARGET" ]; then
|
||||
local targetpath="./target/linux/feeds/$TARGET"
|
||||
if [ -n "$TARGET" -a -d "./target/linux/$TARGET" ]; then
|
||||
local targetpath="./target/linux/$TARGET"
|
||||
local profiles=
|
||||
local pfound=0
|
||||
|
||||
@@ -107,21 +109,25 @@ function genconfig_min {
|
||||
return
|
||||
fi
|
||||
|
||||
[ -e $brcmbca_feed/genconfig ] &&
|
||||
brcmbca=$(cd $brcmbca_feed; ./genconfig)
|
||||
[ -e $airoha_feed/genconfig ] &&
|
||||
airoha=$(cd $airoha_feed; ./genconfig)
|
||||
[ -e $x86_feed/genconfig ] &&
|
||||
iopsys_x86=$(cd $x86_feed; ./genconfig)
|
||||
[ -e $armvirt_feed/genconfig ] &&
|
||||
iopsys_armvirt=$(cd $armvirt_feed; ./genconfig)
|
||||
[ -e $mediatek_feed/genconfig ] &&
|
||||
iopsys_mediatek=$(cd $mediatek_feed; ./genconfig)
|
||||
[ -e $qualcomm_ipq95xx_feed/genconfig ] &&
|
||||
ipq95xx=$(cd $qualcomm_ipq95xx_feed; ./genconfig)
|
||||
[ -e $brcm63xx_arm/genconfig ] &&
|
||||
iopsys_brcm63xx_arm=$(cd $brcm63xx_arm; ./genconfig)
|
||||
[ -e $ramips/genconfig ] &&
|
||||
iopsys_ramips=$(cd $ramips; ./genconfig)
|
||||
[ -e $mediatek/genconfig ] &&
|
||||
iopsys_mediatek=$(cd $mediatek; ./genconfig)
|
||||
[ -e $econet/genconfig ] &&
|
||||
iopsys_econet=$(cd $econet; ./genconfig)
|
||||
[ -e $intel_mips/genconfig ] &&
|
||||
iopsys_intel_mips=$(cd $intel_mips; ./genconfig)
|
||||
[ -e $x86/genconfig ] &&
|
||||
iopsys_x86=$(cd $x86; ./genconfig)
|
||||
[ -e $armvirt/genconfig ] &&
|
||||
iopsys_armvirt=$(cd $armvirt; ./genconfig)
|
||||
[ -e $bcm27xx/genconfig ] &&
|
||||
iopsys_bcm27xx=$(cd $bcm27xx; ./genconfig)
|
||||
|
||||
if [ "$profile" == "LIST" ]; then
|
||||
for list in brcmbca airoha iopsys_x86 iopsys_armvirt iopsys_mediatek ipq95xx; do
|
||||
for list in iopsys_brcm63xx_arm iopsys_ramips iopsys_mediatek iopsys_econet iopsys_intel_mips iopsys_x86 iopsys_armvirt iopsys_bcm27xx; do
|
||||
echo "$list based boards:"
|
||||
for b in ${!list}; do
|
||||
echo -e "\t$b"
|
||||
@@ -130,34 +136,18 @@ function genconfig_min {
|
||||
return
|
||||
fi
|
||||
|
||||
for p in $brcmbca; do
|
||||
for p in $iopsys_brcm63xx_arm; do
|
||||
if [ $p == $profile ]; then
|
||||
target="brcmbca"
|
||||
target_config_path="$brcmbca_feed/config"
|
||||
target="iopsys_brcm63xx_arm"
|
||||
target_config_path="$brcm63xx_arm/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $airoha; do
|
||||
for p in $iopsys_ramips; do
|
||||
if [ $p == $profile ]; then
|
||||
target="airoha"
|
||||
target_config_path="$airoha_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_x86; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_x86"
|
||||
target_config_path="$x86_feed/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_armvirt; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_armvirt"
|
||||
target_config_path="$armvirt_feed/config"
|
||||
target="iopsys_ramips"
|
||||
target_config_path="$ramips/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
@@ -165,22 +155,61 @@ function genconfig_min {
|
||||
for p in $iopsys_mediatek; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_mediatek"
|
||||
target_config_path="$mediatek_feed/config"
|
||||
target_config_path="$mediatek/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $ipq95xx; do
|
||||
for p in $iopsys_econet; do
|
||||
if [ $p == $profile ]; then
|
||||
target="ipq95xx"
|
||||
target_config_path="$qualcomm_ipq95xx_feed/config"
|
||||
target="iopsys_econet"
|
||||
target_config_path="$econet/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_intel_mips; do
|
||||
if [ $p == $profile ]; then
|
||||
target="intel_mips"
|
||||
target_config_path="$intel_mips/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_x86; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_x86"
|
||||
target_config_path="$x86/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_armvirt; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_armvirt"
|
||||
target_config_path="$armvirt/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_bcm27xx; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_bcm27xx"
|
||||
target_config_path="$bcm27xx/config"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
git remote -v | grep -qE '(git@|ssh://)' && {
|
||||
DEVELOPER=1
|
||||
|
||||
bcmAllowed=0
|
||||
endptAllowed=0
|
||||
|
||||
git ls-remote git@dev.iopsys.eu:broadcom/bcmcreator.git -q 2>/dev/null && bcmAllowed=1
|
||||
git ls-remote git@dev.iopsys.eu:iopsys/endptmngr.git -q 2>/dev/null && endptAllowed=1
|
||||
}
|
||||
|
||||
v() {
|
||||
@@ -314,26 +343,38 @@ function genconfig_min {
|
||||
echo "" >> .config
|
||||
fi
|
||||
|
||||
# Special handling for targets which use TARGET_DEVICES
|
||||
case "$target" in
|
||||
airoha | iopsys_mediatek | brcmbca | ipq95xx)
|
||||
# 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}")"
|
||||
#special handling for intel_mips/iopsys_ramips which use TARGET_DEVICES
|
||||
if [ "$target" = "intel_mips" ]; then
|
||||
subtarget="xrx500"
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
|
||||
device=$(echo $BOARDTYPE | tr a-z A-Z)
|
||||
echo "CONFIG_TARGET_DEVICE_${target}_${subtarget}_DEVICE_${device}=y" >> .config
|
||||
elif [ "$target" = "iopsys_ramips" ]; then
|
||||
subtarget="mt7621"
|
||||
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_mediatek" ]; then
|
||||
subtarget="mt7622"
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
|
||||
echo "CONFIG_TARGET_${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
|
||||
elif [ "$target" = "iopsys_bcm27xx" ]; then
|
||||
subtarget="iopsys_bcm2711"
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${subtarget}=y" >> .config
|
||||
echo "CONFIG_TARGET_MULTI_PROFILE=y" >> .config
|
||||
echo "CONFIG_TARGET_PER_DEVICE_ROOTFS=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
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo "$CUSTOMERS $BOARDTYPE" > $CURRENT_CONFIG_FILE
|
||||
|
||||
@@ -362,15 +403,12 @@ function genconfig_min {
|
||||
fi
|
||||
|
||||
# Set target version
|
||||
local git_version
|
||||
if ! git_version="$(git describe --always --dirty --tags --match '[0-9].*.*' --match '[0-9][0-9].*.*')"; then
|
||||
echo "ERROR: Failed getting version via git describe, exiting." >&2
|
||||
return 1
|
||||
fi
|
||||
local version="${git_version,,}${CUSTOMERS:+-${CUSTOMERS// /}}"
|
||||
local version_lower="${version,,}"
|
||||
echo "CONFIG_TARGET_VERSION=\"${version_lower}\"" >> .config
|
||||
echo "CONFIG_VERSION_CODE=\"${version_lower}\"" >> .config
|
||||
local GIT_TAG=$(git describe --abbrev=0 --tags)
|
||||
local GIT_REV=$(git rev-parse --short HEAD)
|
||||
local GIT_VER="$GIT_TAG"
|
||||
git describe --contains $GIT_REV >/dev/null 2>&1 || GIT_VER="${GIT_TAG}_${GIT_REV}"
|
||||
echo "CONFIG_TARGET_VERSION=\"${GIT_VER}\"" >> .config
|
||||
echo "CONFIG_VERSION_CODE=\"${GIT_VER}\"" >> .config
|
||||
echo "CONFIG_VERSION_PRODUCT=\"$BOARDTYPE"\" >> .config
|
||||
|
||||
# Enable Package source tree override if selected
|
||||
|
||||
@@ -48,10 +48,7 @@ function ssh_install_key {
|
||||
local keys="$(get_ssh_public_keys)"
|
||||
echo "Adding the following keys to $DROPBEAR_AUTHORIZED_KEYS_FILE on $host:"
|
||||
echo "$keys"
|
||||
ssh \
|
||||
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
|
||||
root@$host \
|
||||
"echo '$keys' >> '$DROPBEAR_AUTHORIZED_KEYS_FILE'" && echo ok
|
||||
ssh root@$host "echo '$keys' >> '$DROPBEAR_AUTHORIZED_KEYS_FILE'" && echo ok
|
||||
}
|
||||
|
||||
register_command "ssh_install_key" "Install the users public ssh key on host running dropbear"
|
||||
|
||||
@@ -1,283 +1,344 @@
|
||||
# this is a developer helper script to install firmware on a remote host with SSH
|
||||
|
||||
function upd_usage {
|
||||
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"
|
||||
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"
|
||||
}
|
||||
|
||||
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" "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 "-----------------------------------------"
|
||||
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 -n "Continue? [Y/n/q]:"
|
||||
read answer
|
||||
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
|
||||
|
||||
case $answer in
|
||||
n | N)
|
||||
return 1
|
||||
;;
|
||||
q | Q)
|
||||
exit 1
|
||||
;;
|
||||
y | Y | *)
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
echo -n "Continue? [Y/n/q]:"
|
||||
read answer
|
||||
|
||||
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
|
||||
|
||||
new_file=$(cat $tempfile)
|
||||
if [ -n "$new_file" ]; then
|
||||
upd_fw="$new_file"
|
||||
upd_fw_base=$(basename $upd_fw)
|
||||
fi
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
new_file=$(cat $tempfile)
|
||||
if [ -n "$new_file" ]; then
|
||||
upd_host="$new_file"
|
||||
fi
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
res=$(cat $tempfile)
|
||||
case $res in
|
||||
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
|
||||
|
||||
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 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
|
||||
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
|
||||
|
||||
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 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
|
||||
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
|
||||
|
||||
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" "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
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
case $(cat $tempfile) in
|
||||
"Firmware file")
|
||||
upd_select_file
|
||||
;;
|
||||
"Host IP")
|
||||
upd_select_target
|
||||
;;
|
||||
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
|
||||
;;
|
||||
"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
|
||||
;;
|
||||
upd_select_forceimage
|
||||
;;
|
||||
"sysupgrade")
|
||||
upd_select_sysupgrade
|
||||
;;
|
||||
*)
|
||||
return
|
||||
;;
|
||||
esac
|
||||
upd_select
|
||||
return
|
||||
;;
|
||||
esac
|
||||
upd_select
|
||||
}
|
||||
function upd_select_start {
|
||||
lines=$(tput lines)
|
||||
cols=$(tput cols)
|
||||
tempfile="$(mktemp)"
|
||||
trap "rm -f $tempfile" 0 1 2 5 15
|
||||
upd_select
|
||||
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
|
||||
|
||||
}
|
||||
|
||||
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"
|
||||
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"
|
||||
upd_sysupgrade=1
|
||||
do_dialog=0
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
upd_fw_base="$(basename "$upd_fw")"
|
||||
|
||||
[ $do_dialog -eq 1 ] && upd_select_start
|
||||
|
||||
if ! upd_ask_ok; then
|
||||
upd_select_start
|
||||
if ! upd_ask_ok; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f $upd_fw ]; then
|
||||
echo "Firmware file $firmware does not exist."
|
||||
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
|
||||
|
||||
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"
|
||||
for upd_fw_base in $firmwares
|
||||
do
|
||||
#echo "firmware $upd_fw"
|
||||
break
|
||||
done
|
||||
upd_fw="bin/targets/$CONFIG_TARGET_BOARD/generic/$upd_fw_base"
|
||||
fi
|
||||
|
||||
pv "$upd_fw" |
|
||||
ssh \
|
||||
-o ConnectTimeout=60 \
|
||||
-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \
|
||||
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
|
||||
[ $do_dialog -eq 1 ] && upd_select_start
|
||||
|
||||
if ! upd_ask_ok
|
||||
then
|
||||
upd_select_start
|
||||
if ! upd_ask_ok
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f $upd_fw ]
|
||||
then
|
||||
echo "firmware file $firmware do not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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"
|
||||
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
|
||||
}
|
||||
|
||||
register_command "ssh_upgrade" "-t <host> -f <file> [opts] Install firmware on remote host with SSH"
|
||||
register_command "ssh_upgrade" "-h <host> -f <file> [opts] Install firmware on remote host with SSH"
|
||||
|
||||
|
||||
|
||||
54
libjwt/Makefile
Normal file
54
libjwt/Makefile
Normal file
@@ -0,0 +1,54 @@
|
||||
|
||||
# Copyright (C) 2018 Iopsys
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libjwt
|
||||
PKG_VERSION:=1.0.0
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=866607c7741421c8ac99876e7201eb32d9af1b92
|
||||
PKG_SOURCE_URL:=https://github.com/benmcollins/libjwt.git
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)_$(PKG_SOURCE_VERSION).tar.xz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
PKG_LICENSE:=LGPLv3
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/libjwt
|
||||
CATEGORY:=Libraries
|
||||
DEPENDS:=+libopenssl +jansson
|
||||
TITLE:= libjwt
|
||||
endef
|
||||
|
||||
|
||||
#TARGET_CFLAGS += \
|
||||
# -I$(STAGING_DIR)/usr/include
|
||||
# -I$(STAGING_DIR)/usr/include/libnl3
|
||||
|
||||
#MAKE_FLAGS += \
|
||||
# CFLAGS="$(TARGET_CFLAGS)" \
|
||||
# LDFLAGS="$(TARGET_LDFLAGS)" \
|
||||
# FPIC="$(FPIC)" \
|
||||
# PLATFORM="$(TARGET_PLATFORM)" \
|
||||
# subdirs="$(subdirs)"
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/include/jwt.h $(1)/usr/include/
|
||||
$(CP) $(PKG_BUILD_DIR)/libjwt/.libs/libjwt.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libjwt/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libjwt/.libs/libjwt.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libjwt))
|
||||
57
libmicroxml/Makefile
Normal file
57
libmicroxml/Makefile
Normal file
@@ -0,0 +1,57 @@
|
||||
#
|
||||
# Copyright (C) 2012-2014 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libmicroxml
|
||||
PKG_VERSION:=2012-06-11
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/mirror/microxml.git
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_VERSION:=72965423184f24cc0b963d91c2d1863cdb01b6aa
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
PKG_LICENSE:=LGPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/libmicroxml
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=XML library
|
||||
MAINTAINER:=Luka Perkov <luka@openwrt.org>
|
||||
endef
|
||||
|
||||
define Package/libmicroxml/description
|
||||
A micro sized XML library
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--disable-threads \
|
||||
--enable-static \
|
||||
--enable-shared
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(CP) $(PKG_BUILD_DIR)/microxml.h $(1)/usr/include
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libmicroxml.so* $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
||||
$(CP) $(PKG_BUILD_DIR)/microxml.pc $(1)/usr/lib/pkgconfig
|
||||
endef
|
||||
|
||||
define Package/libmicroxml/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libmicroxml.so* $(1)/usr/lib
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libmicroxml))
|
||||
130
libmicroxml/patches/100-fix-memleak.patch
Normal file
130
libmicroxml/patches/100-fix-memleak.patch
Normal file
@@ -0,0 +1,130 @@
|
||||
diff --git a/mxml-file.c b/mxml-file.c
|
||||
index 02eca9d..f10d202 100644
|
||||
--- a/mxml-file.c
|
||||
+++ b/mxml-file.c
|
||||
@@ -363,9 +363,12 @@ mxmlSaveFile(mxml_node_t *node, /* I - Node to write */
|
||||
* Write the node...
|
||||
*/
|
||||
|
||||
- if ((col = mxml_write_node(node, fp, cb, 0, mxml_file_putc, global)) < 0)
|
||||
+ if ((col = mxml_write_node(node, fp, cb, 0, mxml_file_putc, global)) < 0){
|
||||
+ global_free(global);
|
||||
return (-1);
|
||||
-
|
||||
+ }
|
||||
+
|
||||
+ global_free(global);
|
||||
if (col > 0)
|
||||
if (putc('\n', fp) < 0)
|
||||
return (-1);
|
||||
@@ -1448,6 +1451,7 @@ mxml_load_data(
|
||||
if ((buffer = malloc(64)) == NULL)
|
||||
{
|
||||
mxml_error("Unable to allocate string buffer!");
|
||||
+ global_free(global);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@@ -2083,11 +2087,12 @@ mxml_load_data(
|
||||
node->parent ? node->parent->value.element.name : "(null)");
|
||||
|
||||
mxmlDelete(first);
|
||||
-
|
||||
+ global_free(global);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
+ global_free(global);
|
||||
if (parent)
|
||||
return (parent);
|
||||
else
|
||||
@@ -2102,7 +2107,7 @@ error:
|
||||
mxmlDelete(first);
|
||||
|
||||
free(buffer);
|
||||
-
|
||||
+ global_free(global);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
diff --git a/mxml-private.c b/mxml-private.c
|
||||
index 4378ca3..ea6e452 100644
|
||||
--- a/mxml-private.c
|
||||
+++ b/mxml-private.c
|
||||
@@ -41,6 +41,32 @@
|
||||
* This code currently supports AIX, HP-UX, Linux, Mac OS X, Solaris, and
|
||||
* Windows. It might work on the BSDs and IRIX, but I haven't tested that.
|
||||
*/
|
||||
+void *global_mem[16] = {0};
|
||||
+
|
||||
+static void *global_calloc(int x, int size)
|
||||
+{
|
||||
+ int i;
|
||||
+ void *m = calloc(x, size);
|
||||
+ for (i = ((sizeof(global_mem)/sizeof(global_mem[0])) - 1); i > 0; i--) {
|
||||
+ global_mem[i] = global_mem[i-1];
|
||||
+ }
|
||||
+ global_mem[0] = m;
|
||||
+ return m;
|
||||
+}
|
||||
+
|
||||
+void global_free(void *m)
|
||||
+{
|
||||
+ int i;
|
||||
+ if (m == NULL)
|
||||
+ return;
|
||||
+ for (i = ((sizeof(global_mem)/sizeof(global_mem[0])) - 1); i >= 0; i--) {
|
||||
+ if (global_mem[i] == m) {
|
||||
+ global_mem[i] = NULL;
|
||||
+ free(m);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
|
||||
#if defined(__sun) || defined(_AIX)
|
||||
# pragma fini(_mxml_fini)
|
||||
@@ -148,7 +174,6 @@ mxml_real_cb(mxml_node_t *node) /* I - Current node */
|
||||
return (MXML_REAL);
|
||||
}
|
||||
|
||||
-
|
||||
#ifdef HAVE_PTHREAD_H /**** POSIX threading ****/
|
||||
# include <pthread.h>
|
||||
|
||||
@@ -190,7 +215,6 @@ _MXML_FINI(void)
|
||||
}
|
||||
}
|
||||
|
||||
-
|
||||
/*
|
||||
* '_mxml_global()' - Get global data.
|
||||
*/
|
||||
@@ -205,7 +229,7 @@ _mxml_global(void)
|
||||
|
||||
if ((global = (_mxml_global_t *)pthread_getspecific(_mxml_key)) == NULL)
|
||||
{
|
||||
- global = (_mxml_global_t *)calloc(1, sizeof(_mxml_global_t));
|
||||
+ global = (_mxml_global_t *)global_calloc(1, sizeof(_mxml_global_t));
|
||||
pthread_setspecific(_mxml_key, global);
|
||||
|
||||
global->num_entity_cbs = 1;
|
||||
@@ -288,7 +312,7 @@ _mxml_global(void)
|
||||
|
||||
if ((global = (_mxml_global_t *)TlsGetValue(_mxml_tls_index)) == NULL)
|
||||
{
|
||||
- global = (_mxml_global_t *)calloc(1, sizeof(_mxml_global_t));
|
||||
+ global = (_mxml_global_t *)global_calloc(1, sizeof(_mxml_global_t));
|
||||
|
||||
global->num_entity_cbs = 1;
|
||||
global->entity_cbs[0] = _mxml_entity_cb;
|
||||
diff --git a/mxml-private.h b/mxml-private.h
|
||||
index c591208..72ed338 100644
|
||||
--- a/mxml-private.h
|
||||
+++ b/mxml-private.h
|
||||
@@ -43,3 +43,4 @@ typedef struct _mxml_global_s
|
||||
extern _mxml_global_t *_mxml_global(void);
|
||||
extern int _mxml_entity_cb(const char *name);
|
||||
|
||||
+extern void global_free(void *m);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user