Compare commits

...

60 Commits

Author SHA1 Message Date
Sukru Senli
1a23fa2100 asterisk updated 2017-03-22 17:09:15 +01:00
Sukru Senli
a8b5d9342f questd updated 2017-03-22 17:09:05 +01:00
Erik Horemans
4a2c4eeb43 new ice-client R4.3.0-RC6 2017-03-17 13:19:59 +01:00
Sukru Senli
c582f8fe78 brcmwifi: use correct parameter for bsd 2017-03-17 09:50:09 +01:00
Sukru Senli
3258c4901b brcmwifi: nvram bsd values from Broadcom for RSSI threshold 2017-03-15 17:37:15 +01:00
Erik Horemans
c5eb40a768 new ice-client R4.3.0-RC4 2017-03-15 17:22:13 +01:00
Sukru Senli
3729531725 ice-client: fix typo in depedency 2017-03-14 10:23:29 +01:00
Sukru Senli
489f802667 questd updated 2017-03-13 17:23:11 +01:00
Sukru Senli
49f9fdcd37 asterisk: sleep 1 second before asterisk core reload 2017-03-13 17:20:52 +01:00
Erik Horemans
1d2e44c047 new ice-client 4.3.0-RC2 2017-03-13 17:20:09 +01:00
Sukru Senli
6c62a2b55d brcmwifi: bsd no deauth set in nvram 2017-03-10 14:53:31 +01:00
Sukru Senli
2fc14ab7b6 tptest: remove non working tptest server 2017-03-07 15:10:16 +01:00
Alex Oprea
8450eb0222 questd-monitor: possibly improve the restart procedure 2017-03-06 13:19:13 +01:00
Alex Oprea
6da9baae20 questd-monitor: start questd if it's not running 2017-03-06 13:19:09 +01:00
Sukru Senli
24d3a8ff8f questd updated 2017-03-06 13:18:33 +01:00
Sukru Senli
4510fab7b5 tptest: remove unavailable server 2017-03-06 11:23:02 +01:00
Sukru Senli
6693e8b044 questd updated 2017-03-06 09:52:15 +01:00
Sukru Senli
a96536863c questd updated 2017-03-03 11:11:01 +01:00
Kenneth Johansson
e7ccc17227 Update feed [ feed_inteno_packages ] package [ peripheral_manager ]
-------------------------------------------------------------------------------
* abe5807 mem leak: add missing file to previous mem fix patch
-------------------------------------------------------------------------------
commit abe58070db6a616eb4f24304f0613c9d67a77775
Author: Kenneth Johansson <kenneth@southpole.se>
Date: 2017-02-24 18:23:15 +0100

    mem leak: add missing file to previous mem fix patch

Base directory -> /
 src/catv.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 52 insertions(+), 5 deletions(-)
-------------------------------------------------------------------------------
2017-02-26 13:26:15 +01:00
Kenneth Johansson
a866f53300 Update feed [ feed_inteno_packages ] package [ peripheral_manager ]
-------------------------------------------------------------------------------
* 664864a Fix compile for bradcom targets (mips/arm).
* 1a5ba03 mem leak fix.
* 0434260 Add missed interrupt handler for touch panel.
* 3008d04 add support for gpio buttons using linux gpio interface.
* d57bb3f Add support for leds using linux gpio interface.
* 70137e9 Include touch driver sx9512 on all platforms.
-------------------------------------------------------------------------------
commit 664864adeb06d23569f27de91b9c743881d99ee4
Author: Kenneth Johansson <kenneth@southpole.se>
Date: 2017-02-24 16:38:36 +0100

    Fix compile for bradcom targets (mips/arm).

Base directory -> /
 Makefile.am | 4 +++-
 src/gpio.h  | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)
-------------------------------------------------------------------------------
commit 1a5ba03b502a0910b5648b26b1051b0e59c4ff28
Author: Kenneth Johansson <kenneth@southpole.se>
Date: 2017-02-23 18:02:08 +0100

    mem leak fix.

    So blob_buf_init needs to have a blob_buf_free or else we leak memory.

    This is not done in the ubus example client so if you copy that code you
    have a memory leak.

Base directory -> /
 src/button.c       |  5 +++++
 src/catv_monitor.c |  7 +++++++
 src/led.c          |  2 ++
 src/sfp.c          | 22 +++++++++++++++++++++-
 4 files changed, 35 insertions(+), 1 deletion(-)
