mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-27 22:50:19 +08:00
Compare commits
1 Commits
fbt_dev
...
asterisk13
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd29a10221 |
@@ -1,47 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-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_RELEASE:=1
|
||||
PKG_VERSION:=0.1
|
||||
PKG_SOURCE_URL:=git@private.inteno.se:brcmslic
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=837ec19e37650e424e77c921672a0806e198ba7b
|
||||
PKG_NAME:=brcmslic
|
||||
|
||||
|
||||
RSTRIP:=true
|
||||
export BUILD_DIR
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/brcmslic
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Brcmslic
|
||||
URL:=
|
||||
DEPENDS:=
|
||||
endef
|
||||
|
||||
define Package/brcmslic/description
|
||||
Brcmslic
|
||||
endef
|
||||
|
||||
|
||||
define Package/brcmslic/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/brcmslic $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/endpt $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,brcmslic))
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
config dect 'dect'
|
||||
option radio 'auto'
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
|
||||
config service 'catv'
|
||||
option enable '0'
|
||||
option enable 'no'
|
||||
option filter '3'
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2016 Nikil Mehta <nikil.mehta@gmail.com>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=fping
|
||||
PKG_VERSION:=4.0
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://fping.org/dist/
|
||||
PKG_HASH:=67eb4152b98ad34f99d2eec4e1098a0bb52caf13c0c89cd147349d08190fe8ce
|
||||
|
||||
PKG_MAINTAINER:=Nikil Mehta <nikil.mehta@gmail.com>
|
||||
PKG_LICENSE:=BSD-4-Clause
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/fping
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=sends ICMP ECHO_REQUEST packets to network hosts
|
||||
URL:=http://fping.org/
|
||||
endef
|
||||
|
||||
|
||||
define Package/fping/description
|
||||
fping is a ping like program which uses the Internet Control Message Protocol
|
||||
(ICMP) echo request to determine if a target host is responding. fping
|
||||
differs from ping in that you can specify any number of targets on the command
|
||||
line, or specify a file containing the lists of targets to ping. Instead of
|
||||
sending to one target until it times out or replies, fping will send out a
|
||||
ping packet and move on to the next target in a round-robin fashion.
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS+= \
|
||||
--enable-ipv4 \
|
||||
--enable-ipv6
|
||||
|
||||
TARGET_CFLAGS += -std=gnu99
|
||||
|
||||
define Package/fping/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/fping $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,fping))
|
||||
@@ -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:=5.0.1
|
||||
PKG_RELEASE:=RC1
|
||||
BASE_PKG_VERSION:=4.4.0
|
||||
PKG_RELEASE:=RC4
|
||||
PKG_VERSION:=$(BASE_PKG_VERSION)-$(PKG_RELEASE)_$(DATE)_$(LOGIN)
|
||||
export PKG_VERSION
|
||||
|
||||
###########################--RELEASE--################################
|
||||
|
||||
PKG_SOURCE_VERSION:=a2635dd11c477d70728ab6cbe5c2dee3965dbe14
|
||||
PKG_SOURCE_VERSION:=e855fdb65ec312e9ec044ce9319d6ac17fde57cd
|
||||
ifeq ($(CONFIG_ICE_OPEN),y)
|
||||
TARGET_PROFILE=$(shell echo $(CONFIG_TARGET_BOARD) | sed s/\"//g)
|
||||
PKG_SOURCE_URL:=http://iopsys.inteno.se/iopsys/consumer/
|
||||
@@ -154,7 +154,6 @@ define Package/ice-client/install
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/etc/config/ice $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/iopsys
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/server.ini $(1)/etc/iopsys
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/defaults.ini $(1)/etc/iopsys
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/modify.ini $(1)/etc/iopsys
|
||||
$(INSTALL_DIR) $(1)/etc/iopsys/certificates
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/cert_server_ca.pem $(1)/etc/iopsys/certificates
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
grep -rq "^ice:" /etc/passwd || {
|
||||
adduser -D -H -s /bin/false ice
|
||||
local password="$(db get hw.board.wpaKey)"
|
||||
if [ -n "$password" ]; then
|
||||
adduser -D -H -s /bin/false ice
|
||||
(echo $password; sleep 1; echo $password) | passwd ice >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
uci -q delete passwords.ice
|
||||
uci -q set passwords.ice=usertype
|
||||
uci -q set passwords.ice.password="\$WPAKEY"
|
||||
uci -q add_list passwords.ice._access_r=root
|
||||
uci -q commit passwords
|
||||
|
||||
uci show rpcd | grep username=.*ice.* >/dev/null || {
|
||||
cat >> /etc/config/rpcd << EOF
|
||||
|
||||
@@ -49,7 +47,6 @@ config login
|
||||
list write 'juci-network-netifd'
|
||||
list write 'juci-owsd'
|
||||
list write 'juci-printer'
|
||||
list write 'juci-realtime-graphs'
|
||||
list write 'juci-samba'
|
||||
list write 'juci-sfp'
|
||||
list write 'juci-snmpd'
|
||||
@@ -59,7 +56,6 @@ config login
|
||||
list write 'juci-usb'
|
||||
list write 'core'
|
||||
list write 'unauthenticated'
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=3.0-2017-11-24
|
||||
PKG_VERSION:=3.0-2017-05-01
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/icwmp.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=d74b88913f676ebf9a210c4674555d080e57ff52
|
||||
PKG_SOURCE_VERSION:=5a1b5c439524c56dca7a1921d4cf2fcd2d4c1ff0
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
@@ -66,10 +66,6 @@ define Build/Prepare
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TARGET_IBOARDID),"EX400")
|
||||
TARGET_CFLAGS += -DEX400
|
||||
endif
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-D_GNU_SOURCE -D_AADJ
|
||||
|
||||
@@ -133,11 +129,9 @@ define Package/icwmp-$(BUILD_VARIANT)/install
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/cwmp $(1)/etc/config
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/firewall.cwmp $(1)/etc/firewall.cwmp
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init/icwmpd.init $(1)/etc/init.d/icwmpd
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init/icwmpd.init $(1)/etc/init.d/icwmpd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/uci-defaults/90-cwmpfirewall $(1)/etc/uci-defaults/90-cwmpfirewall
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(CP) ./files/icwmp.hotplug $(1)/etc/hotplug.d/iface/90-icwmp
|
||||
ifeq ($(CONFIG_CWMP_SCRIPTS_FULL),y)
|
||||
$(INSTALL_DIR) $(1)/usr/share/icwmp
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/defaults $(1)/usr/share/icwmp
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
grep -q "Designated" /etc/banner || exit 0
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
[ "$ACTION" == "ifup" ] || exit 0
|
||||
|
||||
local islan="$(uci -q get network.$INTERFACE.is_lan)"
|
||||
[ "$islan" == "1" ] && exit 0
|
||||
|
||||
local proto="$(uci -q get network.$INTERFACE.proto)"
|
||||
[ "$proto" == "none" ] && exit 0
|
||||
|
||||
local ifname="$(uci -q get network.$INTERFACE.ifname)"
|
||||
[ "${ifname:0:1}" == "@" ] && exit 0
|
||||
|
||||
mkdir -p /tmp/ipv4
|
||||
|
||||
local previpaddr=""
|
||||
local curipaddr=""
|
||||
local ipaddrfile=/tmp/ipv4/$INTERFACE-ipaddr
|
||||
previpaddr=$(cat $ipaddrfile 2>/dev/null)
|
||||
network_get_ipaddr curipaddr $INTERFACE
|
||||
[ -n "$curipaddr" ] && echo $curipaddr > $ipaddrfile || rm -f $ipaddrfile
|
||||
|
||||
local prevgateway=""
|
||||
local curgateway=""
|
||||
local gatewayfile=/tmp/ipv4/$INTERFACE-gateway
|
||||
prevgateway=$(cat $gatewayfile 2>/dev/null)
|
||||
network_get_gateway curgateway $INTERFACE
|
||||
[ -n "$curgateway" ] && echo $curgateway > $gatewayfile || rm -f $gatewayfile
|
||||
|
||||
local prevsubnets=""
|
||||
local cursubnets=""
|
||||
local subnetsfile=/tmp/ipv4/$INTERFACE-subnets
|
||||
prevsubnets=$(cat $subnetsfile 2>/dev/null)
|
||||
network_get_subnets cursubnets $INTERFACE
|
||||
[ -n "$cursubnets" ] && echo $cursubnets > $subnetsfile || rm -f $subnetsfile
|
||||
|
||||
[ "$previpaddr" = "$curipaddr" -a "$prevgateway" = "$curgateway" -a "$prevsubnets" = "$cursubnets" ] && exit 0
|
||||
|
||||
[ -f /etc/config/cwmp ] && /etc/init.d/icwmpd reload &
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2013 Inteno
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=ifbt
|
||||
PKG_VERSION:=0.1
|
||||
|
||||
PKG_SOURCE_VERSION:=da97d6668d3c0e3f2be226c66b406e90179ada81
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=git@private.inteno.se:ifbt.git
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ifbt
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json +libjson-c
|
||||
TITLE:=Fast BSS Transition
|
||||
endef
|
||||
|
||||
define Package/ifbt/description
|
||||
ifbt is Iopsys application for fast BSS transition
|
||||
endef
|
||||
|
||||
define Package/ifbt/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ifbt $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ifbt))
|
||||
@@ -12,7 +12,7 @@ PKG_NAME:=inbd
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=92f918d26c0ffc22d1704f5ea6cbb0bd7fdbdab9
|
||||
PKG_SOURCE_VERSION:=2d474e9ff37b9cfcffd4b9ac8eba8db03eb38a21
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se/inbd
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/inteno-netmodes
|
||||
CATEGORY:=Base system
|
||||
DEPENDS:=+fping
|
||||
TITLE:=Predefined Network Modes
|
||||
endef
|
||||
|
||||
|
||||
53
inteno-netmodes/files/etc/hotplug.d/iface/01-netmode-firewall-handler
Executable file
53
inteno-netmodes/files/etc/hotplug.d/iface/01-netmode-firewall-handler
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/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
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$INTERFACE" != "wan" ] && exit
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
network_get_ipaddr ip $INTERFACE
|
||||
repeaterready="$(uci -q get netmode.setup.repeaterready)"
|
||||
|
||||
[ -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
|
||||
/etc/init.d/firewall reload
|
||||
}
|
||||
|
||||
is_inteno_macaddr()
|
||||
{
|
||||
macaddr=$1
|
||||
|
||||
echo $macaddr | grep -i -e "^00:22:07" \
|
||||
-e "^02:22:07" \
|
||||
-e "^44:D4:37" \
|
||||
-e "^00:0C:07" \
|
||||
-e "^02:0C:07" \
|
||||
-e "^06:0C:07" \
|
||||
-e "^00:0C:43" \
|
||||
-e "^02:0C:43" \
|
||||
-e "^06:0C:43" \
|
||||
&& return
|
||||
false
|
||||
}
|
||||
|
||||
switch_mode() {
|
||||
[ "$repeaterready" == "1" ] || return
|
||||
|
||||
# flush the ip on br-lan; br-lan will anyhow be deleted.
|
||||
# this is needed if the ip received on the wan is also from the same net
|
||||
ip addr flush dev br-lan
|
||||
|
||||
# flush iptables in case the MASTER
|
||||
# tries to configure us before
|
||||
# firewall is disabled the proper way
|
||||
iptables -F
|
||||
|
||||
ubus call leds set '{"state" : "allflash"}'
|
||||
|
||||
local ret=0
|
||||
# let netmode-conf up to 20 seconds before switching mode
|
||||
for tm in 2 4 6 8; do
|
||||
if [ -f /tmp/wificontrol.txt ]; then
|
||||
ret=1
|
||||
break
|
||||
fi
|
||||
sleep $tm
|
||||
done
|
||||
|
||||
# let netmode-conf take over
|
||||
[ $ret -eq 1 ] && return
|
||||
|
||||
# go head with switching mode
|
||||
touch -f /tmp/switching_mode
|
||||
echo "Switching to 'extender' mode" > /dev/console
|
||||
uci -q set netmode.setup.curmode='repeater'
|
||||
uci set netmode.setup.repeaterready=0
|
||||
uci commit netmode
|
||||
/etc/init.d/netmode reload
|
||||
echo "Restarting network services" > /dev/console
|
||||
ubus call network reload
|
||||
wifi reload nodat
|
||||
ubus call router.network reload
|
||||
ubus call leds set '{"state" : "normal"}'
|
||||
rm -f /tmp/switching_mode
|
||||
}
|
||||
|
||||
test_ip() {
|
||||
if [ -n "$(echo $ip | grep -E '^(192\.168|10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.)')" ]; then
|
||||
# private IP
|
||||
switch_mode
|
||||
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 -9 $pid
|
||||
pid="$(pidof netmode-client-detect)"
|
||||
[ "$pid" == "" ] && /sbin/netmode-client-detect &
|
||||
|
||||
# set default JUCI page to overview
|
||||
uci -q set juci.juci.homepage="overview"
|
||||
uci commit juci
|
||||
}
|
||||
fi
|
||||
}
|
||||
|
||||
case "$(uci -q get netmode.setup.curmode)" in
|
||||
repeater*) test_ip ;;
|
||||
*) [ "$repeaterready" == "1" ] && test_ip 1;;
|
||||
esac
|
||||
|
||||
@@ -1,251 +0,0 @@
|
||||
#!/bin/sh
|
||||
# this scripts shifts the lan network prefixes
|
||||
# if a wan interface has the same network prefix.
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/network.sh
|
||||
|
||||
local lockfile="/tmp/70-shiftrange.lock"
|
||||
local restricted_nets=""
|
||||
local all_nets=""
|
||||
|
||||
|
||||
#####
|
||||
##### initial functions
|
||||
#####
|
||||
|
||||
initial_check()
|
||||
{
|
||||
# run only on ifup
|
||||
[ "$ACTION" == "ifup" ] || exit 0
|
||||
|
||||
# run only for uplink (not is_lan) interfaces
|
||||
local islan="$(uci -q get network.$INTERFACE.is_lan)"
|
||||
[ "$islan" != "1" ] || exit 0
|
||||
|
||||
# run only if the uplink interface has a configured protocol
|
||||
local proto="$(uci -q get network.$INTERFACE.proto)"
|
||||
[ "$proto" != "none" ] || exit 0
|
||||
}
|
||||
|
||||
finish()
|
||||
{
|
||||
lock -u $lockfile
|
||||
rm -f $lockfile
|
||||
}
|
||||
|
||||
# just one instance of this script at a time
|
||||
just_one_instance()
|
||||
{
|
||||
local counter=0
|
||||
local limit=10
|
||||
|
||||
#wait for the lock to become free
|
||||
while [ -e $lockfile ] ; do
|
||||
sleep 1
|
||||
counter=$((counter + 1))
|
||||
[ "$counter" -gt "$limit" ] && exit 1
|
||||
done
|
||||
|
||||
lock $lockfile
|
||||
trap finish EXIT INT TERM
|
||||
}
|
||||
|
||||
|
||||
#####
|
||||
##### helper functions
|
||||
#####
|
||||
|
||||
#given a an ip and a mask in the form of "192.168.1.1/24"
|
||||
#return the network address like "192.168.1.0/24"
|
||||
get_network_address()
|
||||
{
|
||||
local ip="$1"
|
||||
[ -z "$ip" ] && return
|
||||
|
||||
local prefix=${ip##*/}
|
||||
|
||||
local ip1=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip2=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip3=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip4=${ip%%/*}
|
||||
|
||||
local ip=$((($ip1 << 24) + ($ip2 << 16) + ($ip3 << 8) + $ip4))
|
||||
local mask=$((0xFFFFFFFF >> (32 - $prefix) << (32 - $prefix)))
|
||||
local network=$(($ip & $mask))
|
||||
|
||||
local n1=$((($network & 0xFF000000) >> 24))
|
||||
local n2=$((($network & 0x00FF0000) >> 16))
|
||||
local n3=$((($network & 0x0000FF00) >> 8))
|
||||
local n4=$(( $network & 0x000000FF))
|
||||
|
||||
echo "$n1.$n2.$n3.$n4/$prefix"
|
||||
}
|
||||
|
||||
#given a network address (192.168.1.0/24)
|
||||
#find the next network address (192.168.2.0/24)
|
||||
next_network_address()
|
||||
{
|
||||
local ip=$1
|
||||
local prefix=${ip##*/}
|
||||
|
||||
local ip1=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip2=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip3=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip4=${ip%%/*}
|
||||
|
||||
local ip=$((($ip1 << 24) + ($ip2 << 16) + ($ip3 << 8) + $ip4))
|
||||
local one=$((1 << (32-$prefix)))
|
||||
local new=$(($ip + $one))
|
||||
|
||||
local n1=$((($new & 0xFF000000) >> 24))
|
||||
local n2=$((($new & 0x00FF0000) >> 16))
|
||||
local n3=$((($new & 0x0000FF00) >> 8))
|
||||
local n4=$(( $new & 0x000000FF))
|
||||
|
||||
echo "$n1.$n2.$n3.$n4/$prefix"
|
||||
}
|
||||
|
||||
# given a network address and a prefix (192.168.2.0/24)
|
||||
# return the first host ip available (192.168.2.1)
|
||||
first_host_in_network ()
|
||||
{
|
||||
local ip=$1
|
||||
local prefix=${ip##*/}
|
||||
|
||||
local ip1=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip2=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip3=${ip%%.*} ; ip=${ip#*.*}
|
||||
local ip4=${ip%%/*}
|
||||
|
||||
local ip=$((($ip1 << 24) + ($ip2 << 16) + ($ip3 << 8) + $ip4))
|
||||
local new=$(($ip + 1))
|
||||
|
||||
local n1=$((($new & 0xFF000000) >> 24))
|
||||
local n2=$((($new & 0x00FF0000) >> 16))
|
||||
local n3=$((($new & 0x0000FF00) >> 8))
|
||||
local n4=$(( $new & 0x000000FF))
|
||||
|
||||
echo "$n1.$n2.$n3.$n4"
|
||||
}
|
||||
|
||||
# given a network address,
|
||||
# find the next available network address.
|
||||
shift_range()
|
||||
{
|
||||
local net="$1"
|
||||
while true ; do
|
||||
if [ "$restricted_nets" == "${restricted_nets//$net/}" ] && [ "$all_nets" == "${all_nets//$net/}" ]; then
|
||||
# found a net that is not in restricted nets nor in all nets
|
||||
break
|
||||
fi
|
||||
net=$(next_network_address $net)
|
||||
done
|
||||
|
||||
echo "$net"
|
||||
}
|
||||
|
||||
|
||||
#####
|
||||
##### parse all interfaces section
|
||||
#####
|
||||
|
||||
# restricted_nets = all the IPs on wan interfaces
|
||||
# all_nets = all the IPs on any interface
|
||||
parse_interface()
|
||||
{
|
||||
local interface=$1
|
||||
local nets="" # "192.168.1.1/24"
|
||||
local networks="" # "192.168.1.0/24"
|
||||
|
||||
config_get is_lan $interface is_lan
|
||||
network_get_subnets nets $interface
|
||||
|
||||
for n in $nets ; do
|
||||
networks="$networks $(get_network_address $n)"
|
||||
done
|
||||
|
||||
[ "$is_lan" != "1" ] && restricted_nets="$restricted_nets $networks"
|
||||
all_nets="$all_nets $networks"
|
||||
}
|
||||
|
||||
# parse all the interfaces
|
||||
# get all the IPs on wan interfaces and store them in restrict_nets
|
||||
# get all the IPs on all interfaces and store them in all_nets
|
||||
parse_interfaces()
|
||||
{
|
||||
config_foreach parse_interface "interface"
|
||||
}
|
||||
|
||||
|
||||
#####
|
||||
##### parse all lan interfaces section
|
||||
#####
|
||||
|
||||
parse_lan()
|
||||
{
|
||||
local interface=$1
|
||||
local nets=""
|
||||
local ips=""
|
||||
local newips=""
|
||||
local ips_changed=0
|
||||
|
||||
[ "$interface" == "loopback" ] && return
|
||||
config_get is_lan $interface is_lan
|
||||
[ "$is_lan" == "1" ] || return
|
||||
|
||||
network_get_subnets ips $interface
|
||||
|
||||
for ip in $ips ; do
|
||||
net="$(get_network_address $ip)"
|
||||
|
||||
if [ "$restricted_nets" == "${restricted_nets//$net/}" ] ; then
|
||||
# net is not in restricted nets
|
||||
# append ip to newips
|
||||
[ -z "$newips" ] && newips="${ip%/*}" || newips="$newips ${ip%/*}"
|
||||
continue
|
||||
fi
|
||||
|
||||
#net is in restricted_nets
|
||||
local newnet=$(shift_range $net)
|
||||
local newip="$(first_host_in_network $newnet)"
|
||||
# append newip to newips
|
||||
[ -z "$newips" ] && newips="$newip" || newips="$newips $newip"
|
||||
|
||||
ips_changed=1
|
||||
logger "$0: Changing the ip on interface $interface from $ip to $newip/${newnet##*/}"
|
||||
echo "$0: Changing the ip on interface $interface from $ip to $newip/${newnet##*/}" >/dev/console
|
||||
done
|
||||
|
||||
#assign the new ips
|
||||
if [ "$ips_changed" == "1" ] ; then
|
||||
uci -q set network.$interface.ipaddr="$newips"
|
||||
fi
|
||||
}
|
||||
|
||||
# parse all the interface with is_lan=1
|
||||
parse_lans()
|
||||
{
|
||||
config_foreach parse_lan "interface"
|
||||
}
|
||||
|
||||
|
||||
#####
|
||||
##### main
|
||||
#####
|
||||
|
||||
main()
|
||||
{
|
||||
initial_check
|
||||
just_one_instance
|
||||
|
||||
config_load network
|
||||
parse_interfaces
|
||||
parse_lans
|
||||
|
||||
if [ -n "$(uci changes network)" ] ; then
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
fi
|
||||
}
|
||||
|
||||
main $@
|
||||
@@ -52,7 +52,6 @@ link=$(cat /sys/class/net/${WANDEV:0:4}/operstate)
|
||||
case "$ACTION" in
|
||||
add|register)
|
||||
[ "$link" == "down" ] && return
|
||||
ubus call leds set '{"state" : "allflash"}'
|
||||
echo "Autoswitch to Extender mode" > /dev/console
|
||||
sleep 2
|
||||
wetif="$(get_wifi_wet_interface)"
|
||||
@@ -67,14 +66,10 @@ case "$ACTION" in
|
||||
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
|
||||
[ -f /usr/sbin/wlctl ] && wlctl -i $wetif bss down 2>/dev/null
|
||||
ping -c 1 -w 10 $defroute >/dev/null 2>&1 || killall -USR1 udhcpc
|
||||
ubus call router.network reload
|
||||
ubus call leds set '{"state" : "normal"}'
|
||||
;;
|
||||
remove|unregister)
|
||||
[ "$link" == "up" ] && return
|
||||
ubus call leds set '{"state" : "allflash"}'
|
||||
echo "Autoswitch to Repeater mode" > /dev/console
|
||||
sleep 2
|
||||
wetif="$(get_wifi_wet_interface)"
|
||||
@@ -89,14 +84,9 @@ case "$ACTION" in
|
||||
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
|
||||
[ -f /usr/sbin/wlctl ] && wlctl -i $wetif bss up 2>/dev/null
|
||||
ping -c 1 -w 10 $defroute >/dev/null 2>&1 || {
|
||||
killall -9 wifi
|
||||
wifi reload nodat
|
||||
killall -USR1 udhcpc
|
||||
}
|
||||
ubus call router.network reload
|
||||
ubus call leds set '{"state" : "normal"}'
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
START=10
|
||||
USE_PROCD=1
|
||||
|
||||
TMPDIR=/var/netmodes
|
||||
OLD_MODE_FILE=/var/netmodes/old_mode
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/network/config.sh
|
||||
|
||||
@@ -44,29 +41,13 @@ get_device() {
|
||||
|
||||
populate_netmodes() {
|
||||
[ -f /etc/config/netmode -a -d $modedir ] || return
|
||||
local curmode
|
||||
|
||||
config_load netmode
|
||||
|
||||
config_get curmode setup curmode
|
||||
|
||||
mkdir -p $TMPDIR
|
||||
|
||||
if [ "$curmode" == "routed" ]; then
|
||||
local hw="$(db -q get hw.board.hardware)"
|
||||
if [ "$hw" == "EX400" ]; then
|
||||
curmode="routed_mtk"
|
||||
else
|
||||
curmode="routed_brcm"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo $curmode > $OLD_MODE_FILE
|
||||
|
||||
delete_netmode() {
|
||||
uci delete netmode.$1
|
||||
}
|
||||
|
||||
config_load netmode
|
||||
|
||||
config_foreach delete_netmode netmode
|
||||
uci commit netmode
|
||||
|
||||
@@ -181,20 +162,17 @@ populate_netmodes() {
|
||||
|
||||
switch_netmode() {
|
||||
[ -f /etc/config/netmode -a -d $modedir ] || return
|
||||
|
||||
local netreload="$1"
|
||||
local curmode conf repeaterready old_mode
|
||||
local curmode conf repeaterready
|
||||
|
||||
config_load netmode
|
||||
|
||||
config_get curmode setup curmode
|
||||
|
||||
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
|
||||
@@ -215,17 +193,6 @@ switch_netmode() {
|
||||
uci set netmode.setup.curmode="$curmode"
|
||||
uci commit netmode
|
||||
fi
|
||||
|
||||
old_mode=`cat $OLD_MODE_FILE 2>/dev/null`
|
||||
|
||||
# if curmode has not changed do not copy configs
|
||||
if [ "$curmode" == "$old_mode" ]; then
|
||||
/etc/init.d/enviroment reload
|
||||
return
|
||||
fi
|
||||
|
||||
echo $curmode >$OLD_MODE_FILE
|
||||
|
||||
[ -d "/etc/netmodes/$curmode" ] || return
|
||||
cp /etc/netmodes/$curmode/* /etc/config/
|
||||
rm -f /etc/config/DETAILS
|
||||
@@ -234,35 +201,19 @@ switch_netmode() {
|
||||
local askcred=$(uci -q get netmode.$curmode.askcred)
|
||||
if [ "$reboot" == "0" ]; then
|
||||
/etc/init.d/enviroment reload
|
||||
case "$curmode" in
|
||||
routed*)
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
;;
|
||||
repeater*)
|
||||
if [ -f /etc/init.d/omcproxy ]; then
|
||||
/etc/init.d/omcproxy stop
|
||||
fi
|
||||
if [ "$netreload" != "0" ]; then
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
else
|
||||
reboot &
|
||||
fi
|
||||
}
|
||||
|
||||
start_client_listener() {
|
||||
local curmode repeaterready ulcpid
|
||||
|
||||
local curmode repeaterready
|
||||
config_load netmode
|
||||
config_get repeaterready setup repeaterready 0
|
||||
|
||||
ulcpid=$(ps | grep "ubus listen client" | grep -v grep | awk '{print$1}')
|
||||
config_get repeaterready setup repeaterready 0
|
||||
|
||||
[ $repeaterready -eq 1 ] && {
|
||||
killall -SIGKILL netmode-client-detect >/dev/null 2>&1
|
||||
kill -9 $ulcpid >/dev/null 2>&1
|
||||
return
|
||||
}
|
||||
|
||||
@@ -271,7 +222,6 @@ start_client_listener() {
|
||||
case "$curmode" in
|
||||
repeater*)
|
||||
killall -SIGKILL netmode-client-detect >/dev/null 2>&1
|
||||
kill -9 $ulcpid >/dev/null 2>&1
|
||||
;;
|
||||
*)
|
||||
pidof netmode-client-detect || /sbin/netmode-client-detect &
|
||||
@@ -279,45 +229,23 @@ start_client_listener() {
|
||||
esac
|
||||
}
|
||||
|
||||
start_netmode_discover() {
|
||||
local curmode repeaterready
|
||||
|
||||
killall -9 netmode-discover >/dev/null 2>&1
|
||||
|
||||
config_load netmode
|
||||
config_get repeaterready setup repeaterready 0
|
||||
|
||||
[ $repeaterready -eq 1 ] && return
|
||||
|
||||
config_get curmode setup curmode
|
||||
|
||||
case "$curmode" in
|
||||
repeater*)
|
||||
/sbin/netmode-discover &
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
start_service() {
|
||||
populate_netmodes
|
||||
start_client_listener
|
||||
start_netmode_discover
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
switch_netmode "$1"
|
||||
switch_netmode
|
||||
|
||||
# set default JUCI page to overview
|
||||
uci -q set juci.juci.homepage="overview"
|
||||
uci commit juci
|
||||
|
||||
start_client_listener
|
||||
start_netmode_discover
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
killall -SIGKILL netmode-client-detect >/dev/null 2>&1
|
||||
killall -9 netmode-discover >/dev/null 2>&1
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
|
||||
@@ -4,13 +4,6 @@ config wifi-status 'status'
|
||||
option sched_status '0'
|
||||
option schedule '0'
|
||||
|
||||
config bandsteering 'bandsteering'
|
||||
option enabled '0'
|
||||
option policy '0'
|
||||
|
||||
config apsteering 'apsteering'
|
||||
option enabled '0'
|
||||
|
||||
config wifi-device 'wl0'
|
||||
option type 'broadcom'
|
||||
option country 'EU/13'
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
"excluded_boards" : [
|
||||
"CG300",
|
||||
"CG301",
|
||||
"EX400",
|
||||
"F*"
|
||||
"EX400"
|
||||
],
|
||||
"acl" : [
|
||||
"admin",
|
||||
|
||||
@@ -4,13 +4,6 @@ config wifi-status 'status'
|
||||
option sched_status '0'
|
||||
option schedule '0'
|
||||
|
||||
config bandsteering 'bandsteering'
|
||||
option enabled '0'
|
||||
option policy '0'
|
||||
|
||||
config apsteering 'apsteering'
|
||||
option enabled '0'
|
||||
|
||||
config wifi-device 'wl0'
|
||||
option type 'broadcom'
|
||||
option country 'EU/13'
|
||||
|
||||
@@ -11,8 +11,10 @@
|
||||
"DG15*",
|
||||
"DG40*",
|
||||
"EG40*",
|
||||
"EX40*",
|
||||
"F*"
|
||||
"EX40*"
|
||||
],
|
||||
"acl" : [
|
||||
"admin"
|
||||
],
|
||||
"uplink_band" : "b",
|
||||
"credentials" : 1,
|
||||
|
||||
@@ -4,13 +4,6 @@ config wifi-status 'status'
|
||||
option sched_status '0'
|
||||
option schedule '0'
|
||||
|
||||
config bandsteering 'bandsteering'
|
||||
option enabled '0'
|
||||
option policy '0'
|
||||
|
||||
config apsteering 'apsteering'
|
||||
option enabled '0'
|
||||
|
||||
config wifi-device 'wl0'
|
||||
option type 'broadcom'
|
||||
option country 'EU/13'
|
||||
@@ -34,7 +27,7 @@ config wifi-device 'wl0'
|
||||
option rifs '0'
|
||||
option rifs_advert '0'
|
||||
option maxassoc '32'
|
||||
option beamforming '1'
|
||||
option beamforming '0'
|
||||
option doth '1'
|
||||
option dfsc '1'
|
||||
|
||||
|
||||
@@ -11,8 +11,10 @@
|
||||
"DG15*",
|
||||
"DG40*",
|
||||
"EG40*",
|
||||
"EX40*",
|
||||
"F*"
|
||||
"EX40*"
|
||||
],
|
||||
"acl" : [
|
||||
"admin"
|
||||
],
|
||||
"uplink_band" : "b",
|
||||
"credentials" : 1,
|
||||
|
||||
@@ -4,13 +4,6 @@ config wifi-status 'status'
|
||||
option sched_status '0'
|
||||
option schedule '0'
|
||||
|
||||
config bandsteering 'bandsteering'
|
||||
option enabled '0'
|
||||
option policy '0'
|
||||
|
||||
config apsteering 'apsteering'
|
||||
option enabled '0'
|
||||
|
||||
config wifi-device 'wl0'
|
||||
option type 'broadcom'
|
||||
option country 'EU/13'
|
||||
@@ -34,7 +27,7 @@ config wifi-device 'wl0'
|
||||
option rifs '0'
|
||||
option rifs_advert '0'
|
||||
option maxassoc '32'
|
||||
option beamforming '1'
|
||||
option beamforming '0'
|
||||
option doth '1'
|
||||
option dfsc '1'
|
||||
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
{ "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*",
|
||||
"F*"
|
||||
"*G*"
|
||||
],
|
||||
"uplink_band" : 'b',
|
||||
"credentials" : 1,
|
||||
|
||||
@@ -4,20 +4,14 @@ config wifi-status 'status'
|
||||
option sched_status '0'
|
||||
option schedule '0'
|
||||
|
||||
config bandsteering 'bandsteering'
|
||||
option enabled '0'
|
||||
option policy '0'
|
||||
|
||||
config apsteering 'apsteering'
|
||||
option enabled '0'
|
||||
|
||||
config wifi-device ra0
|
||||
option band b
|
||||
option channel auto
|
||||
option channel 1
|
||||
option bandwidth '20'
|
||||
option hwmode auto
|
||||
option hwmode 11n
|
||||
option htmode HT20
|
||||
option country 'DE'
|
||||
option beamforming 0
|
||||
|
||||
config wifi-iface
|
||||
option device ra0
|
||||
@@ -27,16 +21,15 @@ config wifi-iface
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
option ifname ra0
|
||||
option wps_pbc 1
|
||||
|
||||
config wifi-device rai0
|
||||
option band a
|
||||
option channel auto
|
||||
option channel 36
|
||||
option bandwidth '80'
|
||||
option hwmode 11ac
|
||||
option htmode VHT80
|
||||
option country 'DE'
|
||||
option beamforming 1
|
||||
option beamforming 0
|
||||
|
||||
config wifi-iface
|
||||
option device rai0
|
||||
@@ -46,7 +39,6 @@ config wifi-iface
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
option ifname rai0
|
||||
option wps_pbc 1
|
||||
|
||||
config wifi-iface
|
||||
option device ra0
|
||||
|
||||
@@ -8,8 +8,7 @@
|
||||
{ "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*",
|
||||
"F*"
|
||||
"*G*"
|
||||
],
|
||||
"uplink_band" : 'a',
|
||||
"credentials" : 1,
|
||||
|
||||
@@ -4,20 +4,14 @@ config wifi-status 'status'
|
||||
option sched_status '0'
|
||||
option schedule '0'
|
||||
|
||||
config bandsteering 'bandsteering'
|
||||
option enabled '0'
|
||||
option policy '0'
|
||||
|
||||
config apsteering 'apsteering'
|
||||
option enabled '0'
|
||||
|
||||
config wifi-device ra0
|
||||
option band b
|
||||
option channel auto
|
||||
option channel 1
|
||||
option bandwidth '20'
|
||||
option hwmode auto
|
||||
option hwmode 11n
|
||||
option htmode HT20
|
||||
option country 'DE'
|
||||
option beamforming 0
|
||||
|
||||
config wifi-iface
|
||||
option device ra0
|
||||
@@ -27,16 +21,15 @@ config wifi-iface
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
option ifname ra0
|
||||
option wps_pbc 1
|
||||
|
||||
config wifi-device rai0
|
||||
option band a
|
||||
option channel auto
|
||||
option channel 36
|
||||
option bandwidth '80'
|
||||
option hwmode 11ac
|
||||
option htmode VHT80
|
||||
option country 'DE'
|
||||
option beamforming 1
|
||||
option beamforming 0
|
||||
|
||||
config wifi-iface
|
||||
option device rai0
|
||||
@@ -46,7 +39,6 @@ config wifi-iface
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
option ifname rai0
|
||||
option wps_pbc 1
|
||||
|
||||
config wifi-iface
|
||||
option device rai0
|
||||
|
||||
@@ -4,13 +4,6 @@ config wifi-status 'status'
|
||||
option sched_status '0'
|
||||
option schedule '0'
|
||||
|
||||
config bandsteering 'bandsteering'
|
||||
option enabled '0'
|
||||
option policy '0'
|
||||
|
||||
config apsteering 'apsteering'
|
||||
option enabled '0'
|
||||
|
||||
config wifi-device 'wl0'
|
||||
option type 'broadcom'
|
||||
option country 'EU/13'
|
||||
|
||||
@@ -8,10 +8,8 @@
|
||||
{ "sv" : "" }
|
||||
],
|
||||
"excluded_boards" : [
|
||||
"*G*",
|
||||
"F*"
|
||||
"*G*"
|
||||
],
|
||||
"reboot" : 0,
|
||||
"credentials" : 0
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
config proxy
|
||||
option scope global
|
||||
option uplink wan
|
||||
list downlink lan
|
||||
|
||||
config proxy
|
||||
option scope global
|
||||
option uplink wan6
|
||||
list downlink lan
|
||||
|
||||
@@ -4,20 +4,14 @@ config wifi-status 'status'
|
||||
option sched_status '0'
|
||||
option schedule '0'
|
||||
|
||||
config bandsteering 'bandsteering'
|
||||
option enabled '0'
|
||||
option policy '0'
|
||||
|
||||
config apsteering 'apsteering'
|
||||
option enabled '0'
|
||||
|
||||
config wifi-device ra0
|
||||
option band b
|
||||
option channel auto
|
||||
option channel 1
|
||||
option bandwidth '20'
|
||||
option hwmode auto
|
||||
option hwmode 11n
|
||||
option htmode HT20
|
||||
option country 'DE'
|
||||
option beamforming 0
|
||||
|
||||
config wifi-iface
|
||||
option device ra0
|
||||
@@ -26,16 +20,15 @@ config wifi-iface
|
||||
option ssid Inteno-$BSSID4
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
option wps_pbc 1
|
||||
|
||||
config wifi-device rai0
|
||||
option band a
|
||||
option channel auto
|
||||
option channel 36
|
||||
option bandwidth '80'
|
||||
option hwmode 11ac
|
||||
option htmode VHT80
|
||||
option country 'DE'
|
||||
option beamforming 1
|
||||
option beamforming 0
|
||||
|
||||
config wifi-iface
|
||||
option device rai0
|
||||
@@ -44,5 +37,4 @@ config wifi-iface
|
||||
option ssid Inteno-$BSSID4
|
||||
option encryption psk2
|
||||
option key $WPAKEY
|
||||
option wps_pbc 1
|
||||
|
||||
|
||||
@@ -9,48 +9,28 @@ local action ipaddr macaddr network
|
||||
|
||||
timed_check() {
|
||||
while true; do
|
||||
network=${network:-lan}
|
||||
ubus call repeater get_creds '{"network":"'$network'","file":"/tmp/wificontrol.txt"}'
|
||||
wificontrol --router
|
||||
sleep $1
|
||||
done
|
||||
}
|
||||
|
||||
is_inteno_macaddr()
|
||||
{
|
||||
macaddr=$1
|
||||
|
||||
echo $macaddr | grep -i -e "^00:22:07" \
|
||||
-e "^02:22:07" \
|
||||
-e "^44:D4:37" \
|
||||
-e "^00:0C:07" \
|
||||
-e "^02:0C:07" \
|
||||
-e "^06:0C:07" \
|
||||
-e "^00:0C:43" \
|
||||
-e "^02:0C:43" \
|
||||
-e "^06:0C:43" \
|
||||
&& return
|
||||
false
|
||||
}
|
||||
|
||||
timed_check 60 &
|
||||
|
||||
while true ; do
|
||||
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 network "lan"
|
||||
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 is_inteno_macaddr $macaddr; 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
|
||||
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
|
||||
|
||||
@@ -3,22 +3,17 @@
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
state="exit"
|
||||
TMPPATH="/tmp/netmode_config_backup"
|
||||
CURMODE=""
|
||||
SLEEPTIME=300
|
||||
local state="exit"
|
||||
|
||||
set_wireless_values() {
|
||||
local iface_num="$1"
|
||||
local ssid="$2"
|
||||
local key="$3"
|
||||
local encryption="$4"
|
||||
local device="$5"
|
||||
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
|
||||
uci set wireless.@wifi-iface[$iface_num].device="$device"
|
||||
fi
|
||||
local network="$(uci -q get wireless.@wifi-iface[$iface_num].network)"
|
||||
old_ssid="$(uci -q get wireless.@wifi-iface[$iface_num].ssid)"
|
||||
@@ -59,13 +54,10 @@ get_iface_num() {
|
||||
local dev
|
||||
while true; do
|
||||
[ $i -gt 100 ] && break ## just a safty messure
|
||||
if ! uci -q get wireless.@wifi-iface[$i] >/dev/null; then
|
||||
break
|
||||
fi
|
||||
mode="$(uci -q get wireless.@wifi-iface[$i].mode)"
|
||||
if [ "$mode" == "wet" -o "$mode" == "sta" ]; then
|
||||
if [ "$mode" != "ap" ]; then
|
||||
i=$((i+1))
|
||||
continue
|
||||
break
|
||||
fi
|
||||
dev="$(uci -q get wireless.@wifi-iface[$i].device)"
|
||||
if [ "$dev" != "$device" ]; then
|
||||
@@ -81,45 +73,11 @@ get_iface_num() {
|
||||
eval "export -- \"$__save=$i\""
|
||||
}
|
||||
|
||||
restore() {
|
||||
if [ "$1" == "back" ]; then
|
||||
uci set juci.juci.homepage='netmode-wizard'
|
||||
uci commit juci
|
||||
cp $TMPPATH/* /etc/config/
|
||||
uci set netmode.setup.curmode=$CURMODE
|
||||
uci commit netmode
|
||||
ubus call network reload
|
||||
wifi reload
|
||||
ubus call router.network reload
|
||||
fi
|
||||
rm -r $TMPPATH
|
||||
ubus call leds set '{"state":"normal"}'
|
||||
}
|
||||
|
||||
backup() {
|
||||
mkdir -p $TMPPATH
|
||||
cp /etc/config/* $TMPPATH/
|
||||
CURMODE="$(uci -q get netmode.setup.curmode)"
|
||||
ubus call leds set '{"state":"allflash"}'
|
||||
}
|
||||
|
||||
###### START HERE #######
|
||||
|
||||
file="$1"
|
||||
from_gui="$2"
|
||||
|
||||
local file="$1"
|
||||
[ -f "$file" ] || exit
|
||||
|
||||
# let netmode-handler up to 20 seconds to finish switching mode
|
||||
for tm in 2 4 6 8; do
|
||||
if [ ! -f /tmp/switching_mode ]; then
|
||||
break
|
||||
fi
|
||||
sleep $tm
|
||||
done
|
||||
|
||||
[ "$from_gui" == "true" ] && backup
|
||||
|
||||
json_load "`cat $file`"
|
||||
json_select "wifi_ifaces"
|
||||
|
||||
@@ -150,23 +108,15 @@ local dummy band ssid key encryption device iface_num
|
||||
while json_get_var dummy $i; do
|
||||
json_select $i
|
||||
json_get_var band band
|
||||
[ "$band" == "" -o "$apcliband" == "$band" ] && break
|
||||
[ "$apcliband" == "$band" ] && break
|
||||
json_select ..
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
[ "$apcliband" == "$band" -o "$band" == "" ] || {
|
||||
[ "$from_gui" == "true" ] && restore "back"
|
||||
exit
|
||||
}
|
||||
[ "$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" ] && {
|
||||
[ "$from_gui" == "true" ] && restore "back"
|
||||
exit
|
||||
}
|
||||
|
||||
[ -z "$repeater_iface_num" ] && exit
|
||||
json_get_var ssid ssid
|
||||
json_get_var key key
|
||||
json_get_var encryption encryption
|
||||
@@ -184,57 +134,27 @@ 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
|
||||
if [ "$band" == "" ]; then
|
||||
get_device "a" device
|
||||
get_iface_num "$device" "$a_num" iface_num
|
||||
a_num=$((a_num+1))
|
||||
[ -z $iface_num ] && {
|
||||
[ "$from_gui" == "true" ] && restore "back"
|
||||
exit
|
||||
}
|
||||
set_wireless_values "$iface_num" "$ssid" "$key" "$encryption" "$device"
|
||||
get_device "b" device
|
||||
get_iface_num "$device" "$b_num" iface_num
|
||||
b_num=$((b_num+1))
|
||||
[ -z $iface_num ] && {
|
||||
[ "$from_gui" == "true" ] && restore "back"
|
||||
exit
|
||||
}
|
||||
set_wireless_values "$iface_num" "$ssid" "$key" "$encryption" "$device"
|
||||
else
|
||||
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 ] && {
|
||||
[ "$from_gui" == "true" ] && restore "back"
|
||||
exit
|
||||
}
|
||||
set_wireless_values "$iface_num" "$ssid" "$key" "$encryption" "$device"
|
||||
fi
|
||||
i=$((i+1))
|
||||
set_wireless_values "$iface_num" "$ssid" "$key" "$encryption"
|
||||
json_select ..
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
i=$((b_num + a_num + 1))
|
||||
|
||||
if [ $repeater_iface_num -gt $i ]; then
|
||||
i=$((i-1))
|
||||
fi
|
||||
|
||||
while uci -q get wireless.@wifi-iface[$i] >/dev/null; do
|
||||
# if repeater_iface_num is greater than the number of
|
||||
# configured downlink we need to make sure its not deleted
|
||||
local mode="$(uci -q get wireless.@wifi-iface[$i].mode)"
|
||||
if [ "$mode" == "wet" -o "$mode" == "sta" ]; then
|
||||
i=$((i+1))
|
||||
@@ -242,47 +162,19 @@ while uci -q get wireless.@wifi-iface[$i] >/dev/null; do
|
||||
fi
|
||||
state="reload"
|
||||
uci -q delete wireless.@wifi-iface[$i] >/dev/null
|
||||
# do not increment i. The next interface will now
|
||||
# have the same index as the deleted interface
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
uci commit wireless
|
||||
|
||||
if [ "$from_gui" == "true" ]; then
|
||||
# check for connectivity
|
||||
if [ "$state" == "exit" ]; then
|
||||
return
|
||||
elif [ "$state" == "apply" ]; then
|
||||
# wifi apply
|
||||
wifi reload
|
||||
[ -f /etc/init.d/layer2_interface_ethernet -a -f /etc/config/layer2_interface_ethernet ] && /etc/init.d/layer2_interface_ethernet reload
|
||||
i=$SLEEPTIME;
|
||||
|
||||
while [ $i -gt 0 ]; do
|
||||
ip=`route -n | awk '/^0.0.0.0/{print $2}'`
|
||||
if [ "$ip" == "" ]; then
|
||||
i=$((i-10))
|
||||
sleep 10
|
||||
continue
|
||||
fi
|
||||
ping -w1 $ip
|
||||
if [ $? -eq 0 ]; then
|
||||
restore
|
||||
exit
|
||||
else
|
||||
i=$((i-10))
|
||||
sleep 9
|
||||
fi
|
||||
done
|
||||
restore "back"
|
||||
else
|
||||
if [ "$state" == "exit" ]; then
|
||||
return
|
||||
fi
|
||||
ubus call leds set '{"state":"allflash"}'
|
||||
if [ "$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
|
||||
ubus call leds set '{"state":"normal"}'
|
||||
# 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,44 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
local unlisted mac ipaddr netmask mask
|
||||
|
||||
mask_to_cidr() {
|
||||
nbits=0
|
||||
IFS=.
|
||||
for dec in $1 ; do
|
||||
case $dec in
|
||||
255) let nbits+=8;;
|
||||
254) let nbits+=7;;
|
||||
252) let nbits+=6;;
|
||||
248) let nbits+=5;;
|
||||
240) let nbits+=4;;
|
||||
224) let nbits+=3;;
|
||||
192) let nbits+=2;;
|
||||
128) let nbits+=1;;
|
||||
0);;
|
||||
*) echo "Error: $dec is not recognised"; exit 1
|
||||
esac
|
||||
done
|
||||
echo "$nbits"
|
||||
}
|
||||
|
||||
while true; do
|
||||
unlisted=0
|
||||
|
||||
ps | grep -q wifi | grep -q reload || {
|
||||
for mac in $(brctl showmacs br-wan 2>/dev/null | tail -n +2 | grep no | awk '{print$2}'); do
|
||||
grep -q "$mac" /proc/net/arp || unlisted=$((unlisted+1))
|
||||
done
|
||||
|
||||
ipaddr=$(ifconfig br-wan | grep -v inet6 | grep inet | tr ':' ' ' | awk '{print$3}')
|
||||
netmask=$(ifconfig br-wan | grep -v inet6 | grep inet | tr ':' ' ' | awk '{print$7}')
|
||||
mask=$(mask_to_cidr $netmask)
|
||||
}
|
||||
|
||||
if [ $unlisted -gt 0 -a -n "$ipaddr" -a -n "$netmask" ]; then
|
||||
fping -c 1 -t 1000 -g $ipaddr/$mask -q >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
sleep 20
|
||||
done
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
MTK=0
|
||||
[ "$(db -q get hw.board.hardware)" == "EX400" ] && MTK=1
|
||||
|
||||
if [ $MTK -eq 1 ]; then
|
||||
WANDEV="eth0.2"
|
||||
link=$(swconfig dev switch0 port 0 get link | awk '{print$2}' | cut -d':' -f2)
|
||||
else
|
||||
WANDEV="$(uci get layer2_interface_ethernet.Wan.ifname)"
|
||||
link=$(cat /sys/class/net/${WANDEV:0:4}/operstate)
|
||||
fi
|
||||
|
||||
[ "$link" == "up" ] && action=add
|
||||
[ "$link" == "down" ] && action=remove
|
||||
[ -z "$action" ] && exit
|
||||
|
||||
# trigger a fake hotplug net event
|
||||
INTERFACE=$WANDEV ACTION=$action /sbin/hotplug-call net
|
||||
@@ -7,7 +7,7 @@ get_if_creds() {
|
||||
local section=$1
|
||||
local network=$2
|
||||
local net dev ssid key encryption band
|
||||
config_get net $section "network" "lan"
|
||||
config_get net $section "network"
|
||||
if [ "$net" == "$network" ]; then
|
||||
config_get dev $section "device"
|
||||
band="$(uci -q get wireless.$dev.band)"
|
||||
@@ -15,6 +15,7 @@ get_if_creds() {
|
||||
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
|
||||
@@ -86,7 +87,7 @@ duplicate_if_single_radio() {
|
||||
|
||||
case "$1" in
|
||||
list)
|
||||
echo '{ "get_creds": { "network": "str", "file": "str" }, "set_creds": { "file": "str", "from_gui": "str" } }'
|
||||
echo '{ "get_creds": { "network": "str", "file": "str" }, "set_creds": { "file": "str" } }'
|
||||
;;
|
||||
call)
|
||||
case "$2" in
|
||||
@@ -120,11 +121,10 @@ case "$1" in
|
||||
json_dump
|
||||
;;
|
||||
set_creds)
|
||||
local file from_gui
|
||||
local file
|
||||
read input
|
||||
json_load "$input"
|
||||
json_get_var file file
|
||||
json_get_var from_gui from_gui
|
||||
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"
|
||||
@@ -134,7 +134,7 @@ case "$1" in
|
||||
json_add_string "status" success
|
||||
json_dump
|
||||
|
||||
netmode-conf "$file" "$from_gui" >/dev/null 2>&1 &
|
||||
netmode-conf $file >/dev/null 2>&1 &
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
@@ -56,7 +56,6 @@ CONFIG_PACKAGE_juci-dropbear=y
|
||||
CONFIG_PACKAGE_juci-ethernet=y
|
||||
CONFIG_PACKAGE_juci-event=y
|
||||
CONFIG_PACKAGE_juci-firewall-fw3=y
|
||||
CONFIG_PACKAGE_juci-ice-client=y
|
||||
CONFIG_PACKAGE_juci-icwmp=y
|
||||
CONFIG_PACKAGE_juci-igmpinfo=y
|
||||
CONFIG_PACKAGE_juci-inteno-backup=y
|
||||
@@ -95,7 +94,6 @@ CONFIG_PACKAGE_libdaemon=y
|
||||
CONFIG_PACKAGE_libffmpeg-mini=y
|
||||
CONFIG_PACKAGE_libgmp=y
|
||||
CONFIG_PACKAGE_libreadline=y
|
||||
CONFIG_PACKAGE_loop-detector=m
|
||||
CONFIG_PACKAGE_minidlna=y
|
||||
CONFIG_PACKAGE_miniupnpd=y
|
||||
CONFIG_PACKAGE_mtd-utils=y
|
||||
@@ -117,7 +115,6 @@ CONFIG_PACKAGE_port-management=y
|
||||
CONFIG_PACKAGE_power-management=y
|
||||
CONFIG_PACKAGE_ppp-mod-pppoa=y
|
||||
CONFIG_PACKAGE_ppp-mod-pppol2tp=y
|
||||
CONFIG_PACKAGE_ppp-mod-pptp=y
|
||||
CONFIG_PACKAGE_ppp-multilink=y
|
||||
# CONFIG_PACKAGE_ppp is not set
|
||||
CONFIG_PACKAGE_qos-scripts=y
|
||||
@@ -159,14 +156,6 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_UDHCP_8021Q=y
|
||||
CONFIG_BUSYBOX_CONFIG_FIRST_SYSTEM_ID=100
|
||||
CONFIG_BUSYBOX_CONFIG_HTTPD=y
|
||||
CONFIG_BUSYBOX_CONFIG_INSMOD=y
|
||||
CONFIG_BUSYBOX_CONFIG_MODINFO=y
|
||||
CONFIG_BUSYBOX_CONFIG_MODPROBE=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_MODPROBE_BLACKLIST=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_CHECK_TAINTED_MODULE=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_MODUTILS_ALIAS=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_MODUTILS_SYMBOLS=y
|
||||
CONFIG_BUSYBOX_CONFIG_DEFAULT_MODULES_DIR="/lib/modules"
|
||||
CONFIG_BUSYBOX_CONFIG_DEFAULT_DEPMOD_FILE="modules.dep"
|
||||
CONFIG_BUSYBOX_CONFIG_LAST_SYSTEM_ID=999
|
||||
CONFIG_BUSYBOX_CONFIG_LOGIN=y
|
||||
CONFIG_BUSYBOX_CONFIG_LSMOD=y
|
||||
|
||||
@@ -6,12 +6,15 @@ function extract_core {
|
||||
topdir=$(pwd)
|
||||
|
||||
# Paths to packages that should be exported.
|
||||
paths+='package/network/services/base-files '
|
||||
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/system/procd '
|
||||
paths+='package/network/utils/iproute2 '
|
||||
paths+='package/network/utils/curl '
|
||||
paths+='package/utils/busybox '
|
||||
|
||||
function print_usage {
|
||||
|
||||
@@ -9,13 +9,14 @@ function genconfig {
|
||||
CURRENT_CONFIG_FILE=".current_config_file"
|
||||
export CONFIGPATH="package/feeds/feed_inteno_packages/iop/configs"
|
||||
CUSTPATH="customerconfigs"
|
||||
CUSTREPO="git@private.inteno.se:customerconfigs"
|
||||
export CUSTCONF="customerconfigs/customers"
|
||||
export VERBOSE=0
|
||||
export DEVELOPER=0
|
||||
LOCAL_MIRROR="http://mirror.inteno.se/mirror"
|
||||
|
||||
iopsys_brcm63xx_mips="cg300 cg301 dg150 dg150v2 dg150alv2 dg200 dg200al dg301 dg301al eg300 vg50 vox25 hpc_hu02"
|
||||
iopsys_brcm63xx_arm="dg400 eg400 f104w f104 dg400prime dg400primeb 963138REF_P502"
|
||||
iopsys_brcm63xx_mips="cg300 cg301 dg150 dg150v2 dg150alv2 dg200 dg200al dg301 dg301al eg300 vg50 vox25"
|
||||
iopsys_brcm63xx_arm="dg400 eg400"
|
||||
iopsys_ramips="ex400"
|
||||
ramips="mt7621"
|
||||
target="bogus"
|
||||
@@ -105,7 +106,7 @@ function genconfig {
|
||||
local ALL="$1"
|
||||
local CUSTOMER="$2"
|
||||
if [ "$CUSTOMER" -a -d "$CUSTCONF/$CUSTOMER" ]; then
|
||||
local boards="$(ls -1 "$CUSTCONF/$CUSTOMER" | grep -v common | grep -v juci-theme)"
|
||||
local boards="$(ls -1 "$CUSTCONF/$CUSTOMER" | grep -v common)"
|
||||
if [ "$boards" ]; then
|
||||
echo "$CUSTOMER has following boards:"
|
||||
for board in $boards; do
|
||||
@@ -119,10 +120,10 @@ function genconfig {
|
||||
exit 1
|
||||
elif [ -d $CUSTCONF ]; then
|
||||
local customers="$(ls -1 $CUSTCONF)"
|
||||
if [ "$customers" -a "$ALL" == 1 ]; then
|
||||
if [ "$customers" -a "$1" == 1 ]; then
|
||||
for customer in $customers; do
|
||||
echo $customer
|
||||
local boards="$(ls -1 $CUSTCONF/$customer | grep -v common | grep -v juci-theme)"
|
||||
local boards="$(ls -1 $CUSTCONF/$customer | grep -v common)"
|
||||
if [ "$boards" ]; then
|
||||
for board in $boards; do
|
||||
echo -e "\t$board"
|
||||
@@ -155,17 +156,15 @@ function genconfig {
|
||||
|
||||
setup_dirs()
|
||||
{
|
||||
if ssh -o ConnectTimeout=5 git@private.inteno.se 2>/dev/null | grep -qw ${CUSTREPO:22}; then
|
||||
if [ $DEVELOPER -eq 1 ]; then
|
||||
if [ ! -d "$CUSTPATH" ]; then
|
||||
git clone "$CUSTREPO" "$CUSTPATH"
|
||||
git clone "$CUSTREPO" "$CUSTPATH"
|
||||
elif [ $IMPORT -eq 1 ]; then
|
||||
cd $CUSTPATH
|
||||
v "git pull"
|
||||
git pull
|
||||
cd - >/dev/null #go back
|
||||
cd $CUSTPATH
|
||||
v "git pull"
|
||||
git pull
|
||||
cd - >/dev/null #go back
|
||||
fi
|
||||
else
|
||||
echo "You do not have access to $CUSTREPO"
|
||||
fi
|
||||
|
||||
if [ ! -d "$FILEDIR" ]; then
|
||||
@@ -193,18 +192,9 @@ function genconfig {
|
||||
if [ $target == "bogus" ]; then
|
||||
echo "Hardware profile does not exist"
|
||||
exit 1
|
||||
elif [ -n "$CUSTOMER" ]; then
|
||||
if [ ! -d "$CUSTCONF/$CUSTOMER/" ]; then
|
||||
echo "Customer profile for '$CUSTOMER' does not exist"
|
||||
exit 1
|
||||
elif [ ! -d "$CUSTCONF/$CUSTOMER/$BOARDTYPE/" ]; then
|
||||
echo "'$BOARDTYPE' board profile does not exist for customer '$CUSTOMER'"
|
||||
if [ -f "$CUSTCONF/$CUSTOMER/common/common.diff" ]; then
|
||||
echo "Common profile configuration will be used"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
elif [ -n "$CUSTOMER" -a ! -d "$CUSTCONF/$CUSTOMER/$BOARDTYPE/" ]; then
|
||||
echo "Customer profile does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Generate base config
|
||||
@@ -276,9 +266,9 @@ function genconfig {
|
||||
[ $SRCTREEOVERR -eq 1 ] && echo CONFIG_SRC_TREE_OVERRIDE=y >> .config
|
||||
|
||||
# developer mode selected ?
|
||||
echo "CONFIG_DEVEL=y" >>.config
|
||||
if [ $DEVELOPER -eq 1 ]; then
|
||||
# rewrite url to clone with ssh instead of http
|
||||
echo "CONFIG_DEVEL=y" >>.config
|
||||
echo "CONFIG_GITMIRROR_REWRITE=y" >>.config
|
||||
[ $bcmAllowed -eq 0 ] && echo "CONFIG_BCM_OPEN=y" >> .config
|
||||
[ $iceAllowed -eq 0 ] && echo "CONFIG_ICE_OPEN=y" >> .config
|
||||
@@ -286,6 +276,7 @@ function genconfig {
|
||||
[ $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
|
||||
@@ -301,11 +292,6 @@ function genconfig {
|
||||
# Needed to disable kmods for iopsys-brcm targets
|
||||
touch package/kernel/linux/Makefile
|
||||
|
||||
# we need to signal to bradcom SDK that we have changed the board id
|
||||
# currently boardparms.c and boardparms_voice.c is the only place that is depending on inteno boardid name
|
||||
# so just touch that file.
|
||||
[ -d ./build_dir ] && find build_dir/ -name "boardparms*c" -print0 2>/dev/null | xargs -0 touch 2>/dev/null
|
||||
|
||||
# Set default values based on selected parameters
|
||||
v "$(make defconfig 2>&1)"
|
||||
|
||||
@@ -344,7 +330,6 @@ function genconfig {
|
||||
-n|--no-update) export IMPORT=0;;
|
||||
-v|--verbose) export VERBOSE="$(($VERBOSE + 1))";;
|
||||
-p|--profile) export PROFILE="$2"; shift;;
|
||||
-r|--repo) export CUSTREPO="$2"; shift;;
|
||||
-s|--override) export SRCTREEOVERR=1;;
|
||||
-h|--help) usage;;
|
||||
-l|--list) list_customers 0 $2;;
|
||||
@@ -358,9 +343,6 @@ function genconfig {
|
||||
esac
|
||||
shift;
|
||||
done
|
||||
|
||||
CUSTREPO="${CUSTREPO:-git@private.inteno.se:customerconfigs}"
|
||||
|
||||
setup_dirs
|
||||
create_and_copy_files "$1" "$2"
|
||||
fi
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
|
||||
build_bcmkernel_consumer() {
|
||||
local tarfile bcmkernelcommith sdkversion
|
||||
sdkversion=$(grep "CONFIG_BRCM_SDK_VER.*=y" .config | awk -F'[_,=]' '{print$5}')
|
||||
sdkversion=$(grep "CONFIG_BRCM_SDK_VER.*=y" .config | awk -F'[_,=]' '{print$5}')
|
||||
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-$board-$bcmkernelcommith.tar.gz" && return
|
||||
ssh $SERVER "ls $FPATH/bcmopen-$profile-$bcmkernelcommith.tar.gz" && return
|
||||
cd ./build_dir/target-*_uClibc-0.9.33.*/bcmkernel-3.4-$sdkversion/bcm963xx/release
|
||||
sh do_consumer_release -p $profile -y
|
||||
tarfile='out/bcm963xx_*_consumer.tar.gz'
|
||||
[ $(ls -1 $tarfile |wc -l) -ne 1 ] && echo "Too many tar files: '$tarfile'" && return
|
||||
scp $tarfile $SERVER:$FPATH/bcmopen-$board-$bcmkernelcommith.tar.gz
|
||||
scp $tarfile $SERVER:$FPATH/bcmopen-$profile-$bcmkernelcommith.tar.gz
|
||||
rm -f $tarfile
|
||||
cd $curdir
|
||||
}
|
||||
@@ -109,7 +109,6 @@ 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 '"')
|
||||
board=$(grep CONFIG_TARGET_IBOARDID .config | cut -d'=' -f2 | tr -d '"')
|
||||
profile=$(grep CONFIG_BCM_KERNEL_PROFILE .config | cut -d'=' -f2 | tr -d '"')
|
||||
curdir=$(pwd)
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ function ssh_sysupgrade_latest {
|
||||
exit 1
|
||||
fi
|
||||
{ cd `dirname $0`
|
||||
IMAGE=`ls -Art bin/*/*.y[23] | tail -n1`
|
||||
IMAGE=`ls -Art bin/*/*.y2 | tail -n1`
|
||||
[ "$IMAGE" ] && [ -e "$IMAGE" ] && ./iop ssh_sysupgrade $1 $IMAGE $2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ insert_hash_in_feeds_config()
|
||||
check_packages()
|
||||
{
|
||||
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
|
||||
echo "Now checking if any changes have been done to the 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.
|
||||
@@ -536,7 +536,7 @@ check_feeds()
|
||||
read answer
|
||||
|
||||
case $answer in
|
||||
n|N|'')
|
||||
n|N)
|
||||
continue;;
|
||||
esac
|
||||
branch_uptodate feeds/${feed}
|
||||
|
||||
@@ -21,7 +21,7 @@ define Package/iup
|
||||
endef
|
||||
|
||||
define Package/iup/description
|
||||
This package contains Inteno's IUP Client
|
||||
This package contains Intenos IUP Client
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
|
||||
@@ -4,7 +4,6 @@ echo $$ > /var/run/iup.pid
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/network.sh
|
||||
. /lib/functions/savecfg.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
include /lib/upgrade
|
||||
@@ -14,30 +13,20 @@ 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
|
||||
export DESKEY=
|
||||
export MAC=
|
||||
export DESKEY=$(cat /proc/nvram/DesKey | tr -d '\n' | hexdump -e '16/1 "%02x"')
|
||||
export MAC=$(cat /proc/nvram/BaseMacAddr)
|
||||
export RANGE=10
|
||||
export RETRYSTOP=5
|
||||
export SLEEP=10
|
||||
|
||||
local sysinfo=$(ubus call router.system info)
|
||||
json_load "$sysinfo"
|
||||
json_select system
|
||||
json_get_var MAC basemac
|
||||
json_select ..
|
||||
json_select keys
|
||||
json_get_var DESKEY des
|
||||
json_select ..
|
||||
|
||||
# MAC lowercase to uppercase and remove ':'
|
||||
MAC=$(echo $MAC | tr '[a-z]' '[A-Z]' | tr -d ':')
|
||||
|
||||
# Convert DESKEY to HEX format
|
||||
DESKEY=$(echo $DESKEY | tr -d '\n' | hexdump -e '16/1 "%02x"')
|
||||
|
||||
#remove whitespace
|
||||
MAC=${MAC// /}
|
||||
#lower to upper Conversion
|
||||
MAC=$(echo $MAC | tr '[a-z]' '[A-Z]')
|
||||
|
||||
# no verbose: no output
|
||||
# -v log to system log
|
||||
@@ -80,7 +69,41 @@ reload ()
|
||||
|
||||
save_usercfg()
|
||||
{
|
||||
savecfg_save_config fw_redirect fw_parental wifi
|
||||
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()
|
||||
@@ -91,11 +114,64 @@ apply_usercfg()
|
||||
config_get_bool keep configserver keepuserconfig "0"
|
||||
v "apply_usercfg(): keepuserconfig = $keep"
|
||||
if [ "$keep" != "1" ] ; then
|
||||
savecfg_rm_files
|
||||
rm -f $IUPUSERCFG $IUPUSERCFG_WIFI
|
||||
return
|
||||
fi
|
||||
|
||||
savecfg_apply_config fw_redirect fw_parental wifi
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
handle_provisioning() {
|
||||
@@ -195,7 +271,7 @@ handle_Downloaded_file()
|
||||
for f in $CONFILESLURP
|
||||
do
|
||||
v "File to be applied $f and config $(cat $f)"
|
||||
uci -f $f import
|
||||
uci import -f $f
|
||||
done
|
||||
pack=$(get_packages $CONFILESLURP)
|
||||
v "Packages to be commited: $pack"
|
||||
@@ -400,6 +476,8 @@ parse_dhcp_options()
|
||||
json_get_var vlanid vlanid # option 132
|
||||
json_get_var vlanpriority vlanpriority # option 133
|
||||
|
||||
v "Processing dhcp options"
|
||||
|
||||
if [ $privopt224 ]; then
|
||||
v "dhcp option 224 firmware url $privopt224"
|
||||
handle_option224 $privopt224
|
||||
@@ -477,22 +555,13 @@ wait_for_default_gateway()
|
||||
return 0
|
||||
fi
|
||||
|
||||
# try the nameservers too
|
||||
for ns in $(grep nameserver /var/resolv.conf.auto | awk '{print $2}'); do
|
||||
if ping -q -w 1 -c 1 $device $ns >/dev/null 2>&1 ; then
|
||||
[ "$wait_time" -lt "60" ] && v "Name server $ns is reachable"
|
||||
sleep $wait_interval
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
v "Waiting for default gateway or name server. Countdown $wait_time seconds"
|
||||
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
|
||||
|
||||
return 1 # default gateway and name server are not reachable
|
||||
return 1 # default gateway not reachable
|
||||
}
|
||||
|
||||
|
||||
@@ -518,7 +587,7 @@ main()
|
||||
done
|
||||
|
||||
if ! wait_for_default_gateway ; then
|
||||
v "Neither default gateway nor name server are reachable. Aborting iup."
|
||||
v "Default gateway is not reachable. Aborting iup."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
. /lib/network/config.sh
|
||||
|
||||
# FIX: for EG300 WAN port for release 3.13.1 - 4.x
|
||||
if [ "$INTERFACE" == "eth2" ]; then
|
||||
touch /var/update.eth2
|
||||
fi
|
||||
# end FIX
|
||||
|
||||
addif() {
|
||||
# check if wan had a event and start all related services
|
||||
wan=`uci -q get layer2_interface_ethernet.Wan.baseifname`
|
||||
if [ "$INTERFACE" == "$wan" ]; then
|
||||
/etc/init.d/layer2_interface_ethernet start
|
||||
/etc/init.d/layer2_interface_vlan start
|
||||
fi
|
||||
}
|
||||
|
||||
delif() {
|
||||
##remove ethernet wan and nuke any vlans associated
|
||||
wan=`uci -q get layer2_interface_ethernet.Wan.baseifname`
|
||||
if [ "$INTERFACE" == "$wan" ]; then
|
||||
/etc/init.d/layer2_interface_ethernet stop
|
||||
fi
|
||||
}
|
||||
|
||||
# true if speed on interface is Gbit
|
||||
gigatest() {
|
||||
local speed=$(ethctl $INTERFACE media-type 2>&1 | awk '{if (NR == 2) print $6}')
|
||||
case "$speed" in
|
||||
1000*) return 0 ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# true if there is a link on any lan port
|
||||
lan_test () {
|
||||
local landev=$(db get hw.board.ethernetLanPorts)
|
||||
local ledontest
|
||||
for dev in $landev; do
|
||||
ledontest=$(cat /sys/class/net/$dev/operstate)
|
||||
if [ "$ledontest" == "up" ]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# true if adsl or vdsl is up.
|
||||
dsltest() {
|
||||
if cat /var/state/layer2_interface 2>/dev/null | grep 'adsl\|vdsl' | grep up; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
case "$ACTION" in
|
||||
add|register)
|
||||
case "$PHYSDEVDRIVER" in
|
||||
natsemi) sleep 1 ;;
|
||||
esac
|
||||
addif
|
||||
local interfname=$(interfacename $INTERFACE)
|
||||
local operstate=$(cat /sys/class/net/$INTERFACE/operstate)
|
||||
# if [ "$operstate" == "up" ]; then
|
||||
if true ; then
|
||||
case "$interfname" in
|
||||
GbE*)
|
||||
ubus call led.lan set '{"state" : "ok"}'
|
||||
ubus call led.gbe set '{"state" : "ok"}'
|
||||
ubus call led.gbe_phy_link set '{"state" : "ok"}'
|
||||
ubus call led.gbe_phy_speed set '{"state": "off"}'
|
||||
$(gigatest) && ubus call led.gbe_phy_speed set '{"state":"ok"}'
|
||||
;;
|
||||
LAN*)
|
||||
ubus call led.lan set '{"state":"ok"}'
|
||||
;;
|
||||
WAN*)
|
||||
ubus call led.wan set '{"state" : "ok"}'
|
||||
ubus call led.wan_phy_link set '{"state" : "ok"}'
|
||||
ubus call led.wan_phy_speed set '{"state" : "off"}'
|
||||
$(gigatest) && ubus call led.wan_phy_speed set '{"state":"ok"}'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
remove|unregister)
|
||||
local interfname=$(interfacename $INTERFACE)
|
||||
local operstate=$(cat /sys/class/net/$INTERFACE/operstate)
|
||||
if [ "$operstate" == "down" ]; then
|
||||
case "$interfname" in
|
||||
GbE*)
|
||||
ubus call led.gbe set '{"state" : "off"}'
|
||||
ubus call led.gbe_phy_link set '{"state" : "off"}'
|
||||
ubus call led.gbe_phy_speed set '{"state" : "off"}'
|
||||
$(lan_test) || ubus call led.lan set '{"state":"off"}'
|
||||
;;
|
||||
LAN*)
|
||||
$(lan_test) || ubus call led.lan set '{"state":"off"}'
|
||||
;;
|
||||
WAN*)
|
||||
ubus call led.wan set '{"state" : "off"}'
|
||||
ubus call led.wan_phy_speed set '{"state" : "off"}'
|
||||
ubus call led.wan_phy_link set '{"state" : "off"}'
|
||||
# is this needed here ?? don't the dsl hotplug event control this ???
|
||||
# $(dsltest) || ubus call led.dsl set '{"state":"off"}'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
delif
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -16,7 +16,6 @@ start_service() {
|
||||
local AnnexL
|
||||
local ADSL2plus
|
||||
local VDSL2
|
||||
local GFast
|
||||
local a8a
|
||||
local b8b
|
||||
local c8c
|
||||
@@ -24,14 +23,11 @@ start_service() {
|
||||
local a12a
|
||||
local b12b
|
||||
local a17a
|
||||
local a30a
|
||||
local b35b
|
||||
local US0
|
||||
local bitswap
|
||||
local sra
|
||||
local vdsl
|
||||
|
||||
|
||||
config_load layer2_interface
|
||||
config_get Glite capabilities Glite
|
||||
config_get GDmt capabilities GDmt
|
||||
@@ -40,7 +36,6 @@ start_service() {
|
||||
config_get ADSL2plus capabilities ADSL2plus
|
||||
config_get AnnexL capabilities AnnexL
|
||||
config_get VDSL2 capabilities VDSL2
|
||||
config_get GFast capabilities GFast
|
||||
config_get AnnexM capabilities AnnexM
|
||||
|
||||
config_get a8a capabilities 8a
|
||||
@@ -50,9 +45,6 @@ start_service() {
|
||||
config_get a12a capabilities 12a
|
||||
config_get b12b capabilities 12b
|
||||
config_get a17a capabilities 17a
|
||||
config_get a30a capabilities 30a
|
||||
config_get b35b capabilities 35b
|
||||
config_get BrcmPriv1 capabilities BrcmPriv1
|
||||
|
||||
config_get US0 capabilities US0
|
||||
config_get bitswap capabilities bitswap
|
||||
@@ -66,7 +58,6 @@ start_service() {
|
||||
ADSL2plus=$(echo $ADSL2plus | sed 's/Enabled\|1/p/g')
|
||||
AnnexM=$(echo $AnnexM | sed 's/Enabled\|1/m/g')
|
||||
VDSL2=$(echo $VDSL2 | sed 's/Enabled\|1/v/g')
|
||||
GFast=$(echo $GFast | sed 's/Enabled\|1/f/g')
|
||||
|
||||
a8a=$(echo $a8a | sed 's/Enabled\|1/8a/g')
|
||||
b8b=$(echo $b8b | sed 's/Enabled\|1/8b/g')
|
||||
@@ -75,10 +66,7 @@ start_service() {
|
||||
a12a=$(echo $a12a | sed 's/Enabled\|1/12a/g')
|
||||
b12b=$(echo $b12b | sed 's/Enabled\|1/12b/g')
|
||||
a17a=$(echo $a17a | sed 's/Enabled\|1/17a/g')
|
||||
a30a=$(echo $a30a | sed 's/Enabled\|1/30a/g')
|
||||
b35b=$(echo $b35b | sed 's/Enabled\|1/BrcmPriv1/g')
|
||||
BrcmPriv1=$(echo $BrcmPriv1 | sed 's/Enabled\|1/BrcmPriv1/g')
|
||||
[ -n "$b35b" ] && BrcmPriv1=""
|
||||
|
||||
US0=$(echo $US0 | sed 's/1/on/g')
|
||||
US0=$(echo $US0 | sed 's/0/off/g')
|
||||
bitswap=$(echo $bitswap | sed 's/1/on/g')
|
||||
@@ -95,17 +83,13 @@ start_service() {
|
||||
json_get_var vdsl vdsl
|
||||
|
||||
if [ $vdsl -eq 1 ]; then
|
||||
echo "xdslctl start --up --mod $GDmt$Glite$T1413$ADSL2$AnnexL$ADSL2plus$AnnexM$VDSL2$GFast --profile \"$a8a $b8b $c8c $d8d $a12a $b12b $a17a $a30a $b35b $BrcmPriv1\" --sra $sra --bitswap $bitswap --us0 $US0"
|
||||
xdslctl start --up --mod $GDmt$Glite$T1413$ADSL2$AnnexL$ADSL2plus$AnnexM$VDSL2$GFast --profile "$a8a $b8b $c8c $d8d $a12a $b12b $a17a $a30a $b35b $BrcmPriv1" --sra $sra --bitswap $bitswap --us0 $US0
|
||||
echo "xdslctl start --up --mod $GDmt$Glite$T1413$ADSL2$AnnexL$ADSL2plus$AnnexM$VDSL2 --profile \"$a8a $b8b $c8c $d8d $a12a $b12b $a17a\" --sra $sra --bitswap $bitswap --us0 $US0"
|
||||
xdslctl start --up --mod $GDmt$Glite$T1413$ADSL2$AnnexL$ADSL2plus$AnnexM$VDSL2 --profile "$a8a $b8b $c8c $d8d $a12a $b12b $a17a" --sra $sra --bitswap $bitswap --us0 $US0
|
||||
else
|
||||
echo "xdslctl start --up --mod $GDmt$Glite$T1413$ADSL2$AnnexL$ADSL2plus$AnnexM --sra $sra --bitswap $bitswap"
|
||||
xdslctl start --up --mod $GDmt$Glite$T1413$ADSL2$AnnexL$ADSL2plus$AnnexM --sra $sra --bitswap $bitswap
|
||||
fi
|
||||
|
||||
if [ "$GFast" == "f" ]; then
|
||||
# enable V43 tone set for GFAST
|
||||
xdslctl configure1 --phycfg 0 0 0 0 0 0 0 0 0 0 0 0x400000 0x400000
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -50,11 +50,10 @@ addethernet() {
|
||||
config_get baseifname $1 baseifname
|
||||
config_get ifname $1 ifname
|
||||
config_get bridge $1 bridge
|
||||
config_get mac2 $1 mac2
|
||||
|
||||
ifname="${ifname:-$baseifname.1}"
|
||||
|
||||
brcm_virtual_interface_rules "$baseifname" "$ifname" "$bridge" "$mac2"
|
||||
brcm_virtual_interface_rules "$baseifname" "$ifname" "$bridge"
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
local hasEthWan="$(db -q get hw.board.hasEthWan)"
|
||||
hasEthWan=${hasEthWan:-1}
|
||||
local hasEthWan="1"
|
||||
local hasAdsl="$(db -q get hw.board.hasAdsl)"
|
||||
local hasVdsl="$(db -q get hw.board.hasVdsl)"
|
||||
|
||||
local LANPORTS="$(db -q get hw.board.ethernetLanPorts)"
|
||||
local WANPORTS=""
|
||||
|
||||
# populate layer2_interface_ethernet #
|
||||
if [ "$hasEthWan" == "1" ]; then
|
||||
local wanEthernetPort="$(db -q get hw.board.ethernetWanPort)"
|
||||
wanEthernetPort="${wanEthernetPort:-eth0}"
|
||||
if [ ! -f /etc/config/layer2_interface_ethernet -o -z "$(uci -q get layer2_interface_ethernet.@ethernet_interface[0].ifname)" ]; then
|
||||
cat > /etc/config/layer2_interface_ethernet <<EOF
|
||||
config ethernet_interface 'Wan'
|
||||
option name 'WAN'
|
||||
option baseifname '${wanEthernetPort}'
|
||||
option ifname '${wanEthernetPort}.1'
|
||||
EOF
|
||||
fi
|
||||
local ifname="$(uci -q get layer2_interface_ethernet.@ethernet_interface[0].ifname)"
|
||||
[ -n "$WANPORTS" ] && WANPORTS="$WANPORTS $ifname" || WANPORTS="$ifname"
|
||||
elif [ "$hasEthWan" == "0" ]; then
|
||||
echo "" > /etc/config/layer2_interface_ethernet
|
||||
fi
|
||||
|
||||
# populate layer2_interface #
|
||||
if [ "$hasAdsl" == "1" ]; then
|
||||
if [ ! -f /etc/config/layer2_interface -o -z "$(uci -q get layer2_interface.capabilities)" ]; then
|
||||
@@ -43,28 +60,6 @@ elif [ "$hasAdsl" == "0" -a "$hasVdsl" == "0" ]; then
|
||||
echo "" > /etc/config/layer2_interface
|
||||
fi
|
||||
|
||||
# populate layer2_interface_vdsl #
|
||||
if [ "$hasVdsl" == "1" ]; then
|
||||
local wanVdslPort=$(db -q get hw.board.vdslWanPort)
|
||||
wanVdslPort="${wanVdslPort:-ptm0}"
|
||||
if [ ! -f /etc/config/layer2_interface_vdsl -o -z "$(uci -q get layer2_interface_vdsl.@vdsl_interface[0].ifname)" ]; then
|
||||
cat > /etc/config/layer2_interface_vdsl <<EOF
|
||||
config vdsl_interface
|
||||
option 'unit' '0'
|
||||
option 'ifname' '${wanVdslPort}.1'
|
||||
option 'baseifname' '${wanVdslPort}'
|
||||
option 'name' 'VDSL2'
|
||||
option 'dslat' '1'
|
||||
option 'ptmprio' '1'
|
||||
option 'ipqos' '1'
|
||||
EOF
|
||||
fi
|
||||
local ifname="$(uci -q get layer2_interface_vdsl.@vdsl_interface[0].ifname)"
|
||||
[ -n "$WANPORTS" ] && WANPORTS="$WANPORTS $ifname" || WANPORTS="$ifname"
|
||||
elif [ "$hasVdsl" == "0" ]; then
|
||||
echo "" > /etc/config/layer2_interface_vdsl
|
||||
fi
|
||||
|
||||
# populate layer2_interface_adsl #
|
||||
if [ "$hasAdsl" == "1" ]; then
|
||||
local wanAdslPort=$(db -q get hw.board.adslWanPort)
|
||||
@@ -89,22 +84,26 @@ elif [ "$hasAdsl" == "0" ]; then
|
||||
echo "" > /etc/config/layer2_interface_adsl
|
||||
fi
|
||||
|
||||
# populate layer2_interface_ethernet #
|
||||
if [ "$hasEthWan" == "1" ]; then
|
||||
local wanEthernetPort="$(db -q get hw.board.ethernetWanPort)"
|
||||
wanEthernetPort="${wanEthernetPort:-eth0}"
|
||||
if [ ! -f /etc/config/layer2_interface_ethernet -o -z "$(uci -q get layer2_interface_ethernet.@ethernet_interface[0].ifname)" ]; then
|
||||
cat > /etc/config/layer2_interface_ethernet <<EOF
|
||||
config ethernet_interface 'Wan'
|
||||
option name 'WAN'
|
||||
option baseifname '${wanEthernetPort}'
|
||||
option ifname '${wanEthernetPort}.1'
|
||||
# populate layer2_interface_vdsl #
|
||||
if [ "$hasVdsl" == "1" ]; then
|
||||
local wanVdslPort=$(db -q get hw.board.vdslWanPort)
|
||||
wanVdslPort="${wanVdslPort:-ptm0}"
|
||||
if [ ! -f /etc/config/layer2_interface_vdsl -o -z "$(uci -q get layer2_interface_vdsl.@vdsl_interface[0].ifname)" ]; then
|
||||
cat > /etc/config/layer2_interface_vdsl <<EOF
|
||||
config vdsl_interface
|
||||
option 'unit' '0'
|
||||
option 'ifname' '${wanVdslPort}.1'
|
||||
option 'baseifname' '${wanVdslPort}'
|
||||
option 'name' 'VDSL2'
|
||||
option 'dslat' '1'
|
||||
option 'ptmprio' '1'
|
||||
option 'ipqos' '1'
|
||||
EOF
|
||||
fi
|
||||
local ifname="$(uci -q get layer2_interface_ethernet.@ethernet_interface[0].ifname)"
|
||||
local ifname="$(uci -q get layer2_interface_vdsl.@vdsl_interface[0].ifname)"
|
||||
[ -n "$WANPORTS" ] && WANPORTS="$WANPORTS $ifname" || WANPORTS="$ifname"
|
||||
elif [ "$hasEthWan" == "0" ]; then
|
||||
echo "" > /etc/config/layer2_interface_ethernet
|
||||
elif [ "$hasVdsl" == "0" ]; then
|
||||
echo "" > /etc/config/layer2_interface_vdsl
|
||||
fi
|
||||
|
||||
# populate network config ifnames #
|
||||
|
||||
@@ -261,7 +261,6 @@ wlmngr_startWsc()
|
||||
nvram set wps_timeout_enable=0
|
||||
#nvram get wps_config_method
|
||||
nvram set wps_version2=enabled # extra
|
||||
nvram set wps_oob_configured=1
|
||||
nvram set lan_wps_oob=disabled # extra
|
||||
nvram set lan_wps_reg=enabled # extra
|
||||
|
||||
|
||||
@@ -161,38 +161,12 @@ addbrcmvlan()
|
||||
fi
|
||||
}
|
||||
|
||||
update_last_mac_group()
|
||||
{
|
||||
local ifname=$1
|
||||
local last_mac_group=$2
|
||||
|
||||
local full_mac modified_mac dev_mac
|
||||
|
||||
full_mac="$(ifconfig $ifname | awk '{print $NF; exit}')"
|
||||
|
||||
[ "${full_mac}" == "" ] && return
|
||||
|
||||
modified_mac="${full_mac:0:15}${last_mac_group}"
|
||||
|
||||
devs="wl0 wl1 bcmsw"
|
||||
|
||||
for dev in $devs; do
|
||||
dev_mac="$(ifconfig $dev | awk '{print $NF; exit}')"
|
||||
if [ "$dev_mac" == "$modified_mac" ]; then
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
ifconfig $ifname hw ether "${modified_mac}"
|
||||
}
|
||||
|
||||
|
||||
brcm_virtual_interface_rules()
|
||||
{
|
||||
local baseifname=$1
|
||||
local ifname=$2
|
||||
local bridge=$3
|
||||
local last_mac_group=$4
|
||||
|
||||
bridge="${bridge:-0}"
|
||||
|
||||
@@ -256,10 +230,6 @@ brcm_virtual_interface_rules()
|
||||
vlanctl --if $baseifname --rx --tags 0 --set-rxif $ifname --filter-vlan-dev-mac-addr 1 --rule-insert-before -1
|
||||
fi
|
||||
|
||||
if [ "$last_mac_group" != "" ]; then
|
||||
update_last_mac_group $ifname $last_mac_group
|
||||
fi
|
||||
|
||||
ifconfig $ifname up
|
||||
ifconfig $ifname multicast
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=loop-detector
|
||||
PKG_VERSION:=1.0
|
||||
|
||||
PKG_SOURCE_VERSION:=d0fb770eacd6691b98df138b60f5116e02f71a9b
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/loop-detector
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
define Package/loop-detector
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=L2 Loop detector
|
||||
DEPENDS:= +libpcap +libuci +libpthread
|
||||
endef
|
||||
|
||||
define Package/loop-detector/description
|
||||
L2 Loop detection package
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
TARGET_LDFLAGS += \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--with-uci-include-path=$(STAGING_DIR)/usr/include \
|
||||
--with-libubox-include-path=$(STAGING_DIR)/usr/include \
|
||||
--with-libubus-include-path=$(STAGING_DIR)/usr/include
|
||||
|
||||
define Package/loop-detector/install
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/loop-detector $(1)/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(CP) ./files/loop_detection.init $(1)/etc/init.d/loop_detection
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(CP) ./files/loop_detection.config $(1)/etc/config/loop_detection
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,loop-detector))
|
||||
@@ -1,5 +0,0 @@
|
||||
config loop-detect loop
|
||||
option enabled '1'
|
||||
option discovery_interval '10'
|
||||
option recovery_check_tries '5'
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=21
|
||||
STOP=89
|
||||
|
||||
USE_PROCD=1
|
||||
NAME=loop-detector
|
||||
|
||||
start_service() {
|
||||
local enabled
|
||||
|
||||
config_load loop_detection
|
||||
config_get_bool enabled loop enabled 1
|
||||
|
||||
if [ $enabled -eq 1 ]; then
|
||||
procd_open_instance
|
||||
procd_set_param command "/sbin/loop-detector"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
fi
|
||||
}
|
||||
|
||||
stop() {
|
||||
service_stop /sbin/loop-detector
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
{
|
||||
procd_add_reload_trigger loop_detection
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
@@ -5,13 +5,13 @@ PKG_NAME:=mtk-bndstrg
|
||||
PKG_VERSION:=1.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=a67f5ccdf9bc6810f15f1ece9edaad5e89cad0f7
|
||||
PKG_SOURCE_VERSION:=8a804320c53dead1c9b9f3650cbbc58908c76832
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/mtk-bndstrg
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ PKG_SOURCE_PROTO:=git
|
||||
endif
|
||||
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_PARALLEL:=0
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
|
||||
@@ -12,7 +12,7 @@ PKG_NAME:=peripheral_manager
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=959eca8ab2b50eaccfff9c710cffe5b317bb6ad1
|
||||
PKG_SOURCE_VERSION:=ff2cf8bfbd3a04731088e9f4540796696e961382
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se/peripheral_manager
|
||||
|
||||
|
||||
@@ -62,25 +62,18 @@ get_current_status() {
|
||||
fi
|
||||
}
|
||||
|
||||
get_flag(){
|
||||
sfp_flag(){
|
||||
local port=$1
|
||||
local sfptype=$2
|
||||
local eg300="$(ethctl $port media-type 2>&1 | grep 'This is probably wrong')"
|
||||
local eg400="$(ethctl $port media-type 2>&1 | grep 'Error: Interface eth0 has sub ports, please specified one')"
|
||||
if [ -n "$eg300" ]; then
|
||||
echo "sfp copper"
|
||||
elif [ -n "$eg400" ]; then
|
||||
echo "port 10"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
local media="$(ethctl $port media-type 2>&1 | grep 'This is probably wrong')"
|
||||
[ -z "$media" ] && echo "" || echo "sfp $sfptype"
|
||||
}
|
||||
|
||||
set_port_status() {
|
||||
local port="$1"
|
||||
local status="$2"
|
||||
local flag=$(get_flag $port)
|
||||
local curstatus=$(get_current_status "$port" "$flag")
|
||||
local flag=$(sfp_flag $port "copper")
|
||||
local curstatus=$(get_current_status $port $flag)
|
||||
|
||||
ifconfig $port >/dev/null 2>&1 || return
|
||||
|
||||
@@ -100,14 +93,14 @@ set_port_status() {
|
||||
esac
|
||||
;;
|
||||
10*AUTO)
|
||||
ethctl $port media-type advertise $status $flag
|
||||
ethctl $port media-type $flag advertise $status
|
||||
;;
|
||||
10*)
|
||||
ethctl $port media-type $status $flag
|
||||
ethctl $port media-type $flag $status
|
||||
;;
|
||||
*)
|
||||
ethctl $port media-type advertise 1000FDAUTO $flag
|
||||
ethctl $port media-type auto $flag
|
||||
ethctl $port media-type $flag advertise 1000FDAUTO
|
||||
ethctl $port media-type $flag auto
|
||||
;;
|
||||
esac
|
||||
else
|
||||
|
||||
@@ -23,24 +23,18 @@ get_current_status() {
|
||||
fi
|
||||
}
|
||||
|
||||
get_flag(){
|
||||
sfp_flag(){
|
||||
local port=$1
|
||||
local eg300="$(ethctl $port media-type 2>&1 | grep 'This is probably wrong')"
|
||||
local eg400="$(ethctl $port media-type 2>&1 | grep 'Error: Interface eth0 has sub ports, please specified one')"
|
||||
if [ -n "$eg300" ]; then
|
||||
echo "sfp fiber"
|
||||
elif [ -n "$eg400" ]; then
|
||||
echo "port 9"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
local sfptype=$2
|
||||
local media="$(ethctl $port media-type 2>&1 | grep 'This is probably wrong')"
|
||||
[ -z "$media" ] && echo "" || echo "sfp $sfptype"
|
||||
}
|
||||
|
||||
set_fiber_status() {
|
||||
local port="$1"
|
||||
local status="$2"
|
||||
local flag=$(get_flag $port)
|
||||
local curstatus=$(get_current_status "$port" "$flag")
|
||||
local flag=$(sfp_flag $port "fiber")
|
||||
local curstatus=$(get_current_status $port $flag)
|
||||
|
||||
case "$status" in
|
||||
disabled)
|
||||
|
||||
@@ -6,9 +6,9 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=questd
|
||||
PKG_VERSION:=3.1.40
|
||||
PKG_VERSION:=3.1.38
|
||||
|
||||
PKG_SOURCE_VERSION:=b2794295fdf9469b6cd8ba1544f291d4b83a7d5a
|
||||
PKG_SOURCE_VERSION:=85785b97a1526114ae521beacb1b302c3cb914ab
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/questd
|
||||
|
||||
@@ -43,7 +43,7 @@ export QUESTD_CFLAGS
|
||||
|
||||
define Package/questd
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+libuci +libubox +ubus +libpthread +(TARGET_iopsys_ramips_ex400):swconfig +(TARGET_iopsys_ramips_ex400):libnl-tiny +libopenssl
|
||||
DEPENDS:=+libuci +libubox +ubus +libpthread +(TARGET_iopsys_ramips_ex400):swconfig +(TARGET_iopsys_ramips_ex400):libnl-tiny
|
||||
TITLE:=router info daemon
|
||||
endef
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ start_service() {
|
||||
}
|
||||
|
||||
stop() {
|
||||
#stop_service() is called after procd killed the service
|
||||
echo ;
|
||||
service_stop /sbin/questd
|
||||
service_stop /sbin/graphd
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
. /usr/share/libubox/jshn.sh
|
||||
|
||||
# 1. sleep for $SLEEP_LONG seconds
|
||||
# 2. run the check_* functions
|
||||
@@ -23,7 +22,7 @@ NPROC_COUNT=4 # number of time that the NPROC_LIMIT has to be hit to trigger a p
|
||||
NPROC_NFAIL=0 # current consecutive Number of FAILures. process restarts when NPROC_NFAIL == NPROC_COUNT
|
||||
|
||||
# memmory limit
|
||||
MEM_LIMIT=20000
|
||||
MEM_LIMIT=50000
|
||||
MEM_COUNT=4
|
||||
MEM_NFAIL=0
|
||||
|
||||
@@ -32,9 +31,6 @@ PCPU_LIMIT=38
|
||||
PCPU_COUNT=4
|
||||
PCPU_NFAIL=0
|
||||
|
||||
# network call check
|
||||
NNET_NFAIL=0
|
||||
|
||||
UBUS_TIMEOUT=5
|
||||
|
||||
|
||||
@@ -43,7 +39,7 @@ ACSDBIN=$(which acsd)
|
||||
|
||||
restart_questd()
|
||||
{
|
||||
logger -s -t $0[$$] "Restarting questd. $NPROC_NFAIL $MEM_NFAIL $PCPU_NFAIL $NNET_NFAIL"
|
||||
logger -s -t $0[$$] "Restarting questd. $NPROC_NFAIL $MEM_NFAIL $PCPU_NFAIL"
|
||||
|
||||
killall -q -KILL questd
|
||||
/etc/init.d/quest stop
|
||||
@@ -53,7 +49,6 @@ restart_questd()
|
||||
NPROC_NFAIL=0
|
||||
MEM_NFAIL=0
|
||||
PCPU_NFAIL=0
|
||||
NNET_NFAIL=0
|
||||
}
|
||||
|
||||
|
||||
@@ -115,38 +110,21 @@ check_pcpu()
|
||||
|
||||
check_ubuscall()
|
||||
{
|
||||
local rv
|
||||
local rv
|
||||
|
||||
ubus -t $UBUS_TIMEOUT call router.system info >/dev/null 2>&1
|
||||
rv=$?
|
||||
ubus -t $UBUS_TIMEOUT call router.system info >/dev/null 2>&1
|
||||
rv=$?
|
||||
|
||||
[ "$rv" = "0" ] && return 0
|
||||
return 1
|
||||
[ "$rv" = "0" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
check_ubus_network_call() {
|
||||
[ "$(uci -q get network.lan)" == "interface" ] || return 0
|
||||
json_load "$(ifstatus lan)" || return 0
|
||||
json_get_var up up
|
||||
[ $up -eq 1 ] || return 0
|
||||
local ifname="$(uci -q get network.lan.ifname)"
|
||||
[ -z "$ifname" -o "${ifname:0:3}" == "br-" ] && return 0
|
||||
ubus -t 5 call router.network ports '{"network":"lan"}' | grep -q statistics || {
|
||||
NNET_NFAIL=1
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
restart_bsd()
|
||||
{
|
||||
logger -s -t $0[$$] "Restarting WiFi and Band Steering daemon due to bsd hangup."
|
||||
killall -q -15 bsd 2>/dev/null
|
||||
wlctl -i wl0 down 2>/dev/null
|
||||
wlctl -i wl1 down 2>/dev/null
|
||||
wlctl -i wl0 up 2>/dev/null
|
||||
wlctl -i wl1 up 2>/dev/null
|
||||
bsd &
|
||||
logger -s -t $0[$$] "Restarting bsd."
|
||||
killall -q -KILL bsd
|
||||
bsd
|
||||
}
|
||||
|
||||
check_bsdcall()
|
||||
@@ -163,13 +141,9 @@ check_bsdcall()
|
||||
|
||||
restart_acsd()
|
||||
{
|
||||
logger -s -t $0[$$] "Restarting WiFi and Auto Channel Selection daemon due to acsd high CPU usage."
|
||||
killall -q -9 acsd 2>/dev/null
|
||||
wlctl -i wl0 down 2>/dev/null
|
||||
wlctl -i wl1 down 2>/dev/null
|
||||
wlctl -i wl0 up 2>/dev/null
|
||||
wlctl -i wl1 up 2>/dev/null
|
||||
acsd
|
||||
logger -s -t $0[$$] "Restarting acsd."
|
||||
killall -q -KILL acsd
|
||||
acsd &
|
||||
}
|
||||
|
||||
check_acsd()
|
||||
@@ -181,7 +155,7 @@ check_acsd()
|
||||
|
||||
for p in $pcpu; do
|
||||
p=${p%%%*}
|
||||
if [ "$p" -ge "40" ]; then
|
||||
if [ "$p" -ge "20" ]; then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
@@ -219,11 +193,8 @@ main()
|
||||
"$restart_mem" = "1" -o \
|
||||
"$restart_pcpu" = "1" ]
|
||||
then
|
||||
# check_ubuscall || restart_questd
|
||||
restart_questd
|
||||
else
|
||||
if [ "$sample" -ge "$SAMPLES" ]; then
|
||||
check_ubus_network_call || restart_questd
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$BSDBIN" ] ; then
|
||||
|
||||
@@ -55,14 +55,11 @@ define Package/samba2-client
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += $(FPIC)
|
||||
WERR := -Werror=format-security
|
||||
TARGET_CFLAGS_WITHOUT_WERR := $(filter-out $(WERR),$(TARGET_CFLAGS))
|
||||
|
||||
define Build/Compile
|
||||
rm -rf $(PKG_INSTALL_DIR)
|
||||
mkdir -p $(PKG_INSTALL_DIR)
|
||||
(cd $(PKG_BUILD_DIR)/source ; rm -rf config.{cache,status} ; \
|
||||
CFLAGS="-D_LARGEFILE64_SOURCE -D_GNU_SOURCE" \
|
||||
./configure \
|
||||
$(HOST_CONFIGURE_VARS) \
|
||||
$(HOST_CONFIGURE_ARGS) \
|
||||
@@ -96,7 +93,7 @@ define Build/Compile
|
||||
clean
|
||||
(cd $(PKG_BUILD_DIR)/source; rm -rf config.{cache,status}; \
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
CFLAGS="$(TARGET_CFLAGS_WITHOUT_WERR) -D_GNU_SOURCE -DNDEBUG -DSHMEM_SIZE=524288" \
|
||||
CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE -DNDEBUG -DSHMEM_SIZE=524288 -Dfcntl=fcntl64" \
|
||||
CPPFLAGS="$(TARGET_CPPFLAGS)" \
|
||||
LDFLAGS="$(TARGET_LDFLAGS) $(LIBGCC_S)" \
|
||||
ac_cv_lib_cups_httpConnect=no \
|
||||
|
||||
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=samba3
|
||||
PKG_VERSION:=3.0.37
|
||||
PKG_RELEASE:=2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_MD5SUM:=11ed2bfef4090bd5736b194b43f67289
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
diff --git a/source/smbd/process.c b/source/smbd/process.c
|
||||
index e861e16..6499bc7 100644
|
||||
--- a/source/smbd/process.c
|
||||
+++ b/source/smbd/process.c
|
||||
@@ -1159,6 +1159,7 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize)
|
||||
{
|
||||
static char *orig_inbuf;
|
||||
static char *orig_outbuf;
|
||||
+ static int orig_size;
|
||||
int smb_com1, smb_com2 = CVAL(inbuf,smb_vwv0);
|
||||
unsigned smb_off2 = SVAL(inbuf,smb_vwv1);
|
||||
char *inbuf2, *outbuf2;
|
||||
@@ -1178,6 +1179,13 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize)
|
||||
/* this is the first part of the chain */
|
||||
orig_inbuf = inbuf;
|
||||
orig_outbuf = outbuf;
|
||||
+ orig_size = size;
|
||||
+ }
|
||||
+
|
||||
+ /* Validate smb_off2 */
|
||||
+ if ((smb_off2 < smb_wct - 4) || orig_size < (smb_off2 + 4 - smb_wct)) {
|
||||
+ exit_server_cleanly("Bad chained packet");
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1192,6 +1200,11 @@ int chain_reply(char *inbuf,char *outbuf,int size,int bufsize)
|
||||
SSVAL(outbuf,smb_vwv1,smb_offset(outbuf+outsize,outbuf));
|
||||
SCVAL(outbuf,smb_vwv0,smb_com2);
|
||||
|
||||
+ if (outsize <= smb_wct) {
|
||||
+ exit_server_cleanly("Bad chained packet");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
/* remember how much the caller added to the chain, only counting stuff
|
||||
after the parameter words */
|
||||
chain_size += outsize - smb_wct;
|
||||
@@ -1,82 +0,0 @@
|
||||
diff --git a/source/lib/util_sid.c b/source/lib/util_sid.c
|
||||
index 032be9a..2c5a0c7 100644
|
||||
--- a/source/lib/util_sid.c
|
||||
+++ b/source/lib/util_sid.c
|
||||
@@ -403,6 +403,9 @@ BOOL sid_parse(const char *inbuf, size_t len, DOM_SID *sid)
|
||||
|
||||
sid->sid_rev_num = CVAL(inbuf, 0);
|
||||
sid->num_auths = CVAL(inbuf, 1);
|
||||
+ if (sid->num_auths > MAXSUBAUTHS) {
|
||||
+ return false;
|
||||
+ }
|
||||
memcpy(sid->id_auth, inbuf+2, 6);
|
||||
if (len < 8 + sid->num_auths*4)
|
||||
return False;
|
||||
diff --git a/source/libads/ldap.c b/source/libads/ldap.c
|
||||
index 7479894..eebc0fd 100644
|
||||
--- a/source/libads/ldap.c
|
||||
+++ b/source/libads/ldap.c
|
||||
@@ -1771,7 +1771,9 @@ static void dump_sid(const char *field, struct berval **values)
|
||||
int i;
|
||||
for (i=0; values[i]; i++) {
|
||||
DOM_SID sid;
|
||||
- sid_parse(values[i]->bv_val, values[i]->bv_len, &sid);
|
||||
+ if (!sid_parse(values[i]->bv_val, values[i]->bv_len, &sid)) {
|
||||
+ return;
|
||||
+ }
|
||||
printf("%s: %s\n", field, sid_string_static(&sid));
|
||||
}
|
||||
}
|
||||
diff --git a/source/libsmb/cliquota.c b/source/libsmb/cliquota.c
|
||||
index 2a47ae2..5721b67 100644
|
||||
--- a/source/libsmb/cliquota.c
|
||||
+++ b/source/libsmb/cliquota.c
|
||||
@@ -117,7 +117,9 @@ static BOOL parse_user_quota_record(const char *rdata, unsigned int rdata_count,
|
||||
}
|
||||
#endif /* LARGE_SMB_OFF_T */
|
||||
|
||||
- sid_parse(rdata+40,sid_len,&qt.sid);
|
||||
+ if (!sid_parse(rdata+40,sid_len,&qt.sid)) {
|
||||
+ return False;
|
||||
+ }
|
||||
|
||||
qt.qtype = SMB_USER_QUOTA_TYPE;
|
||||
|
||||
diff --git a/source/smbd/nttrans.c b/source/smbd/nttrans.c
|
||||
index 2b9d5da..60bab7e 100644
|
||||
--- a/source/smbd/nttrans.c
|
||||
+++ b/source/smbd/nttrans.c
|
||||
@@ -2424,7 +2424,10 @@ static int call_nt_transact_ioctl(connection_struct *conn, char *inbuf, char *ou
|
||||
/* unknown 4 bytes: this is not the length of the sid :-( */
|
||||
/*unknown = IVAL(pdata,0);*/
|
||||
|
||||
- sid_parse(pdata+4,sid_len,&sid);
|
||||
+ if (!sid_parse(pdata+4,sid_len,&sid)) {
|
||||
+ return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
|
||||
+ }
|
||||
+
|
||||
DEBUGADD(10,("for SID: %s\n",sid_string_static(&sid)));
|
||||
|
||||
if (!sid_to_uid(&sid, &uid)) {
|
||||
@@ -2662,7 +2665,9 @@ static int call_nt_transact_get_user_quota(connection_struct *conn, char *inbuf,
|
||||
break;
|
||||
}
|
||||
|
||||
- sid_parse(pdata+8,sid_len,&sid);
|
||||
+ if (!sid_parse(pdata+8,sid_len,&sid)) {
|
||||
+ return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
|
||||
+ }
|
||||
|
||||
if (vfs_get_ntquota(fsp, SMB_USER_QUOTA_TYPE, &sid, &qt)!=0) {
|
||||
ZERO_STRUCT(qt);
|
||||
@@ -2828,7 +2833,9 @@ static int call_nt_transact_set_user_quota(connection_struct *conn, char *inbuf,
|
||||
}
|
||||
#endif /* LARGE_SMB_OFF_T */
|
||||
|
||||
- sid_parse(pdata+40,sid_len,&sid);
|
||||
+ if (!sid_parse(pdata+40,sid_len,&sid)) {
|
||||
+ return ERROR_NT(NT_STATUS_INVALID_PARAMETER);
|
||||
+ }
|
||||
DEBUGADD(8,("SID: %s\n",sid_string_static(&sid)));
|
||||
|
||||
/* 44 unknown bytes left... */
|
||||
@@ -1,59 +0,0 @@
|
||||
From e11637c2c89c2d38963311416c34a4767b19e175 Mon Sep 17 00:00:00 2001
|
||||
From: Stefan Metzmacher <metze@samba.org>
|
||||
Date: Sat, 17 Mar 2012 01:22:27 +0100
|
||||
Subject: [PATCH] s3:librpc/gen_ndr: fix array checks (bug #8815 / CVE-2012-1182)
|
||||
|
||||
An Anonymous researcher working with HP's Zero Day Initiative program
|
||||
has found this and notified us.
|
||||
|
||||
metze
|
||||
---
|
||||
source/librpc/gen_ndr/ndr_wkssvc.c | 12 ++++++------
|
||||
1 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/source/librpc/gen_ndr/ndr_wkssvc.c b/source/librpc/gen_ndr/ndr_wkssvc.c
|
||||
index 2af3587..07cf1a1 100644
|
||||
--- a/source/librpc/gen_ndr/ndr_wkssvc.c
|
||||
+++ b/source/librpc/gen_ndr/ndr_wkssvc.c
|
||||
@@ -1385,10 +1385,10 @@ NTSTATUS ndr_pull_USER_INFO_0_CONTAINER(struct ndr_pull *ndr, int ndr_flags, str
|
||||
NDR_PULL_ALLOC_N(ndr, r->user0, ndr_get_array_size(ndr, &r->user0));
|
||||
_mem_save_user0_1 = NDR_PULL_GET_MEM_CTX(ndr);
|
||||
NDR_PULL_SET_MEM_CTX(ndr, r->user0, 0);
|
||||
- for (cntr_user0_1 = 0; cntr_user0_1 < r->entries_read; cntr_user0_1++) {
|
||||
+ for (cntr_user0_1 = 0; cntr_user0_1 < ndr_get_array_size(ndr, &r->user0); cntr_user0_1++) {
|
||||
NDR_CHECK(ndr_pull_USER_INFO_0(ndr, NDR_SCALARS, &r->user0[cntr_user0_1]));
|
||||
}
|
||||
- for (cntr_user0_1 = 0; cntr_user0_1 < r->entries_read; cntr_user0_1++) {
|
||||
+ for (cntr_user0_1 = 0; cntr_user0_1 < ndr_get_array_size(ndr, &r->user0); cntr_user0_1++) {
|
||||
NDR_CHECK(ndr_pull_USER_INFO_0(ndr, NDR_BUFFERS, &r->user0[cntr_user0_1]));
|
||||
}
|
||||
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user0_1, 0);
|
||||
@@ -1631,10 +1631,10 @@ NTSTATUS ndr_pull_USER_INFO_1_CONTAINER(struct ndr_pull *ndr, int ndr_flags, str
|
||||
NDR_PULL_ALLOC_N(ndr, r->user1, ndr_get_array_size(ndr, &r->user1));
|
||||
_mem_save_user1_1 = NDR_PULL_GET_MEM_CTX(ndr);
|
||||
NDR_PULL_SET_MEM_CTX(ndr, r->user1, 0);
|
||||
- for (cntr_user1_1 = 0; cntr_user1_1 < r->entries_read; cntr_user1_1++) {
|
||||
+ for (cntr_user1_1 = 0; cntr_user1_1 < ndr_get_array_size(ndr, &r->user1); cntr_user1_1++) {
|
||||
NDR_CHECK(ndr_pull_USER_INFO_1(ndr, NDR_SCALARS, &r->user1[cntr_user1_1]));
|
||||
}
|
||||
- for (cntr_user1_1 = 0; cntr_user1_1 < r->entries_read; cntr_user1_1++) {
|
||||
+ for (cntr_user1_1 = 0; cntr_user1_1 < ndr_get_array_size(ndr, &r->user1); cntr_user1_1++) {
|
||||
NDR_CHECK(ndr_pull_USER_INFO_1(ndr, NDR_BUFFERS, &r->user1[cntr_user1_1]));
|
||||
}
|
||||
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_user1_1, 0);
|
||||
@@ -1953,10 +1953,10 @@ NTSTATUS ndr_pull_wkssvc_NetWkstaTransportCtr0(struct ndr_pull *ndr, int ndr_fla
|
||||
NDR_PULL_ALLOC_N(ndr, r->array, ndr_get_array_size(ndr, &r->array));
|
||||
_mem_save_array_1 = NDR_PULL_GET_MEM_CTX(ndr);
|
||||
NDR_PULL_SET_MEM_CTX(ndr, r->array, 0);
|
||||
- for (cntr_array_1 = 0; cntr_array_1 < r->count; cntr_array_1++) {
|
||||
+ for (cntr_array_1 = 0; cntr_array_1 < ndr_get_array_size(ndr, &r->array); cntr_array_1++) {
|
||||
NDR_CHECK(ndr_pull_wkssvc_NetWkstaTransportInfo0(ndr, NDR_SCALARS, &r->array[cntr_array_1]));
|
||||
}
|
||||
- for (cntr_array_1 = 0; cntr_array_1 < r->count; cntr_array_1++) {
|
||||
+ for (cntr_array_1 = 0; cntr_array_1 < ndr_get_array_size(ndr, &r->array); cntr_array_1++) {
|
||||
NDR_CHECK(ndr_pull_wkssvc_NetWkstaTransportInfo0(ndr, NDR_BUFFERS, &r->array[cntr_array_1]));
|
||||
}
|
||||
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_array_1, 0);
|
||||
--
|
||||
1.7.4.1
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
--- a/source/utils/owrt_smbpasswd.c 2017-10-03 15:57:24.190827000 +0100
|
||||
+++ a/source/utils/owrt_smbpasswd.c 2017-10-03 16:07:54.862857000 +0100
|
||||
@@ -108,7 +108,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- fprintf(fp, line);
|
||||
+ fprintf(fp, "%s", line);
|
||||
|
||||
out:
|
||||
if(fp)
|
||||
@@ -134,20 +134,20 @@
|
||||
p = strchr(t, ':');
|
||||
if(p && (p - t == strlen(user)) && (strncmp(t, user, strlen(user))) == 0)
|
||||
{
|
||||
- fpos_t r_pos, w_pos;
|
||||
+ long int r_pos, w_pos;
|
||||
char t2[256];
|
||||
- fgetpos(fp, &r_pos);
|
||||
+ r_pos = ftell(fp);
|
||||
w_pos = r_pos;
|
||||
- w_pos.__pos -= strlen(t);
|
||||
+ w_pos -= strlen(t);
|
||||
while(fgets(t2, 256, fp))
|
||||
{
|
||||
- fsetpos(fp, &w_pos);
|
||||
+ fseek(fp, w_pos, SEEK_SET);
|
||||
fputs(t2, fp);
|
||||
- r_pos.__pos += strlen(t2);
|
||||
- w_pos.__pos += strlen(t2);
|
||||
- fsetpos(fp, &r_pos);
|
||||
+ r_pos += strlen(t2);
|
||||
+ w_pos += strlen(t2);
|
||||
+ fseek(fp, r_pos, SEEK_SET);
|
||||
}
|
||||
- ftruncate(fileno(fp), w_pos.__pos);
|
||||
+ ftruncate(fileno(fp), w_pos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
|
||||
config testserver '1'
|
||||
option server 'tptest.bredband.net'
|
||||
option port '1640'
|
||||
|
||||
config testserver '2'
|
||||
option server 'referens.sth.ip-performance.se'
|
||||
option port '1642'
|
||||
|
||||
|
||||
107
tr064/.cproject
107
tr064/.cproject
@@ -1,107 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.debug.1423203916">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.debug.1423203916" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.debug.1423203916" name="Debug" parent="cdt.managedbuild.config.gnu.cross.exe.debug">
|
||||
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.1423203916." name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.debug.482080998" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.debug">
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1864775892" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
||||
<builder buildPath="${workspace_loc:/tr064}/Debug" id="cdt.managedbuild.builder.gnu.cross.84968765" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.912678595" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
|
||||
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.732187738" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.debugging.level.406132207" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.656190220" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.894741631" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
|
||||
<option id="gnu.cpp.compiler.option.optimization.level.1987025848" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.debugging.level.1506505331" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1176314661" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1134635640" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1076025733" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.862614592" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.638528350" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.390953300" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="cdt.managedbuild.config.gnu.cross.exe.release.517635632">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.cross.exe.release.517635632" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.release.517635632" name="Release" parent="cdt.managedbuild.config.gnu.cross.exe.release">
|
||||
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.release.517635632." name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.exe.release.2086871607" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.exe.release">
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1691338213" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
||||
<builder buildPath="${workspace_loc:/tr064}/Release" id="cdt.managedbuild.builder.gnu.cross.2045398730" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.804948441" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
|
||||
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.option.optimization.level.422910401" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" useByScannerDiscovery="false" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.debugging.level.1240870180" name="Debug Level" superClass="gnu.c.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.c.debugging.level.none" valueType="enumerated"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.118715116" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.119838407" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
|
||||
<option id="gnu.cpp.compiler.option.optimization.level.198417757" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.debugging.level.380023243" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" useByScannerDiscovery="false" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.751400281" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.398459196" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.1354328537" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.1258554594" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.2022763402" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1223740654" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="tr064.cdt.managedbuild.target.gnu.cross.exe.1457888368" name="Executable" projectType="cdt.managedbuild.target.gnu.cross.exe"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.debug.1423203916;cdt.managedbuild.config.gnu.cross.exe.debug.1423203916.;cdt.managedbuild.tool.gnu.cross.c.compiler.912678595;cdt.managedbuild.tool.gnu.c.compiler.input.656190220">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.cross.exe.release.517635632;cdt.managedbuild.config.gnu.cross.exe.release.517635632.;cdt.managedbuild.tool.gnu.cross.c.compiler.804948441;cdt.managedbuild.tool.gnu.c.compiler.input.118715116">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
|
||||
</cproject>
|
||||
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>tr064</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>openssl-1.0.2i</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project>
|
||||
<configuration id="cdt.managedbuild.config.gnu.cross.exe.debug.1423203916" name="Debug">
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1404192411374960532" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
</extension>
|
||||
</configuration>
|
||||
<configuration id="cdt.managedbuild.config.gnu.cross.exe.release.517635632" name="Release">
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="1404192411374960532" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
</extension>
|
||||
</configuration>
|
||||
</project>
|
||||
@@ -1,82 +0,0 @@
|
||||
# Copyright (C) 2017 PIVA Software <www.pivasoftware.com>
|
||||
# Author: OMAR Kallel <omar.kallel@pivasoftware.com>
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=tr064
|
||||
PKG_VERSION:=1.0
|
||||
PKG_SOURCE_URL:=git@public.inteno.se:tr064.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=e53d492a09c433718a520987c419cb6a4d4ae8dc
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_TR064_DEBUG \
|
||||
CONFIG_TR064_DEVEL
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/tr064
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=tr064
|
||||
DEPENDS:=+libubus +libuci +libubox +libmicroxml +libjson-c +libpthread +libdatamodel +libopenssl +libubus +libubox
|
||||
endef
|
||||
|
||||
define Package/tr064/description
|
||||
TR-064 protocol
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += \
|
||||
-D_GNU_SOURCE
|
||||
|
||||
TARGET_LDFLAGS += \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--with-uci-include-path=$(STAGING_DIR)/usr/include \
|
||||
--with-libubox-include-path=$(STAGING_DIR)/usr/include \
|
||||
--with-libubus-include-path=$(STAGING_DIR)/usr/include
|
||||
|
||||
ifeq ($(CONFIG_TR064_DEBUG),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-debug
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TR064_DEVEL),y)
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-devel
|
||||
endif
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--enable-jsonc=1
|
||||
|
||||
define Package/tr064/conffiles
|
||||
/etc/config/tr064
|
||||
endef
|
||||
|
||||
define Package/tr064/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DIR) $(1)/etc/upnp-md
|
||||
$(INSTALL_DIR) $(1)/etc/upnp-md/web
|
||||
$(INSTALL_DIR) $(1)/etc/upnp-md/x509
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/upnp-md-pupnp/upnp-md $(1)/usr/bin
|
||||
$(CP) $(PKG_BUILD_DIR)/web/*.xml $(1)/etc/upnp-md/web
|
||||
$(CP) $(PKG_BUILD_DIR)/tools/parse_ftp_server_log.sh $(1)/usr/bin
|
||||
$(CP) $(PKG_BUILD_DIR)/tools/kill_child.sh $(1)/usr/bin
|
||||
$(CP) $(PKG_BUILD_DIR)/x509/*.pem $(1)/etc/upnp-md/x509
|
||||
$(INSTALL_CONF) $(PKG_BUILD_DIR)/conf/upnp-md.conf $(1)/etc/upnp-md
|
||||
$(CP) $(PKG_BUILD_DIR)/conf/DMconf.xml $(1)/etc/upnp-md
|
||||
$(CP) $(PKG_BUILD_DIR)/conf/CPID.csv $(1)/etc/upnp-md
|
||||
$(CP) $(PKG_BUILD_DIR)/conf/tr064 $(1)/etc/config
|
||||
$(CP) $(PKG_BUILD_DIR)/conf/tr064d $(1)/etc/init.d
|
||||
chmod 0744 $(1)/etc/init.d/tr064d
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,tr064))
|
||||
@@ -9,10 +9,10 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=u-boot
|
||||
PKG_VERSION:=2016.08
|
||||
PKG_RELEASE:=4
|
||||
PKG_RELEASE:=2
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/uboot
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=f502d1b589f14142bf7d7719e8434014f180d03f
|
||||
PKG_SOURCE_VERSION:=fccb9d5ee720a9f60cba917ded83e5cebe221eef
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
@@ -16,7 +16,7 @@ define Package/voice-client
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=voice-client
|
||||
DEPENDS:=asterisk13||asterisk18-mod
|
||||
DEPENDS:=+asterisk13
|
||||
endef
|
||||
|
||||
define Package/voice-client/description
|
||||
|
||||
@@ -68,7 +68,6 @@ TMPL_ASTERISK=$TEMPLATEDIR/asterisk.conf.TEMPLATE
|
||||
TMPL_CDR=$TEMPLATEDIR/cdr.conf.TEMPLATE
|
||||
TMPL_CDR_SYSLOG=$TEMPLATEDIR/cdr_syslog.conf.TEMPLATE
|
||||
TMPL_INDICATIONS=$TEMPLATEDIR/indications.conf.TEMPLATE
|
||||
TMPL_CEL=$TEMPLATEDIR/cel.conf.TEMPLATE
|
||||
TMPL_LOGGER=$TEMPLATEDIR/logger.conf.TEMPLATE
|
||||
TMPL_MANAGER=$TEMPLATEDIR/manager.conf.TEMPLATE
|
||||
TMPL_MODULES=$TEMPLATEDIR/modules.conf.TEMPLATE
|
||||
@@ -81,7 +80,7 @@ TMPL_BRCM_LINE=$TEMPLATEDIR/brcm_line.TEMPLATE
|
||||
|
||||
TMPL_MEETME=$TEMPLATEDIR/meetme.conf.TEMPLATE
|
||||
|
||||
SPECRATECFG=$ASTERISKDIR/special_rate_nr.cfg
|
||||
SPECRATEDIR=$ASTERISKDIR/special_rate_nr.cfg
|
||||
|
||||
run_hook()
|
||||
{
|
||||
@@ -98,13 +97,13 @@ escape_sed_substitution()
|
||||
# Gets rid of any config files from $ASTERISKDIR not found in $WORKDIR.
|
||||
clean_up_asterisk_config_dir()
|
||||
{
|
||||
for f in $ASTERISKDIR/* ; do
|
||||
basef="`basename $f`"
|
||||
if [ ! -e "$WORKDIR/$basef" ] ; then
|
||||
rm -rf "$f"
|
||||
for f in $ASTERISKDIR/* ; do
|
||||
basef="`basename $f`"
|
||||
if [ ! -e "$WORKDIR/$basef" ] ; then
|
||||
rm -rf "$f"
|
||||
echo "$f" >> /tmp/voice.log
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Compares md5sums of the config files in $WORKDIR to those
|
||||
@@ -114,7 +113,7 @@ compare_configs_and_copy_changed()
|
||||
{
|
||||
# First, compute md5sums of the config files in $WORKDIR.
|
||||
cd $WORKDIR/
|
||||
md5sum * > $MD5SUMSFILE 2>/dev/null
|
||||
md5sum * > $MD5SUMSFILE
|
||||
|
||||
# Now, check the files in $ASTERISKDIR against the md5sums.
|
||||
cd $ASTERISKDIR/
|
||||
@@ -142,15 +141,15 @@ assemble_and_copy_config()
|
||||
# start if a config item is missing and an included config file isn't created.
|
||||
|
||||
# Copy the template files which we don't edit.
|
||||
[ -f $TMPL_ASTERISK ] && cp $TMPL_ASTERISK $WORKDIR/asterisk.conf
|
||||
[ -f $TMPL_CDR ] && cp $TMPL_CDR $WORKDIR/cdr.conf
|
||||
[ -f $TMPL_CEL ] && cp $TMPL_CEL $WORKDIR/cel.conf
|
||||
[ -f $TMPL_INDICATIONS ] && cp $TMPL_INDICATIONS $WORKDIR/indications.conf
|
||||
[ -f $TMPL_MANAGER ] && cp $TMPL_MANAGER $WORKDIR/manager.conf
|
||||
[ -f $TMPL_MODULES ] && cp $TMPL_MODULES $WORKDIR/modules.conf
|
||||
[ -f $TMPL_EXTENSIONS_MACRO ] && cp $TMPL_EXTENSIONS_MACRO $WORKDIR/extensions_macro.conf
|
||||
[ -f $TMPL_MUSICONHOLD ] && cp $TMPL_MUSICONHOLD $WORKDIR/musiconhold.conf
|
||||
[ -f $SPECRATECFG ] && cp $SPECRATECFG $WORKDIR/special_rate_nr.cfg
|
||||
cp $TMPL_ASTERISK $WORKDIR/asterisk.conf
|
||||
cp $TMPL_CDR $WORKDIR/cdr.conf
|
||||
cp $TMPL_CEL $WORKDIR/cel.conf
|
||||
cp $TMPL_INDICATIONS $WORKDIR/indications.conf
|
||||
cp $TMPL_MANAGER $WORKDIR/manager.conf
|
||||
cp $TMPL_MODULES $WORKDIR/modules.conf
|
||||
cp $TMPL_EXTENSIONS_MACRO $WORKDIR/extensions_macro.conf
|
||||
cp $TMPL_MUSICONHOLD $WORKDIR/musiconhold.conf
|
||||
cp $SPECRATEDIR $WORKDIR/special_rate_nr.cfg
|
||||
|
||||
test -e $TMPL_MEETME && cp $TMPL_MEETME $WORKDIR/meetme.conf
|
||||
|
||||
@@ -179,7 +178,7 @@ assemble_and_copy_config()
|
||||
mv $WORKDIR/features.tmp $WORKDIR/features.conf
|
||||
mv $WORKDIR/voicemail.tmp $WORKDIR/voicemail.conf
|
||||
mv $WORKDIR/meetme.tmp $WORKDIR/meetme.conf
|
||||
mv $WORKDIR/logger.tmp $WORKDIR/logger.conf
|
||||
mv $WORKDIR/logger.tmp $WORKDIR/logger.conf
|
||||
mv $WORKDIR/queues.tmp $WORKDIR/queues.conf
|
||||
mv $WORKDIR/dnsmgr.tmp $WORKDIR/dnsmgr.conf
|
||||
|
||||
@@ -468,13 +467,13 @@ configure_sip()
|
||||
if [ -z "$registertimeoutbackoff" ] ; then
|
||||
sed -i "s/registertimeoutbackoff=|REGISTERTIMEOUTBACKOFF|/;registertimeoutbackoff=/g" $WORKDIR/sip.tmp
|
||||
else
|
||||
sed -i "s/|REGISTERTIMEOUTBACKOFF|/$registertimeoutbackoff/g" $WORKDIR/sip.tmp
|
||||
sed -i "s/|REGISTERTIMEOUTBACKOFF|/$registertimeoutbackoff/g" $WORKDIR/sip.tmp
|
||||
fi
|
||||
|
||||
if [ -z "$registerattemptsbackoff" ] ; then
|
||||
sed -i "s/registerattemptsbackoff=|REGISTERATTEMPTSBACKOFF|/;registerattemptsbackoff=/g" $WORKDIR/sip.tmp
|
||||
else
|
||||
sed -i "s/|REGISTERATTEMPTSBACKOFF|/$registerattemptsbackoff/g" $WORKDIR/sip.tmp
|
||||
sed -i "s/|REGISTERATTEMPTSBACKOFF|/$registerattemptsbackoff/g" $WORKDIR/sip.tmp
|
||||
fi
|
||||
|
||||
if [ -z "$register403timeout" ] ; then
|
||||
@@ -543,7 +542,7 @@ configure_sip()
|
||||
for section in ${CONFIG_SECTIONS}; do
|
||||
local transport
|
||||
config_get cfgtype "$section" TYPE
|
||||
[ -n "$type" -a "x$cfgtype" != "x$type" ] && continue
|
||||
[ -n "$type" -a "x$cfgtype" != "x$type" ] && continue
|
||||
config_get transport $section transport
|
||||
if [ "$transport" == "tls" ] ; then
|
||||
tlsenable="yes"
|
||||
@@ -805,7 +804,7 @@ configure_sip_provider()
|
||||
fi
|
||||
sed -i "s/|AUTOFRAMING|/$autoframing/" $WORKDIR/sip_provider.tmp
|
||||
|
||||
# Set registered extension so that incoming calls match the correct peer
|
||||
# Set registered extension so that incoming calls match the correct peer
|
||||
sed -i "s/|CONTACT_USER|/$user/g" $WORKDIR/sip_provider.tmp
|
||||
|
||||
# Add SIP Provider configuration to the temp file containing all SIP Provider configs.
|
||||
@@ -1036,7 +1035,7 @@ configure_queue()
|
||||
echo "[macro-$1]" >> $WORKDIR/macros.tmp
|
||||
echo "exten => s,1,Answer()" >> $WORKDIR/macros.tmp
|
||||
|
||||
# Workaround to fix no ringback issue for incoming SIP calls
|
||||
# Workaround to fix no ringback issue for incoming SIP calls
|
||||
echo "exten => s,n,Playback(silence/1)" >> $WORKDIR/macros.tmp
|
||||
|
||||
echo "exten => s,n,Queue($1,R)" >> $WORKDIR/macros.tmp
|
||||
@@ -1128,13 +1127,13 @@ configure_cdr()
|
||||
|
||||
echo "cdr_syslog: $cdr_syslog"
|
||||
|
||||
if [ -z "$cdr_syslog" ] ; then
|
||||
if [ -z "$cdr_syslog" ] ; then
|
||||
cdr_syslog='0'
|
||||
fi
|
||||
|
||||
# Enable/disable CDR logging in syslog
|
||||
if [ "$cdr_syslog" == "1" ] ; then
|
||||
cp $TMPL_CDR_SYSLOG $WORKDIR/cdr_syslog.conf
|
||||
cp $TMPL_CDR_SYSLOG $WORKDIR/cdr_syslog.conf
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1189,28 +1188,27 @@ configure_call_filters()
|
||||
echo "exten => s,n(not-foreign),Set(FOREIGN=0)" >> $WORKDIR/macros.tmp
|
||||
echo "" >> $WORKDIR/macros.tmp
|
||||
|
||||
# Get special rate numbers from /etc/asterisk/special_rate_nr.cfg
|
||||
if [ -f $SPECRATECFG ]; then
|
||||
while read line
|
||||
do
|
||||
i=0
|
||||
for v in $(echo $line | tr ";" "\n")
|
||||
do
|
||||
if [ "$i" -eq "0" -a "$v" != "$country" ] ; then
|
||||
continue 2
|
||||
fi
|
||||
if [ "$i" -eq "1" ] ; then
|
||||
srn=$v
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
if [ -n "$srn" ] ; then
|
||||
# Special rate numbers found
|
||||
break
|
||||
# Get special rate numbers from /etc/asterisk/special_rate_nr.cfg
|
||||
while read line
|
||||
do
|
||||
i=0
|
||||
for v in $(echo $line | tr ";" "\n")
|
||||
do
|
||||
if [ "$i" -eq "0" -a "$v" != "$country" ] ; then
|
||||
continue 2
|
||||
fi
|
||||
done < $SPECRATECFG
|
||||
fi
|
||||
if [ "$i" -eq "1" ] ; then
|
||||
srn=$v
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
if [ -n "$srn" ] ; then
|
||||
# Special rate numbers found
|
||||
break
|
||||
fi
|
||||
done < "/etc/asterisk/special_rate_nr.cfg"
|
||||
|
||||
echo "Found special rate numbers: $srn"
|
||||
|
||||
@@ -1329,8 +1327,8 @@ get_call_filter()
|
||||
macro="NoOp()"
|
||||
|
||||
if ! [ "x$direction" != "xincoming" -o "x$direction" != "xoutgoing" ] ; then
|
||||
echo $macro
|
||||
fi
|
||||
echo $macro
|
||||
fi
|
||||
|
||||
local call_filter enabled
|
||||
config_get call_filter $provider call_filter "call_filter0"
|
||||
@@ -1355,20 +1353,20 @@ configure_opening_hours_profile()
|
||||
local section cfgtype
|
||||
[ -z "$CONFIG_SECTIONS" ] && return 0
|
||||
for section in ${CONFIG_SECTIONS}; do
|
||||
config_get cfgtype "$section" TYPE
|
||||
[ -n "timespan" -a "x$cfgtype" != "xtimespan" ] && continue
|
||||
local owner
|
||||
config_get cfgtype "$section" TYPE
|
||||
[ -n "timespan" -a "x$cfgtype" != "xtimespan" ] && continue
|
||||
local owner
|
||||
|
||||
config_get owner $section owner
|
||||
if [ "$owner" == "$1" ] ; then
|
||||
local tr dow dom months
|
||||
config_get tr $section time_range
|
||||
config_get dow $section days_of_week
|
||||
config_get dom $section days_of_month
|
||||
config_get months $section months
|
||||
config_get owner $section owner
|
||||
if [ "$owner" == "$1" ] ; then
|
||||
local tr dow dom months
|
||||
config_get tr $section time_range
|
||||
config_get dow $section days_of_week
|
||||
config_get dom $section days_of_month
|
||||
config_get months $section months
|
||||
|
||||
echo "exten => s,n,GotoIfTime($tr,$dow,$dom,$months,?$label)" >> $WORKDIR/macros.tmp
|
||||
fi
|
||||
echo "exten => s,n,GotoIfTime($tr,$dow,$dom,$months,?$label)" >> $WORKDIR/macros.tmp
|
||||
fi
|
||||
done
|
||||
if [ "$invert" == "0" ] ; then
|
||||
echo "exten => s,n,Goto(closed)" >> $WORKDIR/macros.tmp
|
||||
@@ -1643,7 +1641,7 @@ configure_extensions_provider()
|
||||
local call_ivr call_queue extension
|
||||
echo "exten => $user,n,Set(__TRANSFER_CONTEXT=\${CHANNEL(peername)}-transfer)" >> $tmp
|
||||
|
||||
# replace prefix '+' with '00'
|
||||
# replace prefix '+' with '00'
|
||||
echo "exten => $user,n,GotoIf($[\"\${CALLERID(NUM):0:1}\" = \"+\"]?rewrite:norewrite)" >> $tmp
|
||||
echo "exten => $user,n(rewrite),Set(CALLERID(num)=\"00\${CALLERID(num):1}\"))" >> $tmp
|
||||
echo "exten => $user,n(norewrite),NoOp()">> $tmp
|
||||
@@ -1706,7 +1704,7 @@ configure_brcm_line_extension()
|
||||
echo "Configuring local extension $extension"
|
||||
|
||||
config_get cbbs_enabled "features" cbbs_enabled
|
||||
# load cbbs settings if enabled
|
||||
# load cbbs settings if enabled
|
||||
cbbs_key=""
|
||||
cbbs_maxretry="0"
|
||||
cbbs_retrytime="0"
|
||||
@@ -1723,7 +1721,7 @@ configure_brcm_line_extension()
|
||||
sed -i "s/|LINE|/$line/g" $WORKDIR/extensions_local_line.tmp
|
||||
sed -i "s/|TIMEOUT|/$(get_voicemail_timeout)/g" $WORKDIR/extensions_local_line.tmp
|
||||
|
||||
#cbbs settings
|
||||
#cbbs settings
|
||||
sed -i "s/|CBBS_KEY|/$(escape_sed_substitution $cbbs_key)/" $WORKDIR/extensions_local_line.tmp
|
||||
sed -i "s/|MAX_RETRIES|/$cbbs_maxretry/" $WORKDIR/extensions_local_line.tmp
|
||||
sed -i "s/|RETRYTIME|/$cbbs_retrytime/" $WORKDIR/extensions_local_line.tmp
|
||||
@@ -2000,8 +1998,8 @@ configure_conference()
|
||||
echo "exten => $extension,n(enterno),Read(confno,,5)" >> $WORKDIR/extensions_local.tmp
|
||||
|
||||
for section in ${CONFIG_SECTIONS}; do
|
||||
config_get cfgtype "$section" TYPE
|
||||
[ "x$cfgtype" != "xconference_room" ] && continue
|
||||
config_get cfgtype "$section" TYPE
|
||||
[ "x$cfgtype" != "xconference_room" ] && continue
|
||||
|
||||
local name id enabled
|
||||
config_get name $section name
|
||||
@@ -2013,7 +2011,7 @@ configure_conference()
|
||||
echo "Enabling conference room $id"
|
||||
echo "exten => $extension,n,GotoIf($[\"\${confno}\"=\"$id\"]?enterconf)" >> $WORKDIR/extensions_local.tmp
|
||||
echo "conf => $id" >> $WORKDIR/meetme.tmp
|
||||
done
|
||||
done
|
||||
|
||||
echo "exten => $extension,n,Playback(conf-invalid)" >> $WORKDIR/extensions_local.tmp
|
||||
echo "exten => $extension,n,Goto(enterno)" >> $WORKDIR/extensions_local.tmp
|
||||
@@ -2283,13 +2281,11 @@ reload_service() {
|
||||
# if there is a registered account
|
||||
ubus call led.voice1 set '{"state":"off"}'
|
||||
|
||||
asterisk -rx "config reload $ASTERISKDIR/sip.conf"
|
||||
sleep 1
|
||||
asterisk -rx "core reload"
|
||||
asterisk -rx "dialplan reload"
|
||||
asterisk -rx "brcm reload"
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger voice_client
|
||||
procd_add_reload_trigger voice_client
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user