mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-01-02 11:15:58 +08:00
Compare commits
2 Commits
asterisk13
...
3.10.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
817435f36c | ||
|
|
2fcb0ea2c2 |
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=asterisk18-mod
|
||||
PKG_VERSION:=1.8.10.1
|
||||
|
||||
PKG_SOURCE_VERSION:=ee99af0d91a2197529b13075d802ebc37e644e40
|
||||
PKG_SOURCE_VERSION:=62c3764e6765fa9b1d22cb5dda26476e4742bdcf
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/asterisk-1.8.x
|
||||
|
||||
@@ -455,8 +455,6 @@ define Package/asterisk18-mod/install
|
||||
$(INSTALL_DATA) ./files/asterisk.default $(1)/etc/default/asterisk
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/asterisk.init $(1)/etc/init.d/asterisk
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_BIN) ./files/asterisk.hotplug $(1)/etc/hotplug.d/iface/80-asterisk
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-sounds/install
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = ifup ] || exit 0
|
||||
|
||||
config_load voice_client
|
||||
config_get bindintf SIP bindintf
|
||||
|
||||
[ "$INTERFACE" == "$bindintf" ] || exit 0
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
if [ -n "$bindintf" ]; then
|
||||
network_get_ipaddr bindaddr "$bindintf"
|
||||
[ -z "$bindaddr" ] && network_get_ipaddr6 bindaddr "$bindintf"
|
||||
bindaddr="${bindaddr:-0.0.0.0}"
|
||||
sed -i "s/bindaddr=.*/bindaddr=$bindaddr/g" /etc/asterisk/sip.conf
|
||||
[ -e /var/run/asterisk/asterisk.ctl ] && /etc/init.d/asterisk reload
|
||||
fi
|
||||
|
||||
@@ -9,9 +9,26 @@ USE_PROCD=1
|
||||
NAME=asterisk
|
||||
PROG=/usr/sbin/asterisk
|
||||
DEFAULT=/etc/default/asterisk
|
||||
CONFDIR=/etc/asterisk
|
||||
|
||||
init_asterisk() {
|
||||
# do not start asterisk until the
|
||||
# router receives a default route
|
||||
config_load voice_client
|
||||
local bindintf
|
||||
config_get bindintf SIP bindintf ""
|
||||
if [ "$bindintf" == "" ]; then
|
||||
while ! ip r | grep -q default; do
|
||||
sleep 1
|
||||
done
|
||||
else
|
||||
network_get_ipaddr ip "$bindintf"
|
||||
while [ "$ip" == "" ]; do
|
||||
sleep 1
|
||||
network_flush_cache
|
||||
network_get_ipaddr ip "$bindintf"
|
||||
done
|
||||
fi
|
||||
|
||||
[ -f $DEFAULT ] && . $DEFAULT
|
||||
[ -d /var/run/asterisk ] || mkdir -p /var/run/asterisk
|
||||
[ -d /var/log/asterisk ] || mkdir -p /var/log/asterisk
|
||||
@@ -39,8 +56,6 @@ start_service() {
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
asterisk -rx "config reload $CONFDIR/sip.conf"
|
||||
sleep 1
|
||||
asterisk -rx "core reload"
|
||||
asterisk -rx "dialplan reload"
|
||||
asterisk -rx "brcm reload"
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2016 inteno
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
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:=http://public.inteno.se:/ated
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
# 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,62 +0,0 @@
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=bashdb
|
||||
PKG_VERSION:=4.4-0.92
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
#PKG_SOURCE_URL:=http://sourceforge.net/projects/bashdb/files/bashdb/$(PKG_VERSION)
|
||||
PKG_SOURCE_URL:=@SF/bashdb/
|
||||
PKG_MD5SUM:=b72c17870bfab2fd791b1f6de4d79f9e
|
||||
#PKG_CAT:=zcat
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/$(PKG_NAME)
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Bash script debugging utility.
|
||||
URL:=http://sourceforge.net/projects/bashdb/
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/description
|
||||
Bash script debugging utility.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
CFLAGS="$(TARGET_CFLAGS) -DLINUX $(TARGET_CPPFLAGS) \
|
||||
-I./src" \
|
||||
LIBS="$(TARGET_LDFLAGS)" \
|
||||
DESTDIR="$(PKG_INSTALL_DIR)"
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bashdb $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/usr/share
|
||||
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/*.sh $(1)/usr/share/$(PKG_NAME)/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/*.inc $(1)/usr/share/$(PKG_NAME)/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/init
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/init/*.sh $(1)/usr/share/$(PKG_NAME)/init/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/command
|
||||
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/command/show_sub
|
||||
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/command/set_sub
|
||||
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/command/info_sub
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/command/*.sh $(1)/usr/share/$(PKG_NAME)/command/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/command/show_sub/*.sh $(1)/usr/share/$(PKG_NAME)/command/show_sub/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/command/set_sub/*.sh $(1)/usr/share/$(PKG_NAME)/command/set_sub/
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/command/info_sub/*.sh $(1)/usr/share/$(PKG_NAME)/command/info_sub/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/lib
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/*.sh $(1)/usr/share/$(PKG_NAME)/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,bashdb))
|
||||
@@ -11,7 +11,7 @@ PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.1.0
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/dectmngr2
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=13da1568d57b8e6732dadc16de828d64c81906b8
|
||||
PKG_SOURCE_VERSION:=17aa3b1d8d372ebcf4d37379f7cc4fb59c461d4b
|
||||
PKG_NAME:=dectmngr2
|
||||
|
||||
|
||||
|
||||
@@ -19,18 +19,18 @@ export PLATFORM_INCLUDE:=platforms/iopsys/build.mk
|
||||
|
||||
export DATE:=$(shell date +%Y-%m-%d-%H-%M-%S)
|
||||
export LOGIN:=$(shell whoami)
|
||||
BASE_PKG_VERSION:=4.4.0
|
||||
PKG_RELEASE:=RC4
|
||||
BASE_PKG_VERSION:=4.1.0
|
||||
PKG_RELEASE:=RC6
|
||||
PKG_VERSION:=$(BASE_PKG_VERSION)-$(PKG_RELEASE)_$(DATE)_$(LOGIN)
|
||||
export PKG_VERSION
|
||||
|
||||
###########################--RELEASE--################################
|
||||
|
||||
PKG_SOURCE_VERSION:=e855fdb65ec312e9ec044ce9319d6ac17fde57cd
|
||||
PKG_SOURCE_VERSION:=daa4bea4911af4b9e454434744437c2c4de75188
|
||||
ifeq ($(CONFIG_ICE_OPEN),y)
|
||||
TARGET_PROFILE=$(shell echo $(CONFIG_TARGET_BOARD) | sed s/\"//g)
|
||||
BRCM_KERNEL_PROFILE=$(shell echo $(CONFIG_BCM_KERNEL_PROFILE) | sed s/\"//g)
|
||||
PKG_SOURCE_URL:=http://iopsys.inteno.se/iopsys/consumer/
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(TARGET_PROFILE)-$(BASE_PKG_VERSION)$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(BRCM_KERNEL_PROFILE)-$(BASE_PKG_VERSION)$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
else
|
||||
@@ -45,7 +45,7 @@ endif
|
||||
|
||||
###########################--RELEASE--################################
|
||||
|
||||
#include $(INCLUDE_DIR)/uclibc++.mk
|
||||
include $(INCLUDE_DIR)/uclibc++.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ice-client/Default
|
||||
@@ -58,7 +58,7 @@ define Package/ice-client
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=ice-client
|
||||
MENU:=1
|
||||
DEPENDS:=+libopenssl +libstdcpp +libubus +ubus +ubusd +jshn +libubox +libpthread
|
||||
DEPENDS:=+libopenssl +uclibcxx +libubus +ubus +ubusd +jshn +libubox +libpthread
|
||||
endef
|
||||
|
||||
define Package/ice-client/config
|
||||
|
||||
@@ -22,8 +22,8 @@ config login
|
||||
list write 'juci-broadcom-iptv'
|
||||
list write 'juci-broadcom-vlan'
|
||||
list write 'juci-broadcom-vlan-admin'
|
||||
list write 'juci-wireless'
|
||||
list write 'juci-wireless-admin'
|
||||
list write 'juci-broadcom-wl'
|
||||
list write 'juci-broadcom-wl-admin'
|
||||
list write 'juci-catv'
|
||||
list write 'juci-ddns'
|
||||
list write 'juci-diagnostics'
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=3.0-2017-05-01
|
||||
PKG_VERSION:=3.0-2016-12-19
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/icwmp.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=5a1b5c439524c56dca7a1921d4cf2fcd2d4c1ff0
|
||||
PKG_SOURCE_VERSION:=e5975d963d4be25c202aae7cc45b247021823d69
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
@@ -122,11 +122,11 @@ endif
|
||||
|
||||
define Package/icwmp-$(BUILD_VARIANT)/install
|
||||
$(INSTALL_DIR) $(1)/etc/icwmpd
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/dmmap $(1)/etc/icwmpd
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) $(PKG_BUILD_DIR)/bin/icwmpd $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/cwmp $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/dmmap $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/firewall.cwmp $(1)/etc/firewall.cwmp
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2016 Inteno
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=inbd
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=2d474e9ff37b9cfcffd4b9ac8eba8db03eb38a21
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se/inbd
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
# 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/inbd
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Inteno Netlink Bridge Daemon
|
||||
URL:=
|
||||
DEPENDS:=+libuci +libubus +libblobmsg-json +libnl-genl
|
||||
endef
|
||||
|
||||
define Package/inbd/description
|
||||
Application handling netlink messages from kernel and sending them out on ubus.
|
||||
endef
|
||||
|
||||
define Package/inbd/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/inbd $(1)/usr/bin/
|
||||
cp $(PKG_BUILD_DIR)/files/etc/init.d/inbd $(1)/etc/init.d/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,inbd))
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$INTERFACE" != "wan" ] && exit
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
network_get_ipaddr ip $INTERFACE
|
||||
|
||||
[ -z "$ip" ] && exit
|
||||
|
||||
toggle_firewall() {
|
||||
local section=$1
|
||||
local disable=$2
|
||||
config_get name "$1" name
|
||||
if [ "$name" == "wan" ]; then
|
||||
uci -q set firewall.settings.disabled=$disable
|
||||
if [ "$disable" == "1" ]; then
|
||||
uci -q set firewall.$section.input="ACCEPT"
|
||||
else
|
||||
uci -q set firewall.$section.input="REJECT"
|
||||
fi
|
||||
uci -q commit firewall
|
||||
fi
|
||||
}
|
||||
|
||||
set_disabled() {
|
||||
config_load firewall
|
||||
config_foreach toggle_firewall zone $1
|
||||
}
|
||||
|
||||
test_ip() {
|
||||
if [ -n "$(echo $ip | grep -E '^(192\.168|10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.)')" ]; then
|
||||
# private IP
|
||||
set_disabled 1
|
||||
else
|
||||
# public IP
|
||||
set_disabled 0
|
||||
[ "$1" -eq "1" ] && {
|
||||
uci set netmode.setup.repeaterready=0
|
||||
uci commit netmode
|
||||
local pid="$(ps | grep wificontro[l] | awk '/repeater/ {print $1}')"
|
||||
[ "$pid" != "" ] && kill $pid
|
||||
pid="$(pidof netmode-client-detect)"
|
||||
[ "$pid" == "" ] && /sbin/netmode-client-detect &
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
case "$(uci -q get netmode.setup.curmode)" in
|
||||
repeater*) test_ip ;;
|
||||
*) [ "$(uci -q get netmode.setup.repeaterready)" == "1" ] && test_ip 1;;
|
||||
esac
|
||||
|
||||
@@ -3,38 +3,25 @@
|
||||
. /lib/functions.sh
|
||||
include /lib/network
|
||||
|
||||
ps | grep hotplug | grep button && exit
|
||||
|
||||
MTK=0
|
||||
[ "$(db -q get hw.board.hardware)" == "EX400" ] && MTK=1
|
||||
|
||||
WANDEV="$(uci get layer2_interface_ethernet.Wan.ifname)"
|
||||
[ $MTK -eq 1 ] && WANDEV="eth0.2"
|
||||
|
||||
[ "$INTERFACE" != "$WANDEV" ] && exit
|
||||
|
||||
defroute=$(ip route | grep default | awk '{print$3}')
|
||||
[ "$INTERFACE" != "$(uci get layer2_interface_ethernet.Wan.ifname)" ] && exit
|
||||
[ "$(uci get netmode.setup.curmode)" != "repeater" ] && exit
|
||||
|
||||
case "$(uci get netmode.setup.curmode)" in
|
||||
repeater*)
|
||||
echo "Preparing to switch mode"
|
||||
;;
|
||||
*)
|
||||
ping -c 1 -w 5 $defroute >/dev/null 2>&1 || killall -USR1 udhcpc
|
||||
exit
|
||||
;;
|
||||
repeater|repeater_dualdown) echo "Preparing to switch mode" ;;
|
||||
*) exit ;;
|
||||
esac
|
||||
|
||||
get_wifi_wet_interface() {
|
||||
handle_interface() {
|
||||
config_get mode "$1" mode
|
||||
if [ "$mode" == "sta" -o "$mode" == "wet" ] ; then
|
||||
config_get ifname "$1" ifname
|
||||
echo "$ifname"
|
||||
fi
|
||||
}
|
||||
config_load wireless
|
||||
config_foreach handle_interface wifi-iface
|
||||
# handle_interface() {
|
||||
# config_get mode "$1" mode
|
||||
# if [ "$mode" == "wet" ] ; then
|
||||
# config_get ifname "$1" ifname
|
||||
# echo "$ifname"
|
||||
# fi
|
||||
# }
|
||||
# config_load wireless
|
||||
# config_foreach handle_interface wifi-iface "$device"
|
||||
echo "wl1"
|
||||
}
|
||||
|
||||
get_wifi_iface_cfgstr() {
|
||||
@@ -43,50 +30,42 @@ get_wifi_iface_cfgstr() {
|
||||
[ "$ifname" == "$2" ] && echo "wireless.$1"
|
||||
}
|
||||
config_load wireless
|
||||
config_foreach get_cfgno wifi-iface $1
|
||||
config_foreach get_cfgno wifi-iface $1 $2
|
||||
}
|
||||
|
||||
link=$(cat /sys/class/net/${WANDEV:0:4}/operstate)
|
||||
[ $MTK -eq 1 ] && link=$(swconfig dev switch0 port 0 get link | awk '{print$2}' | cut -d':' -f2)
|
||||
|
||||
case "$ACTION" in
|
||||
add|register)
|
||||
[ "$link" == "down" ] && return
|
||||
echo "Autoswitch to Extender mode" > /dev/console
|
||||
sleep 2
|
||||
wetif="$(get_wifi_wet_interface)"
|
||||
# remove wifi client interface
|
||||
case "$(uci get netmode.setup.curmode)" in
|
||||
repeater*)
|
||||
uci -q set $(get_wifi_iface_cfgstr $wetif).disabled=1
|
||||
repeater_dualdown)
|
||||
uci -q set $(get_wifi_iface_cfgstr $(get_wifi_wet_interface)).disabled=1
|
||||
;;
|
||||
repeater)
|
||||
uci -q set $(get_wifi_iface_cfgstr $(get_wifi_wet_interface)).mode=ap
|
||||
;;
|
||||
esac
|
||||
uci commit wireless
|
||||
#add wan ethernet port
|
||||
uci set network.wan.ifname="$(echo $WANDEV $(uci get network.wan.ifname) | sed 's/$/ /' | sed -r "s/$wetif //g" | tr ' ' '\n' | sort -u | tr '\n' ' ')"
|
||||
uci commit network
|
||||
ubus call network reload
|
||||
ping -c 1 -w 10 $defroute >/dev/null 2>&1 || killall -USR1 udhcpc
|
||||
uci set network.wan.ifname="$(echo $(uci get layer2_interface_ethernet.Wan.ifname) $(uci get network.wan.ifname) | tr ' ' '\n' | sort -u | tr '\n' ' ')"
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
;;
|
||||
remove|unregister)
|
||||
[ "$link" == "up" ] && return
|
||||
echo "Autoswitch to Repeater mode" > /dev/console
|
||||
sleep 2
|
||||
wetif="$(get_wifi_wet_interface)"
|
||||
# add wifi client interface
|
||||
case "$(uci get netmode.setup.curmode)" in
|
||||
repeater*)
|
||||
uci -q set $(get_wifi_iface_cfgstr $wetif).disabled=0
|
||||
repeater_dualdown)
|
||||
uci -q set $(get_wifi_iface_cfgstr $(get_wifi_wet_interface)).disabled=0
|
||||
;;
|
||||
repeater)
|
||||
uci -q set $(get_wifi_iface_cfgstr $(get_wifi_wet_interface)).mode=wet
|
||||
;;
|
||||
esac
|
||||
uci commit wireless
|
||||
#remove wan ethernet port
|
||||
uci set network.wan.ifname="$(echo $wetif $(uci get network.wan.ifname) | sed 's/$/ /' | sed -r "s/$WANDEV //g" | tr ' ' '\n' | sort -u | tr '\n' ' ')"
|
||||
uci commit network
|
||||
ubus call network reload
|
||||
ping -c 1 -w 10 $defroute >/dev/null 2>&1 || {
|
||||
wifi reload nodat
|
||||
killall -USR1 udhcpc
|
||||
}
|
||||
uci set network.wan.ifname="$(uci get network.wan.ifname | sed 's/$/ /' | sed -r "s/`uci get layer2_interface_ethernet.Wan.ifname` //g")"
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -59,21 +59,11 @@ populate_netmodes() {
|
||||
lan5=$(get_device LAN5)
|
||||
|
||||
for file in $(find $modedir -type f); do
|
||||
conf="$(echo $file | cut -d'/' -f5)"
|
||||
if [ "$conf" == "layer2_interface_ethernet" ]; then
|
||||
grep -q "\$WAN" $file && sed -i "s/\$WAN/$wan/g" $file
|
||||
fi
|
||||
if [ "$conf" == "network" ]; then
|
||||
grep -q "\$WAN" $file && sed -i "s/\$WAN/$wan/g" $file
|
||||
grep -q "\$LAN1" $file && sed -i "s/\$LAN1/$lan1/g" $file
|
||||
grep -q "\$LAN2" $file && sed -i "s/\$LAN2/$lan2/g" $file
|
||||
grep -q "\$LAN3" $file && sed -i "s/\$LAN3/$lan3/g" $file
|
||||
grep -q "\$LAN4" $file && sed -i "s/\$LAN4/$lan4/g" $file
|
||||
|
||||
ifname="$(uci -q get $file.wan.ifname | sed 's/[ \t]*$//')"
|
||||
uci -q set $file.wan.ifname="$ifname"
|
||||
uci -q commit $file
|
||||
fi
|
||||
grep -q "\$WAN" $file && sed -i "s/\$WAN/$wan/g" $file
|
||||
grep -q "\$LAN1" $file && sed -i "s/\$LAN1/$lan1/g" $file
|
||||
grep -q "\$LAN2" $file && sed -i "s/\$LAN2/$lan2/g" $file
|
||||
grep -q "\$LAN3" $file && sed -i "s/\$LAN3/$lan3/g" $file
|
||||
grep -q "\$LAN4" $file && sed -i "s/\$LAN4/$lan4/g" $file
|
||||
done
|
||||
|
||||
local hardware=$(db get hw.board.hardware)
|
||||
@@ -82,7 +72,7 @@ populate_netmodes() {
|
||||
|
||||
case "$mode" in
|
||||
repeater*)
|
||||
wlctl -i wl1 ap >/dev/null 2>&1 || ifconfig rai0 2>/dev/null | grep -q rai0 || continue
|
||||
wlctl -i wl1 ap >/dev/null 2>&1 || continue
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -90,6 +80,7 @@ populate_netmodes() {
|
||||
desc=""
|
||||
exp=""
|
||||
uci -q set netmode.$mode=netmode
|
||||
uci -q set netmode.$mode.conf=$mode
|
||||
json_load "$(cat $modedir/$mode/DETAILS)"
|
||||
|
||||
if json_select excluded_boards; then
|
||||
@@ -146,59 +137,23 @@ populate_netmodes() {
|
||||
|
||||
json_get_var cred credentials
|
||||
uci -q set netmode.$mode.askcred="$cred"
|
||||
json_get_var ulb uplink_band
|
||||
uci -q set netmode.$mode.uplink_band="$ulb"
|
||||
json_get_var reboot reboot
|
||||
uci -q set netmode.$mode.reboot="$reboot"
|
||||
done
|
||||
|
||||
config_get curmode setup curmode
|
||||
[ -d /etc/netmodes/$curmode ] || {
|
||||
[ "$(db -q get hw.board.hardware)" == "EX400" ] && uci -q set netmode.setup.curmode="routed_mtk" || uci -q set netmode.setup.curmode="routed_brcm"
|
||||
}
|
||||
|
||||
uci commit netmode
|
||||
}
|
||||
|
||||
switch_netmode() {
|
||||
[ -f /etc/config/netmode -a -d $modedir ] || return
|
||||
local curmode conf repeaterready
|
||||
|
||||
config_load netmode
|
||||
|
||||
config_get repeaterready setup repeaterready "0"
|
||||
if [ "$repeaterready" == "1" ] ; then
|
||||
uci -q set netmode.setup.repeaterready="0"
|
||||
uci commit netmode
|
||||
fi
|
||||
|
||||
config_get curmode setup curmode
|
||||
if [ "$curmode" == "repeater" ]; then
|
||||
local hw="$(db -q get hw.board.hardware)"
|
||||
if [ "$hw" == "EX400" ]; then
|
||||
curmode="repeater_mtk_5g_up_dual_down"
|
||||
else
|
||||
curmode="repeater_brcm_2g_up_dual_down"
|
||||
fi
|
||||
uci set netmode.setup.curmode="$curmode"
|
||||
uci commit netmode
|
||||
fi
|
||||
if [ "$curmode" == "routed" ]; then
|
||||
local hw="$(db -q get hw.board.hardware)"
|
||||
if [ "$hw" == "EX400" ]; then
|
||||
curmode="routed_mtk"
|
||||
else
|
||||
curmode="routed_brcm"
|
||||
fi
|
||||
uci set netmode.setup.curmode="$curmode"
|
||||
uci commit netmode
|
||||
fi
|
||||
[ -d "/etc/netmodes/$curmode" ] || return
|
||||
cp /etc/netmodes/$curmode/* /etc/config/
|
||||
config_get conf $curmode conf
|
||||
cp /etc/netmodes/$conf/* /etc/config/
|
||||
rm -f /etc/config/DETAILS
|
||||
sync
|
||||
local reboot=$(uci -q get netmode.$curmode.reboot)
|
||||
local askcred=$(uci -q get netmode.$curmode.askcred)
|
||||
if [ "$reboot" == "0" ]; then
|
||||
/etc/init.d/enviroment reload
|
||||
else
|
||||
@@ -206,46 +161,12 @@ switch_netmode() {
|
||||
fi
|
||||
}
|
||||
|
||||
start_client_listener() {
|
||||
local curmode repeaterready
|
||||
config_load netmode
|
||||
|
||||
config_get repeaterready setup repeaterready 0
|
||||
|
||||
[ $repeaterready -eq 1 ] && {
|
||||
killall -SIGKILL netmode-client-detect >/dev/null 2>&1
|
||||
return
|
||||
}
|
||||
|
||||
config_get curmode setup curmode
|
||||
|
||||
case "$curmode" in
|
||||
repeater*)
|
||||
killall -SIGKILL netmode-client-detect >/dev/null 2>&1
|
||||
;;
|
||||
*)
|
||||
pidof netmode-client-detect || /sbin/netmode-client-detect &
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
start_service() {
|
||||
populate_netmodes
|
||||
start_client_listener
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
switch_netmode
|
||||
|
||||
# set default JUCI page to overview
|
||||
uci -q set juci.juci.homepage="overview"
|
||||
uci commit juci
|
||||
|
||||
start_client_listener
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
killall -SIGKILL netmode-client-detect >/dev/null 2>&1
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
"credentials" : 0,
|
||||
"excluded_boards" : [
|
||||
"CG300",
|
||||
"CG301",
|
||||
"EX400"
|
||||
"CG301"
|
||||
],
|
||||
"acl" : [
|
||||
"admin",
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
config atm_bridge
|
||||
option link_type 'EoA'
|
||||
option encapseoa 'llcsnap_eth'
|
||||
option unit '0'
|
||||
option ifname 'atm0.1'
|
||||
option baseifname 'atm0'
|
||||
option atmtype 'ubr'
|
||||
option name 'atm_inet'
|
||||
option vpi '8'
|
||||
option vci '35'
|
||||
|
||||
config atm_bridge
|
||||
option link_type 'EoA'
|
||||
option encapseoa 'llcsnap_eth'
|
||||
option unit '1'
|
||||
option ifname 'atm1.1'
|
||||
option baseifname 'atm1'
|
||||
option atmtype 'ubr'
|
||||
option name 'atm_tv'
|
||||
option vpi '8'
|
||||
option vci '45'
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
|
||||
|
||||
config 'vlan_interface'
|
||||
option name 'eth_tv'
|
||||
option ifname '$WAN.100'
|
||||
option baseifname '$WAN'
|
||||
option vlan8021q '100'
|
||||
option vlan8021p '0'
|
||||
option bridge '1'
|
||||
|
||||
config 'vlan_interface'
|
||||
option name 'vdsl_tv'
|
||||
option ifname 'ptm0.100'
|
||||
option baseifname 'ptm0'
|
||||
option vlan8021q '100'
|
||||
option vlan8021p '0'
|
||||
option bridge '1'
|
||||
|
||||
@@ -10,8 +10,7 @@
|
||||
"credentials" : 0,
|
||||
"excluded_boards" : [
|
||||
"CG300",
|
||||
"CG301",
|
||||
"EX400"
|
||||
"CG301"
|
||||
],
|
||||
"acl" : [
|
||||
"admin",
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
config atm_bridge
|
||||
option link_type 'EoA'
|
||||
option encapseoa 'llcsnap_eth'
|
||||
option unit '0'
|
||||
option ifname 'atm0.1'
|
||||
option baseifname 'atm0'
|
||||
option atmtype 'ubr'
|
||||
option name 'atm_inet'
|
||||
option vpi '8'
|
||||
option vci '35'
|
||||
|
||||
config atm_bridge
|
||||
option link_type 'EoA'
|
||||
option encapseoa 'llcsnap_eth'
|
||||
option unit '1'
|
||||
option ifname 'atm1.1'
|
||||
option baseifname 'atm1'
|
||||
option atmtype 'ubr'
|
||||
option name 'atm_tv'
|
||||
option vpi '8'
|
||||
option vci '45'
|
||||
|
||||
config atm_bridge
|
||||
option link_type 'EoA'
|
||||
option encapseoa 'llcsnap_eth'
|
||||
option unit '1'
|
||||
option ifname 'atm2.1'
|
||||
option baseifname 'atm2'
|
||||
option atmtype 'ubr'
|
||||
option name 'atm_voip'
|
||||
option vpi '8'
|
||||
option vci '55'
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
config ethernet_interface 'Wan'
|
||||
option baseifname '$WAN'
|
||||
option ifname '$WAN.1'
|
||||
option name 'WAN'
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
config vdsl_interface
|
||||
option unit '0'
|
||||
option ifname 'ptm0.1'
|
||||
option baseifname 'ptm0'
|
||||
option name 'VDSL2'
|
||||
option dslat '1'
|
||||
option ptmprio '1'
|
||||
option ipqos '1'
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
|
||||
|
||||
config 'vlan_interface'
|
||||
option name 'eth_tv'
|
||||
option ifname '$WAN.100'
|
||||
option baseifname '$WAN'
|
||||
option vlan8021q '100'
|
||||
option vlan8021p '0'
|
||||
option bridge '1'
|
||||
|
||||
config 'vlan_interface'
|
||||
option name 'eth_voip'
|
||||
option ifname '$WAN.200'
|
||||
option baseifname '$WAN'
|
||||
option vlan8021q '200'
|
||||
option vlan8021p '0'
|
||||
|
||||
config 'vlan_interface'
|
||||
option name 'vdsl_tv'
|
||||
option ifname 'ptm0.100'
|
||||
option baseifname 'ptm0'
|
||||
option vlan8021q '100'
|
||||
option vlan8021p '0'
|
||||
option bridge '1'
|
||||
|
||||
config 'vlan_interface'
|
||||
option name 'vdsl_voip'
|
||||
option ifname 'ptm0.200'
|
||||
option baseifname 'ptm0'
|
||||
option vlan8021q '200'
|
||||
option vlan8021p '0'
|
||||
|
||||
@@ -10,13 +10,11 @@
|
||||
"excluded_boards" : [
|
||||
"DG15*",
|
||||
"DG40*",
|
||||
"EG40*",
|
||||
"EX40*"
|
||||
"EG40*"
|
||||
],
|
||||
"acl" : [
|
||||
"admin"
|
||||
],
|
||||
"uplink_band" : "b",
|
||||
"credentials" : 1,
|
||||
"reboot" : 0
|
||||
}
|
||||
@@ -19,7 +19,6 @@ config zone
|
||||
config zone
|
||||
option name wan
|
||||
list network 'wan'
|
||||
list network 'wan6'
|
||||
option input REJECT
|
||||
option output ACCEPT
|
||||
option forward REJECT
|
||||
@@ -39,6 +38,16 @@ config rule
|
||||
option dest_port 68
|
||||
option target ACCEPT
|
||||
option family ipv4
|
||||
option hidden 1
|
||||
|
||||
config rule
|
||||
option name Repeater-Management
|
||||
option src wan
|
||||
option proto tcp
|
||||
option dest_port '22 80 8080 8181 9876'
|
||||
option target ACCEPT
|
||||
option family ipv4
|
||||
option hidden 1
|
||||
|
||||
# Allow IPv4 ping
|
||||
config rule
|
||||
@@ -48,13 +57,7 @@ config rule
|
||||
option icmp_type echo-request
|
||||
option family ipv4
|
||||
option target ACCEPT
|
||||
|
||||
config rule
|
||||
option name Allow-IGMP
|
||||
option src wan
|
||||
option proto igmp
|
||||
option family ipv4
|
||||
option target ACCEPT
|
||||
option hidden 1
|
||||
|
||||
# Allow DHCPv6 replies
|
||||
# see https://dev.openwrt.org/ticket/10381
|
||||
@@ -68,24 +71,13 @@ config rule
|
||||
option dest_port 546
|
||||
option family ipv6
|
||||
option target ACCEPT
|
||||
|
||||
config rule
|
||||
option name Allow-MLD
|
||||
option src wan
|
||||
option proto icmp
|
||||
option src_ip fe80::/10
|
||||
list icmp_type '130/0'
|
||||
list icmp_type '131/0'
|
||||
list icmp_type '132/0'
|
||||
list icmp_type '143/0'
|
||||
option family ipv6
|
||||
option target ACCEPT
|
||||
option hidden 1
|
||||
|
||||
# Allow essential incoming IPv6 ICMP traffic
|
||||
config rule
|
||||
option name Allow-ICMPv6-Input
|
||||
option src wan
|
||||
option proto icmp
|
||||
option proto icmp
|
||||
list icmp_type echo-request
|
||||
list icmp_type echo-reply
|
||||
list icmp_type destination-unreachable
|
||||
@@ -100,6 +92,7 @@ config rule
|
||||
option limit 1000/sec
|
||||
option family ipv6
|
||||
option target ACCEPT
|
||||
option hidden 1
|
||||
|
||||
# Allow essential forwarded IPv6 ICMP traffic
|
||||
config rule
|
||||
@@ -117,37 +110,15 @@ config rule
|
||||
option limit 1000/sec
|
||||
option family ipv6
|
||||
option target ACCEPT
|
||||
|
||||
# allow IPsec/ESP and ISAKMP passthrough
|
||||
config rule
|
||||
option src wan
|
||||
option dest lan
|
||||
option proto esp
|
||||
option target ACCEPT
|
||||
|
||||
config rule
|
||||
option src wan
|
||||
option dest lan
|
||||
option dest_port 500
|
||||
option proto udp
|
||||
option target ACCEPT
|
||||
|
||||
config dmz dmz
|
||||
option enabled '0'
|
||||
option exclude_ports '5060 7547'
|
||||
option hidden 1
|
||||
|
||||
# include a file with users custom iptables rules
|
||||
config include
|
||||
option path /etc/firewall.user
|
||||
option reload 1
|
||||
|
||||
# include a file with rules for prioritizing some specific packets
|
||||
# include a file with rules for SIP and RTP traffic
|
||||
config include
|
||||
option path /etc/firewall.qos
|
||||
option reload 1
|
||||
|
||||
# include a file with rules for DMZ Host
|
||||
config include dmzhost
|
||||
option path /etc/firewall.dmz
|
||||
option path /etc/firewall.sip
|
||||
option reload 1
|
||||
|
||||
24
inteno-netmodes/files/etc/netmodes/repeater/network
Normal file
24
inteno-netmodes/files/etc/netmodes/repeater/network
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
config interface 'loopback'
|
||||
option is_lan '1'
|
||||
option ifname 'lo'
|
||||
option proto 'static'
|
||||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
||||
|
||||
config interface 'wan'
|
||||
option type 'bridge'
|
||||
option proto 'dhcp'
|
||||
option vendorid 'Inteno_Repeater_$MAC4'
|
||||
option hostname 'Inteno_Repeater_$MAC4'
|
||||
option ifname '$WAN.1'
|
||||
option reqopts '43'
|
||||
|
||||
config interface 'lan'
|
||||
option is_lan '1'
|
||||
option type 'bridge'
|
||||
option proto 'static'
|
||||
option ifname '$LAN1 $LAN2 $LAN3 $LAN4'
|
||||
option ipaddr '192.168.11.1'
|
||||
option netmask '255.255.255.0'
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
config interface 'loopback'
|
||||
option is_lan '1'
|
||||
option ifname 'lo'
|
||||
option proto 'static'
|
||||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
||||
|
||||
config interface 'wan'
|
||||
option type 'bridge'
|
||||
option proto 'dhcp'
|
||||
option hostname 'Inteno-$BSSID4'
|
||||
option ifname '$WAN.1 $LAN1 $LAN2 $LAN3 $LAN4'
|
||||
option reqopts '43'
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
config interface 'loopback'
|
||||
option is_lan '1'
|
||||
option ifname 'lo'
|
||||
option proto 'static'
|
||||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
||||
|
||||
config interface 'wan'
|
||||
option type 'bridge'
|
||||
option proto 'dhcp'
|
||||
option hostname 'Inteno-$BSSID4'
|
||||
option ifname '$WAN.1 $LAN1 $LAN2 $LAN3 $LAN4'
|
||||
option reqopts '43'
|
||||
|
||||
@@ -10,13 +10,11 @@
|
||||
"excluded_boards" : [
|
||||
"DG15*",
|
||||
"DG40*",
|
||||
"EG40*",
|
||||
"EX40*"
|
||||
"EG40*"
|
||||
],
|
||||
"acl" : [
|
||||
"admin"
|
||||
],
|
||||
"uplink_band" : "b",
|
||||
"credentials" : 1,
|
||||
"reboot" : 0
|
||||
}
|
||||
124
inteno-netmodes/files/etc/netmodes/repeater_dualdown/firewall
Normal file
124
inteno-netmodes/files/etc/netmodes/repeater_dualdown/firewall
Normal file
@@ -0,0 +1,124 @@
|
||||
config settings 'settings'
|
||||
option disabled '0'
|
||||
|
||||
config defaults
|
||||
option syn_flood 1
|
||||
option input ACCEPT
|
||||
option output ACCEPT
|
||||
option forward REJECT
|
||||
# Uncomment this line to disable ipv6 rules
|
||||
# option disable_ipv6 1
|
||||
|
||||
config zone
|
||||
option name lan
|
||||
list network 'lan'
|
||||
option input ACCEPT
|
||||
option output ACCEPT
|
||||
option forward ACCEPT
|
||||
|
||||
config zone
|
||||
option name wan
|
||||
list network 'wan'
|
||||
option input REJECT
|
||||
option output ACCEPT
|
||||
option forward REJECT
|
||||
option masq 1
|
||||
option mtu_fix 1
|
||||
|
||||
config forwarding
|
||||
option src lan
|
||||
option dest wan
|
||||
|
||||
# We need to accept udp packets on port 68,
|
||||
# see https://dev.openwrt.org/ticket/4108
|
||||
config rule
|
||||
option name Allow-DHCP-Renew
|
||||
option src wan
|
||||
option proto udp
|
||||
option dest_port 68
|
||||
option target ACCEPT
|
||||
option family ipv4
|
||||
option hidden 1
|
||||
|
||||
config rule
|
||||
option name Repeater-Management
|
||||
option src wan
|
||||
option proto tcp
|
||||
option dest_port '22 80 8080 8181 9876'
|
||||
option target ACCEPT
|
||||
option family ipv4
|
||||
option hidden 1
|
||||
|
||||
# Allow IPv4 ping
|
||||
config rule
|
||||
option name Allow-Ping
|
||||
option src wan
|
||||
option proto icmp
|
||||
option icmp_type echo-request
|
||||
option family ipv4
|
||||
option target ACCEPT
|
||||
option hidden 1
|
||||
|
||||
# Allow DHCPv6 replies
|
||||
# see https://dev.openwrt.org/ticket/10381
|
||||
config rule
|
||||
option name Allow-DHCPv6
|
||||
option src wan
|
||||
option proto udp
|
||||
option src_ip fe80::/10
|
||||
option src_port 547
|
||||
option dest_ip fe80::/10
|
||||
option dest_port 546
|
||||
option family ipv6
|
||||
option target ACCEPT
|
||||
option hidden 1
|
||||
|
||||
# Allow essential incoming IPv6 ICMP traffic
|
||||
config rule
|
||||
option name Allow-ICMPv6-Input
|
||||
option src wan
|
||||
option proto icmp
|
||||
list icmp_type echo-request
|
||||
list icmp_type echo-reply
|
||||
list icmp_type destination-unreachable
|
||||
list icmp_type packet-too-big
|
||||
list icmp_type time-exceeded
|
||||
list icmp_type bad-header
|
||||
list icmp_type unknown-header-type
|
||||
list icmp_type router-solicitation
|
||||
list icmp_type neighbour-solicitation
|
||||
list icmp_type router-advertisement
|
||||
list icmp_type neighbour-advertisement
|
||||
option limit 1000/sec
|
||||
option family ipv6
|
||||
option target ACCEPT
|
||||
option hidden 1
|
||||
|
||||
# Allow essential forwarded IPv6 ICMP traffic
|
||||
config rule
|
||||
option name Allow-ICMPv6-Forward
|
||||
option src wan
|
||||
option dest *
|
||||
option proto icmp
|
||||
list icmp_type echo-request
|
||||
list icmp_type echo-reply
|
||||
list icmp_type destination-unreachable
|
||||
list icmp_type packet-too-big
|
||||
list icmp_type time-exceeded
|
||||
list icmp_type bad-header
|
||||
list icmp_type unknown-header-type
|
||||
option limit 1000/sec
|
||||
option family ipv6
|
||||
option target ACCEPT
|
||||
option hidden 1
|
||||
|
||||
# include a file with users custom iptables rules
|
||||
config include
|
||||
option path /etc/firewall.user
|
||||
option reload 1
|
||||
|
||||
# include a file with rules for SIP and RTP traffic
|
||||
config include
|
||||
option path /etc/firewall.sip
|
||||
option reload 1
|
||||
|
||||
24
inteno-netmodes/files/etc/netmodes/repeater_dualdown/network
Normal file
24
inteno-netmodes/files/etc/netmodes/repeater_dualdown/network
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
config interface 'loopback'
|
||||
option is_lan '1'
|
||||
option ifname 'lo'
|
||||
option proto 'static'
|
||||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
||||
|
||||
config interface 'wan'
|
||||
option type 'bridge'
|
||||
option proto 'dhcp'
|
||||
option vendorid 'Inteno_Repeater_$MAC4'
|
||||
option hostname 'Inteno_Repeater_$MAC4'
|
||||
option ifname '$WAN.1'
|
||||
option reqopts '43'
|
||||
|
||||
config interface 'lan'
|
||||
option is_lan '1'
|
||||
option type 'bridge'
|
||||
option proto 'static'
|
||||
option ifname '$LAN1 $LAN2 $LAN3 $LAN4'
|
||||
option ipaddr '192.168.11.1'
|
||||
option netmask '255.255.255.0'
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"description": [
|
||||
{ "en" : "Repeater 2.4▴▾2.4&5" },
|
||||
{ "sv" : "Repeater 2.4▴▾2.4&5" }
|
||||
],
|
||||
"explanation": [
|
||||
{ "en" : "Your router is going to act as a wired extender or wireless repeater to the selected Wireless Access Point. Uplink 2.4G & Downlink 2.4G + 5G" },
|
||||
{ "sv" : "Routern kommer att fungera som en trådbunden extender eller trådlös repeater till den valda trådlösa åtkomstpunkten. Uplink 2.4G & Downlink 2.4G + 5G" }
|
||||
],
|
||||
"excluded_boards" : [
|
||||
"*G*"
|
||||
],
|
||||
"uplink_band" : 'b',
|
||||
"credentials" : 1,
|
||||
"reboot" : 0
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
config interface 'loopback'
|
||||
option ifname 'lo'
|
||||
option proto 'static'
|
||||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
||||
|
||||
config device 'lan_dev'
|
||||
option name 'eth0.1'
|
||||
option macaddr '$MACLAN'
|
||||
|
||||
config interface 'wan'
|
||||
option type 'bridge'
|
||||
option ifname 'eth0.2 eth0.1'
|
||||
option proto 'dhcp'
|
||||
option hostname 'Inteno-$BSSID4'
|
||||
option reqopts '66 67 128 224'
|
||||
option igmp_snooping '0'
|
||||
|
||||
config device 'wan_dev'
|
||||
option name 'eth0.2'
|
||||
option macaddr '$MACWAN'
|
||||
|
||||
config interface 'wan6'
|
||||
option ifname '@wan'
|
||||
option proto 'dhcpv6'
|
||||
|
||||
config switch
|
||||
option name 'switch0'
|
||||
option reset '1'
|
||||
option enable_vlan '1'
|
||||
|
||||
config switch_vlan
|
||||
option device 'switch0'
|
||||
option vlan '1'
|
||||
option ports '1 6t'
|
||||
|
||||
config switch_vlan
|
||||
option device 'switch0'
|
||||
option vlan '2'
|
||||
option ports '0 5t'
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
config owsd 'global'
|
||||
option sock '/var/run/ubus.sock'
|
||||
option www '/www'
|
||||
option redirect '/cgi-bin/luci:/cacheflush.html'
|
||||
|
||||
config owsd-listen 'loopback'
|
||||
option port '80'
|
||||
option interface 'loopback'
|
||||
option ipv6 'on'
|
||||
list origin '*'
|
||||
|
||||
config owsd-listen 'lan'
|
||||
option port '80'
|
||||
option interface 'lan'
|
||||
option ipv6 'on'
|
||||
option whitelist_interface_as_origin '1'
|
||||
option whitelist_dhcp_domains '1'
|
||||
|
||||
config owsd-listen 'wan'
|
||||
option port '80'
|
||||
option interface 'wan'
|
||||
option ipv6 'on'
|
||||
option whitelist_interface_as_origin '1'
|
||||
list origin '*'
|
||||
|
||||
config owsd-listen 'wan_8080'
|
||||
option port '8080'
|
||||
option interface 'wan'
|
||||
option ipv6 'on'
|
||||
option whitelist_interface_as_origin '1'
|
||||
list origin '*'
|
||||
|
||||
config owsd-listen 'wan_8181'
|
||||
option port '8181'
|
||||
option interface 'wan'
|
||||
option ipv6 'on'
|
||||
option whitelist_interface_as_origin '1'
|
||||
list origin '*'
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
config wifi-status 'status'
|
||||
option wlan '1'
|
||||
option wps '1'
|
||||
option sched_status '0'
|
||||
option schedule '0'
|
||||
|
||||
config wifi-device ra0
|
||||
option band b
|
||||
option channel 1
|
||||
option bandwidth '20'
|
||||
option hwmode 11n
|
||||
option htmode HT20
|
||||
option country 'DE'
|
||||
option beamforming 0
|
||||
|
||||
config wifi-iface
|
||||
option device ra0
|
||||
option network wan
|
||||
option mode ap
|
||||
option ssid Inteno-$BSSID4
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
option ifname ra0
|
||||
|
||||
config wifi-device rai0
|
||||
option band a
|
||||
option channel 36
|
||||
option bandwidth '80'
|
||||
option hwmode 11ac
|
||||
option htmode VHT80
|
||||
option country 'DE'
|
||||
option beamforming 0
|
||||
|
||||
config wifi-iface
|
||||
option device rai0
|
||||
option network wan
|
||||
option mode ap
|
||||
option ssid Inteno-$BSSID4
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
option ifname rai0
|
||||
|
||||
config wifi-iface
|
||||
option device ra0
|
||||
option network wan
|
||||
option mode wet
|
||||
option ssid Inteno-$BSSID4
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
option ifname apcli0
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"description": [
|
||||
{ "en" : "Repeater 5▴▾2.4&5" },
|
||||
{ "sv" : "Repeater 5▴▾2.4&5" }
|
||||
],
|
||||
"explanation": [
|
||||
{ "en" : "Your router is going to act as a wired extender or wireless repeater to the selected Wireless Access Point. Uplink 5G & Downlink 2.4G + 5G" },
|
||||
{ "sv" : "Routern kommer att fungera som en trådbunden extender eller trådlös repeater till den valda trådlösa åtkomstpunkten. Uplink 5G & Downlink 2.4G + 5G" }
|
||||
],
|
||||
"excluded_boards" : [
|
||||
"*G*"
|
||||
],
|
||||
"uplink_band" : 'a',
|
||||
"credentials" : 1,
|
||||
"reboot" : 0
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
config interface 'loopback'
|
||||
option ifname 'lo'
|
||||
option proto 'static'
|
||||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
||||
|
||||
config device 'lan_dev'
|
||||
option name 'eth0.1'
|
||||
option macaddr '$MACLAN'
|
||||
|
||||
config interface 'wan'
|
||||
option type 'bridge'
|
||||
option ifname 'eth0.2 eth0.1'
|
||||
option proto 'dhcp'
|
||||
option hostname 'Inteno-$BSSID4'
|
||||
option reqopts '66 67 128 224'
|
||||
option igmp_snooping '0'
|
||||
|
||||
config device 'wan_dev'
|
||||
option name 'eth0.2'
|
||||
option macaddr '$MACWAN'
|
||||
|
||||
config interface 'wan6'
|
||||
option ifname '@wan'
|
||||
option proto 'dhcpv6'
|
||||
|
||||
config switch
|
||||
option name 'switch0'
|
||||
option reset '1'
|
||||
option enable_vlan '1'
|
||||
|
||||
config switch_vlan
|
||||
option device 'switch0'
|
||||
option vlan '1'
|
||||
option ports '1 6t'
|
||||
|
||||
config switch_vlan
|
||||
option device 'switch0'
|
||||
option vlan '2'
|
||||
option ports '0 5t'
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
config owsd 'global'
|
||||
option sock '/var/run/ubus.sock'
|
||||
option www '/www'
|
||||
option redirect '/cgi-bin/luci:/cacheflush.html'
|
||||
|
||||
config owsd-listen 'loopback'
|
||||
option port '80'
|
||||
option interface 'loopback'
|
||||
option ipv6 'on'
|
||||
list origin '*'
|
||||
|
||||
config owsd-listen 'lan'
|
||||
option port '80'
|
||||
option interface 'lan'
|
||||
option ipv6 'on'
|
||||
option whitelist_interface_as_origin '1'
|
||||
option whitelist_dhcp_domains '1'
|
||||
|
||||
config owsd-listen 'wan'
|
||||
option port '80'
|
||||
option interface 'wan'
|
||||
option ipv6 'on'
|
||||
option whitelist_interface_as_origin '1'
|
||||
list origin '*'
|
||||
|
||||
config owsd-listen 'wan_8080'
|
||||
option port '8080'
|
||||
option interface 'wan'
|
||||
option ipv6 'on'
|
||||
option whitelist_interface_as_origin '1'
|
||||
list origin '*'
|
||||
|
||||
config owsd-listen 'wan_8181'
|
||||
option port '8181'
|
||||
option interface 'wan'
|
||||
option ipv6 'on'
|
||||
option whitelist_interface_as_origin '1'
|
||||
list origin '*'
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
config wifi-status 'status'
|
||||
option wlan '1'
|
||||
option wps '1'
|
||||
option sched_status '0'
|
||||
option schedule '0'
|
||||
|
||||
config wifi-device ra0
|
||||
option band b
|
||||
option channel 1
|
||||
option bandwidth '20'
|
||||
option hwmode 11n
|
||||
option htmode HT20
|
||||
option country 'DE'
|
||||
option beamforming 0
|
||||
|
||||
config wifi-iface
|
||||
option device ra0
|
||||
option network wan
|
||||
option mode ap
|
||||
option ssid Inteno-$BSSID4
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
option ifname ra0
|
||||
|
||||
config wifi-device rai0
|
||||
option band a
|
||||
option channel 36
|
||||
option bandwidth '80'
|
||||
option hwmode 11ac
|
||||
option htmode VHT80
|
||||
option country 'DE'
|
||||
option beamforming 0
|
||||
|
||||
config wifi-iface
|
||||
option device rai0
|
||||
option network wan
|
||||
option mode ap
|
||||
option ssid Inteno-$BSSID4
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
option ifname rai0
|
||||
|
||||
config wifi-iface
|
||||
option device rai0
|
||||
option network wan
|
||||
option mode wet
|
||||
option ssid Inteno-$BSSID4
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
option ifname apclii0
|
||||
|
||||
@@ -7,9 +7,6 @@
|
||||
{ "en" : "" },
|
||||
{ "sv" : "" }
|
||||
],
|
||||
"excluded_boards" : [
|
||||
"*G*"
|
||||
],
|
||||
"credentials" : 0
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
config ethernet_interface 'Wan'
|
||||
option baseifname '$WAN'
|
||||
option ifname '$WAN.1'
|
||||
option name 'WAN'
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
config vdsl_interface
|
||||
option unit '0'
|
||||
option ifname 'ptm0.1'
|
||||
option baseifname 'ptm0'
|
||||
option name 'VDSL2'
|
||||
option dslat '1'
|
||||
option ptmprio '1'
|
||||
option ipqos '1'
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"description": [
|
||||
{ "en" : "Fully Routed (NAT)" },
|
||||
{ "sv" : "Fullt Omdirigerad (NAT)" }
|
||||
],
|
||||
"explanation": [
|
||||
{ "en" : "" },
|
||||
{ "sv" : "" }
|
||||
],
|
||||
"excluded_boards" : [
|
||||
"EX4*"
|
||||
],
|
||||
"credentials" : 0
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
config dnsmasq
|
||||
option domainneeded 1
|
||||
option boguspriv 1
|
||||
option filterwin2k 0
|
||||
option localise_queries 1
|
||||
option rebind_protection 0
|
||||
option rebind_localhost 1
|
||||
option local '/lan/'
|
||||
option domain 'lan'
|
||||
option expandhosts 1
|
||||
option nonegcache 0
|
||||
option authoritative 1
|
||||
option readethers 1
|
||||
option leasefile '/tmp/dhcp.leases'
|
||||
option resolvfile '/tmp/resolv.conf.auto'
|
||||
|
||||
config dhcp lan
|
||||
option interface lan
|
||||
option start 100
|
||||
option limit 150
|
||||
option leasetime 12h
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
config interface 'loopback'
|
||||
option ifname 'lo'
|
||||
option proto 'static'
|
||||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
||||
|
||||
config interface 'lan'
|
||||
option type 'bridge'
|
||||
option proto 'static'
|
||||
option is_lan '1'
|
||||
option ipaddr '192.168.1.1'
|
||||
option netmask '255.255.255.0'
|
||||
option ip6assign '60'
|
||||
option ifname 'eth0.1 ra0 rai0'
|
||||
|
||||
config device 'lan_dev'
|
||||
option name 'eth0.1'
|
||||
option macaddr '$MACLAN'
|
||||
|
||||
config interface 'wan'
|
||||
option ifname 'eth0.2'
|
||||
option proto 'dhcp'
|
||||
option reqopts '66 67 128 224'
|
||||
|
||||
config device 'wan_dev'
|
||||
option name 'eth0.2'
|
||||
option macaddr '$MACWAN'
|
||||
|
||||
config interface 'wan6'
|
||||
option ifname '@wan'
|
||||
option proto 'dhcpv6'
|
||||
|
||||
config switch
|
||||
option name 'switch0'
|
||||
option reset '1'
|
||||
option enable_vlan '1'
|
||||
|
||||
config switch_vlan
|
||||
option device 'switch0'
|
||||
option vlan '1'
|
||||
option ports '1 6t'
|
||||
|
||||
config switch_vlan
|
||||
option device 'switch0'
|
||||
option vlan '2'
|
||||
option ports '0 5t'
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
config wifi-status 'status'
|
||||
option wlan '1'
|
||||
option wps '1'
|
||||
option sched_status '0'
|
||||
option schedule '0'
|
||||
|
||||
config wifi-device ra0
|
||||
option band b
|
||||
option channel 1
|
||||
option bandwidth '20'
|
||||
option hwmode 11n
|
||||
option htmode HT20
|
||||
option country 'DE'
|
||||
option beamforming 0
|
||||
|
||||
config wifi-iface
|
||||
option device ra0
|
||||
option network lan
|
||||
option mode ap
|
||||
option ssid Inteno-$BSSID4
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
|
||||
config wifi-device rai0
|
||||
option band a
|
||||
option channel 36
|
||||
option bandwidth '80'
|
||||
option hwmode 11ac
|
||||
option htmode VHT80
|
||||
option country 'DE'
|
||||
option beamforming 0
|
||||
|
||||
config wifi-iface
|
||||
option device rai0
|
||||
option network lan
|
||||
option mode ap
|
||||
option ssid Inteno-$BSSID4
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# receive new client events
|
||||
# and trigger wificontrol in --router mode for that client
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
local action ipaddr macaddr network
|
||||
|
||||
timed_check() {
|
||||
while true; do
|
||||
wificontrol --router
|
||||
sleep $1
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
timed_check 60 &
|
||||
|
||||
ubus listen client | \
|
||||
while read event ; do
|
||||
#echo "netmode-client-detect got event: $event" >/dev/console
|
||||
json_load "$event"
|
||||
json_select client
|
||||
json_get_var action action
|
||||
[ "$action" == "connect" ] || continue
|
||||
json_get_var macaddr macaddr
|
||||
json_get_var ipaddr ipaddr
|
||||
json_get_var network netwrork "lan"
|
||||
|
||||
if echo $macaddr | grep -i -e "^00:22:07" -e "^44:D4:37" -e "^02:0C:07" -e "^06:0C:07"; then
|
||||
echo "netmode-client-detect: a new Inteno device detected on '$network' network (MACAddr:$macaddr IPAddr:$ipaddr)" >/dev/console
|
||||
ubus call repeater get_creds '{"network":"'$network'","file":"/tmp/wificontrol.txt"}'
|
||||
/sbin/wificontrol --router --destination $ipaddr
|
||||
fi
|
||||
done
|
||||
@@ -1,180 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
local state="exit"
|
||||
|
||||
set_wireless_values() {
|
||||
local iface_num="$1"
|
||||
local ssid="$2"
|
||||
local key="$3"
|
||||
local encryption="$4"
|
||||
local old_ssid old_key old_encryption
|
||||
if ! uci -q get wireless.@wifi-iface[$iface_num] >/dev/null 2>&1; then
|
||||
state="reload"
|
||||
uci add wireless wifi-iface >/dev/null 2>&1
|
||||
fi
|
||||
local network="$(uci -q get wireless.@wifi-iface[$iface_num].network)"
|
||||
old_ssid="$(uci -q get wireless.@wifi-iface[$iface_num].ssid)"
|
||||
old_key="$(uci -q get wireless.@wifi-iface[$iface_num].key)"
|
||||
old_encryption="$(uci -q get wireless.@wifi-iface[$iface_num].encryption)"
|
||||
if [ "$old_ssid" != "$ssid" -o "$old_encryption" != "$encryption" -o "$old_key" != "$key" -o -z "$network" ]; then
|
||||
#TODO: get network dynamicaly
|
||||
[ "$state" == "exit" ] && state="apply"
|
||||
[ -z "$network" ] && network="wan"
|
||||
uci set wireless.@wifi-iface[$iface_num].network="$network"
|
||||
uci set wireless.@wifi-iface[$iface_num].ssid="$ssid"
|
||||
uci set wireless.@wifi-iface[$iface_num].key="$key"
|
||||
uci set wireless.@wifi-iface[$iface_num].encryption="$encryption"
|
||||
fi
|
||||
}
|
||||
|
||||
get_wifi_device_from_band(){
|
||||
local section="$1"
|
||||
local band="$2"
|
||||
local __ret="$3"
|
||||
local b
|
||||
config_get b $section "band"
|
||||
if [ "$band" == "$b" ]; then
|
||||
eval "export -- \"$__ret=$section\""
|
||||
fi
|
||||
}
|
||||
|
||||
get_device(){
|
||||
local band="$1"
|
||||
config_foreach get_wifi_device_from_band "wifi-device" "$band" "$2"
|
||||
}
|
||||
|
||||
get_iface_num() {
|
||||
local device="$1"
|
||||
local prev="$2"
|
||||
local __save="$3"
|
||||
local i=0
|
||||
local dev
|
||||
while true; do
|
||||
[ $i -gt 100 ] && break ## just a safty messure
|
||||
mode="$(uci -q get wireless.@wifi-iface[$i].mode)"
|
||||
if [ "$mode" != "ap" ]; then
|
||||
i=$((i+1))
|
||||
break
|
||||
fi
|
||||
dev="$(uci -q get wireless.@wifi-iface[$i].device)"
|
||||
if [ "$dev" != "$device" ]; then
|
||||
[ -z "$dev" ] && break
|
||||
i=$((i+1))
|
||||
elif [ $prev -ne 0 ]; then
|
||||
i=$((i+1))
|
||||
prev=$((prev-1))
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
eval "export -- \"$__save=$i\""
|
||||
}
|
||||
|
||||
###### START HERE #######
|
||||
|
||||
local file="$1"
|
||||
[ -f "$file" ] || exit
|
||||
|
||||
json_load "`cat $file`"
|
||||
json_select "wifi_ifaces"
|
||||
|
||||
local curmode repmode
|
||||
config_load netmode
|
||||
config_get curmode setup curmode
|
||||
|
||||
case $curmode in
|
||||
*repeater*)
|
||||
;;
|
||||
*)
|
||||
uci set netmode.setup.curmode="repeater"
|
||||
uci commit netmode
|
||||
/etc/init.d/netmode reload
|
||||
curmode="$(uci -q get netmode.setup.curmode)"
|
||||
;;
|
||||
esac
|
||||
|
||||
local apcliband="a"
|
||||
case $curmode in
|
||||
*_2g_*) apcliband="b";;
|
||||
esac
|
||||
|
||||
i=1
|
||||
|
||||
local dummy band ssid key encryption device iface_num
|
||||
|
||||
while json_get_var dummy $i; do
|
||||
json_select $i
|
||||
json_get_var band band
|
||||
[ "$apcliband" == "$band" ] && break
|
||||
json_select ..
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
[ "$apcliband" == "$band" ] || exit
|
||||
|
||||
repeater_iface_num=$(uci -q show wireless | grep -e ".mode='wet'" -e ".mode='sta'" | sed 's/.*\[\([0-9]\)\].*/\1/')
|
||||
[ -z "$repeater_iface_num" ] && exit
|
||||
json_get_var ssid ssid
|
||||
json_get_var key key
|
||||
json_get_var encryption encryption
|
||||
|
||||
set_wireless_values "$repeater_iface_num" "$ssid" "$key" "$encryption"
|
||||
|
||||
json_load "`cat $file`"
|
||||
json_select "wifi_ifaces"
|
||||
|
||||
config_load wireless
|
||||
local b_num=0
|
||||
local a_num=0
|
||||
|
||||
i=1
|
||||
while json_get_var dummy $i; do
|
||||
json_select $i
|
||||
json_get_var band band
|
||||
get_device "$band" device
|
||||
case $band in
|
||||
a)
|
||||
get_iface_num "$device" "$a_num" iface_num
|
||||
a_num=$((a_num+1))
|
||||
;;
|
||||
b)
|
||||
get_iface_num "$device" "$b_num" iface_num
|
||||
b_num=$((b_num+1))
|
||||
;;
|
||||
esac
|
||||
[ -z $iface_num ] && return
|
||||
json_get_var ssid ssid
|
||||
json_get_var encryption encryption
|
||||
json_get_var key key
|
||||
set_wireless_values "$iface_num" "$ssid" "$key" "$encryption"
|
||||
json_select ..
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
while uci -q get wireless.@wifi-iface[$i] >/dev/null; do
|
||||
local mode="$(uci -q get wireless.@wifi-iface[$i].mode)"
|
||||
if [ "$mode" == "wet" -o "$mode" == "sta" ]; then
|
||||
i=$((i+1))
|
||||
continue
|
||||
fi
|
||||
state="reload"
|
||||
uci -q delete wireless.@wifi-iface[$i] >/dev/null
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
uci commit wireless
|
||||
|
||||
if [ "$state" == "exit" ]; then
|
||||
return
|
||||
elif [ "$state" == "apply" ]; then
|
||||
# wifi apply
|
||||
wifi reload
|
||||
else
|
||||
# wifi reload
|
||||
wifi reload
|
||||
fi
|
||||
|
||||
[ -f /etc/init.d/layer2_interface_ethernet -a -f /etc/config/layer2_interface_ethernet ] && /etc/init.d/layer2_interface_ethernet reload
|
||||
@@ -1,141 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
get_if_creds() {
|
||||
local section=$1
|
||||
local network=$2
|
||||
local net dev ssid key encryption band
|
||||
config_get net $section "network"
|
||||
if [ "$net" == "$network" ]; then
|
||||
config_get dev $section "device"
|
||||
band="$(uci -q get wireless.$dev.band)"
|
||||
config_get ssid $section ssid
|
||||
config_get key $section key
|
||||
config_get encryption $section encryption
|
||||
config_get disabled $section disabled 0
|
||||
echo "disabled for $band = $disabled" >>/tmp/dbg
|
||||
[ $disabled -eq 1 ] && return
|
||||
[ "$ssid" == "" -o "$band" == "" ] && return
|
||||
json_add_object
|
||||
json_add_string "ssid" "$ssid"
|
||||
json_add_string "band" "$band"
|
||||
json_add_string "key" "$key"
|
||||
json_add_string "encryption" "$encryption"
|
||||
json_close_object
|
||||
fi
|
||||
}
|
||||
|
||||
validate_file() {
|
||||
local file="$1"
|
||||
local real="$(readlink -f `dirname $file`)"
|
||||
real="${real}/`basename $file`"
|
||||
case "$real" in
|
||||
/tmp/*)
|
||||
touch $real && return 0 || return 1
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
write_error(){
|
||||
json_init
|
||||
json_add_string "status" "error: $1"
|
||||
json_dump
|
||||
exit 1
|
||||
}
|
||||
|
||||
duplicate_if_single_radio() {
|
||||
json_select "wifi-ifaces"
|
||||
local i=1
|
||||
local dummy band dup_band num_radios
|
||||
|
||||
num_radios="$(uci -q show wireless | grep wifi-device | wc -l)"
|
||||
|
||||
[ "$num_radios" == "2" ] && return
|
||||
|
||||
band="$(uci -q get wireless.@wifi-device[0].band)"
|
||||
|
||||
[ "$band" == "a" ] && dup_band="b"
|
||||
[ "$band" == "b" ] && dup_band="a"
|
||||
[ -z "$dup_band" ] && return
|
||||
|
||||
|
||||
while json_get_var dummy $i; do
|
||||
i=$((i+1))
|
||||
done
|
||||
i=$((i-1))
|
||||
local ssid key encryption
|
||||
while [ $i -gt 0 ]; do
|
||||
json_select $i
|
||||
json_get_var ssid ssid
|
||||
json_get_var key key
|
||||
json_get_var encryption encryption
|
||||
json_select ..
|
||||
json_add_object
|
||||
json_add_string "ssid" "$ssid"
|
||||
json_add_string "band" "$dup_band"
|
||||
json_add_string "key" "$key"
|
||||
json_add_string "encryption" "$encryption"
|
||||
json_close_object
|
||||
i=$((i-1))
|
||||
done
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
list)
|
||||
echo '{ "get_creds": { "network": "str", "file": "str" }, "set_creds": { "file": "str" } }'
|
||||
;;
|
||||
call)
|
||||
case "$2" in
|
||||
get_creds)
|
||||
#TODO: if not routed exit
|
||||
local curmode="$(uci -q get netmode.setup.curmode)"
|
||||
case $curmode in
|
||||
*repeater*) write_error "not in repeater mode";;
|
||||
esac
|
||||
local network file input
|
||||
read input
|
||||
json_load $input
|
||||
json_get_var network network
|
||||
json_get_var file file
|
||||
|
||||
json_init
|
||||
json_add_array "wifi-ifaces"
|
||||
config_load wireless
|
||||
config_foreach get_if_creds "wifi-iface" "$network"
|
||||
json_close_array
|
||||
|
||||
duplicate_if_single_radio
|
||||
|
||||
if [ "$file" == "" ]; then
|
||||
json_dump
|
||||
else
|
||||
validate_file $file && json_dump -i >$file || write_error "invalid filename (\"$file\"), file must be in /tmp/ and in an existing directory"
|
||||
fi
|
||||
json_init
|
||||
json_add_string "status" success
|
||||
json_dump
|
||||
;;
|
||||
set_creds)
|
||||
local file
|
||||
read input
|
||||
json_load "$input"
|
||||
json_get_var file file
|
||||
validate_file "$file" || write_error "invalid filename (\"$file\"), file must be in /tmp and exist"
|
||||
json_load "`cat $file`" || write_error "invalid file content"
|
||||
json_select "wifi_ifaces" || write_error "invalid file content"
|
||||
|
||||
|
||||
json_init
|
||||
json_add_string "status" success
|
||||
json_dump
|
||||
|
||||
netmode-conf $file >/dev/null 2>&1 &
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
@@ -47,7 +47,7 @@ CONFIG_PACKAGE_juci-broadcom-ethernet=y
|
||||
CONFIG_PACKAGE_juci-broadcom-iptv=y
|
||||
CONFIG_PACKAGE_juci-broadcom-pwrmgmt=y
|
||||
CONFIG_PACKAGE_juci-broadcom-vlan=y
|
||||
CONFIG_PACKAGE_juci-wireless=y
|
||||
CONFIG_PACKAGE_juci-broadcom-wl=y
|
||||
CONFIG_PACKAGE_juci-broadcom-xdsl=y
|
||||
CONFIG_PACKAGE_juci-ddns=y
|
||||
CONFIG_PACKAGE_juci-diagnostics=y
|
||||
@@ -59,7 +59,7 @@ CONFIG_PACKAGE_juci-firewall-fw3=y
|
||||
CONFIG_PACKAGE_juci-icwmp=y
|
||||
CONFIG_PACKAGE_juci-igmpinfo=y
|
||||
CONFIG_PACKAGE_juci-inteno-backup=y
|
||||
CONFIG_PACKAGE_juci-mwan3=y
|
||||
CONFIG_PACKAGE_juci-inteno-multiwan=y
|
||||
CONFIG_PACKAGE_juci-inteno-provisioning=y
|
||||
CONFIG_PACKAGE_juci-inteno-qos=y
|
||||
CONFIG_PACKAGE_juci-inteno-voice-client=y
|
||||
@@ -72,7 +72,6 @@ CONFIG_PACKAGE_juci-netmode=y
|
||||
CONFIG_PACKAGE_juci-network-netifd=y
|
||||
CONFIG_PACKAGE_juci-owsd=y
|
||||
CONFIG_PACKAGE_juci-printer=y
|
||||
CONFIG_PACKAGE_juci-realtime-graphs=y
|
||||
CONFIG_PACKAGE_juci-samba=y
|
||||
CONFIG_PACKAGE_juci-simple-gui=y
|
||||
CONFIG_PACKAGE_juci-snmpd=y
|
||||
@@ -101,7 +100,7 @@ CONFIG_PACKAGE_mtd-utils-deubinize=y
|
||||
CONFIG_PACKAGE_mtd-utils-imagewrite=y
|
||||
CONFIG_PACKAGE_mtd-utils-mkfs.jffs2=y
|
||||
CONFIG_PACKAGE_mtd-utils-nanddump=y
|
||||
CONFIG_PACKAGE_mwan3=y
|
||||
CONFIG_PACKAGE_multiwan=y
|
||||
CONFIG_PACKAGE_ndisc6=y
|
||||
CONFIG_PACKAGE_ntfs-3g=y
|
||||
CONFIG_PACKAGE_odhcp6c=y
|
||||
@@ -196,5 +195,3 @@ CONFIG_LIBCURL_CRYPTO_AUTH=y
|
||||
CONFIG_OPENVPN_openssl_ENABLE_IPROUTE2=y
|
||||
# CONFIG_SAMBA3_CONFIG_NO_PRINTING is not set
|
||||
# CONFIG_SIGNED_PACKAGES is not set
|
||||
CONFIG_KERNEL_DEVTMPFS=y
|
||||
CONFIG_KERNEL_DEVTMPFS_MOUNT=y
|
||||
|
||||
@@ -1,135 +1,88 @@
|
||||
#!/bin/bash
|
||||
|
||||
function extract_core {
|
||||
initial_commit=1427738ac4b77f474999ae21af1a8b916468df36
|
||||
patch_dir=extract_core_patches
|
||||
topdir=$(pwd)
|
||||
# Intermediate repo for core packages
|
||||
core_repo=git@public.inteno.se:iopsys-cc-core.git
|
||||
|
||||
# Paths to packages that should be exported.
|
||||
paths+='package/network/services/samba36 '
|
||||
paths+='package/network/services/dnsmasq '
|
||||
paths+='package/network/services/dropbear '
|
||||
paths+='package/network/services/odhcpd '
|
||||
paths+='package/network/config/firewall '
|
||||
paths+='package/network/config/netifd '
|
||||
paths+='package/network/config/qos-scripts '
|
||||
paths+='package/network/utils/iproute2 '
|
||||
paths+='package/network/utils/curl '
|
||||
paths+='package/utils/busybox '
|
||||
# Repo to which core packages should be imported
|
||||
import_repo=git@public.inteno.se:feed-inteno-openwrt.git
|
||||
import_branch=openwrt-cc-core
|
||||
|
||||
function print_usage {
|
||||
echo "Usage: $0 extract_core"
|
||||
echo " -p <path-to-package> | default"
|
||||
echo " -r <import-repo>"
|
||||
echo " -b <import-branch>"
|
||||
echo ""
|
||||
echo "Example: $0 extract_core"
|
||||
echo " -p package/utils/busybox"
|
||||
echo " -r feeds/feed_inteno_openwrt"
|
||||
echo " -b devel"
|
||||
}
|
||||
|
||||
function orphan_branch {
|
||||
local branch=$1
|
||||
function export_core {
|
||||
|
||||
git checkout --orphan $branch
|
||||
git rm -rf --cached *
|
||||
git rm -rf --cached .empty
|
||||
rm -rf *
|
||||
rm -rf .empty
|
||||
}
|
||||
local path=$1
|
||||
|
||||
function export_core {
|
||||
local path=$1
|
||||
|
||||
echo "Extracting ${path} from core to ${import_repo}:${import_branch}"
|
||||
|
||||
# Generate patches from start of openwrt repo.
|
||||
mkdir -p $patch_dir
|
||||
repo=$(basename $path)
|
||||
dir=$(dirname $path)
|
||||
git format-patch $initial_commit $path -o $patch_dir
|
||||
|
||||
# Remove dirname from patches to commit the packages to the
|
||||
# top directory in the destination repo.
|
||||
ls $patch_dir | while read line; do
|
||||
sdir=$(echo "$dir/" | sed 's/\//\\\//g')
|
||||
sed -i "s/$sdir//g" $patch_dir/$line
|
||||
done
|
||||
|
||||
cd $import_repo
|
||||
|
||||
if [ -n "$(git rev-parse -q --verify remotes/origin/$repo)" ]; then
|
||||
# Create temporary branch to apply patches on.
|
||||
# We need to do this as git am does not like it
|
||||
# when patches have already been applied.
|
||||
orphan_branch tmp
|
||||
git am $topdir/$patch_dir/*
|
||||
|
||||
# Rebase and merge.
|
||||
git rebase origin/$repo
|
||||
git checkout --track -b $repo origin/$repo
|
||||
git merge tmp
|
||||
git br -d tmp
|
||||
else
|
||||
# Remote branch does not exist for packet so create it.
|
||||
orphan_branch $repo
|
||||
git am $topdir/$patch_dir/*
|
||||
fi
|
||||
|
||||
git push origin $repo
|
||||
|
||||
# Merge the package branch into the main branch.
|
||||
git checkout $import_branch
|
||||
git merge $repo -m "Syncing $repo"
|
||||
git push origin $import_branch
|
||||
git br -d $repo
|
||||
|
||||
rm -rf $topdir/$patch_dir
|
||||
cd $topdir
|
||||
}
|
||||
|
||||
# Execute user command
|
||||
while getopts "p:r:b:h" opt; do
|
||||
case $opt in
|
||||
p)
|
||||
export_path=${OPTARG}
|
||||
;;
|
||||
r)
|
||||
import_repo=${OPTARG}
|
||||
;;
|
||||
b)
|
||||
import_branch=${OPTARG}
|
||||
;;
|
||||
h)
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
\?)
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! -n "$export_path" ] || [ ! -n "$import_repo" ] || [ ! -n "$import_branch" ]; then
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$export_path" == "default" ]; then
|
||||
echo "Extracting default packages:"
|
||||
for p in $paths; do
|
||||
export_core $p
|
||||
|
||||
done
|
||||
else
|
||||
export_core $export_path
|
||||
fi
|
||||
|
||||
exit 0
|
||||
# export paths to their own branches in an intermediate repo
|
||||
repo=$(basename $path)
|
||||
git subtree push -q --prefix=$path $core_repo $repo
|
||||
}
|
||||
|
||||
register_command "extract_core" "Extract core package to separate feed"
|
||||
|
||||
function update_core {
|
||||
|
||||
local path=$1
|
||||
|
||||
if [ ! -d $topdir/feeds/feed_inteno_openwrt ]; then
|
||||
echo "You need to run ./iop feeds_update"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# ensure that we are synced with the remote
|
||||
cd $topdir/feeds/feed_inteno_openwrt
|
||||
git checkout $import_branch
|
||||
git pull
|
||||
|
||||
# first install subtrees if they don't already exist
|
||||
repo=$(basename $path)
|
||||
git subtree add --prefix=$repo $core_repo $repo
|
||||
|
||||
# install subtrees in feed from intermediate repo
|
||||
repo=$(basename $path)
|
||||
echo "Exporting $repo"
|
||||
git subtree pull -q -m "Exporting $repo" --prefix=$repo $core_repo $repo
|
||||
|
||||
# update import repo sync branch
|
||||
git push origin $import_branch
|
||||
}
|
||||
|
||||
function display_help {
|
||||
|
||||
echo "Usage: ./iop export_core -e path/to/package"
|
||||
}
|
||||
|
||||
function extract_core {
|
||||
|
||||
# Dir of script location
|
||||
topdir=$(pwd)
|
||||
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
display_help
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# Execute user command
|
||||
while getopts "he:" opt; do
|
||||
case $opt in
|
||||
e)
|
||||
path=${OPTARG}
|
||||
echo "Extracting ${path} from core to ${import_repo}:${import_branch}"
|
||||
export_core $path
|
||||
update_core $path
|
||||
;;
|
||||
h)
|
||||
display_help
|
||||
exit 0
|
||||
;;
|
||||
\?)
|
||||
display_help
|
||||
exit -1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
register_command "extract_core" "Extract core package to feeds_inteno_openwrt"
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ function feeds_update {
|
||||
else
|
||||
./scripts/feeds update
|
||||
fi
|
||||
./scripts/feeds update -ai
|
||||
|
||||
# replace core packages with iopsys versions
|
||||
if [ $override == 1 ]; then
|
||||
|
||||
@@ -64,7 +64,6 @@ function genconfig {
|
||||
iceAllowed=0
|
||||
endptAllowed=0
|
||||
natalieAllowed=0
|
||||
mediatekAllowed=0
|
||||
|
||||
allowedRepos="$(ssh -o ConnectTimeout=5 git@private.inteno.se 2>/dev/null | grep -w 'R\|W' | awk '{print$NF}')"
|
||||
for repo in $allowedRepos; do
|
||||
@@ -73,7 +72,6 @@ function genconfig {
|
||||
ice-client) iceAllowed=1 ;;
|
||||
endptcfg) endptAllowed=1 ;;
|
||||
natalie-dect*) natalieAllowed=1 ;;
|
||||
linux) mediatekAllowed=1 ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
@@ -144,6 +142,16 @@ function genconfig {
|
||||
}
|
||||
|
||||
|
||||
use_local_mirror()
|
||||
{
|
||||
if wget -T 3 -t 2 -O /dev/null $LOCAL_MIRROR >/dev/null 2>/dev/null; then
|
||||
echo "mirror [$LOCAL_MIRROR] exists. Using local mirror"
|
||||
sed -i "s;CONFIG_LOCALMIRROR=.*;CONFIG_LOCALMIRROR=\"$LOCAL_MIRROR\";" .config
|
||||
else
|
||||
echo "mirror [$LOCAL_MIRROR] does not exist. Not using local mirror"
|
||||
fi
|
||||
}
|
||||
|
||||
generate_config()
|
||||
{
|
||||
DIFFFILE="$1"
|
||||
@@ -206,13 +214,6 @@ function genconfig {
|
||||
cp $CONFIGPATH/config .config
|
||||
fi
|
||||
|
||||
# Add target diff
|
||||
local target_name=$(echo $target | sed 's/_/-/g')
|
||||
local target_conf=target/linux/${target_name}/config
|
||||
if [ -f $target_conf ]; then
|
||||
cat $target_conf >> .config
|
||||
fi
|
||||
|
||||
# Apply profile diff to master config if selected
|
||||
if [ -n "$PROFILE" ]; then
|
||||
if [ -e "$CONFIGPATH/$PROFILE.diff" ]; then
|
||||
@@ -274,15 +275,11 @@ function genconfig {
|
||||
[ $iceAllowed -eq 0 ] && echo "CONFIG_ICE_OPEN=y" >> .config
|
||||
[ $endptAllowed -eq 0 ] && echo "CONFIG_ENDPT_OPEN=y" >> .config
|
||||
[ $natalieAllowed -eq 0 ] && echo "CONFIG_NATALIE_OPEN=y" >> .config
|
||||
[ $mediatekAllowed -eq 0 ] && echo "CONFIG_MEDIATEK_OPEN=y" >> .config
|
||||
else
|
||||
echo "CONFIG_DEVEL=n" >>.config
|
||||
echo "CONFIG_GITMIRROR_REWRITE=n" >>.config
|
||||
echo "CONFIG_BCM_OPEN=y" >> .config
|
||||
echo "CONFIG_ICE_OPEN=y" >> .config
|
||||
echo "CONFIG_ENDPT_OPEN=y" >> .config
|
||||
echo "CONFIG_NATALIE_OPEN=y" >> .config
|
||||
echo "CONFIG_MEDIATEK_OPEN=y" >> .config
|
||||
fi
|
||||
|
||||
# Force regeneration of themes
|
||||
@@ -345,6 +342,10 @@ function genconfig {
|
||||
done
|
||||
setup_dirs
|
||||
create_and_copy_files "$1" "$2"
|
||||
|
||||
if [ $masterconfig -eq 1 ]; then
|
||||
use_local_mirror
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
|
||||
build_bcmkernel_consumer() {
|
||||
local tarfile bcmkernelcommith sdkversion
|
||||
sdkversion=$(grep "CONFIG_BRCM_SDK_VER.*=y" .config | awk -F'[_,=]' '{print$5}')
|
||||
local tarfile bcmkernelcommith
|
||||
bcmkernelcommith=$(grep -w "PKG_SOURCE_VERSION:" $curdir/feeds/feed_inteno_broadcom/bcmkernel/$sdkversion.mk | cut -d'=' -f2)
|
||||
# do not build bcmopen sdk if it was already built before
|
||||
ssh $SERVER "ls $FPATH/bcmopen-$profile-$bcmkernelcommith.tar.gz" && return
|
||||
@@ -59,48 +58,15 @@ build_ice_consumer() {
|
||||
icebasever=$(grep -w "BASE_PKG_VERSION:" ./feeds/feed_inteno_packages/ice-client/Makefile | cut -d'=' -f2)
|
||||
icerelease=$(grep -w "PKG_RELEASE:" ./feeds/feed_inteno_packages/ice-client/Makefile | cut -d'=' -f2)
|
||||
iceversion=$icebasever$icerelease
|
||||
ssh $SERVER "ls $FPATH/ice-client-$target-$iceversion-$icecommith.tar.gz" && return
|
||||
cd ./build_dir/target-*_uClibc-0.9.33.*/ice-client-$icebasever/ipkg-* || cd ./build_dir/target-mips*musl-*/ice-client-$icebasever/ipkg-*
|
||||
tar -czv ice-client -f ice-client-$target-$iceversion-$icecommith.tar.gz
|
||||
scp ice-client-$target-$iceversion-$icecommith.tar.gz $SERVER:$FPATH/
|
||||
cp ice-client-$target-$iceversion-$icecommith.tar.gz $curdir/
|
||||
rm -f ice-client-$target-$iceversion-$icecommith.tar.gz
|
||||
ssh $SERVER "ls $FPATH/ice-client-$profile-$iceversion-$icecommith.tar.gz" && return
|
||||
cd ./build_dir/target-*_uClibc-0.9.33.*/ice-client-$icebasever/ipkg-*
|
||||
tar -czv ice-client -f ice-client-$profile-$iceversion-$icecommith.tar.gz
|
||||
scp ice-client-$profile-$iceversion-$icecommith.tar.gz $SERVER:$FPATH/
|
||||
cp ice-client-$profile-$iceversion-$icecommith.tar.gz $curdir/
|
||||
rm -f ice-client-$profile-$iceversion-$icecommith.tar.gz
|
||||
cd $curdir
|
||||
}
|
||||
|
||||
build_mediatek_kernel() {
|
||||
local mediatek_commit kernel_version kernel
|
||||
|
||||
mediatek_commit=$(grep CONFIG_KERNEL_GIT_COMMIT .config | cut -d '=' -f2 | tr -d '"')
|
||||
kernel_version=$(grep KERNEL_PATCHVER target/linux/iopsys-ramips/Makefile | cut -d '=' -f2)
|
||||
kernel=linux-${kernel_version}.*
|
||||
ssh $SERVER "ls $FPATH/mediatek-kernel-open-$mediatek_commit.tar.gz" && return
|
||||
echo "Building mediatek kernel tarball from kernel commit:"
|
||||
echo $mediatek_commit
|
||||
cd build_dir/target-mipsel_1004kc*/linux-iopsys-ramips_*/$kernel
|
||||
|
||||
# Save Kconfig files to recreate the same kernel config,
|
||||
# delete everyting else.
|
||||
find drivers/net/wireless/mt_wifi -type f ! -name Kconfig | xargs rm
|
||||
find drivers/net/wireless/rlt_wifi -type f ! -name Kconfig | xargs rm
|
||||
|
||||
# remove git repo
|
||||
rm -rf .git
|
||||
|
||||
# patch kernel for openstk
|
||||
ls consumer_release | while read line; do patch -p1 < consumer_release/$line; done
|
||||
cd ..
|
||||
|
||||
tar -czv $kernel -f mediatek-kernel-open-$mediatek_commit.tar.gz
|
||||
scp mediatek-kernel-open-$mediatek_commit.tar.gz $SERVER:$FPATH/
|
||||
cd $curdir
|
||||
}
|
||||
|
||||
function print_usage {
|
||||
echo "Usage: $0 generate_tarballs"
|
||||
echo " -t <target>"
|
||||
}
|
||||
|
||||
function generate_tarballs {
|
||||
|
||||
SERVER="god@software.inteno.se"
|
||||
@@ -108,46 +74,14 @@ function generate_tarballs {
|
||||
|
||||
git remote -v | grep -q http && return # do not continue if this is an open SDK environment
|
||||
|
||||
target=$(grep CONFIG_TARGET_BOARD .config | cut -d'=' -f2 | tr -d '"')
|
||||
profile=$(grep CONFIG_BCM_KERNEL_PROFILE .config | cut -d'=' -f2 | tr -d '"')
|
||||
sdkversion=$(grep "CONFIG_BRCM_SDK_VER.*=y" .config | awk -F'[_,=]' '{print$5}')
|
||||
curdir=$(pwd)
|
||||
|
||||
|
||||
# Execute user command
|
||||
while getopts "t:h" opt; do
|
||||
case $opt in
|
||||
t)
|
||||
stk_target=${OPTARG}
|
||||
;;
|
||||
h)
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
\?)
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! -n "$stk_target" ]; then
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$stk_target" == "broadcom" ]; then
|
||||
build_bcmkernel_consumer
|
||||
build_natalie_consumer
|
||||
build_endptcfg_consumer
|
||||
build_ice_consumer
|
||||
elif [ "$stk_target" == "mediatek" ]; then
|
||||
build_mediatek_kernel
|
||||
build_ice_consumer
|
||||
else
|
||||
echo "Invalid target: $stk_target"
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
build_bcmkernel_consumer
|
||||
build_natalie_consumer
|
||||
build_endptcfg_consumer
|
||||
build_ice_consumer
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
UPDATE=0
|
||||
|
||||
print_git_update()
|
||||
{
|
||||
echo "pkg -> ${PKG_NAME}"
|
||||
@@ -397,13 +399,9 @@ check_packages()
|
||||
echo "Now checking if any changes has been done to the packages."
|
||||
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
|
||||
|
||||
# only scan in the build directory that is currently in use.
|
||||
CPU=$(grep "CONFIG_CPU_TYPE=" .config| cut -f2 -d\")
|
||||
LIBC=$(grep "CONFIG_LIBC=" .config| cut -f2 -d\")
|
||||
|
||||
# First scan all files in build dir for packages that have .git directories.
|
||||
all_pkgs=$(find build_dir/*${CPU}*${LIBC}* -name ".git")
|
||||
|
||||
all_pkgs=$(find build_dir/ -name ".git")
|
||||
|
||||
for pkg in `echo "$all_pkgs"`
|
||||
do
|
||||
pkg=$(dirname $pkg)
|
||||
@@ -425,7 +423,7 @@ check_packages()
|
||||
# print_git_update
|
||||
git_repos_uptodate
|
||||
insert_hash_in_feed_makefile
|
||||
[ ${UPDATE} -eq 1 ] && insert_version_in_feed_makefile
|
||||
[ "${UPDATE}" ] && insert_version_in_feed_makefile
|
||||
create_message >tmp/msg
|
||||
commit_feed tmp/msg
|
||||
insert_hash_in_feeds_config
|
||||
@@ -489,7 +487,7 @@ Date: %ai%n\
|
||||
check_feeds()
|
||||
{
|
||||
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
|
||||
echo "Now checking if any changes have been done to the feeds."
|
||||
echo "Now checking if any changes has been done to the feeds."
|
||||
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
|
||||
|
||||
feeds=$(grep -v "^#" feeds.conf| awk '{print $2}')
|
||||
@@ -584,8 +582,6 @@ usage(){
|
||||
# Exported interface
|
||||
function update_package {
|
||||
|
||||
UPDATE=0
|
||||
|
||||
Color_Off='\033[0m' # Text Reset
|
||||
|
||||
# Regular Colors
|
||||
|
||||
@@ -31,16 +31,19 @@ management_interfaces() {
|
||||
}
|
||||
|
||||
init_iup() {
|
||||
local polling_enabled
|
||||
local interval
|
||||
local starttime
|
||||
local nummber
|
||||
number=$RANDOM
|
||||
|
||||
[ -f $CRONPATH ] || touch $CRONPATH
|
||||
if [ -f $CRONPATH ]; then
|
||||
echo "File $CRONPATH exists"
|
||||
else
|
||||
echo "File $CRONPATH did not exists"
|
||||
touch $CRONPATH
|
||||
fi
|
||||
|
||||
config_load provisioning
|
||||
config_get polling_enabled polling enabled on
|
||||
config_get interval polling interval
|
||||
config_get starttime polling starttime
|
||||
|
||||
@@ -51,12 +54,12 @@ init_iup() {
|
||||
local newreqopts=
|
||||
local baseopts=
|
||||
local reqopts="$(uci -q get network.$net.reqopts)"
|
||||
local iupopts="66 67 128 224 225 226"
|
||||
local iupopts="66 67 128 224"
|
||||
local ropt iopt
|
||||
config_get enabled iup enabled "on"
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
66|67|128|224|225|226) ;;
|
||||
66|67|128|224) ;;
|
||||
*) baseopts="$baseopts $ropt" ;;
|
||||
esac
|
||||
done
|
||||
@@ -64,7 +67,7 @@ init_iup() {
|
||||
reqopts="$baseopts $iupopts"
|
||||
for ropt in $reqopts; do
|
||||
case $ropt in
|
||||
66|67|128|224|225|226) [ $enabled == "on" ] && newreqopts="$newreqopts $ropt" ;;
|
||||
66|67|128|224) [ $enabled == "on" ] && newreqopts="$newreqopts $ropt" ;;
|
||||
*) newreqopts="$newreqopts $ropt" ;;
|
||||
esac
|
||||
done
|
||||
@@ -79,18 +82,8 @@ init_iup() {
|
||||
ubus call network reload
|
||||
#################################################################
|
||||
|
||||
if [ $polling_enabled == "off" ]; then
|
||||
sed -i "/\/sbin\/iup/d" $CRONPATH
|
||||
logger -s -t /etc/init.d/iup[$$] "Provisioning polling unscheduled" 2>/dev/console
|
||||
return
|
||||
fi
|
||||
|
||||
local log_hour=$starttime
|
||||
local log_minute
|
||||
local log_interval=$interval
|
||||
if [ $interval == "weekly" ]; then
|
||||
interval="0"
|
||||
log_interval="$log_interval/sunday"
|
||||
elif [ $interval == "hourly" ]; then
|
||||
interval='*'
|
||||
starttime='*'
|
||||
@@ -98,7 +91,9 @@ init_iup() {
|
||||
interval='*'
|
||||
fi
|
||||
let "number %= $RANGE"
|
||||
if ! grep -q "$starttime \* \* \\$interval /sbin/iup" "$CRONPATH" ; then
|
||||
if grep -q "$starttime \* \* \\$interval /sbin/iup" "$CRONPATH" ; then
|
||||
echo "IUP is scheduled $starttime \* \* \\$interval "
|
||||
else
|
||||
if grep -q "iup" "$CRONPATH" ; then
|
||||
sed -i "/iup/d" $CRONPATH
|
||||
fi
|
||||
@@ -106,14 +101,15 @@ init_iup() {
|
||||
fsync $CRONPATH
|
||||
/etc/init.d/cron restart
|
||||
fi
|
||||
log_minute=$(awk '/\/sbin\/iup/ {print $1}' /etc/crontabs/root)
|
||||
logger -s -t /etc/init.d/iup[$$] "Provisioning is scheduled at $log_hour:$log_minute $log_interval" 2>/dev/console
|
||||
}
|
||||
|
||||
start_service() {
|
||||
init_iup
|
||||
|
||||
/sbin/iup -v &
|
||||
test_default_route
|
||||
if [ "$?" -eq 0 ]; then
|
||||
/sbin/iup -v &
|
||||
fi
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
|
||||
@@ -13,8 +13,6 @@ export IUPCONFFILES=/tmp/iup/sysupgrade.conffiles.tar.gz
|
||||
export IUPMD5=/etc/configchecksums
|
||||
export CONFILESLURP='/tmp/iup/*.conf'
|
||||
export IUPTEMP="/tmp/iup"
|
||||
export IUPUSERCFG="/tmp/iupusercfg"
|
||||
export IUPUSERCFG_WIFI="/tmp/iupusercfg_wifi"
|
||||
export INTERACTIVE=0
|
||||
export VERBOSE=0
|
||||
export CONF=1
|
||||
@@ -28,22 +26,28 @@ MAC=${MAC// /}
|
||||
#lower to upper Conversion
|
||||
MAC=$(echo $MAC | tr '[a-z]' '[A-Z]')
|
||||
|
||||
# no verbose: no output
|
||||
# -v log to system log
|
||||
# -v -v log to system log and console
|
||||
# -v -v -v log to system log, console and stderr
|
||||
v() {
|
||||
[ "$VERBOSE" -eq 0 ] && return
|
||||
[ "$VERBOSE" -eq 1 ] && logger -t $0[$$] "$@" && return
|
||||
[ "$VERBOSE" -eq 2 ] && logger -s -t $0[$$] "$@" >/dev/console 2>&1 && return
|
||||
[ "$VERBOSE" -eq 3 ] && logger -s -t $0[$$] "$@" 2>&1 | tee /dev/console && return
|
||||
[ "$VERBOSE" -ge 1 ] && logger -t iup "$@"
|
||||
}
|
||||
|
||||
vv() {
|
||||
VERBOSE="$(($VERBOSE + 1))"
|
||||
v "$@"
|
||||
VERBOSE="$(($VERBOSE - 1))"
|
||||
if [ -f $IUPMD5 ]; then
|
||||
v "File $IUPMD5 exists"
|
||||
else
|
||||
v "File $IUPMD5 did not exists"
|
||||
touch $IUPMD5
|
||||
fi
|
||||
|
||||
handle_ucitrack()
|
||||
{
|
||||
local config="$1"
|
||||
config_get init "$config" init
|
||||
echo $init
|
||||
config_get affects "$config" affects
|
||||
|
||||
for aff in $affects
|
||||
do
|
||||
config_foreach handle_ucitrack $aff
|
||||
done
|
||||
}
|
||||
|
||||
get_packages()
|
||||
@@ -57,121 +61,35 @@ get_packages()
|
||||
|
||||
reload ()
|
||||
{
|
||||
local reload
|
||||
local initlist
|
||||
local reload
|
||||
local pack
|
||||
pack=$(get_packages $1)
|
||||
v "Calling ubus call uci commit for $pack"
|
||||
config_load ucitrack
|
||||
for packname in $pack
|
||||
do
|
||||
ubus call uci commit '{"config":"'$packname'"}'
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
save_usercfg()
|
||||
{
|
||||
rm -f $IUPUSERCFG $IUPUSERCFG_WIFI
|
||||
touch $IUPUSERCFG $IUPUSERCFG_WIFI
|
||||
|
||||
# save the firewall redirects/port forwarding
|
||||
uci show firewall | grep redirect >> $IUPUSERCFG
|
||||
|
||||
# save the parental rules
|
||||
local parentalrules=$(uci show firewall | grep -i "Parental Rule" | grep -o "rule\[.*\]")
|
||||
for rule in $parentalrules ; do
|
||||
rule=${rule//\[/\\[} # escape [
|
||||
rule=${rule//]/\]} # escape ]
|
||||
uci show firewall | grep "$rule" >>$IUPUSERCFG
|
||||
done
|
||||
|
||||
# tranfsorm the output of uci show into a uci script
|
||||
|
||||
# prepend "set" to each line NOT containing "]="
|
||||
# firewall.@redirect[0].enabled='1' becomes
|
||||
# set firewall.@redirect[0].enabled='1'
|
||||
sed -i '/.*]=.*/! s/.*/set \0/' $IUPUSERCFG
|
||||
|
||||
# prepend "add" to each line containing "]="
|
||||
# AND keep only the package name (before the first dot) and section type (after equal)
|
||||
# firewall.@redirect[0]=redirect becomes
|
||||
# add firewall redirect
|
||||
sed -i 's/\(.*\)\..*]=\(.*\)/add \1 \2/' $IUPUSERCFG
|
||||
|
||||
# change all the array indexes to [-1]
|
||||
sed -i 's/\[.\?.\?.\?.\?\]/[-1]/' $IUPUSERCFG
|
||||
|
||||
# commit at the end of the script
|
||||
[ -s $IUPUSERCFG ] && echo "commit" >> $IUPUSERCFG
|
||||
|
||||
# save wireless interfaces
|
||||
uci show wireless | grep "wifi-iface" > $IUPUSERCFG_WIFI
|
||||
}
|
||||
|
||||
apply_usercfg()
|
||||
{
|
||||
# decide to save the user changes based on keepuserconfig received through provisioning
|
||||
local keep
|
||||
config_load provisioning
|
||||
config_get_bool keep configserver keepuserconfig "0"
|
||||
v "apply_usercfg(): keepuserconfig = $keep"
|
||||
if [ "$keep" != "1" ] ; then
|
||||
rm -f $IUPUSERCFG $IUPUSERCFG_WIFI
|
||||
return
|
||||
fi
|
||||
|
||||
local index ifname network
|
||||
local newindex newifname newnetwork
|
||||
|
||||
# loop through all the user wifi-ifaces
|
||||
for index in $(seq 0 99) ; do
|
||||
ifname=$(sed -n 's/.*wifi-iface\['$index'\]\.ifname='\''\(.*\)'\''/\1/p' $IUPUSERCFG_WIFI )
|
||||
[ "$ifname" ] || break
|
||||
network=$(sed -n 's/.*wifi-iface\['$index'\]\.network='\''\(.*\)'\''/\1/p' $IUPUSERCFG_WIFI )
|
||||
|
||||
newindex=""
|
||||
newifname=""
|
||||
newnetwork=""
|
||||
|
||||
# loop through all the newly configured wifi-ifaces
|
||||
for newindex in $(seq 0 99) ; do
|
||||
newifname=$( uci show wireless | grep wifi-iface | sed -n 's/.*wifi-iface\['$newindex'\]\.ifname='\''\(.*\)'\''/\1/p' )
|
||||
if [ -z "$newifname" ] ; then
|
||||
# no newifname means that all the wifi-ifaces have already been parsed
|
||||
newindex="-1"
|
||||
break
|
||||
fi
|
||||
newnetwork=$(uci show wireless | grep wifi-iface | sed -n 's/.*wifi-iface\['$newindex'\]\.network='\''\(.*\)'\''/\1/p' )
|
||||
|
||||
# two wifi interfaces are the same if "ifname" and "network" are the same
|
||||
if [ "$newifname" == "$ifname" ] && [ "$newnetwork" == "$network" ] ; then
|
||||
break
|
||||
fi
|
||||
initlist=$(config_foreach handle_ucitrack $packname)
|
||||
for reltest in $initlist
|
||||
do
|
||||
case $reload in
|
||||
*" $reltest "*) v "already added to reload $reltest" ;;
|
||||
*) reload="$reload"" ""$reltest" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# prepend "set" to each line NOT containing "]="
|
||||
# wireless.@wifi-iface[$index].<option>='<value>' becomes
|
||||
# set wireless.@wifi-iface[$index].<option>='<value>'
|
||||
sed -i '/.*]=.*/! s/\(.*\[\)'$index'\(\].*\)/set \1'$newindex'\2/' $IUPUSERCFG_WIFI
|
||||
|
||||
if [ "$newindex" == "-1" ] ; then
|
||||
# prepend "add" to each line containing "]="
|
||||
# AND keep only the package name (before the first dot) and section type (after equal)
|
||||
# wireless.@wifi-iface[0]=wifi-iface becomes
|
||||
# add wireless wifi-iface
|
||||
sed -i 's/\(.*\)\..*\['$index'\]=\(.*\)/add \1 \2/' $IUPUSERCFG_WIFI
|
||||
else
|
||||
# no need to create a new uci section, just delete the line defining a new section
|
||||
sed -i '/\(.*\)\..*\['$index'\]=\(.*\)/d' $IUPUSERCFG_WIFI
|
||||
fi
|
||||
|
||||
done
|
||||
# commit at the end of the script
|
||||
[ -s $IUPUSERCFG_WIFI ] && echo "commit" >> $IUPUSERCFG_WIFI
|
||||
|
||||
# run the uci batch scripts
|
||||
cat $IUPUSERCFG | uci batch >/dev/null 2>&1
|
||||
cat $IUPUSERCFG_WIFI | uci batch >/dev/null 2>&1
|
||||
|
||||
rm -f $IUPUSERCFG $IUPUSERCFG_WIFI
|
||||
v "Init scripts to be run $reload"
|
||||
for inittoreload in $reload
|
||||
do
|
||||
if [ "$inittoreload" != "iup" ]; then
|
||||
/etc/init.d/$inittoreload restart
|
||||
fi
|
||||
done
|
||||
#Ugly hack need to figure out something here
|
||||
test_default_route
|
||||
if [ "$?" -eq 1 ]; then
|
||||
sleep 5
|
||||
fi
|
||||
}
|
||||
|
||||
handle_provisioning() {
|
||||
@@ -199,15 +117,15 @@ handle_provisioning() {
|
||||
config_get deckey "$config" deckey
|
||||
if [ "$enabled" -eq 1 ]; then
|
||||
if [ "$config" == "iup" ]; then
|
||||
v "Using url received in dhcp options"
|
||||
v "using url from dhcp options"
|
||||
config_get url "$config" urliup
|
||||
else
|
||||
else
|
||||
config_get url "$config" url
|
||||
fi
|
||||
url=${url//\$MAC/$MAC}
|
||||
v "Downloading from url \"$url\""
|
||||
|
||||
while [ $retry -le $RETRYSTOP ]
|
||||
v "Download from $url"
|
||||
|
||||
while [ $retry -le $RETRYSTOP ]
|
||||
do
|
||||
if [ ${url%%:*} == "tftp" ]; then
|
||||
tftpfile=${url#*\/\/}
|
||||
@@ -219,17 +137,17 @@ handle_provisioning() {
|
||||
get_image "$url" "cat" > $IUPCONFFILES
|
||||
fi
|
||||
if [ -s $IUPCONFFILES ]; then
|
||||
v "Download finished"
|
||||
v "File Downloaded"
|
||||
retry=$((RETRYSTOP + 1))
|
||||
else
|
||||
v "Download failed, retrying in $incsleep seconds"
|
||||
else
|
||||
v "Download failed will try again in $incsleep sec"
|
||||
sleep $incsleep
|
||||
incsleep=$((incsleep * retry + number))
|
||||
retry=$((retry+1))
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [ ! -s "$IUPCONFFILES" ] && [ "$enabled" -eq 1 ]; then
|
||||
if [ ! -s "$IUPCONFFILES" ]; then
|
||||
echo "File not Found"
|
||||
reboot="off"
|
||||
CONF=0
|
||||
@@ -245,44 +163,41 @@ handle_Downloaded_file()
|
||||
[ -n "$1" ] && DECKEY=$(echo $1 | tr -d '\n' | hexdump -e '16/1 "%02x"')
|
||||
KEY=${DECKEY:-$DESKEY}
|
||||
local img_type
|
||||
case "$(get_image_type "$IUPCONFFILES")" in
|
||||
"INTENO") img_type=2 ;;
|
||||
"CFE+FS") img_type=1 ;;
|
||||
"FS") img_type=0 ;;
|
||||
*) img_type="UNKNOWN";;
|
||||
esac
|
||||
|
||||
case "$(get_image_type "$IUPCONFFILES")" in
|
||||
"INTENO") img_type=2 ;;
|
||||
"CFE+FS") img_type=1 ;;
|
||||
"FS") img_type=0 ;;
|
||||
*) img_type="UNKNOWN";;
|
||||
esac
|
||||
|
||||
if [ "$img_type" == "UNKNOWN" ] ; then
|
||||
case "$(hexdump -v -n 2 -e '1/1 "%02x"' $IUPCONFFILES)" in
|
||||
1f8b)
|
||||
v "Downloaded file is an unencrypted config"
|
||||
v "Found Config"
|
||||
md5=$(md5sum $IUPCONFFILES)
|
||||
md5="${md5%% *}" # remove the first space and everything after it
|
||||
md5sum "$IUPCONFFILES" >> "$IUPMD5.temp"
|
||||
if grep -q "$md5" "$IUPMD5"; then
|
||||
v "Config is already up to date, nothing to do"
|
||||
#because config is up to date we need to disable last step reboot if set
|
||||
v "Config Already Up to Date"
|
||||
#becuse config is up to date we need to disable last step reboot if set
|
||||
reboot="off"
|
||||
rm -rf $IUPTEMP
|
||||
else
|
||||
save_usercfg
|
||||
cd $IUPTEMP
|
||||
cd /tmp/iup/
|
||||
tar xvzf $IUPCONFFILES
|
||||
for f in $CONFILESLURP
|
||||
do
|
||||
v "File to be applied $f and config $(cat $f)"
|
||||
v "file to be applied $f and config $(cat $f)"
|
||||
uci import -f $f
|
||||
done
|
||||
pack=$(get_packages $CONFILESLURP)
|
||||
v "Packages to be commited: $pack"
|
||||
v "$pack packages to be commited"
|
||||
for packname in $pack
|
||||
do
|
||||
uci commit $packname
|
||||
done
|
||||
apply_usercfg
|
||||
reboot=`uci -q get provisioning.configserver.reboot`
|
||||
if [ "$reboot" != "on" ]; then
|
||||
sync
|
||||
reload $CONFILESLURP
|
||||
fi
|
||||
rm -rf $IUPTEMP
|
||||
@@ -292,11 +207,11 @@ handle_Downloaded_file()
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
v "Downloaded file is an encrypted config"
|
||||
v "encrypted"
|
||||
if [ $KEY ]; then
|
||||
openssl enc -d -des-ede -nosalt -K $KEY -iv "0000000000000000" -in $IUPCONFFILES -out $IUPCONFFILES.tmp
|
||||
if [ $? -eq 0 ]; then
|
||||
v "Decryption successful"
|
||||
v "Decrypted Content"
|
||||
mv $IUPCONFFILES.tmp $IUPCONFFILES
|
||||
handle_Downloaded_file
|
||||
else
|
||||
@@ -312,12 +227,11 @@ handle_Downloaded_file()
|
||||
;;
|
||||
esac
|
||||
else
|
||||
v "Downloaded file is a firmware, will start reflashing"
|
||||
v "Image found will start flashing"
|
||||
if [ "$defaultreset" -eq 1 ]; then
|
||||
v "Not saving configuration over reflash"
|
||||
v "nuke config"
|
||||
/sbin/sysupgrade -v -n $IUPCONFFILES
|
||||
else
|
||||
v "Saving configuration over reflash"
|
||||
/sbin/sysupgrade -v $IUPCONFFILES
|
||||
fi
|
||||
fi
|
||||
@@ -339,7 +253,7 @@ change_to_vlan() {
|
||||
|
||||
# bring down old interface/device.
|
||||
ifdown "${base_dev}"
|
||||
v "option 132: bringing down old if: ${base_dev}"
|
||||
logger -t dhcp_opt132 "bringing down old if: ${base_dev}"
|
||||
|
||||
# extract base name of device.
|
||||
base_dev=$(echo ${base_dev} | cut -d. -f1)
|
||||
@@ -353,15 +267,15 @@ change_to_vlan() {
|
||||
uci set layer2_interface_vlan.@vlan_interface[-1].baseifname=${base_dev}
|
||||
# and commit the change.
|
||||
uci commit layer2_interface_vlan
|
||||
v "option 132: committed update to file layer2_interface_vlan"
|
||||
logger -t dhcp_opt132 "committed update to file layer2_interface_vlan"
|
||||
|
||||
# reload configuration files.
|
||||
/etc/init.d/layer2_interface_vlan reload
|
||||
v "option 132: reload layer2_interface_vlan config"
|
||||
logger -t dhcp_opt132 "reload layer2_interface_vlan config"
|
||||
|
||||
# replace old interface (like eth0.1 with new eth0.101).
|
||||
wan_if=$(uci get network.$3.ifname)
|
||||
v "option 132: old network.${3}.ifname: $wan_if"
|
||||
logger -t dhcp_opt132 "old network.${3}.ifname: $wan_if"
|
||||
|
||||
# loop through the string, remove any word close to "base_dev".
|
||||
for word in ${wan_if}; do
|
||||
@@ -379,12 +293,10 @@ change_to_vlan() {
|
||||
uci set network.wan.ifname="${new_wan_if}"
|
||||
# and commit the change.
|
||||
uci commit network
|
||||
v "option 132: committed update to file network: ifname=${new_wan_if}"
|
||||
logger -t dhcp_opt132 "committed update to file network: ifname=${new_wan_if}"
|
||||
|
||||
# reboot into new if configuration.
|
||||
vv "Rebooting"
|
||||
export REBOOT_REASON=iup
|
||||
/sbin/reboot
|
||||
reboot
|
||||
}
|
||||
|
||||
handle_option224()
|
||||
@@ -435,67 +347,69 @@ handle_option224()
|
||||
softwareminuspath=${url##*/}
|
||||
|
||||
if [ $url ] && [ $active -eq 1 ]; then
|
||||
v "Software version to download \"$softwareminuspath\""
|
||||
echo "Software version to download $softwareminuspath"
|
||||
local sysinfo=$(ubus call router.system info)
|
||||
json_load "$sysinfo"
|
||||
json_select system
|
||||
json_get_var firmware firmware
|
||||
local firmware_new=${softwareminuspath%.*} # remove extension (.w, .y or .y2) from filename
|
||||
if [ "$firmware_new" != "$firmware" ] ; then
|
||||
v "Firmware found $url will start flashing"
|
||||
v "Currently running firmware: \"$firmware\""
|
||||
v "Newly received firmware: \"$firmware_new\""
|
||||
echo "Image found $url will start flashing"
|
||||
wait_for_dns $url
|
||||
v "Start flashing"
|
||||
/sbin/sysupgrade -v $url &
|
||||
return 1
|
||||
else
|
||||
v "Firmware is up to date, nothing to do"
|
||||
echo "Will not update software, already up to date"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
### MAIN ###
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
-v) export VERBOSE="$(($VERBOSE + 1))";;
|
||||
-q) export VERBOSE="$(($VERBOSE - 1))";;
|
||||
-*)
|
||||
echo "Invalid option: $1"
|
||||
exit 1
|
||||
;;
|
||||
*) break;;
|
||||
esac
|
||||
shift;
|
||||
done
|
||||
|
||||
parse_dhcp_options()
|
||||
{
|
||||
local the_json="$@"
|
||||
# Process IUP related DHCP options #
|
||||
# Process IUP related DHCP options #
|
||||
if [ -n "$1" ]; then
|
||||
local privopt224 privopt225 privopt226 vendorspecinf httpurl128
|
||||
local tftp bootfile vlanid vlanpriority interface
|
||||
|
||||
json_load "$the_json"
|
||||
json_load "$1"
|
||||
json_get_var interface interface
|
||||
json_get_var privopt224 privopt224
|
||||
json_get_var privopt225 privopt225
|
||||
json_get_var privopt226 privopt226
|
||||
json_get_var vendorspecinf vendorspecinf # option 43
|
||||
json_get_var vendorspecinf vendorspecinf
|
||||
json_get_var httpurl128 httpurl128
|
||||
json_get_var tftp tftp # option 66
|
||||
json_get_var bootfile bootfile #option 67
|
||||
json_get_var vlanid vlanid # option 132
|
||||
json_get_var vlanpriority vlanpriority # option 133
|
||||
|
||||
v "Processing dhcp options"
|
||||
json_get_var tftp tftp
|
||||
json_get_var bootfile bootfile
|
||||
json_get_var vlanid vlanid
|
||||
json_get_var vlanpriority vlanpriority
|
||||
|
||||
if [ $privopt224 ]; then
|
||||
v "dhcp option 224 firmware url $privopt224"
|
||||
echo "Option224 recived " $privopt224 > /dev/console
|
||||
handle_option224 $privopt224
|
||||
[ $? -eq 1 ] && exit
|
||||
fi
|
||||
|
||||
if [ $vendorspecinf ]; then
|
||||
v "dhcp option 43 tr69 url $vendorspecinf"
|
||||
url=${vendorspecinf%%,*}; rest=${vendorspecinf#*,}
|
||||
provisioningcode=${rest%%,*};
|
||||
uci_set_state provisioning iup urlcwmp "$url"
|
||||
uci_set_state provisioning iup url "$url"
|
||||
uci_set_state provisioning iup provisioningcode "$provisioningcode"
|
||||
elif [ $httpurl128 ]; then
|
||||
v "dhcp option 128 http config url $httpurl128"
|
||||
uci_set_state provisioning iup urliup "$httpurl128"
|
||||
elif [ $tftp ]; then
|
||||
v "dhcp option 66 tftp config url $tftp"
|
||||
if [ ${bootfile:0:1} == '/' ]; then
|
||||
uci_set_state provisioning iup urliup "tftp://$tftp$bootfile"
|
||||
else
|
||||
@@ -503,17 +417,17 @@ parse_dhcp_options()
|
||||
fi
|
||||
fi
|
||||
|
||||
# vlanid (and vlanpriority)
|
||||
# if we get vlanid and maybe vlanpriority, configure for that.
|
||||
if [ -n "$vlanid" -a -n "$vlanpriority" ]; then
|
||||
v "dhcp option 132 vlanid: ${vlanid} vlanpriority: ${vlanpriority}"
|
||||
logger -t dhcp_opt132 "vlanid: ${vlanid}, vlanpriority: ${vlanpriority}"
|
||||
change_to_vlan ${vlanid} ${vlanpriority} ${interface}
|
||||
elif [ -n "$vlanid" ]; then
|
||||
v "dhcp option 132 vlanid: ${vlanid}"
|
||||
logger -t dhcp_opt132 "vlanid: ${vlanid}"
|
||||
change_to_vlan ${vlanid} 0 ${interface}
|
||||
elif [ -n "$privopt225" ] || [ -n "$privopt226" ]; then
|
||||
# opt225 and opt226 can be used together or separatly
|
||||
if [ -n "$privopt225" ]; then
|
||||
v "dhcp option 225: $privopt225"
|
||||
echo "dhcp option 225: $privopt225" >/dev/console
|
||||
# option225 is allowd to change only once per CPE
|
||||
if [ "$(uci get -q ice.cloud.frozen)" != "1" ] ; then
|
||||
uci set ice.cloud.frozen="1"
|
||||
@@ -522,137 +436,69 @@ parse_dhcp_options()
|
||||
fi
|
||||
fi
|
||||
if [ -n "$privopt226" ]; then
|
||||
v "dhcp option 226: $privopt226"
|
||||
echo "dhcp option 226: $privopt226" >/dev/console
|
||||
[ -z "$(uci get -q ice.dhcp)" ] && uci set ice.dhcp="dhcp"
|
||||
uci set ice.dhcp.opt226connectionid="$privopt226"
|
||||
ubus send dhcp.opt226connectionid '{"opt226connectionid":"","value":"'$privopt226'"}'
|
||||
fi
|
||||
uci commit
|
||||
fi
|
||||
}
|
||||
|
||||
# wait_for_default_gateway to become reachable
|
||||
# return 0 if the default gateway is reachable
|
||||
# return 1 if the default gateway is not reachable after $wait_time
|
||||
wait_for_default_gateway()
|
||||
{
|
||||
local gateway
|
||||
local device
|
||||
local wait_time=120
|
||||
local wait_interval=10
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while [ true ] ; do
|
||||
local iupurl
|
||||
local configurl
|
||||
local software
|
||||
local sofwareminuspath
|
||||
|
||||
gateway=""
|
||||
device=""
|
||||
network_flush_cache
|
||||
network_get_gateway gateway wan #true
|
||||
network_get_device device wan
|
||||
device="${device:+-I }$device"
|
||||
if ping -q -w 1 -c 1 $device $gateway >/dev/null 2>&1 ; then
|
||||
[ "$wait_time" -lt "60" ] && v "Default gateway $gateway is reachable"
|
||||
sleep $wait_interval
|
||||
return 0
|
||||
fi
|
||||
config_load provisioning
|
||||
#check if iup should be used or if its overridden by /etc/config
|
||||
config_get configurl configserver url
|
||||
config_get reboot configserver reboot
|
||||
config_get iupurl iup urliup
|
||||
|
||||
v "Waiting for default gateway. Countdown $wait_time seconds"
|
||||
sleep $wait_interval
|
||||
wait_time=$((wait_time - wait_interval))
|
||||
[ "$wait_time" -le "0" ] && break # timer expired
|
||||
done
|
||||
if [ $configurl ]; then
|
||||
handle_provisioning configserver "0"
|
||||
elif [ $iupurl ]; then
|
||||
handle_provisioning iup "1"
|
||||
else
|
||||
v "No Provisioning Server Found"
|
||||
exit
|
||||
fi
|
||||
|
||||
return 1 # default gateway not reachable
|
||||
}
|
||||
config_load provisioning
|
||||
config_foreach handle_provisioning subconfig "0"
|
||||
config_get software uppgradeserver url
|
||||
sofwareminuspath=${software##*/}
|
||||
v "Software version to download $sofwareminuspath"
|
||||
|
||||
|
||||
main()
|
||||
{
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
-v) export VERBOSE="$(($VERBOSE + 1))";;
|
||||
-q) export VERBOSE="$(($VERBOSE - 1))";;
|
||||
--dhcp-options)
|
||||
shift
|
||||
parse_dhcp_options "$@"
|
||||
exit 0
|
||||
;;
|
||||
-*)
|
||||
echo "Invalid option: $1"
|
||||
exit 1
|
||||
;;
|
||||
*) break;;
|
||||
esac
|
||||
shift;
|
||||
done
|
||||
|
||||
if ! wait_for_default_gateway ; then
|
||||
v "Default gateway is not reachable. Aborting iup."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f $IUPMD5 ]; then
|
||||
v "Creating file $IUPMD5"
|
||||
touch $IUPMD5
|
||||
fi
|
||||
|
||||
|
||||
local iupurl
|
||||
local configurl
|
||||
local software
|
||||
local sofwareminuspath
|
||||
|
||||
config_load provisioning
|
||||
#check if iup should be used or if its overridden by /etc/config
|
||||
config_get configurl configserver url
|
||||
config_get reboot configserver reboot
|
||||
config_get iupurl iup urliup
|
||||
|
||||
if [ $configurl ]; then
|
||||
handle_provisioning configserver "0"
|
||||
elif [ $iupurl ]; then
|
||||
handle_provisioning iup "1"
|
||||
if [ $software ]; then
|
||||
local sysinfo=$(ubus call router.system info)
|
||||
json_load "$sysinfo"
|
||||
json_select system
|
||||
json_get_var firmware firmware
|
||||
json_get_var filesystem filesystem
|
||||
if [ "$filesystem" == "JFFS2" ] ; then
|
||||
firmware=$firmware.w
|
||||
else
|
||||
firmware=$firmware.y
|
||||
fi
|
||||
if [ "$sofwareminuspath" == "${sofwareminuspath/$firmware/}" ] ; then
|
||||
echo $software
|
||||
handle_provisioning uppgradeserver "0"
|
||||
else
|
||||
v "No provisioning server configured"
|
||||
exit
|
||||
v "Will not update software, already up to date"
|
||||
fi
|
||||
fi
|
||||
|
||||
config_load provisioning
|
||||
config_foreach handle_provisioning subconfig "0"
|
||||
config_get software uppgradeserver url
|
||||
sofwareminuspath=${software##*/}
|
||||
if [ $CONF -eq 1 ]; then
|
||||
mv "$IUPMD5.temp" $IUPMD5
|
||||
fi
|
||||
|
||||
if [ $software ]; then
|
||||
v "Software version to download \"$sofwareminuspath\""
|
||||
local sysinfo=$(ubus call router.system info)
|
||||
json_load "$sysinfo"
|
||||
json_select system
|
||||
json_get_var firmware firmware
|
||||
json_get_var filesystem filesystem
|
||||
if [ "$filesystem" == "JFFS2" ] ; then
|
||||
firmware=$firmware.w
|
||||
else
|
||||
firmware=$firmware.y
|
||||
fi
|
||||
if [ "$sofwareminuspath" == "${sofwareminuspath/$firmware/}" ] ; then
|
||||
v "Software \"$software\""
|
||||
handle_provisioning uppgradeserver "0"
|
||||
else
|
||||
v "Will not update software, already up to date"
|
||||
fi
|
||||
fi
|
||||
if [ "$reboot" == "on" ]; then
|
||||
v "Reboot Signaled"
|
||||
/sbin/reboot
|
||||
fi
|
||||
|
||||
if [ $CONF -eq 1 ]; then
|
||||
mv "$IUPMD5.temp" $IUPMD5
|
||||
fi
|
||||
|
||||
if [ "$reboot" == "on" ]; then
|
||||
vv "Rebooting"
|
||||
export REBOOT_REASON=iup
|
||||
/sbin/reboot
|
||||
fi
|
||||
|
||||
rm -rf /var/run/iup.pid
|
||||
}
|
||||
|
||||
main $@
|
||||
rm -rf /var/run/iup.pid
|
||||
|
||||
@@ -29,14 +29,8 @@ endef
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_mips),y)
|
||||
define Package/layer2interface/install
|
||||
$(CP) ./broadcom/* $(1)/
|
||||
endef
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
define Package/layer2interface/install
|
||||
$(CP) ./broadcom/* $(1)/
|
||||
endef
|
||||
endif
|
||||
|
||||
$(eval $(call BuildPackage,layer2interface))
|
||||
|
||||
@@ -156,22 +156,11 @@ wlmngr_startServices() {
|
||||
|
||||
enableBSD() {
|
||||
local wdev wdev_to_steer
|
||||
local enabled policy
|
||||
local rssi_threshold bw_util
|
||||
|
||||
nvram set bsd_role=0
|
||||
nvram unset bsd_ifnames
|
||||
|
||||
enabled="$(uci -q get wireless.bandsteering.enabled)"
|
||||
|
||||
[ "$enabled" == "1" ] || return 1
|
||||
|
||||
policy="$(uci -q get wireless.bandsteering.policy)"
|
||||
policy=${policy:-0}
|
||||
rssi_threshold="$(uci -q get wireless.bandsteering.rssi_threshold)"
|
||||
rssi_threshold=${rssi_threshold:--75}
|
||||
bw_util="$(uci -q get wireless.bandsteering.bw_util)"
|
||||
bw_util=${bw_util:--60}
|
||||
[ "$(uci -q get wireless.status.bsd)" == "1" ] || return 1
|
||||
|
||||
nvram set bsd_role=3
|
||||
nvram set bsd_pport=9878
|
||||
@@ -180,52 +169,30 @@ enableBSD() {
|
||||
nvram set bsd_primary=192.168.1.1
|
||||
nvram set bsd_scheme=2
|
||||
nvram set bsd_poll_interval=1
|
||||
nvram set bsd_bounce_detect="180 2 3600"
|
||||
nvram set bsd_bounce_detect="180 8 3600"
|
||||
nvram set bsd_msglevel=0
|
||||
nvram set bsd_status_poll=5
|
||||
nvram set bsd_status=3
|
||||
nvram set bsd_actframe=1
|
||||
nvram set bsd_steer_no_deauth=1
|
||||
|
||||
for wdev in wl0 wl1; do
|
||||
#if [ "$(uci -q get wireless.$wdev.band_steering)" == "1" ]; then
|
||||
nvram set bsd_ifnames="$(nvram get bsd_ifnames) $wdev"
|
||||
[ "$wdev" == "wl0" ] && wdev_to_steer="wl1" || wdev_to_steer="wl0"
|
||||
|
||||
if [ "$policy" == "0" ]; then
|
||||
# RSSI Threshold based policy #
|
||||
if [ "$(nvram get ${wdev}_nband)" == "2" ]; then
|
||||
# 2.4G
|
||||
nvram set ${wdev}_bsd_if_qualify_policy="0 0x0"
|
||||
nvram set ${wdev}_bsd_if_select_policy=$wdev_to_steer
|
||||
nvram set ${wdev}_bsd_sta_select_policy="20 -60 0 0 1 0 0 0 0 0x42"
|
||||
nvram set ${wdev}_bsd_steer_prefix=$wdev
|
||||
nvram set ${wdev}_bsd_steering_policy="0 0 0 -60 0 0x52"
|
||||
else
|
||||
# 5G
|
||||
nvram set ${wdev}_bsd_if_qualify_policy="30 0x0"
|
||||
nvram set ${wdev}_bsd_if_select_policy=$wdev_to_steer
|
||||
nvram set ${wdev}_bsd_sta_select_policy="20 $rssi_threshold 0 0 1 0 0 0 0 0x40"
|
||||
nvram set ${wdev}_bsd_steer_prefix=$wdev
|
||||
nvram set ${wdev}_bsd_steering_policy="80 5 3 $rssi_threshold 0 0x40"
|
||||
fi
|
||||
if [ "$(nvram get ${wdev}_nband)" == "2" ]; then
|
||||
# 2.4G
|
||||
nvram set ${wdev}_bsd_if_quality_policy="0 0x0 -100"
|
||||
nvram set ${wdev}_bsd_if_select_policy=$wdev_to_steer
|
||||
nvram set ${wdev}_bsd_sta_select_policy="10 0 0 0 1 1 0 0 0 0x400"
|
||||
nvram set ${wdev}_bsd_steer_prefix=$wdev
|
||||
nvram set ${wdev}_bsd_steering_policy="0 5 3 0 0 0x1"
|
||||
else
|
||||
# Bandwidth Usage based policy #
|
||||
if [ "$(nvram get ${wdev}_nband)" == "2" ]; then
|
||||
# 2.4G
|
||||
nvram set ${wdev}_bsd_if_qualify_policy="0 0x0 -75"
|
||||
nvram set ${wdev}_bsd_if_select_policy=$wdev_to_steer
|
||||
nvram set ${wdev}_bsd_sta_select_policy="0 0 0 0 0 1 0 0 0 0x600"
|
||||
nvram set ${wdev}_bsd_steer_prefix=$wdev
|
||||
nvram set ${wdev}_bsd_steering_policy="0 5 3 0 0 0x10"
|
||||
else
|
||||
# 5G
|
||||
nvram set ${wdev}_bsd_if_qualify_policy="40 0x0 -75"
|
||||
nvram set ${wdev}_bsd_if_select_policy=$wdev_to_steer
|
||||
nvram set ${wdev}_bsd_sta_select_policy="0 0 0 0 0 1 0 0 0 0x240"
|
||||
nvram set ${wdev}_bsd_steer_prefix=$wdev
|
||||
nvram set ${wdev}_bsd_steering_policy="$bw_util 5 3 0 0 0x40"
|
||||
fi
|
||||
# 5G
|
||||
nvram set ${wdev}_bsd_if_quality_policy="20 0x0 -75"
|
||||
nvram set ${wdev}_bsd_if_select_policy=$wdev_to_steer
|
||||
nvram set ${wdev}_bsd_sta_select_policy="100 0 0 0 0 1 0 0 0 0x40"
|
||||
nvram set ${wdev}_bsd_steer_prefix=$wdev
|
||||
nvram set ${wdev}_bsd_steering_policy="80 5 3 -75 0 0x40"
|
||||
fi
|
||||
#fi
|
||||
done
|
||||
@@ -353,11 +320,10 @@ wlmngr_finalize() {
|
||||
|
||||
# RADAR THRESHOLD VALUES #
|
||||
local pcid="$(wlctl -i wl$idx revinfo | awk 'FNR == 2 {print}' | cut -d'x' -f2)"
|
||||
local isac="$(db get hw.$pcid.is_ac)"
|
||||
if [ "$isac" == "1" ]; then
|
||||
wlctl -i wl$idx msglevel +radar +dfs 2>/dev/null
|
||||
dhdctl -i wl$idx dconpoll 200 2>/dev/null
|
||||
fi
|
||||
# local isac="$(db get hw.$pcid.is_ac)"
|
||||
# if [ "$isac" == "1" ]; then
|
||||
# wlctl -i $device msglevel +radar +dfs
|
||||
# fi
|
||||
local rdrthrs="$(db get hw.$pcid.radarthrs)"
|
||||
if [ -n "$rdrthrs" ]; then
|
||||
wlctl -i wl$idx radarthrs $rdrthrs
|
||||
|
||||
@@ -58,19 +58,6 @@ ifbaseexists()
|
||||
return 0
|
||||
}
|
||||
|
||||
check_mac_address()
|
||||
{
|
||||
local baseifname="$1"
|
||||
local vlan="$2"
|
||||
local basemac
|
||||
local mac=$(ifconfig -a | grep "^${baseifname}.${vlan} " | awk '{print $NF}')
|
||||
local mac_in_use=$(ifconfig -a | grep "$mac" | grep -v "^${baseifname}.${vlan}[ ]")
|
||||
if [ "$mac_in_use" ]; then
|
||||
basemac=$(ifconfig -a | grep "^$baseifname " | awk '{print $NF}')
|
||||
ifconfig ${baseifname}.${vlan} hw ether $basemac
|
||||
fi
|
||||
}
|
||||
|
||||
addbrcmvlan()
|
||||
{
|
||||
local baseifname=$1
|
||||
@@ -115,11 +102,9 @@ addbrcmvlan()
|
||||
vlanctl --if-create $baseifname $vlan8021q
|
||||
else
|
||||
vlanctl --dhcp-bridged --if-create $baseifname $vlan8021q
|
||||
check_mac_address $baseifname $vlan8021q
|
||||
fi
|
||||
else
|
||||
vlanctl --routed --if-create $baseifname $vlan8021q
|
||||
check_mac_address $baseifname $vlan8021q
|
||||
fi
|
||||
|
||||
if [ "$bridge" -eq 1 ]; then
|
||||
|
||||
@@ -7,7 +7,7 @@ PKG_RELEASE:=1
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/apietila/libtrace.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_VERSION:=e4b4c5cce35a52da152776a00532aa0b80879c5b
|
||||
PKG_SOURCE_VERSION:=HEAD
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
123
mtd-utils/Makefile
Normal file
123
mtd-utils/Makefile
Normal file
@@ -0,0 +1,123 @@
|
||||
#
|
||||
# Copyright (C) 2009-2010 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:=mtd-utils
|
||||
PKG_VERSION:=1.5.1
|
||||
PKG_RELEASE:=3
|
||||
PKG_INSTALL:=1
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=dd9f464eced6af7d5e6a4a920b727421229310f4
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/mtd-utils
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
FILES:= \
|
||||
docfdisk \
|
||||
doc_loadbios \
|
||||
flashcp \
|
||||
flash_erase \
|
||||
flash_lock \
|
||||
flash_otp_dump \
|
||||
flash_otp_info \
|
||||
flash_otp_lock \
|
||||
flash_otp_write \
|
||||
flash_unlock \
|
||||
ftl_check \
|
||||
ftl_format \
|
||||
imagewrite \
|
||||
jffs2dump \
|
||||
jffs2reader \
|
||||
mkfs.jffs2 \
|
||||
mtd_debug \
|
||||
nanddump \
|
||||
nandtest \
|
||||
nandwrite \
|
||||
nftldump \
|
||||
nftl_format \
|
||||
recv_image \
|
||||
rfddump \
|
||||
rfdformat \
|
||||
serve_image \
|
||||
sumtool
|
||||
|
||||
ifneq ($(CONFIG_LINUX_2_4),y)
|
||||
FILES += \
|
||||
mkfs.ubifs \
|
||||
mtdinfo \
|
||||
ubiattach \
|
||||
ubiblock \
|
||||
ubicrc32 \
|
||||
ubidetach \
|
||||
ubiformat \
|
||||
ubimkvol \
|
||||
ubinfo \
|
||||
ubinize \
|
||||
deubinize \
|
||||
ubirename \
|
||||
ubirmvol \
|
||||
ubirsvol \
|
||||
ubiupdatevol
|
||||
endif
|
||||
|
||||
define PartGen
|
||||
define Package/mtd-utils-$(subst _,-,$(1))
|
||||
TITLE:=MTD $(1)
|
||||
URL:=http://www.linux-mtd.infradead.org/
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=mtd-utils +zlib +liblzo +libuuid
|
||||
endef
|
||||
endef
|
||||
|
||||
define Package/mtd-utils
|
||||
TITLE:=Utilities for flash info/debug
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/mtd-utils/description
|
||||
Utilities for manipulating memory technology devices.
|
||||
endef
|
||||
|
||||
define Package/mtd-utils/install
|
||||
true
|
||||
endef
|
||||
|
||||
$(foreach file,$(FILES),$(eval $(call PartGen,$(file))))
|
||||
|
||||
MAKE_FLAGS += \
|
||||
DESTDIR="$(PKG_INSTALL_DIR)" \
|
||||
BUILDDIR="$(PKG_BUILD_DIR)" \
|
||||
LDLIBS+="$(LIBGCC_S)" \
|
||||
WITHOUT_XATTR=1
|
||||
|
||||
ifeq ($(CONFIG_LINUX_2_4),y)
|
||||
MAKE_FLAGS += \
|
||||
SUBDIRS=""
|
||||
endif
|
||||
|
||||
define PartInstall
|
||||
define Package/mtd-utils-$(subst _,-,$(1))/install
|
||||
$(INSTALL_DIR) \
|
||||
$$(1)/usr/sbin
|
||||
|
||||
$(INSTALL_BIN) \
|
||||
$(PKG_INSTALL_DIR)/usr/sbin/$(1) \
|
||||
$$(1)/usr/sbin/
|
||||
endef
|
||||
endef
|
||||
|
||||
$(foreach file,$(FILES),$(eval $(call PartInstall,$(file))))
|
||||
|
||||
$(eval $(call BuildPackage,mtd-utils))
|
||||
$(foreach file,$(FILES),$(eval $(call BuildPackage,mtd-utils-$(subst _,-,$(file)))))
|
||||
@@ -1,41 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=mtk-bndstrg
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=8a804320c53dead1c9b9f3650cbbc58908c76832
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/mtk-bndstrg
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/mtk-bndstrg
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+libpthread +librt
|
||||
TITLE:=Band steering daemon for Mediatek
|
||||
endef
|
||||
|
||||
define Package/mtk-bndstrg/description
|
||||
Band steering for Mediatek
|
||||
endef
|
||||
|
||||
#define Build/Compile
|
||||
#endef
|
||||
|
||||
define Build/Configure
|
||||
#$(call Build/Configure/Default,--with-linux-headers=$(LINUX_DIR))
|
||||
endef
|
||||
|
||||
define Package/mtk-bndstrg/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bndstrg $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,mtk-bndstrg))
|
||||
@@ -27,9 +27,9 @@ failover() {
|
||||
|
||||
add() {
|
||||
|
||||
wan_fail_map=$(echo $wan_fail_map | sed -e "s/\(^\|.*\]\)${1}\[${failchk}\]/\1/g")
|
||||
wan_fail_map=$(echo $wan_fail_map | sed -e "s/${1}\[${failchk}\]//g")
|
||||
wan_fail_map="$wan_fail_map${1}[x]"
|
||||
wan_recovery_map=$(echo $wan_recovery_map | sed -e "s/\(^\|.*\]\)${1}\[${recvrychk}\]/\1/g")
|
||||
wan_recovery_map=$(echo $wan_recovery_map | sed -e "s/${1}\[${recvrychk}\]//g")
|
||||
update_cache
|
||||
|
||||
if [ "$existing_failover" == "2" ]; then
|
||||
@@ -46,8 +46,8 @@ failover() {
|
||||
|
||||
del() {
|
||||
|
||||
wan_recovery_map=$(echo $wan_recovery_map | sed -e "s/\(^\|.*\]\)${1}\[${recvrychk}\]/\1/g")
|
||||
wan_fail_map=$(echo $wan_fail_map | sed -e "s/\(^\|.*\]\)${1}\[${failchk}\]/\1/g")
|
||||
wan_recovery_map=$(echo $wan_recovery_map | sed -e "s/${1}\[${recvrychk}\]//g")
|
||||
wan_fail_map=$(echo $wan_fail_map | sed -e "s/${1}\[${failchk}\]//g")
|
||||
update_cache
|
||||
|
||||
if [ "$existing_failover" == "3" ]; then
|
||||
@@ -70,7 +70,7 @@ fail_wan() {
|
||||
|
||||
local failchk=$(query_config failchk $1)
|
||||
local recvrychk=$(query_config recvrychk $1)
|
||||
wan_recovery_map=$(echo $wan_recovery_map | sed -e "s/\(^\|.*\]\)${1}\[${recvrychk}\]/\1/g")
|
||||
wan_recovery_map=$(echo $wan_recovery_map | sed -e "s/${1}\[${recvrychk}\]//g")
|
||||
|
||||
if [ -z "$failchk" ]; then
|
||||
failchk=1
|
||||
@@ -80,7 +80,7 @@ fail_wan() {
|
||||
if [ "$failchk" != "x" ]; then
|
||||
new_fail_count=$(($failchk + 1))
|
||||
if [ "$new_fail_count" -lt "$health_fail_retries" ]; then
|
||||
wan_fail_map=$(echo $wan_fail_map | sed -e "s/\(^\|.*\]\)${1}\[${failchk}\]/\1${1}\[${new_fail_count}\]/g")
|
||||
wan_fail_map=$(echo $wan_fail_map | sed -e "s/${1}\[${failchk}\]/$1\[${new_fail_count}\]/g")
|
||||
else
|
||||
failover add $1
|
||||
refresh_dns
|
||||
@@ -103,7 +103,7 @@ recover_wan() {
|
||||
local wanid=$(query_config wanid $1)
|
||||
|
||||
if [ ! -z "$failchk" -a "$failchk" != "x" ]; then
|
||||
wan_fail_map=$(echo $wan_fail_map | sed -e "s/\(^\|.*\]\)${1}\[${failchk}\]/\1/g")
|
||||
wan_fail_map=$(echo $wan_fail_map | sed -e "s/${1}\[${failchk}\]//g")
|
||||
update_cache
|
||||
fi
|
||||
|
||||
@@ -117,7 +117,7 @@ recover_wan() {
|
||||
else
|
||||
new_recovery_count=$(($recvrychk + 1))
|
||||
if [ "$new_recovery_count" -lt "$health_recovery_retries" ]; then
|
||||
wan_recovery_map=$(echo $wan_recovery_map | sed -e "s/\(^\|.*\]\)${1}\[${recvrychk}\]/\1${1}\[${new_recovery_count}\]/g")
|
||||
wan_recovery_map=$(echo $wan_recovery_map | sed -e "s/${1}\[${recvrychk}\]/$1\[${new_recovery_count}\]/g")
|
||||
update_cache
|
||||
else
|
||||
failover del $1
|
||||
@@ -138,12 +138,11 @@ acquire_wan_data() {
|
||||
local old_gateway
|
||||
|
||||
local ifname ipaddr gateway
|
||||
network_flush_cache
|
||||
network_get_device ifname ${1} || ifname=x
|
||||
network_get_ipaddr ipaddr ${1} || ipaddr=x
|
||||
network_get_gateway gateway ${1} || gateway=x
|
||||
|
||||
check_old_map=$(echo $wan_id_map 2>&1 | grep -o -e "^$1\[" -e "\]$1\[")
|
||||
check_old_map=$(echo $wan_id_map 2>&1 | grep -o "$1\[")
|
||||
|
||||
if [ -z $check_old_map ]; then
|
||||
wancount=$(($wancount + 1))
|
||||
@@ -161,9 +160,9 @@ acquire_wan_data() {
|
||||
old_ifname=$(query_config ifname $1)
|
||||
get_wanid=$(query_config wanid $1)
|
||||
|
||||
wan_if_map=$(echo $wan_if_map | sed -e "s/\(^\|.*\]\)${1}\[${old_ifname}\]/\1${1}\[${ifname}\]/g")
|
||||
wan_ip_map=$(echo $wan_ip_map | sed -e "s/\(^\|.*\]\)${1}\[${old_ipaddr}\]/\1${1}\[${ipaddr}\]/g")
|
||||
wan_gw_map=$(echo $wan_gw_map | sed -e "s/\(^\|.*\]\)${1}\[${old_gateway}\]/\1${1}\[${gateway}\]/g")
|
||||
wan_if_map=$(echo $wan_if_map | sed -e "s/${1}\[${old_ifname}\]/$1\[${ifname}\]/g")
|
||||
wan_ip_map=$(echo $wan_ip_map | sed -e "s/${1}\[${old_ipaddr}\]/$1\[${ipaddr}\]/g")
|
||||
wan_gw_map=$(echo $wan_gw_map | sed -e "s/${1}\[${old_gateway}\]/$1\[${gateway}\]/g")
|
||||
|
||||
if [ "$old_ifname" != "$ifname" ]; then
|
||||
iptables -D MultiWanPreHandler -t mangle -i $old_$ifname -m state --state NEW -j FW${get_wanid}MARK
|
||||
@@ -206,14 +205,14 @@ update_cache() {
|
||||
|
||||
query_config() {
|
||||
case $1 in
|
||||
ifname) echo $wan_if_map | grep -o -e "^$2\[\w*.*\]" -e "\]$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
|
||||
ipaddr) echo $wan_ip_map | grep -o -e "^$2\[\w*.*\]" -e "\]$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
|
||||
gateway) echo $wan_gw_map | grep -o -e "^$2\[\w*.*\]" -e "\]$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
|
||||
wanid) echo $wan_id_map | grep -o -e "^$2\[\w*.*\]" -e "\]$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
|
||||
failchk) echo $wan_fail_map | grep -o -e "^$2\[\w*.*\]" -e "\]$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
|
||||
recvrychk) echo $wan_recovery_map | grep -o -e "^$2\[\w*.*\]" -e "\]$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
|
||||
monitor) echo $wan_monitor_map | grep -o -e "^$2\[\w*.*\]" -e "\]$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
|
||||
group) echo $wan_id_map | grep -o "\w*\[$2\]" | awk -F "[" '{print $1}';;
|
||||
ifname) echo $wan_if_map | grep -o "$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
|
||||
ipaddr) echo $wan_ip_map | grep -o "$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
|
||||
gateway) echo $wan_gw_map | grep -o "$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
|
||||
wanid) echo $wan_id_map | grep -o "$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
|
||||
failchk) echo $wan_fail_map | grep -o "$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
|
||||
recvrychk) echo $wan_recovery_map | grep -o "$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
|
||||
monitor) echo $wan_monitor_map | grep -o "$2\[\w*.*\]" | awk -F "[" '{print $2}' | awk -F "]" '{print $1}';;
|
||||
group) echo $wan_id_map | grep -o "\w*\[$2\]" | awk -F "[" '{print $1}';;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -436,34 +435,6 @@ mwanrule() {
|
||||
add_rule
|
||||
}
|
||||
|
||||
|
||||
get_dns_servers() {
|
||||
local group=$1
|
||||
local groups=$1
|
||||
local dns=""
|
||||
local dnss=""
|
||||
local aliases=""
|
||||
local g
|
||||
|
||||
aliases="$(uci show network| grep =\'@$group\')"
|
||||
|
||||
for g in $aliases ; do
|
||||
g=${g#*.}; g=${g%%.*}
|
||||
[ "$(uci -q get network.$g)" == "interface" ] || continue
|
||||
groups="$groups $g"
|
||||
done
|
||||
|
||||
groups="$(echo $groups | tr ' ' '\n' | sort -u | tr '\n' ' ')"
|
||||
|
||||
for group in $groups ; do
|
||||
network_get_dnsserver dns ${group}
|
||||
dnss="$dnss $dns"
|
||||
done
|
||||
|
||||
echo $dnss
|
||||
}
|
||||
|
||||
|
||||
refresh_dns() {
|
||||
local dns
|
||||
local group
|
||||
@@ -474,8 +445,6 @@ refresh_dns() {
|
||||
local compile_dns
|
||||
local dns_server
|
||||
|
||||
network_flush_cache
|
||||
|
||||
iptables -F MultiWanDNS -t mangle
|
||||
|
||||
rm /tmp/resolv.conf.auto
|
||||
@@ -492,8 +461,8 @@ refresh_dns() {
|
||||
failchk=$(query_config failchk $group)
|
||||
|
||||
dns=$(uci_get_state multiwan ${group} dns 'auto')
|
||||
[ "$dns" == "auto" ] && dns=$(get_dns_servers $group)
|
||||
dns=$(echo $dns | sed -e "s/\,/ /g" | sed -e "s/ /\n/g")
|
||||
[ "$dns" == "auto" ] && network_get_dnsserver dns ${group}
|
||||
dns=$(echo $dns | sed -e "s/ /\n/g")
|
||||
|
||||
if [ ! -z "$dns" -a "$failchk" != "x" -a "$ipaddr" != "x" -a "$gateway" != "x" -a "$ifname" != "x" ]; then
|
||||
echo "$dns" | while read dns_server; do
|
||||
@@ -853,7 +822,6 @@ monitor_wan() {
|
||||
while :; do
|
||||
[ "${health_monitor%.*}" = 'parallel' ] && sleep $health_interval
|
||||
|
||||
network_flush_cache
|
||||
network_get_device ifname ${1} || ifname=x
|
||||
network_get_ipaddr ipaddr ${1} || ipaddr=x
|
||||
network_get_gateway gateway ${1} || gateway=x
|
||||
@@ -924,7 +892,7 @@ monitor_wan() {
|
||||
fi
|
||||
|
||||
[ "$health_monitor" = 'serial' ] && {
|
||||
wan_monitor_map=$(echo $wan_monitor_map | sed -e "s/\(^\|.*\]\)${1}\[\w*\]/\1${1}\[$(date +%s)\]/g")
|
||||
wan_monitor_map=$(echo $wan_monitor_map | sed -e "s/$1\[\w*\]/$1\[$(date +%s)\]/g")
|
||||
update_cache
|
||||
break
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ PKG_NAME:=peripheral_manager
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=ff2cf8bfbd3a04731088e9f4540796696e961382
|
||||
PKG_SOURCE_VERSION:=db710fed768e20fba40212e11fa4191593e168fc
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se/peripheral_manager
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
|
||||
|
||||
USE_PROCD=0
|
||||
NAME=peripheral_led_normal
|
||||
|
||||
start_service() {
|
||||
ubus -t 2 wait_for led.status
|
||||
ubus call led.status set '{"state":"ok"}'
|
||||
ubus -t 2 wait_for button
|
||||
}
|
||||
|
||||
|
||||
@@ -16,12 +16,11 @@ start_service() {
|
||||
|
||||
service_running() {
|
||||
ubus -t 2 wait_for led.status
|
||||
ubus call led.status set '{"state":"notice"}'
|
||||
ubus call led.status set '{"state":"ok"}'
|
||||
ubus -t 2 wait_for button
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
ubus call leds set '{"state":"alloff"}'
|
||||
service_stop /sbin/peripheral_manager
|
||||
stop() {
|
||||
service_stop /sbin/peripheral_manager
|
||||
}
|
||||
|
||||
|
||||
@@ -130,10 +130,7 @@ set_port_pause() {
|
||||
}
|
||||
|
||||
start_service() {
|
||||
[ -f /sbin/db ] && check_for_config
|
||||
|
||||
[ -f /usr/sbin/ethswctl -a -f /usr/sbin/ethctl ] || return
|
||||
|
||||
check_for_config
|
||||
config_load ports
|
||||
config_foreach configure_ethports ethport
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=questd
|
||||
PKG_VERSION:=3.1.38
|
||||
PKG_VERSION:=3.1.25
|
||||
|
||||
PKG_SOURCE_VERSION:=85785b97a1526114ae521beacb1b302c3cb914ab
|
||||
PKG_SOURCE_VERSION:=a53d9b949da052a6fb3ad49bff422821853ed0bc
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/questd
|
||||
|
||||
@@ -19,31 +19,24 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_mips),y)
|
||||
QUESTD_TARGET:=-DIOPSYS_BROADCOM
|
||||
QUESTD_CLFAGS:=-DIOPSYS_BROADCOM
|
||||
KERNEL_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
QUESTD_TARGET:=-DIOPSYS_BROADCOM
|
||||
QUESTD_CLFAGS:=-DIOPSYS_BROADCOM
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_linksys),y)
|
||||
QUESTD_TARGET:=-DIOPSYS_MARVELL
|
||||
QUESTD_CLFAGS:=-DIOPSYS_MARVELL
|
||||
else ifeq ($(CONFIG_TARGET_lantiq_xrx500),y)
|
||||
QUESTD_TARGET:=-DIOPSYS_LANTIQ
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_ramips_ex400),y)
|
||||
QUESTD_TARGET:=-DIOPSYS_MEDIATEK
|
||||
QUESTD_CFLAGS:=\
|
||||
-I$(STAGING_DIR)/usr/include \
|
||||
-I$(STAGING_DIR)/usr/include/libnl-tiny
|
||||
QUESTD_CLFAGS:=-DIOPSYS_LANTIQ
|
||||
else
|
||||
$(info (UNEXPECTED CONFIG TARGET))
|
||||
endif
|
||||
QUESTD_CFLAGS:=$(QUESTD_CFLAGS) $(QUESTD_TARGET)
|
||||
|
||||
export QUESTD_TARGET
|
||||
export KERNEL_DIR
|
||||
export QUESTD_CFLAGS
|
||||
export QUESTD_CLFAGS
|
||||
|
||||
define Package/questd
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+libuci +libubox +ubus +libpthread +(TARGET_iopsys_ramips_ex400):swconfig +(TARGET_iopsys_ramips_ex400):libnl-tiny
|
||||
DEPENDS:=+libuci +libubox +ubus +libpthread
|
||||
TITLE:=router info daemon
|
||||
endef
|
||||
|
||||
@@ -57,9 +50,11 @@ define Package/questd/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/questd $(1)/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wificontrol $(1)/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/graphd $(1)/sbin/
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/netcheck $(1)/usr/bin/
|
||||
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/router.sh $(1)/usr/libexec/rpcd/router
|
||||
#$(INSTALL_BIN) $(PKG_BUILD_DIR)/wps.sh $(1)/usr/libexec/rpcd/wps
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,questd))
|
||||
|
||||
@@ -11,18 +11,10 @@ start_service() {
|
||||
procd_set_param command "/sbin/questd"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "/sbin/graphd"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
|
||||
pidof imonitor > /dev/null 2>&1 || /sbin/imonitor &
|
||||
}
|
||||
|
||||
stop() {
|
||||
service_stop /sbin/questd
|
||||
service_stop /sbin/graphd
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
|
||||
@@ -1,223 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
# 1. sleep for $SLEEP_LONG seconds
|
||||
# 2. run the check_* functions
|
||||
# 3. sleep for $SLEEP_SHORT seconds
|
||||
# 4. go to step 2. $SAMPLES-1 times (step 2. will run $SAMPLES times)
|
||||
# 5. go to step 1.
|
||||
SAMPLES=4
|
||||
SLEEP_SHORT=2
|
||||
SLEEP_LONG=10
|
||||
|
||||
# worst-case scenario:
|
||||
# quest will be restarted in:
|
||||
# SLEEP_LONG + (SAMPLES-1)*SLEEP_SHORT + UBUS_TIMEOUT + epsilon =
|
||||
# = 21 seconds
|
||||
|
||||
# number of process
|
||||
NPROC_LIMIT=2 # the value that is considered to be wrong (and above)
|
||||
NPROC_COUNT=4 # number of time that the NPROC_LIMIT has to be hit to trigger a process restart
|
||||
NPROC_NFAIL=0 # current consecutive Number of FAILures. process restarts when NPROC_NFAIL == NPROC_COUNT
|
||||
|
||||
# memmory limit
|
||||
MEM_LIMIT=50000
|
||||
MEM_COUNT=4
|
||||
MEM_NFAIL=0
|
||||
|
||||
# procentage of CPU usage
|
||||
PCPU_LIMIT=38
|
||||
PCPU_COUNT=4
|
||||
PCPU_NFAIL=0
|
||||
|
||||
UBUS_TIMEOUT=5
|
||||
|
||||
|
||||
BSDBIN=$(which bsd)
|
||||
ACSDBIN=$(which acsd)
|
||||
|
||||
restart_questd()
|
||||
{
|
||||
logger -s -t $0[$$] "Restarting questd. $NPROC_NFAIL $MEM_NFAIL $PCPU_NFAIL"
|
||||
|
||||
killall -q -KILL questd
|
||||
/etc/init.d/quest stop
|
||||
killall -q -KILL questd
|
||||
/etc/init.d/quest start
|
||||
|
||||
NPROC_NFAIL=0
|
||||
MEM_NFAIL=0
|
||||
PCPU_NFAIL=0
|
||||
}
|
||||
|
||||
|
||||
check_nproc()
|
||||
{
|
||||
local nproc="$@"
|
||||
|
||||
if [ "$nproc" -ge "$NPROC_LIMIT" -o "$nproc" -eq "0" ]; then
|
||||
NPROC_NFAIL=$((NPROC_NFAIL + 1))
|
||||
else
|
||||
NPROC_NFAIL=0
|
||||
fi
|
||||
|
||||
[ "$NPROC_NFAIL" -ge "$NPROC_COUNT" ] && return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
check_mem()
|
||||
{
|
||||
local mem="$@"
|
||||
local ok=true
|
||||
|
||||
for m in $mem; do
|
||||
if [ "$m" -ge "$MEM_LIMIT" ]; then
|
||||
ok=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
[ "$ok" = "true" ] && MEM_NFAIL=0
|
||||
[ "$ok" = "false" ] && MEM_NFAIL=$((MEM_NFAIL + 1))
|
||||
|
||||
[ "$MEM_NFAIL" -ge "$MEM_COUNT" ] && return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
check_pcpu()
|
||||
{
|
||||
local pcpu="$@"
|
||||
local ok=true
|
||||
|
||||
for p in $pcpu; do
|
||||
p=${p%%%*}
|
||||
if [ "$p" -ge "$PCPU_LIMIT" ]; then
|
||||
ok=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
[ "$ok" = "true" ] && PCPU_NFAIL=0
|
||||
[ "$ok" = "false" ] && PCPU_NFAIL=$((PCPU_NFAIL + 1))
|
||||
|
||||
[ "$PCPU_NFAIL" -ge "$PCPU_COUNT" ] && return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
check_ubuscall()
|
||||
{
|
||||
local rv
|
||||
|
||||
ubus -t $UBUS_TIMEOUT call router.system info >/dev/null 2>&1
|
||||
rv=$?
|
||||
|
||||
[ "$rv" = "0" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
restart_bsd()
|
||||
{
|
||||
logger -s -t $0[$$] "Restarting bsd."
|
||||
killall -q -KILL bsd
|
||||
bsd
|
||||
}
|
||||
|
||||
check_bsdcall()
|
||||
{
|
||||
local rv
|
||||
|
||||
bsd -s >/dev/null 2>&1
|
||||
rv=$?
|
||||
|
||||
[ "$rv" == "0" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
restart_acsd()
|
||||
{
|
||||
logger -s -t $0[$$] "Restarting acsd."
|
||||
killall -q -KILL acsd
|
||||
acsd &
|
||||
}
|
||||
|
||||
check_acsd()
|
||||
{
|
||||
local topline pcpu p
|
||||
|
||||
topline=$(top -bn1 | grep "[a]csd")
|
||||
pcpu=$(echo -en "$topline" | awk '{print $7}')
|
||||
|
||||
for p in $pcpu; do
|
||||
p=${p%%%*}
|
||||
if [ "$p" -ge "20" ]; then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
main()
|
||||
{
|
||||
local topline nproc mem pcpu
|
||||
local restart_nproc restart_mem restart_pcpu
|
||||
local sample=1
|
||||
local bsdenabled
|
||||
|
||||
while true ; do
|
||||
|
||||
# collect info
|
||||
topline=$(top -bn1 | grep "/sbin/[q]uestd" | grep -v monitor)
|
||||
|
||||
nproc=$(echo -n "$topline" | awk 'END{print NR}')
|
||||
check_nproc $nproc
|
||||
restart_nproc=$?
|
||||
|
||||
mem=$(echo -en "$topline" | awk '{print $5}')
|
||||
check_mem $mem
|
||||
restart_mem=$?
|
||||
|
||||
pcpu=$(echo -en "$topline" | awk '{print $7}')
|
||||
check_pcpu $pcpu
|
||||
restart_pcpu=$?
|
||||
|
||||
# do the restart
|
||||
if [ "$restart_nproc" = "1" -o \
|
||||
"$restart_mem" = "1" -o \
|
||||
"$restart_pcpu" = "1" ]
|
||||
then
|
||||
# check_ubuscall || restart_questd
|
||||
restart_questd
|
||||
fi
|
||||
|
||||
if [ "$BSDBIN" ] ; then
|
||||
config_load wireless
|
||||
config_get_bool bsdenabled bandsteering enabled 0
|
||||
if [ $bsdenabled == "1" -a "$(pidof wifi)" == "" ] ; then
|
||||
check_bsdcall || restart_bsd
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$ACSDBIN" ] ; then
|
||||
check_acsd || restart_acsd
|
||||
fi
|
||||
|
||||
# sleep
|
||||
if [ "$sample" -lt "$SAMPLES" ]; then
|
||||
sample=$((sample + 1))
|
||||
sleep $SLEEP_SHORT
|
||||
else
|
||||
sample=1
|
||||
sleep $SLEEP_LONG
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
main $@
|
||||
@@ -3,4 +3,5 @@ config samba
|
||||
option 'workgroup' 'IntenoSMB'
|
||||
option 'description' 'IntenoSMB'
|
||||
option 'homes' '0'
|
||||
option 'interface' 'lan'
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ PKG_NAME:=tptest
|
||||
PKG_VERSION:=1.3
|
||||
PKG_RELEASE:=0
|
||||
|
||||
PKG_SOURCE_VERSION:=57786908e7a0c790f303417b459c562887582384
|
||||
PKG_SOURCE_VERSION:=4dfab45a92328226c8182347df50e86a5d72ca5f
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/tptest
|
||||
|
||||
|
||||
@@ -3,6 +3,14 @@ config testserver '1'
|
||||
option port '1640'
|
||||
|
||||
config testserver '2'
|
||||
option server 'tptest.dataphone.se'
|
||||
option port '1640'
|
||||
|
||||
config testserver '3'
|
||||
option server 'referens.sth.ip-performance.se'
|
||||
option port '1642'
|
||||
|
||||
config testserver '4'
|
||||
option server 'tptest.songnetworks.se'
|
||||
option port '1640'
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=u-boot
|
||||
PKG_VERSION:=2016.08
|
||||
PKG_RELEASE:=2
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/uboot
|
||||
PKG_RELEASE:=1
|
||||
PKG_SOURCE_URL:=git@private.inteno.se:uboot
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=fccb9d5ee720a9f60cba917ded83e5cebe221eef
|
||||
PKG_SOURCE_VERSION:=e925b36e4e29416aac7f2a64ef40d44ef034d4c4
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
@@ -61,11 +61,6 @@ endif
|
||||
define Build/Configure
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
$(UBOOT_CONFIG)_config
|
||||
|
||||
$(SED) "s,CONFIG_INTENO_MAJOR=\"0\",CONFIG_INTENO_MAJOR=\"$(PKG_RELEASE)\"," $(PKG_BUILD_DIR)/.config
|
||||
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
oldconfig
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
@@ -76,15 +71,10 @@ define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/uboot/install/default
|
||||
$(CP) ./files/* $$(1)/
|
||||
$(INSTALL_DIR) $(BIN_DIR)/$(TARGET)
|
||||
$(INSTALL_DIR) $$(1)/boot
|
||||
$(CP) \
|
||||
$(PKG_BUILD_DIR)/uboot.img \
|
||||
$(BIN_DIR)/$(TARGET)/
|
||||
$(CP) \
|
||||
$(PKG_BUILD_DIR)/uboot.img \
|
||||
$$(1)/boot
|
||||
$(INSTALL_DIR) $$(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/env/fw_printenv $$(1)/usr/sbin/
|
||||
ln -s /usr/sbin/fw_printenv $$(1)/usr/sbin/fw_setenv
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=50
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
|
||||
sanity_check_env(){
|
||||
|
||||
# make sure iboot is used to start board, but only if verify_boot != 1
|
||||
# that allows a person to change the bootcmd and not have it overwritten automatically
|
||||
# but still force it to iboot for old boards.
|
||||
vb=$(fw_printenv -n verify_boot 2>/dev/null)
|
||||
|
||||
if [ "1" != "$verify_boot" ]
|
||||
then
|
||||
if ! fw_printenv -n bootcmd 2>/dev/null| grep iboot >/dev/null
|
||||
then
|
||||
echo "update uboot boot command"
|
||||
fw_setenv bootcmd "rescue;iboot"
|
||||
fw_setenv verify_boot 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# just set 115200 baudrate as it is really hardcoded in the binary blob
|
||||
fw_setenv baudrate 115200
|
||||
}
|
||||
|
||||
uboot_upgrade(){
|
||||
echo "doing upgrade of u-boot old version $cur_Major.$cur_Minor new version $Major.$Minor"
|
||||
mtd erase /dev/mtd0
|
||||
mtd write /boot/uboot.img /dev/mtd0
|
||||
|
||||
sanity_check_env
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
iver=$(fw_printenv -n uboot_inteno_version 2>/dev/null)
|
||||
|
||||
if [ -z "$iver" ]
|
||||
then
|
||||
# if this variable is not set by u-boot the u-boot version is too old.
|
||||
uboot_upgrade
|
||||
return
|
||||
fi
|
||||
|
||||
# read in current version into Major Minor variables
|
||||
json_init
|
||||
json_load $(echo $iver |sed -e 's/938f0820-2ffb-11e7-bbc9-2f21351ee6fb: //')
|
||||
json_get_vars Major Minor
|
||||
|
||||
# echo "Major $Major"
|
||||
# echo "Minor $Minor"
|
||||
|
||||
cur_Major=$Major
|
||||
cur_Minor=$Minor
|
||||
|
||||
# read in new uboot version into Major Minor variables
|
||||
json_load $(strings /boot/uboot.img | grep 938f0820-2ffb-11e7-bbc9-2f21351ee6fb |sed -e 's/938f0820-2ffb-11e7-bbc9-2f21351ee6fb: //')
|
||||
json_get_vars Major Minor
|
||||
|
||||
# echo "Major $Major"
|
||||
# echo "Minor $Minor"
|
||||
|
||||
if [ $Major -gt $cur_Major ]
|
||||
then
|
||||
uboot_upgrade
|
||||
return
|
||||
fi
|
||||
|
||||
if [ $Major -eq $cur_Major -a $Minor -gt $cur_Minor ]
|
||||
then
|
||||
uboot_upgrade
|
||||
return
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ define Package/voice-client
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=voice-client
|
||||
DEPENDS:=+asterisk13
|
||||
DEPENDS:=+asterisk18-mod
|
||||
endef
|
||||
|
||||
define Package/voice-client/description
|
||||
|
||||
@@ -336,7 +336,6 @@ get_bindaddr() {
|
||||
local bindaddr=""
|
||||
|
||||
[ -n "$intf" ] && network_get_ipaddr bindaddr "$intf"
|
||||
[ -z "$bindaddr" ] && network_get_ipaddr6 bindaddr "$intf"
|
||||
echo "${bindaddr:-0.0.0.0}"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user