-------------------------------------------------------------------------------
commit 04342602acb00420c5e5cb4e83807d55ccc4b42f
Author: Kenneth Johansson <kenneth@southpole.se>
Date: 2016-11-18 19:17:24 +0100

    Add missed interrupt handler for touch panel.

    missed this file from last commit.

Base directory -> /
 src/touch_sx9512.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
-------------------------------------------------------------------------------
commit 3008d04ed46d82f98fc2078333d1c76b6c03de1b
Author: Kenneth Johansson <kenneth@southpole.se>
Date: 2016-11-18 18:51:02 +0100

    add support for gpio buttons using linux gpio interface.

Base directory -> /
 Makefile.am       |  2 +-
 src/button.c      | 10 ++++++----
 src/gpio.h        |  4 ++++
 src/gpio_button.c | 32 +++++++++++++++++++++++++++++++-
 src/gpio_led.c    |  2 +-
 src/gpio_linux.c  | 34 ++++++++++++++++++++++++++++++++--
 6 files changed, 75 insertions(+), 9 deletions(-)
-------------------------------------------------------------------------------
commit d57bb3f171a1c4383dbc9d6cff7a104b310a61fe
Author: Kenneth Johansson <kenneth@southpole.se>
Date: 2016-11-17 20:41:18 +0100

    Add support for leds using linux gpio interface.

Base directory -> /
 Makefile.am       |  9 ++++----
 src/gpio.h        | 14 +++++++++++++
 src/gpio_button.c |  1 -
 src/gpio_led.c    | 16 +++++++++-----
 src/gpio_linux.c  | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/server.c      |  6 +++---
 6 files changed, 96 insertions(+), 13 deletions(-)
-------------------------------------------------------------------------------
commit 70137e9ef89f43e71b455c8445dd33ae03b06bf6
Author: Kenneth Johansson <kenneth@southpole.se>
Date: 2016-11-17 17:18:07 +0100

    Include touch driver sx9512 on all platforms.

    Was only compiled in on broadcom based platform. But is now also needed for
    mediatek SOC (ex400).

Base directory -> /
 Makefile.am        |  8 ++++----
 src/gpio.h         |  5 ++++-
 src/server.c       |  2 +-
 src/sx9512.c       |  6 ++++--
 src/sx9512.h       |  4 ++++
 src/touch_sx9512.c | 12 ++++++++----
 6 files changed, 25 insertions(+), 12 deletions(-)
-------------------------------------------------------------------------------
2017-02-24 17:03:41 +01:00
Sukru Senli
f2856573ba iup: add options 225 and 226 to reqopts by default 2017-02-22 10:22:03 +01:00
Sukru Senli
62ffc9d09f iup: set option43 url in provisioning.iup.urlcwmp as well 2017-02-22 10:18:32 +01:00
Erik Horemans
a62b4af959 new ice-client 4.2.0-RC7 2017-02-20 16:37:56 +01:00
Sukru Senli
b51bbf8a81 questd updated 2017-02-14 13:40:56 +01:00
Sukru Senli
cae188c58f brcmwifi: rssi threshold based policy is working 2017-02-11 15:19:40 +01:00
Erik Horemans
b378f9d282 new ice-client 4.2.0-RC5 2017-02-11 12:17:27 +01:00
Erik Horemans
8991729ba9 new ice-client 4.2.0-RC4 2017-02-11 12:17:23 +01:00
Erik Horemans
83f844710b new ice-client 4.2.0-RC3 2017-02-11 12:17:15 +01:00
Erik Horemans
a54afcfd71 new ice-client 4.2.0-RC2 2017-02-11 12:17:10 +01:00
Alex Oprea
b97967ccca iup: reduce verbose level. do not output messages to console
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
c37874b635 iup: init script: redirect a copy of the log messages to console
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
40bdae09b0 iup: reload: use ubus call uci commit
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
40ae768fad iup: improve logging messages
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
c94d1cbb2e iup: provisioninig: add log messages for scheduling and unscheduling
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
d518078c59 iup: polling.enabled: implement functionality
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
e2a4d61ec9 iup: wait_for_default_gateway: increase timers to 120 10
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
75dfbb9f0b iup: wait_for_default_gateway: add interface for ping
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
d4ab4b545e iup: wait_for_default_gateway
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
9922c9cdf2 iup: init.d script: always start iup
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
e7b63568cc iup: verbose on 3 levels: -v ,-v -v, -v -v -v
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
173040e05a iup: refactor code: add main and parse_dhcp_functions
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
6c62ea0d11 iup: option 132: use verbose function instead of logger
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
8f32bea7e2 iup: improve config checksums log message
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
4827f77d53 iup: improve the log messages and debug output
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
a7831be487 iup: improve dhcp options parsing, comments and debug output
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
b869f70925 iup: reboot: improve log, output message and reboot reason
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
988c64dab7 iup: fix iup tmp directory path
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
a79d4ad6f2 iup: do not use the verbose function before parsing the args
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
0281d75a7d iup: improve the message logging function
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Alex Oprea
7f257980a2 iup: remove whitespaces
Signed-off-by: Sukru Senli <sukru.senli@inteno.se>
2017-02-11 12:14:35 +01:00
Sukru Senli
2bda0c8231 questd-updated: added new inteno mac range 2017-02-11 12:08:21 +01:00
Reidar Cederqvist
dd1feb9bd0 added a check that fixes doubble macs on vlans 2017-02-11 11:57:57 +01:00
Sukru Senli
ed107abe0e questd updated 2017-01-30 17:57:42 +01:00
Sukru Senli
7968558847 questd-updated 2017-01-27 11:29:44 +01:00
Alex Oprea
692fced9f9 questd: questd-monitor: remove dummy set 2017-01-25 19:21:16 +01:00
Alex Oprea
7f467c553a questd: add quest-monitor script refs #11253 2017-01-25 19:16:28 +01:00
Sukru Senli
c6383f1d0d asterisk: create hotplug directory 2017-01-25 17:51:23 +01:00
Sukru Senli
db87f6c673 asterisk: do not stop boot process #11083 2017-01-25 17:51:20 +01:00
Sukru Senli
32a6438946 brcmwifi: policy based band steering 2017-01-25 17:51:16 +01:00
Sukru Senli
ebbe738a6b icwmp-3.0-2017-01-20 2017-01-25 17:51:08 +01:00
14 changed files with 467 additions and 222 deletions

View File

@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=asterisk18-mod
PKG_VERSION:=1.8.10.1
PKG_SOURCE_VERSION:=62c3764e6765fa9b1d22cb5dda26476e4742bdcf
PKG_SOURCE_VERSION:=ee99af0d91a2197529b13075d802ebc37e644e40
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=http://public.inteno.se:/asterisk-1.8.x
@@ -455,6 +455,8 @@ 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

View File

@@ -0,0 +1,18 @@
#!/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"
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

View File

@@ -9,26 +9,9 @@ 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
@@ -56,6 +39,8 @@ 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"

View File

@@ -19,14 +19,14 @@ 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.1.0
PKG_RELEASE:=RC8
BASE_PKG_VERSION:=4.3.0
PKG_RELEASE:=RC6
PKG_VERSION:=$(BASE_PKG_VERSION)-$(PKG_RELEASE)_$(DATE)_$(LOGIN)
export PKG_VERSION
###########################--RELEASE--################################
PKG_SOURCE_VERSION:=5d13d0034c0174cdb6d66f09a458851fe54d810e
PKG_SOURCE_VERSION:=bd9dbd00ff9175e0d8e6a46fba8309b251927663
ifeq ($(CONFIG_ICE_OPEN),y)
BRCM_KERNEL_PROFILE=$(shell echo $(CONFIG_BCM_KERNEL_PROFILE) | sed s/\"//g)
PKG_SOURCE_URL:=http://iopsys.inteno.se/iopsys/consumer/
@@ -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 +uclibcxx +libubus +ubus +ubusd +jshn +libubox +libpthread
DEPENDS:=+libopenssl +libstdcpp +libubus +ubus +ubusd +jshn +libubox +libpthread
endef
define Package/ice-client/config

View File

@@ -8,11 +8,11 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=icwmp
PKG_VERSION:=3.0-2017-01-17
PKG_VERSION:=3.0-2017-01-20
PKG_FIXUP:=autoreconf
PKG_SOURCE_URL:=http://public.inteno.se:/icwmp.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=cfe4253f37e127c9ef405802beeec05d3507cc6a
PKG_SOURCE_VERSION:=5c39d8d99127010c8d553495cd318ced80531a04
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)

View File

@@ -31,19 +31,16 @@ management_interfaces() {
}
init_iup() {
local polling_enabled
local interval
local starttime
local nummber
number=$RANDOM
if [ -f $CRONPATH ]; then
echo "File $CRONPATH exists"
else
echo "File $CRONPATH did not exists"
touch $CRONPATH
fi
[ -f $CRONPATH ] || touch $CRONPATH
config_load provisioning
config_get polling_enabled polling enabled on
config_get interval polling interval
config_get starttime polling starttime
@@ -54,12 +51,12 @@ init_iup() {
local newreqopts=
local baseopts=
local reqopts="$(uci -q get network.$net.reqopts)"
local iupopts="66 67 128 224"
local iupopts="66 67 128 224 225 226"
local ropt iopt
config_get enabled iup enabled "on"
for ropt in $reqopts; do
case $ropt in
66|67|128|224) ;;
66|67|128|224|225|226) ;;
*) baseopts="$baseopts $ropt" ;;
esac
done
@@ -67,7 +64,7 @@ init_iup() {
reqopts="$baseopts $iupopts"
for ropt in $reqopts; do
case $ropt in
66|67|128|224) [ $enabled == "on" ] && newreqopts="$newreqopts $ropt" ;;
66|67|128|224|225|226) [ $enabled == "on" ] && newreqopts="$newreqopts $ropt" ;;
*) newreqopts="$newreqopts $ropt" ;;
esac
done
@@ -82,8 +79,18 @@ 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='*'
@@ -91,9 +98,7 @@ init_iup() {
interval='*'
fi
let "number %= $RANGE"
if grep -q "$starttime \* \* \\$interval /sbin/iup" "$CRONPATH" ; then
echo "IUP is scheduled $starttime \* \* \\$interval "
else
if ! grep -q "$starttime \* \* \\$interval /sbin/iup" "$CRONPATH" ; then
if grep -q "iup" "$CRONPATH" ; then
sed -i "/iup/d" $CRONPATH
fi
@@ -101,15 +106,14 @@ 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
test_default_route
if [ "$?" -eq 0 ]; then
/sbin/iup -v &
fi
/sbin/iup -v &
}
stop_service() {

View File

@@ -26,28 +26,15 @@ 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" -ge 1 ] && logger -t iup "$@"
}
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
[ "$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
}
get_packages()
@@ -61,35 +48,13 @@ get_packages()
reload ()
{
local reload
local initlist
local reload
local pack
pack=$(get_packages $1)
config_load ucitrack
v "Calling ubus call uci commit for $pack"
for packname in $pack
do
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
ubus call uci commit '{"config":"'$packname'"}'
done
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() {
@@ -117,15 +82,15 @@ handle_provisioning() {
config_get deckey "$config" deckey
if [ "$enabled" -eq 1 ]; then
if [ "$config" == "iup" ]; then
v "using url from dhcp options"
v "Using url received in dhcp options"
config_get url "$config" urliup
else
else
config_get url "$config" url
fi
url=${url//\$MAC/$MAC}
v "Download from $url"
while [ $retry -le $RETRYSTOP ]
v "Downloading from url \"$url\""
while [ $retry -le $RETRYSTOP ]
do
if [ ${url%%:*} == "tftp" ]; then
tftpfile=${url#*\/\/}
@@ -137,10 +102,10 @@ handle_provisioning() {
get_image "$url" "cat" > $IUPCONFFILES
fi
if [ -s $IUPCONFFILES ]; then
v "File Downloaded"
v "Download finished"
retry=$((RETRYSTOP + 1))
else
v "Download failed will try again in $incsleep sec"
else
v "Download failed, retrying in $incsleep seconds"
sleep $incsleep
incsleep=$((incsleep * retry + number))
retry=$((retry+1))
@@ -163,35 +128,35 @@ 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 "Found Config"
v "Downloaded file is an unencrypted 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 Already Up to Date"
#becuse config is up to date we need to disable last step reboot if set
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
reboot="off"
rm -rf $IUPTEMP
else
cd /tmp/iup/
cd $IUPTEMP
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 "$pack packages to be commited"
v "Packages to be commited: $pack"
for packname in $pack
do
uci commit $packname
@@ -207,11 +172,11 @@ handle_Downloaded_file()
fi
;;
*)
v "encrypted"
v "Downloaded file is an encrypted config"
if [ $KEY ]; then
openssl enc -d -des-ede -nosalt -K $KEY -iv "0000000000000000" -in $IUPCONFFILES -out $IUPCONFFILES.tmp
if [ $? -eq 0 ]; then
v "Decrypted Content"
v "Decryption successful"
mv $IUPCONFFILES.tmp $IUPCONFFILES
handle_Downloaded_file
else
@@ -227,11 +192,12 @@ handle_Downloaded_file()
;;
esac
else
v "Image found will start flashing"
v "Downloaded file is a firmware, will start reflashing"
if [ "$defaultreset" -eq 1 ]; then
v "nuke config"
v "Not saving configuration over reflash"
/sbin/sysupgrade -v -n $IUPCONFFILES
else
v "Saving configuration over reflash"
/sbin/sysupgrade -v $IUPCONFFILES
fi
fi
@@ -253,7 +219,7 @@ change_to_vlan() {
# bring down old interface/device.
ifdown "${base_dev}"
logger -t dhcp_opt132 "bringing down old if: ${base_dev}"
v "option 132: bringing down old if: ${base_dev}"
# extract base name of device.
base_dev=$(echo ${base_dev} | cut -d. -f1)
@@ -267,15 +233,15 @@ change_to_vlan() {
uci set layer2_interface_vlan.@vlan_interface[-1].baseifname=${base_dev}
# and commit the change.
uci commit layer2_interface_vlan
logger -t dhcp_opt132 "committed update to file layer2_interface_vlan"
v "option 132: committed update to file layer2_interface_vlan"
# reload configuration files.
/etc/init.d/layer2_interface_vlan reload
logger -t dhcp_opt132 "reload layer2_interface_vlan config"
v "option 132: reload layer2_interface_vlan config"
# replace old interface (like eth0.1 with new eth0.101).
wan_if=$(uci get network.$3.ifname)
logger -t dhcp_opt132 "old network.${3}.ifname: $wan_if"
v "option 132: old network.${3}.ifname: $wan_if"
# loop through the string, remove any word close to "base_dev".
for word in ${wan_if}; do
@@ -293,10 +259,12 @@ change_to_vlan() {
uci set network.wan.ifname="${new_wan_if}"
# and commit the change.
uci commit network
logger -t dhcp_opt132 "committed update to file network: ifname=${new_wan_if}"
v "option 132: committed update to file network: ifname=${new_wan_if}"
# reboot into new if configuration.
reboot
v "Rebooting"
export REBOOT_REASON=iup
/sbin/reboot
}
handle_option224()
@@ -347,69 +315,67 @@ handle_option224()
softwareminuspath=${url##*/}
if [ $url ] && [ $active -eq 1 ]; then
echo "Software version to download $softwareminuspath"
v "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
echo "Image found $url will start flashing"
v "Firmware found $url will start flashing"
v "Currently running firmware: \"$firmware\""
v "Newly received firmware: \"$firmware_new\""
wait_for_dns $url
v "Start flashing"
/sbin/sysupgrade -v $url &
return 1
else
echo "Will not update software, already up to date"
v "Firmware is up to date, nothing to do"
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
# Process IUP related DHCP options #
if [ -n "$1" ]; then
parse_dhcp_options()
{
local the_json="$@"
# Process IUP related DHCP options #
local privopt224 privopt225 privopt226 vendorspecinf httpurl128
local tftp bootfile vlanid vlanpriority interface
json_load "$1"
json_load "$the_json"
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
json_get_var vendorspecinf vendorspecinf # option 43
json_get_var httpurl128 httpurl128
json_get_var tftp tftp
json_get_var bootfile bootfile
json_get_var vlanid vlanid
json_get_var vlanpriority vlanpriority
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"
if [ $privopt224 ]; then
echo "Option224 recived " $privopt224 > /dev/console
v "dhcp option 224 firmware url $privopt224"
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
@@ -417,17 +383,17 @@ if [ -n "$1" ]; then
fi
fi
# if we get vlanid and maybe vlanpriority, configure for that.
# vlanid (and vlanpriority)
if [ -n "$vlanid" -a -n "$vlanpriority" ]; then
logger -t dhcp_opt132 "vlanid: ${vlanid}, vlanpriority: ${vlanpriority}"
v "dhcp option 132 vlanid: ${vlanid} vlanpriority: ${vlanpriority}"
change_to_vlan ${vlanid} ${vlanpriority} ${interface}
elif [ -n "$vlanid" ]; then
logger -t dhcp_opt132 "vlanid: ${vlanid}"
v "dhcp option 132 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
echo "dhcp option 225: $privopt225" >/dev/console
v "dhcp option 225: $privopt225"
# option225 is allowd to change only once per CPE
if [ "$(uci get -q ice.cloud.frozen)" != "1" ] ; then
uci set ice.cloud.frozen="1"
@@ -436,69 +402,137 @@ if [ -n "$1" ]; then
fi
fi
if [ -n "$privopt226" ]; then
echo "dhcp option 226: $privopt226" >/dev/console
v "dhcp option 226: $privopt226"
[ -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
}
exit 0
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
local iupurl
local configurl
local software
local sofwareminuspath
while [ true ] ; do
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
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
if [ $configurl ]; then
handle_provisioning configserver "0"
elif [ $iupurl ]; then
handle_provisioning iup "1"
else
v "No Provisioning Server Found"
exit
fi
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
config_load provisioning
config_foreach handle_provisioning subconfig "0"
config_get software uppgradeserver url
sofwareminuspath=${software##*/}
v "Software version to download $sofwareminuspath"
return 1 # default gateway not reachable
}
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 "Will not update software, already up to date"
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
fi
if [ $CONF -eq 1 ]; then
mv "$IUPMD5.temp" $IUPMD5
fi
if [ ! -f $IUPMD5 ]; then
v "Creating file $IUPMD5"
touch $IUPMD5
fi
if [ "$reboot" == "on" ]; then
v "Reboot Signaled"
/sbin/reboot
fi
rm -rf /var/run/iup.pid
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"
else
v "No provisioning server configured"
exit
fi
config_load provisioning
config_foreach handle_provisioning subconfig "0"
config_get software uppgradeserver url
sofwareminuspath=${software##*/}
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 [ $CONF -eq 1 ]; then
mv "$IUPMD5.temp" $IUPMD5
fi
if [ "$reboot" == "on" ]; then
v "Rebooting"
export REBOOT_REASON=iup
/sbin/reboot
fi
rm -rf /var/run/iup.pid
}
main $@

View File

@@ -156,11 +156,22 @@ 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
[ "$(uci -q get wireless.status.bandsteering)" == "1" ] || return 1
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}
nvram set bsd_role=3
nvram set bsd_pport=9878
@@ -169,30 +180,52 @@ 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 8 3600"
nvram set bsd_bounce_detect="180 2 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 [ "$(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"
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
else
# 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"
# 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
fi
#fi
done

View File

@@ -58,6 +58,19 @@ 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
@@ -102,9 +115,11 @@ 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

View File

@@ -12,7 +12,7 @@ PKG_NAME:=peripheral_manager
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_SOURCE_VERSION:=db710fed768e20fba40212e11fa4191593e168fc
PKG_SOURCE_VERSION:=abe58070db6a616eb4f24304f0613c9d67a77775
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=http://public.inteno.se/peripheral_manager

View File

@@ -8,7 +8,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=questd
PKG_VERSION:=3.1.28
PKG_SOURCE_VERSION:=44105d2003ad530b8ba4e85fd6ac06850aec1f4c
PKG_SOURCE_VERSION:=14aff338da3a30f5f543547a71b1ece1561d1895
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=http://public.inteno.se:/questd

View File

@@ -11,6 +11,8 @@ start_service() {
procd_set_param command "/sbin/questd"
procd_set_param respawn
procd_close_instance
pidof questd-monitor > /dev/null 2>&1 || /sbin/questd-monitor &
}
stop() {

160
questd/files/sbin/questd-monitor Executable file
View File

@@ -0,0 +1,160 @@
#!/bin/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
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
}
main()
{
local topline nproc mem pcpu
local restart_nproc restart_mem restart_pcpu
local sample=1
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
fi
# sleep
if [ "$sample" -lt "$SAMPLES" ]; then
sample=$((sample + 1))
sleep $SLEEP_SHORT
else
sample=1
sleep $SLEEP_LONG
fi
done
}
main $@

View File

@@ -3,14 +3,6 @@ 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'