mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2026-01-09 06:07:19 +08:00
Compare commits
10 Commits
reidar-uci
...
elements-c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4bba2176ca | ||
|
|
c59d8ef0a6 | ||
|
|
f88e94cfee | ||
|
|
a241b7691e | ||
|
|
0406aef430 | ||
|
|
191941ec50 | ||
|
|
b30d872526 | ||
|
|
f026b15ee5 | ||
|
|
3f69dea2f1 | ||
|
|
a48f40489d |
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=asterisk18-mod
|
||||
PKG_VERSION:=1.8.10.1
|
||||
|
||||
PKG_SOURCE_VERSION:=62c3764e6765fa9b1d22cb5dda26476e4742bdcf
|
||||
PKG_SOURCE_VERSION:=015d279241d0ac5d8c1321aa6f78b9ae551575d1
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/asterisk-1.8.x
|
||||
|
||||
@@ -455,8 +455,6 @@ define Package/asterisk18-mod/install
|
||||
$(INSTALL_DATA) ./files/asterisk.default $(1)/etc/default/asterisk
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/asterisk.init $(1)/etc/init.d/asterisk
|
||||
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
|
||||
$(INSTALL_BIN) ./files/asterisk.hotplug $(1)/etc/hotplug.d/iface/80-asterisk
|
||||
endef
|
||||
|
||||
define Package/asterisk18-mod-sounds/install
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ "$ACTION" = ifup ] || exit 0
|
||||
|
||||
config_load voice_client
|
||||
config_get bindintf SIP bindintf
|
||||
|
||||
[ "$INTERFACE" == "$bindintf" ] || exit 0
|
||||
|
||||
. /lib/functions/network.sh
|
||||
|
||||
if [ -n "$bindintf" ]; then
|
||||
network_get_ipaddr bindaddr "$bindintf"
|
||||
bindaddr="${bindaddr:-0.0.0.0}"
|
||||
sed -i "s/bindaddr=.*/bindaddr=$bindaddr/g" /etc/asterisk/sip.conf
|
||||
[ -e /var/run/asterisk/asterisk.ctl ] && /etc/init.d/asterisk reload
|
||||
fi
|
||||
|
||||
@@ -3,15 +3,18 @@
|
||||
START=98
|
||||
STOP=10
|
||||
|
||||
. /usr/share/libubox/jshn.sh
|
||||
. /lib/functions/network.sh
|
||||
USE_PROCD=1
|
||||
NAME=asterisk
|
||||
PROG=/usr/sbin/asterisk
|
||||
DEFAULT=/etc/default/asterisk
|
||||
CONFDIR=/etc/asterisk
|
||||
|
||||
init_asterisk() {
|
||||
# do not start asterisk until the
|
||||
# router receives a default route
|
||||
while ! ip r | grep -q default; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
[ -f $DEFAULT ] && . $DEFAULT
|
||||
[ -d /var/run/asterisk ] || mkdir -p /var/run/asterisk
|
||||
[ -d /var/log/asterisk ] || mkdir -p /var/log/asterisk
|
||||
@@ -39,7 +42,6 @@ start_service() {
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
asterisk -rx "config reload $CONFDIR/sip.conf"
|
||||
asterisk -rx "core reload"
|
||||
asterisk -rx "dialplan reload"
|
||||
asterisk -rx "brcm reload"
|
||||
|
||||
@@ -10,16 +10,12 @@ USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
local enable=0
|
||||
local filter=0
|
||||
local filter=0
|
||||
|
||||
config_load catv
|
||||
config_get_bool enable catv enable 0
|
||||
config_get filter catv filter
|
||||
if [ $enable -eq 0 ]; then
|
||||
ubus call catv set-enable "{\"enable\":\"off\"}"
|
||||
else
|
||||
ubus call catv set-enable "{\"enable\":\"on\"}"
|
||||
fi
|
||||
config_load catv
|
||||
config_get enable catv enable
|
||||
config_get filter catv filter
|
||||
ubus call catv set-enable "{\"enable\":\"$enable\"}"
|
||||
ubus call catv set-filter "{\"filter\":\"$filter\"}"
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.1.0
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/dectmngr2
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=17aa3b1d8d372ebcf4d37379f7cc4fb59c461d4b
|
||||
PKG_SOURCE_VERSION:=ee63f0c087840adba9d944ae31d71a3ef9d64043
|
||||
PKG_NAME:=dectmngr2
|
||||
|
||||
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2009-2010 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=eventlog
|
||||
PKG_VERSION:=0.2.9
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_URL:=http://www.balabit.com/downloads/files/eventlog/0.2/
|
||||
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
|
||||
PKG_MD5SUM:=76e3d7a0b8f335c12099e9b91191fbf1
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/libeventlog
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=A new API to format and send structured log messages.
|
||||
endef
|
||||
|
||||
define Package/eventlog/description
|
||||
A new API to format and send structured log messages. It supports multiple message
|
||||
representations (plain, XML attributes and XML tags) and multiple output methods
|
||||
(local syslogd).
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/eventlog $(1)/usr/include/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevtlog.{a,so*} $(1)/usr/lib/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/eventlog.pc $(1)/usr/lib/pkgconfig/
|
||||
endef
|
||||
|
||||
define Package/libeventlog/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libevtlog.so* $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libeventlog))
|
||||
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=gigaset-elements
|
||||
|
||||
PKG_VERSION:=2.4.2
|
||||
PKG_VERSION:=2.1.4
|
||||
# PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
|
||||
PKG_GIGASET_ELEMENTS_SRC_URL ?= git@public.inteno.se:gigaset-elements.git
|
||||
@@ -10,7 +10,7 @@ PKG_GIGASET_ELEMENTS_VERSION ?= v$(PKG_VERSION)
|
||||
|
||||
PKG_SOURCE_URL:=$(PKG_GIGASET_ELEMENTS_SRC_URL)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=aa906b37062b6d7937a9c0f8e7b62b32afe4bdeb
|
||||
PKG_SOURCE_VERSION:=$(PKG_GIGASET_ELEMENTS_VERSION)
|
||||
|
||||
|
||||
PKG_MAINTAINER:=Magier Marcin, Figlarek Piotr
|
||||
@@ -26,7 +26,7 @@ include $(INCLUDE_DIR)/package.mk
|
||||
define Package/gigaset-elements
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+libjson-c +libcurl +libpthread
|
||||
DEPENDS:=+libjson-c +libcurl
|
||||
TITLE:=Gigaset elements
|
||||
endef
|
||||
|
||||
@@ -39,8 +39,7 @@ endef
|
||||
|
||||
|
||||
define Package/gigaset-elements/install
|
||||
$(CP) -r $(PKG_BUILD_DIR)/sysroot_common/* $(1)/
|
||||
$(CP) -r $(PKG_BUILD_DIR)/sysroot_$(CONFIG_ARCH)/* $(1)/
|
||||
$(CP) -r $(PKG_BUILD_DIR)/sysroot/* $(1)/
|
||||
endef
|
||||
|
||||
|
||||
|
||||
@@ -5,10 +5,6 @@ PKG_NAME:=ice-client
|
||||
|
||||
CFMODULES:=$(filter CONFIG_PACKAGE_$(PKG_NAME)-%,$(.VARIABLES))
|
||||
CFMODULES:=$(subst CONFIG_PACKAGE_$(PKG_NAME)-,,$(CFMODULES))
|
||||
|
||||
#CFMODULES:=$(CFMODULES) webaccess texec iperf
|
||||
#CFMODULES:=$(sort $(CFMODULES))
|
||||
|
||||
$(info Building package: $(PKG_NAME))
|
||||
$(info Building with additional modules: $(CFMODULES))
|
||||
export CFMODULES
|
||||
@@ -19,33 +15,31 @@ export PLATFORM_INCLUDE:=platforms/iopsys/build.mk
|
||||
|
||||
export DATE:=$(shell date +%Y-%m-%d-%H-%M-%S)
|
||||
export LOGIN:=$(shell whoami)
|
||||
BASE_PKG_VERSION:=4.1.0
|
||||
PKG_RELEASE:=RC8
|
||||
BASE_PKG_VERSION:=3.4.1
|
||||
PKG_RELEASE:=RC11
|
||||
PKG_VERSION:=$(BASE_PKG_VERSION)-$(PKG_RELEASE)_$(DATE)_$(LOGIN)
|
||||
export PKG_VERSION
|
||||
|
||||
###########################--RELEASE--################################
|
||||
|
||||
PKG_SOURCE_VERSION:=5d13d0034c0174cdb6d66f09a458851fe54d810e
|
||||
PKG_SOURCE_VERSION:=184d29446fe6103f567c968bf35569625326a82c
|
||||
ifeq ($(CONFIG_ICE_OPEN),y)
|
||||
BRCM_KERNEL_PROFILE=$(shell echo $(CONFIG_BCM_KERNEL_PROFILE) | sed s/\"//g)
|
||||
PKG_SOURCE_URL:=http://iopsys.inteno.se/iopsys/consumer/
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(BRCM_KERNEL_PROFILE)-$(BASE_PKG_VERSION)$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
PKG_SOURCE_URL:=http://iopsys.inteno.se/iopsys/consumer/
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
#PKG_NAME:=ice-client-open
|
||||
else
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=git@private.inteno.se:ice-client.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(BASE_PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(BASE_PKG_VERSION)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(BASE_PKG_VERSION)-$(PKG_RELEASE).tar.gz
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BASE_PKG_VERSION)
|
||||
endif
|
||||
|
||||
|
||||
###########################--RELEASE--################################
|
||||
|
||||
include $(INCLUDE_DIR)/uclibc++.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ice-client/Default
|
||||
@@ -58,7 +52,7 @@ define Package/ice-client
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=ice-client
|
||||
MENU:=1
|
||||
DEPENDS:=+libopenssl +uclibcxx +libubus +ubus +ubusd +jshn +libubox +libpthread
|
||||
DEPENDS:=+libopenssl +libstdcpp +libubus +ubus +ubusd +jshn +libubox +libpthread
|
||||
endef
|
||||
|
||||
define Package/ice-client/config
|
||||
@@ -78,7 +72,7 @@ endef
|
||||
# PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(BASE_PKG_VERSION)
|
||||
#
|
||||
#
|
||||
# These settings allow you to specify a source folder where your source code is located
|
||||
# These settings allow you to specify a soruce folder where your source code is located
|
||||
# This avoids having to tar-zip or fetch from git each time
|
||||
# Changes can be done in your sources while the build is performed somewhere else
|
||||
# If you forget some settings, your source folder will be deleted!!! So be carefull and
|
||||
@@ -87,6 +81,7 @@ endef
|
||||
#define Build/Prepare
|
||||
# rm -rf $(PKG_BUILD_DIR)
|
||||
# ln -s /home/erik/Desktop/ice-client $(PKG_BUILD_DIR)
|
||||
## ln -s /home/erik/Desktop/checkCompilation/iopsys-client $(PKG_BUILD_DIR)
|
||||
#endef
|
||||
|
||||
###########################--DEVELOPMENT--################################
|
||||
@@ -144,7 +139,7 @@ define Package/ice-client/install
|
||||
$(CP) $(PKG_BUILD_DIR)/core/ice $(1)/bin
|
||||
$(CP) $(PKG_BUILD_DIR)/modules/system/ubusevent/obj/iopsys/ubusevent $(1)/bin
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/{systemService.so.1.0.1,libconfStore.so.1,networkService.so.1.0.1,packageService.so.1.0.1,monitorService.so.1.0.1,iperfService.so.1.0.1,logService.so.1.0.1,texecService.so.1.0.1,webaccessService.so.1.0.1} $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/{systemService.so.1.0.1,libconfStore.so.1,networkService.so.1.0.1,packageService.so.1.0.1,monitorService.so.1.0.1,iperfService.so.1.0.1,logService.so.1.0.1,texecService.so.1.0.1} $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/lib/wsice/obj/iopsys/libwsice.so $(1)/usr/lib
|
||||
$(INSTALL_DIR) $(1)/bin/ifs/iperf/execute
|
||||
$(INSTALL_DIR) $(1)/bin/ifs/iperf/progress
|
||||
@@ -160,8 +155,6 @@ define Package/ice-client/install
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/inteno_root_ca.pem $(1)/etc/iopsys/certificates
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(CP) $(PKG_BUILD_DIR)/scripts/ice-client $(1)/etc/init.d/ice-client
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults/
|
||||
$(CP) ./files/ice-client.uci_default $(1)/etc/uci-defaults/95-ice-client
|
||||
endef
|
||||
endif
|
||||
|
||||
@@ -911,7 +904,7 @@ PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=tExecMgr" > /tmp/cfin
|
||||
echo "system moduleRemove topic=texec" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
@@ -942,54 +935,6 @@ fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
# webaccess
|
||||
define Package/ice-client-webaccess
|
||||
$(call Package/ice-client/Default)
|
||||
TITLE:=webaccess
|
||||
DEPENDS+=
|
||||
endef
|
||||
|
||||
define Package/ice-client-webaccess/description
|
||||
remote script execution module for ice-client
|
||||
endef
|
||||
|
||||
define Package/ice-client-webaccess/prerm
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=webAccess" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-webaccess/preinst
|
||||
#!/bin/sh
|
||||
if [ ! -f "/tmp/ice.pid" ] ; then exit 0 ; fi
|
||||
PROC_ID=$$(cat /tmp/ice.pid)
|
||||
PROC_EXISTS=$$(/usr/bin/pgrep -P $${PROC_ID})
|
||||
if [ -n "$$PROC_EXISTS" ]; then
|
||||
read -t 1 <>/tmp/cfout
|
||||
echo "system moduleRemove topic=webAccess" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
|
||||
define Package/ice-client-webaccess/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/core/lib/webaccessService.so.1.0.1 $(1)/usr/lib
|
||||
endef
|
||||
|
||||
define Package/ice-client-webaccess/postinst
|
||||
#!/bin/sh
|
||||
read -t 1 <>/tmp/cfout
|
||||
if [ -f /tmp/ice.pid ]; then
|
||||
echo "system moduleAdd file=webaccessService.so.1.0.1" package="ice-client-webaccess" > /tmp/cfin
|
||||
fi
|
||||
exit 0
|
||||
endef
|
||||
# bmspeedtest
|
||||
define Package/ice-client-bcmspeedmgr
|
||||
$(call Package/ice-client/Default)
|
||||
@@ -1040,5 +985,4 @@ $(eval $(call BuildPackage,ice-client-monitor))
|
||||
$(eval $(call BuildPackage,ice-client-gigaset))
|
||||
$(eval $(call BuildPackage,ice-client-texec))
|
||||
$(eval $(call BuildPackage,ice-client-bcmspeedmgr))
|
||||
$(eval $(call BuildPackage,ice-client-webaccess))
|
||||
endif
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
grep -rq "^ice:" /etc/passwd || {
|
||||
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 show rpcd | grep username=.*ice.* >/dev/null || {
|
||||
cat >> /etc/config/rpcd << EOF
|
||||
|
||||
config login
|
||||
option username 'ice'
|
||||
option password '\$p\$ice'
|
||||
list _access_r 'none'
|
||||
list write 'user-user'
|
||||
list write 'juci-broadcom-dsl'
|
||||
list write 'juci-broadcom-dsl-admin'
|
||||
list write 'juci-broadcom-ethernet'
|
||||
list write 'juci-broadcom-iptv'
|
||||
list write 'juci-broadcom-vlan'
|
||||
list write 'juci-broadcom-vlan-admin'
|
||||
list write 'juci-wireless'
|
||||
list write 'juci-wireless-admin'
|
||||
list write 'juci-catv'
|
||||
list write 'juci-ddns'
|
||||
list write 'juci-diagnostics'
|
||||
list write 'juci-dnsmasq-dhcp'
|
||||
list write 'juci-dropbear'
|
||||
list write 'juci-ethernet'
|
||||
list write 'juci-event'
|
||||
list write 'juci-firewall-fw3'
|
||||
list write 'juci-iconnect'
|
||||
list write 'juci-igmpinfo'
|
||||
list write 'juci-inteno-backup'
|
||||
list write 'juci-inteno-multiwan'
|
||||
list write 'juci-inteno-provisioning'
|
||||
list write 'juci-inteno-qos'
|
||||
list write 'juci-inteno-voice-client'
|
||||
list write 'juci-minidlna'
|
||||
list write 'juci-mod-status'
|
||||
list write 'juci-mod-system'
|
||||
list write 'juci-natalie-dect'
|
||||
list write 'juci-netmode'
|
||||
list write 'juci-network-netifd'
|
||||
list write 'juci-owsd'
|
||||
list write 'juci-printer'
|
||||
list write 'juci-samba'
|
||||
list write 'juci-sfp'
|
||||
list write 'juci-snmpd'
|
||||
list write 'juci-sysupgrade'
|
||||
list write 'juci-uhttpd'
|
||||
list write 'juci-upnp'
|
||||
list write 'juci-usb'
|
||||
list write 'core'
|
||||
list write 'unauthenticated'
|
||||
EOF
|
||||
}
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=icwmp
|
||||
PKG_VERSION:=3.0-2017-01-20
|
||||
PKG_VERSION:=3.0-2016-07-04
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/icwmp.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=5c39d8d99127010c8d553495cd318ced80531a04
|
||||
PKG_SOURCE_VERSION:=bbd3867e3158e9942a5b930747abf45a041a05ec
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
@@ -34,7 +34,7 @@ define Package/icwmp/Default
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=CWMP client
|
||||
DEPENDS:=+libuci +libmicroxml +libubox +jshn +libubus +libblobmsg-json +libpthread +ubusd +shflags +getopt +zlib +libjson-c +libopenssl +libexpat +libstrophe +curl +libtrace
|
||||
DEPENDS:=+libuci +libmicroxml +libubox +jshn +libubus +libblobmsg-json +libpthread +ubusd +shflags +getopt +zlib +libjson-c +libopenssl +libexpat +libstrophe +curl
|
||||
endef
|
||||
|
||||
define Package/icwmp/description
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /lib/functions.sh
|
||||
include /lib/network
|
||||
|
||||
[ "$INTERFACE" != "$(uci get layer2_interface_ethernet.Wan.ifname)" ] && exit
|
||||
|
||||
case "$(uci get netmode.setup.curmode)" in
|
||||
repeater|repeater_dualdown) echo "Preparing to switch mode" ;;
|
||||
*) exit ;;
|
||||
esac
|
||||
|
||||
get_wifi_wet_interface() {
|
||||
# handle_interface() {
|
||||
# config_get mode "$1" mode
|
||||
# if [ "$mode" == "wet" ] ; then
|
||||
# config_get ifname "$1" ifname
|
||||
# echo "$ifname"
|
||||
# fi
|
||||
# }
|
||||
# config_load wireless
|
||||
# config_foreach handle_interface wifi-iface "$device"
|
||||
echo "wl1"
|
||||
}
|
||||
|
||||
get_wifi_iface_cfgstr() {
|
||||
get_cfgno() {
|
||||
config_get ifname "$1" ifname
|
||||
[ "$ifname" == "$2" ] && echo "wireless.$1"
|
||||
}
|
||||
config_load wireless
|
||||
config_foreach get_cfgno wifi-iface $1 $2
|
||||
}
|
||||
|
||||
case "$ACTION" in
|
||||
add|register)
|
||||
echo "Autoswitch to Extender mode" > /dev/console
|
||||
sleep 2
|
||||
# remove wifi client interface
|
||||
case "$(uci get netmode.setup.curmode)" in
|
||||
repeater_dualdown)
|
||||
uci -q set $(get_wifi_iface_cfgstr $(get_wifi_wet_interface)).disabled=1
|
||||
;;
|
||||
repeater)
|
||||
uci -q set $(get_wifi_iface_cfgstr $(get_wifi_wet_interface)).mode=ap
|
||||
;;
|
||||
esac
|
||||
uci commit wireless
|
||||
#add wan ethernet port
|
||||
uci set network.wan.ifname="$(echo $(uci get layer2_interface_ethernet.Wan.ifname) $(uci get network.wan.ifname) | tr ' ' '\n' | sort -u | tr '\n' ' ')"
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
;;
|
||||
remove|unregister)
|
||||
echo "Autoswitch to Repeater mode" > /dev/console
|
||||
sleep 2
|
||||
# add wifi client interface
|
||||
case "$(uci get netmode.setup.curmode)" in
|
||||
repeater_dualdown)
|
||||
uci -q set $(get_wifi_iface_cfgstr $(get_wifi_wet_interface)).disabled=0
|
||||
;;
|
||||
repeater)
|
||||
uci -q set $(get_wifi_iface_cfgstr $(get_wifi_wet_interface)).mode=wet
|
||||
;;
|
||||
esac
|
||||
uci commit wireless
|
||||
#remove wan ethernet port
|
||||
uci set network.wan.ifname="$(uci get network.wan.ifname | sed 's/$/ /' | sed -r "s/`uci get layer2_interface_ethernet.Wan.ifname` //g")"
|
||||
ubus call uci commit '{"config":"network"}'
|
||||
;;
|
||||
esac
|
||||
@@ -69,13 +69,6 @@ populate_netmodes() {
|
||||
local hardware=$(db get hw.board.hardware)
|
||||
local keys lang desc exp exclude
|
||||
for mode in $(ls $modedir); do
|
||||
|
||||
case "$mode" in
|
||||
repeater*)
|
||||
wlctl -i wl1 ap >/dev/null 2>&1 || continue
|
||||
;;
|
||||
esac
|
||||
|
||||
lang=""
|
||||
desc=""
|
||||
exp=""
|
||||
@@ -83,31 +76,16 @@ populate_netmodes() {
|
||||
uci -q set netmode.$mode.conf=$mode
|
||||
json_load "$(cat $modedir/$mode/DETAILS)"
|
||||
|
||||
if json_select excluded_boards; then
|
||||
exclude=0
|
||||
_i=1
|
||||
while json_get_var board $_i; do
|
||||
case "$hardware" in
|
||||
$board)
|
||||
uci -q delete netmode.$mode
|
||||
exclude=1
|
||||
break
|
||||
;;
|
||||
esac
|
||||
_i=$((_i+1))
|
||||
done
|
||||
json_select ..
|
||||
[ $exclude -eq 1 ] && continue
|
||||
fi
|
||||
|
||||
if json_select acl; then
|
||||
_i=1
|
||||
while json_get_var user $_i; do
|
||||
uci add_list netmode.$mode._access_r="$user"
|
||||
_i=$((_i+1))
|
||||
done
|
||||
json_select ..
|
||||
fi
|
||||
exclude=0
|
||||
json_get_var excluded_boards excluded_boards
|
||||
for board in $excluded_boards; do
|
||||
if [ "$board" == "$hardware" ]; then
|
||||
uci -q delete netmode.$mode
|
||||
exclude=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ $exclude -eq 1 ] && continue
|
||||
|
||||
json_select description
|
||||
json_get_keys keys
|
||||
|
||||
@@ -8,13 +8,6 @@
|
||||
{ "sv" : "LAN4 port överbryggas med IPTV VLAN" }
|
||||
],
|
||||
"credentials" : 0,
|
||||
"excluded_boards" : [
|
||||
"CG300",
|
||||
"CG301"
|
||||
],
|
||||
"acl" : [
|
||||
"admin",
|
||||
"support"
|
||||
]
|
||||
"excluded_boards" : "CG300 CG301"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
config settings 'settings'
|
||||
option disabled '0'
|
||||
|
||||
config defaults
|
||||
option syn_flood 1
|
||||
option input ACCEPT
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
config wifi-status 'status'
|
||||
option wlan '1'
|
||||
option wps '1'
|
||||
option sched_status '0'
|
||||
option schedule '0'
|
||||
|
||||
config wifi-device 'wl0'
|
||||
option type 'broadcom'
|
||||
option country 'EU/13'
|
||||
option band 'a'
|
||||
option bandwidth '80'
|
||||
option hwmode 'auto'
|
||||
option channel 'auto'
|
||||
option scantimer '15'
|
||||
option wmm '1'
|
||||
option wmm_noack '0'
|
||||
option wmm_apsd '1'
|
||||
option txpower '100'
|
||||
option rateset 'default'
|
||||
option frag '2346'
|
||||
option rts '2347'
|
||||
option dtim_period '1'
|
||||
option beacon_int '100'
|
||||
option rxchainps '0'
|
||||
option rxchainps_qt '10'
|
||||
option rxchainps_pps '10'
|
||||
option rifs '0'
|
||||
option rifs_advert '0'
|
||||
option maxassoc '32'
|
||||
option beamforming '1'
|
||||
option doth '1'
|
||||
option dfsc '1'
|
||||
|
||||
config wifi-iface
|
||||
option device 'wl0'
|
||||
option network 'lan'
|
||||
option mode 'ap'
|
||||
option ssid 'Inteno-$BSSID4'
|
||||
option encryption 'psk2'
|
||||
option cipher 'auto'
|
||||
option key '$WPAKEY'
|
||||
option gtk_rekey '3600'
|
||||
option macfilter '0'
|
||||
option wps_pbc '1'
|
||||
option wmf_bss_enable '1'
|
||||
option bss_max '32'
|
||||
|
||||
config wifi-device 'wl1'
|
||||
option type 'broadcom'
|
||||
option country 'EU/13'
|
||||
option band 'b'
|
||||
option bandwidth '20'
|
||||
option hwmode 'auto'
|
||||
option channel 'auto'
|
||||
option scantimer '15'
|
||||
option wmm '1'
|
||||
option wmm_noack '0'
|
||||
option wmm_apsd '1'
|
||||
option txpower '100'
|
||||
option rateset 'default'
|
||||
option frag '2346'
|
||||
option rts '2347'
|
||||
option dtim_period '1'
|
||||
option beacon_int '100'
|
||||
option rxchainps '0'
|
||||
option rxchainps_qt '10'
|
||||
option rxchainps_pps '10'
|
||||
option rifs '0'
|
||||
option rifs_advert '0'
|
||||
option maxassoc '32'
|
||||
option doth '0'
|
||||
|
||||
config wifi-iface
|
||||
option device 'wl1'
|
||||
option network 'lan'
|
||||
option mode 'ap'
|
||||
option ssid 'Inteno-$BSSID4'
|
||||
option encryption 'mixed-psk'
|
||||
option cipher 'auto'
|
||||
option key '$WPAKEY'
|
||||
option gtk_rekey '3600'
|
||||
option macfilter '0'
|
||||
option wps_pbc '1'
|
||||
option wmf_bss_enable '1'
|
||||
option bss_max '32'
|
||||
|
||||
@@ -8,13 +8,6 @@
|
||||
{ "sv" : "VoIP on dedicated VLAN + LAN4 port överbryggas med IPTV VLAN" }
|
||||
],
|
||||
"credentials" : 0,
|
||||
"excluded_boards" : [
|
||||
"CG300",
|
||||
"CG301"
|
||||
],
|
||||
"acl" : [
|
||||
"admin",
|
||||
"support"
|
||||
]
|
||||
"excluded_boards" : "CG300 CG301"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
config settings 'settings'
|
||||
option disabled '0'
|
||||
|
||||
config defaults
|
||||
option syn_flood 1
|
||||
option input ACCEPT
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
config wifi-status 'status'
|
||||
option wlan '1'
|
||||
option wps '1'
|
||||
option sched_status '0'
|
||||
option schedule '0'
|
||||
|
||||
config wifi-device 'wl0'
|
||||
option type 'broadcom'
|
||||
option country 'EU/13'
|
||||
option band 'a'
|
||||
option bandwidth '80'
|
||||
option hwmode 'auto'
|
||||
option channel 'auto'
|
||||
option scantimer '15'
|
||||
option wmm '1'
|
||||
option wmm_noack '0'
|
||||
option wmm_apsd '1'
|
||||
option txpower '100'
|
||||
option rateset 'default'
|
||||
option frag '2346'
|
||||
option rts '2347'
|
||||
option dtim_period '1'
|
||||
option beacon_int '100'
|
||||
option rxchainps '0'
|
||||
option rxchainps_qt '10'
|
||||
option rxchainps_pps '10'
|
||||
option rifs '0'
|
||||
option rifs_advert '0'
|
||||
option maxassoc '32'
|
||||
option beamforming '1'
|
||||
option doth '1'
|
||||
option dfsc '1'
|
||||
|
||||
config wifi-iface
|
||||
option device 'wl0'
|
||||
option network 'lan'
|
||||
option mode 'ap'
|
||||
option ssid 'Inteno-$BSSID4'
|
||||
option encryption 'psk2'
|
||||
option cipher 'auto'
|
||||
option key '$WPAKEY'
|
||||
option gtk_rekey '3600'
|
||||
option macfilter '0'
|
||||
option wps_pbc '1'
|
||||
option wmf_bss_enable '1'
|
||||
option bss_max '32'
|
||||
|
||||
config wifi-device 'wl1'
|
||||
option type 'broadcom'
|
||||
option country 'EU/13'
|
||||
option band 'b'
|
||||
option bandwidth '20'
|
||||
option hwmode 'auto'
|
||||
option channel 'auto'
|
||||
option scantimer '15'
|
||||
option wmm '1'
|
||||
option wmm_noack '0'
|
||||
option wmm_apsd '1'
|
||||
option txpower '100'
|
||||
option rateset 'default'
|
||||
option frag '2346'
|
||||
option rts '2347'
|
||||
option dtim_period '1'
|
||||
option beacon_int '100'
|
||||
option rxchainps '0'
|
||||
option rxchainps_qt '10'
|
||||
option rxchainps_pps '10'
|
||||
option rifs '0'
|
||||
option rifs_advert '0'
|
||||
option maxassoc '32'
|
||||
option doth '0'
|
||||
|
||||
config wifi-iface
|
||||
option device 'wl1'
|
||||
option network 'lan'
|
||||
option mode 'ap'
|
||||
option ssid 'Inteno-$BSSID4'
|
||||
option encryption 'mixed-psk'
|
||||
option cipher 'auto'
|
||||
option key '$WPAKEY'
|
||||
option gtk_rekey '3600'
|
||||
option macfilter '0'
|
||||
option wps_pbc '1'
|
||||
option wmf_bss_enable '1'
|
||||
option bss_max '32'
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
{
|
||||
"description": [
|
||||
{ "en" : "Repeater 2.4▴▾5" },
|
||||
{ "sv" : "Repeater 2.4▴▾5" }
|
||||
{ "en" : "Wireless Repeater" },
|
||||
{ "sv" : "Trådlös Repeater" }
|
||||
],
|
||||
"explanation": [
|
||||
{ "en" : "Your router is going to act as a wired extender or wireless repeater to the selected Wireless Access Point. Uplink 2.4G & Downlink 5G" },
|
||||
{ "sv" : "Routern kommer att fungera som en trådbunden extender eller trådlös repeater till den valda trådlösa åtkomstpunkten. Uplink 2.4G & Downlink 5G" }
|
||||
],
|
||||
"excluded_boards" : [
|
||||
"DG15*",
|
||||
"DG40*",
|
||||
"EG40*"
|
||||
],
|
||||
"acl" : [
|
||||
"admin"
|
||||
{ "en" : "Your router is going to act as a wired extender or wireless repeater to the selected Wireless Access Point." },
|
||||
{ "sv" : "Routern kommer att fungera som en trådbunden extender eller trådlös repeater till den valda trådlösa åtkomstpunkten." }
|
||||
],
|
||||
"credentials" : 1,
|
||||
"reboot" : 0
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
config settings 'settings'
|
||||
option disabled '0'
|
||||
|
||||
config defaults
|
||||
option syn_flood 1
|
||||
option input ACCEPT
|
||||
@@ -11,6 +8,7 @@ config defaults
|
||||
|
||||
config zone
|
||||
option name lan
|
||||
list network 'lan'
|
||||
option input ACCEPT
|
||||
option output ACCEPT
|
||||
option forward ACCEPT
|
||||
|
||||
@@ -11,6 +11,14 @@ config interface 'wan'
|
||||
option proto 'dhcp'
|
||||
option vendorid 'Inteno_Repeater_$MAC4'
|
||||
option hostname 'Inteno_Repeater_$MAC4'
|
||||
option ifname '$WAN.1 $LAN1 $LAN2 $LAN3 $LAN4'
|
||||
option ifname '$WAN.1'
|
||||
option reqopts '43'
|
||||
|
||||
config interface 'lan'
|
||||
option is_lan '1'
|
||||
option type 'bridge'
|
||||
option proto 'static'
|
||||
option ifname '$LAN1 $LAN2 $LAN3 $LAN4'
|
||||
option ipaddr '192.168.11.1'
|
||||
option netmask '255.255.255.0'
|
||||
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
config owsd 'global'
|
||||
option sock '/var/run/ubus.sock'
|
||||
option www '/www'
|
||||
option redirect '/cgi-bin/luci:/cacheflush.html'
|
||||
|
||||
config owsd-listen 'loopback'
|
||||
option port '80'
|
||||
option interface 'loopback'
|
||||
option ipv6 'on'
|
||||
list origin '*'
|
||||
|
||||
config owsd-listen 'lan'
|
||||
option port '80'
|
||||
option interface 'lan'
|
||||
option ipv6 'on'
|
||||
option whitelist_interface_as_origin '1'
|
||||
option whitelist_dhcp_domains '1'
|
||||
|
||||
config owsd-listen 'wan'
|
||||
option port '80'
|
||||
option interface 'wan'
|
||||
option ipv6 'on'
|
||||
option whitelist_interface_as_origin '1'
|
||||
list origin '*'
|
||||
|
||||
config owsd-listen 'wan_8080'
|
||||
option port '8080'
|
||||
option interface 'wan'
|
||||
option ipv6 'on'
|
||||
option whitelist_interface_as_origin '1'
|
||||
list origin '*'
|
||||
|
||||
config owsd-listen 'wan_8181'
|
||||
option port '8181'
|
||||
option interface 'wan'
|
||||
option ipv6 'on'
|
||||
option whitelist_interface_as_origin '1'
|
||||
list origin '*'
|
||||
|
||||
33
inteno-netmodes/files/etc/netmodes/repeater/uhttpd
Normal file
33
inteno-netmodes/files/etc/netmodes/repeater/uhttpd
Normal file
@@ -0,0 +1,33 @@
|
||||
config uhttpd 'main'
|
||||
list listen_http '0.0.0.0:80'
|
||||
list listen_http '[::]:80'
|
||||
list listen_http '0.0.0.0:8080'
|
||||
list listen_http '[::]:8080'
|
||||
list listen_http '0.0.0.0:8181'
|
||||
list listen_http '[::]:8181'
|
||||
list listen_https '0.0.0.0:443'
|
||||
list listen_https '[::]:443'
|
||||
option redirect_https '1'
|
||||
option home '/www'
|
||||
option rfc1918_filter '1'
|
||||
option max_requests '3'
|
||||
option max_connections '100'
|
||||
option cert '/etc/uhttpd.crt'
|
||||
option key '/etc/uhttpd.key'
|
||||
option cgi_prefix '/cgi-bin'
|
||||
option script_timeout '60'
|
||||
option network_timeout '30'
|
||||
option http_keepalive '20'
|
||||
option tcp_keepalive '1'
|
||||
option ubus_prefix '/ubus'
|
||||
|
||||
config cert 'px5g'
|
||||
option days '730'
|
||||
option bits '1024'
|
||||
option country 'ZZ'
|
||||
option state 'Somewhere'
|
||||
option location 'Uknown'
|
||||
option commonname 'OpenWrt'
|
||||
|
||||
config logopts 'logopts'
|
||||
|
||||
@@ -8,7 +8,7 @@ config wifi-device 'wl0'
|
||||
option type 'broadcom'
|
||||
option country 'EU/13'
|
||||
option band 'a'
|
||||
option bandwidth '80'
|
||||
option bandwidth '20'
|
||||
option hwmode '11ac'
|
||||
option channel 'auto'
|
||||
option scantimer '15'
|
||||
@@ -84,3 +84,18 @@ config wifi-iface
|
||||
option wmf_bss_enable '1'
|
||||
option autoconf '1'
|
||||
|
||||
config wifi-iface
|
||||
option device 'wl1'
|
||||
option network 'wan'
|
||||
option mode 'ap'
|
||||
option ssid 'Inteno-$BSSID4'
|
||||
option encryption 'psk2'
|
||||
option cipher 'auto'
|
||||
option key '$WPAKEY'
|
||||
option gtk_rekey '3600'
|
||||
option macfilter '0'
|
||||
option wps_pbc '1'
|
||||
option wmf_bss_enable '1'
|
||||
option bss_max '32'
|
||||
option autoconf '1'
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
{
|
||||
"description": [
|
||||
{ "en" : "Repeater 2.4▴▾2.4&5" },
|
||||
{ "sv" : "Repeater 2.4▴▾2.4&5" }
|
||||
],
|
||||
"explanation": [
|
||||
{ "en" : "Your router is going to act as a wired extender or wireless repeater to the selected Wireless Access Point. Uplink 2.4G & Downlink 2.4G + 5G" },
|
||||
{ "sv" : "Routern kommer att fungera som en trådbunden extender eller trådlös repeater till den valda trådlösa åtkomstpunkten. Uplink 2.4G & Downlink 2.4G + 5G" }
|
||||
],
|
||||
"excluded_boards" : [
|
||||
"DG15*",
|
||||
"DG40*",
|
||||
"EG40*"
|
||||
],
|
||||
"acl" : [
|
||||
"admin"
|
||||
],
|
||||
"credentials" : 1,
|
||||
"reboot" : 0
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
config settings 'settings'
|
||||
option disabled '0'
|
||||
|
||||
config defaults
|
||||
option syn_flood 1
|
||||
option input ACCEPT
|
||||
option output ACCEPT
|
||||
option forward REJECT
|
||||
# Uncomment this line to disable ipv6 rules
|
||||
# option disable_ipv6 1
|
||||
|
||||
config zone
|
||||
option name lan
|
||||
option input ACCEPT
|
||||
option output ACCEPT
|
||||
option forward ACCEPT
|
||||
|
||||
config zone
|
||||
option name wan
|
||||
list network 'wan'
|
||||
option input REJECT
|
||||
option output ACCEPT
|
||||
option forward REJECT
|
||||
option masq 1
|
||||
option mtu_fix 1
|
||||
|
||||
config forwarding
|
||||
option src lan
|
||||
option dest wan
|
||||
|
||||
# We need to accept udp packets on port 68,
|
||||
# see https://dev.openwrt.org/ticket/4108
|
||||
config rule
|
||||
option name Allow-DHCP-Renew
|
||||
option src wan
|
||||
option proto udp
|
||||
option dest_port 68
|
||||
option target ACCEPT
|
||||
option family ipv4
|
||||
option hidden 1
|
||||
|
||||
config rule
|
||||
option name Repeater-Management
|
||||
option src wan
|
||||
option proto tcp
|
||||
option dest_port '22 80 8080 8181 9876'
|
||||
option target ACCEPT
|
||||
option family ipv4
|
||||
option hidden 1
|
||||
|
||||
# Allow IPv4 ping
|
||||
config rule
|
||||
option name Allow-Ping
|
||||
option src wan
|
||||
option proto icmp
|
||||
option icmp_type echo-request
|
||||
option family ipv4
|
||||
option target ACCEPT
|
||||
option hidden 1
|
||||
|
||||
# Allow DHCPv6 replies
|
||||
# see https://dev.openwrt.org/ticket/10381
|
||||
config rule
|
||||
option name Allow-DHCPv6
|
||||
option src wan
|
||||
option proto udp
|
||||
option src_ip fe80::/10
|
||||
option src_port 547
|
||||
option dest_ip fe80::/10
|
||||
option dest_port 546
|
||||
option family ipv6
|
||||
option target ACCEPT
|
||||
option hidden 1
|
||||
|
||||
# Allow essential incoming IPv6 ICMP traffic
|
||||
config rule
|
||||
option name Allow-ICMPv6-Input
|
||||
option src wan
|
||||
option proto icmp
|
||||
list icmp_type echo-request
|
||||
list icmp_type echo-reply
|
||||
list icmp_type destination-unreachable
|
||||
list icmp_type packet-too-big
|
||||
list icmp_type time-exceeded
|
||||
list icmp_type bad-header
|
||||
list icmp_type unknown-header-type
|
||||
list icmp_type router-solicitation
|
||||
list icmp_type neighbour-solicitation
|
||||
list icmp_type router-advertisement
|
||||
list icmp_type neighbour-advertisement
|
||||
option limit 1000/sec
|
||||
option family ipv6
|
||||
option target ACCEPT
|
||||
option hidden 1
|
||||
|
||||
# Allow essential forwarded IPv6 ICMP traffic
|
||||
config rule
|
||||
option name Allow-ICMPv6-Forward
|
||||
option src wan
|
||||
option dest *
|
||||
option proto icmp
|
||||
list icmp_type echo-request
|
||||
list icmp_type echo-reply
|
||||
list icmp_type destination-unreachable
|
||||
list icmp_type packet-too-big
|
||||
list icmp_type time-exceeded
|
||||
list icmp_type bad-header
|
||||
list icmp_type unknown-header-type
|
||||
option limit 1000/sec
|
||||
option family ipv6
|
||||
option target ACCEPT
|
||||
option hidden 1
|
||||
|
||||
# include a file with users custom iptables rules
|
||||
config include
|
||||
option path /etc/firewall.user
|
||||
option reload 1
|
||||
|
||||
# include a file with rules for SIP and RTP traffic
|
||||
config include
|
||||
option path /etc/firewall.sip
|
||||
option reload 1
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
config ethernet_interface 'Wan'
|
||||
option baseifname '$WAN'
|
||||
option ifname '$WAN.1'
|
||||
option name 'WAN'
|
||||
option bridge '1'
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
config interface 'loopback'
|
||||
option is_lan '1'
|
||||
option ifname 'lo'
|
||||
option proto 'static'
|
||||
option ipaddr '127.0.0.1'
|
||||
option netmask '255.0.0.0'
|
||||
|
||||
config interface 'wan'
|
||||
option type 'bridge'
|
||||
option proto 'dhcp'
|
||||
option vendorid 'Inteno_Repeater_$MAC4'
|
||||
option hostname 'Inteno_Repeater_$MAC4'
|
||||
option ifname '$WAN.1 $LAN1 $LAN2 $LAN3 $LAN4'
|
||||
option reqopts '43'
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
config owsd 'global'
|
||||
option sock '/var/run/ubus.sock'
|
||||
option www '/www'
|
||||
option redirect '/cgi-bin/luci:/cacheflush.html'
|
||||
|
||||
config owsd-listen 'loopback'
|
||||
option port '80'
|
||||
option interface 'loopback'
|
||||
option ipv6 'on'
|
||||
list origin '*'
|
||||
|
||||
config owsd-listen 'lan'
|
||||
option port '80'
|
||||
option interface 'lan'
|
||||
option ipv6 'on'
|
||||
option whitelist_interface_as_origin '1'
|
||||
option whitelist_dhcp_domains '1'
|
||||
|
||||
config owsd-listen 'wan'
|
||||
option port '80'
|
||||
option interface 'wan'
|
||||
option ipv6 'on'
|
||||
option whitelist_interface_as_origin '1'
|
||||
list origin '*'
|
||||
|
||||
config owsd-listen 'wan_8080'
|
||||
option port '8080'
|
||||
option interface 'wan'
|
||||
option ipv6 'on'
|
||||
option whitelist_interface_as_origin '1'
|
||||
list origin '*'
|
||||
|
||||
config owsd-listen 'wan_8181'
|
||||
option port '8181'
|
||||
option interface 'wan'
|
||||
option ipv6 'on'
|
||||
option whitelist_interface_as_origin '1'
|
||||
list origin '*'
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
config wifi-status 'status'
|
||||
option wlan '1'
|
||||
option wps '1'
|
||||
option sched_status '0'
|
||||
option schedule '0'
|
||||
|
||||
config wifi-device 'wl0'
|
||||
option type 'broadcom'
|
||||
option country 'EU/13'
|
||||
option band 'a'
|
||||
option bandwidth '80'
|
||||
option hwmode '11ac'
|
||||
option channel 'auto'
|
||||
option scantimer '15'
|
||||
option wmm '1'
|
||||
option wmm_noack '0'
|
||||
option wmm_apsd '0'
|
||||
option txpower '100'
|
||||
option rateset 'default'
|
||||
option frag '2346'
|
||||
option rts '2347'
|
||||
option dtim_period '1'
|
||||
option beacon_int '100'
|
||||
option rxchainps '0'
|
||||
option rxchainps_qt '10'
|
||||
option rxchainps_pps '10'
|
||||
option rifs '0'
|
||||
option rifs_advert '0'
|
||||
option maxassoc '32'
|
||||
option beamforming '0'
|
||||
option doth '1'
|
||||
option dfsc '1'
|
||||
|
||||
config wifi-iface
|
||||
option device 'wl0'
|
||||
option network 'wan'
|
||||
option mode 'ap'
|
||||
option ssid 'Inteno-$BSSID4'
|
||||
option encryption 'psk2'
|
||||
option cipher 'auto'
|
||||
option key '$WPAKEY'
|
||||
option gtk_rekey '3600'
|
||||
option macfilter '0'
|
||||
option wps_pbc '1'
|
||||
option wmf_bss_enable '1'
|
||||
option bss_max '32'
|
||||
option autoconf '1'
|
||||
|
||||
config wifi-device 'wl1'
|
||||
option type 'broadcom'
|
||||
option country 'EU/13'
|
||||
option band 'b'
|
||||
option bandwidth '20'
|
||||
option hwmode 'auto'
|
||||
option channel 'auto'
|
||||
option scantimer '15'
|
||||
option wmm '1'
|
||||
option wmm_noack '0'
|
||||
option wmm_apsd '0'
|
||||
option txpower '100'
|
||||
option rateset 'default'
|
||||
option frag '2346'
|
||||
option rts '2347'
|
||||
option dtim_period '1'
|
||||
option beacon_int '100'
|
||||
option rxchainps '0'
|
||||
option rxchainps_qt '10'
|
||||
option rxchainps_pps '10'
|
||||
option rifs '0'
|
||||
option rifs_advert '0'
|
||||
option maxassoc '32'
|
||||
option doth '0'
|
||||
option apsta '1'
|
||||
|
||||
config wifi-iface
|
||||
option device 'wl1'
|
||||
option ifname 'wl1'
|
||||
option network 'wan'
|
||||
option mode 'wet'
|
||||
option ssid 'Inteno-$BSSID4'
|
||||
option encryption 'psk2'
|
||||
option cipher 'auto'
|
||||
option wps_pbc '0'
|
||||
option wmf_bss_enable '1'
|
||||
option autoconf '1'
|
||||
|
||||
config wifi-iface
|
||||
option device 'wl1'
|
||||
option network 'wan'
|
||||
option mode 'ap'
|
||||
option ssid 'Inteno-$BSSID4'
|
||||
option encryption 'psk2'
|
||||
option cipher 'auto'
|
||||
option key '$WPAKEY'
|
||||
option gtk_rekey '3600'
|
||||
option macfilter '0'
|
||||
option wps_pbc '1'
|
||||
option wmf_bss_enable '1'
|
||||
option bss_max '32'
|
||||
option autoconf '1'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
config settings 'settings'
|
||||
option disabled '0'
|
||||
config settings settings
|
||||
option disabled 0
|
||||
|
||||
config defaults
|
||||
option syn_flood 1
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
config wifi-status 'status'
|
||||
option wlan '1'
|
||||
option wps '1'
|
||||
option sched_status '0'
|
||||
option schedule '0'
|
||||
|
||||
config wifi-device 'wl0'
|
||||
option type 'broadcom'
|
||||
option country 'EU/13'
|
||||
option band 'a'
|
||||
option bandwidth '80'
|
||||
option hwmode 'auto'
|
||||
option channel 'auto'
|
||||
option scantimer '15'
|
||||
option wmm '1'
|
||||
option wmm_noack '0'
|
||||
option wmm_apsd '1'
|
||||
option txpower '100'
|
||||
option rateset 'default'
|
||||
option frag '2346'
|
||||
option rts '2347'
|
||||
option dtim_period '1'
|
||||
option beacon_int '100'
|
||||
option rxchainps '0'
|
||||
option rxchainps_qt '10'
|
||||
option rxchainps_pps '10'
|
||||
option rifs '0'
|
||||
option rifs_advert '0'
|
||||
option maxassoc '32'
|
||||
option beamforming '1'
|
||||
option doth '1'
|
||||
option dfsc '1'
|
||||
|
||||
config wifi-iface
|
||||
option device 'wl0'
|
||||
option network 'lan'
|
||||
option mode 'ap'
|
||||
option ssid 'Inteno-$BSSID4'
|
||||
option encryption 'psk2'
|
||||
option cipher 'auto'
|
||||
option key '$WPAKEY'
|
||||
option gtk_rekey '3600'
|
||||
option macfilter '0'
|
||||
option wps_pbc '1'
|
||||
option wmf_bss_enable '1'
|
||||
option bss_max '32'
|
||||
|
||||
config wifi-device 'wl1'
|
||||
option type 'broadcom'
|
||||
option country 'EU/13'
|
||||
option band 'b'
|
||||
option bandwidth '20'
|
||||
option hwmode 'auto'
|
||||
option channel 'auto'
|
||||
option scantimer '15'
|
||||
option wmm '1'
|
||||
option wmm_noack '0'
|
||||
option wmm_apsd '1'
|
||||
option txpower '100'
|
||||
option rateset 'default'
|
||||
option frag '2346'
|
||||
option rts '2347'
|
||||
option dtim_period '1'
|
||||
option beacon_int '100'
|
||||
option rxchainps '0'
|
||||
option rxchainps_qt '10'
|
||||
option rxchainps_pps '10'
|
||||
option rifs '0'
|
||||
option rifs_advert '0'
|
||||
option maxassoc '32'
|
||||
option doth '0'
|
||||
|
||||
config wifi-iface
|
||||
option device 'wl1'
|
||||
option network 'lan'
|
||||
option mode 'ap'
|
||||
option ssid 'Inteno-$BSSID4'
|
||||
option encryption 'mixed-psk'
|
||||
option cipher 'auto'
|
||||
option key '$WPAKEY'
|
||||
option gtk_rekey '3600'
|
||||
option macfilter '0'
|
||||
option wps_pbc '1'
|
||||
option wmf_bss_enable '1'
|
||||
option bss_max '32'
|
||||
|
||||
@@ -9,6 +9,7 @@ CONFIG_PACKAGE_6rd=y
|
||||
CONFIG_PACKAGE_6to4=y
|
||||
CONFIG_PACKAGE_6tunnel=y
|
||||
CONFIG_PACKAGE_alsa-lib=y
|
||||
CONFIG_PACKAGE_bind-host=y
|
||||
CONFIG_PACKAGE_chat=y
|
||||
CONFIG_PACKAGE_comgt=y
|
||||
CONFIG_PACKAGE_comgt-directip=y
|
||||
@@ -47,7 +48,7 @@ CONFIG_PACKAGE_juci-broadcom-ethernet=y
|
||||
CONFIG_PACKAGE_juci-broadcom-iptv=y
|
||||
CONFIG_PACKAGE_juci-broadcom-pwrmgmt=y
|
||||
CONFIG_PACKAGE_juci-broadcom-vlan=y
|
||||
CONFIG_PACKAGE_juci-wireless=y
|
||||
CONFIG_PACKAGE_juci-broadcom-wl=y
|
||||
CONFIG_PACKAGE_juci-broadcom-xdsl=y
|
||||
CONFIG_PACKAGE_juci-ddns=y
|
||||
CONFIG_PACKAGE_juci-diagnostics=y
|
||||
@@ -70,7 +71,6 @@ CONFIG_PACKAGE_juci-mod-system=y
|
||||
CONFIG_PACKAGE_juci-natalie-dect=y
|
||||
CONFIG_PACKAGE_juci-netmode=y
|
||||
CONFIG_PACKAGE_juci-network-netifd=y
|
||||
CONFIG_PACKAGE_juci-owsd=y
|
||||
CONFIG_PACKAGE_juci-printer=y
|
||||
CONFIG_PACKAGE_juci-samba=y
|
||||
CONFIG_PACKAGE_juci-simple-gui=y
|
||||
@@ -90,7 +90,6 @@ CONFIG_PACKAGE_libcgroup=y
|
||||
# CONFIG_PACKAGE_libcgroup-utils is not set
|
||||
CONFIG_PACKAGE_ldd=y
|
||||
CONFIG_PACKAGE_libdaemon=y
|
||||
CONFIG_PACKAGE_libffmpeg-mini=y
|
||||
CONFIG_PACKAGE_libgmp=y
|
||||
CONFIG_PACKAGE_libreadline=y
|
||||
CONFIG_PACKAGE_minidlna=y
|
||||
@@ -102,6 +101,7 @@ CONFIG_PACKAGE_mtd-utils-mkfs.jffs2=y
|
||||
CONFIG_PACKAGE_mtd-utils-nanddump=y
|
||||
CONFIG_PACKAGE_multiwan=y
|
||||
CONFIG_PACKAGE_ndisc6=y
|
||||
CONFIG_PACKAGE_netcheck=y
|
||||
CONFIG_PACKAGE_ntfs-3g=y
|
||||
CONFIG_PACKAGE_odhcp6c=y
|
||||
CONFIG_PACKAGE_odhcpd=y
|
||||
@@ -117,6 +117,7 @@ CONFIG_PACKAGE_ppp-mod-pppol2tp=y
|
||||
CONFIG_PACKAGE_ppp-multilink=y
|
||||
# CONFIG_PACKAGE_ppp is not set
|
||||
CONFIG_PACKAGE_qos-scripts=y
|
||||
CONFIG_PACKAGE_qrencode=y
|
||||
CONFIG_PACKAGE_questd=y
|
||||
CONFIG_PACKAGE_rdisc6=y
|
||||
CONFIG_PACKAGE_rdnssd=y
|
||||
@@ -136,7 +137,6 @@ CONFIG_PACKAGE_umbim=y
|
||||
CONFIG_PACKAGE_uqmi=y
|
||||
CONFIG_PACKAGE_usb-modeswitch=y
|
||||
CONFIG_PACKAGE_usbreset=y
|
||||
CONFIG_PACKAGE_wget=y
|
||||
CONFIG_PACKAGE_wwan=y
|
||||
CONFIG_PACKAGE_xl2tpd=y
|
||||
CONFIG_PACKAGE_zoneinfo-core=y
|
||||
@@ -186,7 +186,6 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_SECURETTY=y
|
||||
# CONFIG_BUSYBOX_CONFIG_FEATURE_TFTP_BLOCKSIZE is not set
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_TFTP_GET=y
|
||||
CONFIG_BUSYBOX_CONFIG_FEATURE_TFTP_PUT=y
|
||||
# CONFIG_BUSYBOX_CONFIG_WGET is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_LOGIN_SCRIPTS is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_LOGIN_SESSION_AS_CHILD is not set
|
||||
# CONFIG_BUSYBOX_CONFIG_PAM is not set
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
function compile {
|
||||
if [ -z "$1" ]; then
|
||||
echo "Please give a valid package as first argument."
|
||||
return 1
|
||||
fi
|
||||
|
||||
local cpath pck
|
||||
local lpath=$(find package/ -type l -name $1)
|
||||
local dpath=$(find package/ -type d -name $1)
|
||||
|
||||
for pck in $lpath $dpath; do
|
||||
if [ -n "$(ls $pck/Makefile 2>/dev/null)" ]; then
|
||||
cpath=$pck
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$cpath" ]; then
|
||||
make $cpath/compile V=$2
|
||||
else
|
||||
echo "Package $1 does not exist. Make sure you have installed the necessary feed."
|
||||
fi
|
||||
}
|
||||
|
||||
register_command "compile" "Compile a specific package: ./iop compile <PACKAGE_NAME> [0-99]; i.e ./iop compile netifd 99"
|
||||
@@ -3,21 +3,25 @@
|
||||
function feeds_update {
|
||||
|
||||
developer=0
|
||||
override=1
|
||||
start=$(date -u +'%s');
|
||||
while getopts "n" opt; do
|
||||
case $opt in
|
||||
n)
|
||||
override=0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
git remote -v | grep -q http || developer=1
|
||||
|
||||
#while getopts "d" opt; do
|
||||
# case $opt in
|
||||
# d)
|
||||
# developer=1
|
||||
# ;;
|
||||
# \?)
|
||||
# echo "Invalid option: -$OPTARG" >&2
|
||||
# exit 1
|
||||
# ;;
|
||||
# esac
|
||||
#done
|
||||
|
||||
cp .config .genconfig_config_bak
|
||||
|
||||
rm -rf package/feeds
|
||||
|
||||
#if -d argument is passed, clone feeds with ssh instead of http
|
||||
if [ $developer == 1 ]; then
|
||||
./scripts/feeds update -g
|
||||
@@ -25,21 +29,25 @@ function feeds_update {
|
||||
./scripts/feeds update
|
||||
fi
|
||||
|
||||
# replace core packages with iopsys versions
|
||||
if [ $override == 1 ]; then
|
||||
./scripts/feeds install -f -p feed_inteno_openwrt -a
|
||||
fi
|
||||
|
||||
# targets need to be installed explicitly
|
||||
./scripts/feeds install -p feed_inteno_targets iopsys-brcm63xx-mips
|
||||
./scripts/feeds install -p feed_inteno_targets iopsys-brcm63xx-arm
|
||||
./scripts/feeds install -p feed_inteno_targets iopsys-ramips
|
||||
|
||||
# install all packages
|
||||
./scripts/feeds install -f -p feed_inteno_openwrt -a
|
||||
./scripts/feeds install -f -p feed_inteno_juci -a
|
||||
./scripts/feeds install -f -p feed_inteno_packages -a
|
||||
./scripts/feeds install -f -p feed_inteno_broadcom -a
|
||||
./scripts/feeds install -f -p feed_inteno_targets iopsys-brcm63xx-mips
|
||||
./scripts/feeds install -f -p feed_inteno_targets iopsys-brcm63xx-arm
|
||||
./scripts/feeds install -a
|
||||
./scripts/feeds uninstall asterisk18
|
||||
./scripts/feeds uninstall zstream
|
||||
./scripts/feeds uninstall mtd-utils
|
||||
./scripts/feeds install -f -p feed_inteno_packages mtd-utils
|
||||
./scripts/feeds uninstall qrencode
|
||||
./scripts/feeds install -f -p feed_inteno_packages qrencode
|
||||
./scripts/feeds uninstall libwebsockets
|
||||
./scripts/feeds uninstall libwebsockets-openssl
|
||||
./scripts/feeds install -f -p feed_inteno_juci libwebsockets
|
||||
|
||||
# remove broken symlinks ( for packages that are no longer in the feed )
|
||||
find -L package/feeds -maxdepth 2 -type l -delete
|
||||
rm -rf package/feeds/oldpackages/libzstream # have to run this for now since uninstall is not working every time
|
||||
|
||||
cp .genconfig_config_bak .config
|
||||
make defconfig
|
||||
|
||||
@@ -1,352 +1,259 @@
|
||||
#!/bin/bash
|
||||
|
||||
function genconfig {
|
||||
export CLEAN=0
|
||||
export IMPORT=1
|
||||
export SRCTREEOVERR=0
|
||||
export FILEDIR="files/"
|
||||
export THEMEDIR="themes"
|
||||
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"
|
||||
export CLEAN=0
|
||||
export IMPORT=0
|
||||
export SRCTREEOVERR=0
|
||||
export FILEDIR="files/"
|
||||
export CONFIGPATH="package/feeds/feed_inteno_packages/iop/configs"
|
||||
export CUSTCONF="customerconfigs"
|
||||
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"
|
||||
iopsys_brcm63xx_arm="dg400 eg400"
|
||||
iopsys_ramips="ex400"
|
||||
ramips="mt7621"
|
||||
target="bogus"
|
||||
masterconfig=1
|
||||
iopsys_brcm63xx_mips="cg300 cg301 dg150 dg150v2 dg150alv2 dg200 dg200al dg301 dg301al eg300 vg50 vox25"
|
||||
iopsys_brcm63xx_arm="dg400"
|
||||
target="bogus"
|
||||
|
||||
set_target() {
|
||||
|
||||
set_target()
|
||||
{
|
||||
local profile=$1
|
||||
|
||||
for p in $iopsys_brcm63xx_mips; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_brcm63xx_mips"
|
||||
return
|
||||
fi
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_brcm63xx_mips"
|
||||
fi
|
||||
done
|
||||
|
||||
for p in $iopsys_brcm63xx_arm; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_brcm63xx_arm"
|
||||
return
|
||||
fi
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_brcm63xx_arm"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
for p in $iopsys_ramips; do
|
||||
if [ $p == $profile ]; then
|
||||
target="iopsys_ramips"
|
||||
return
|
||||
fi
|
||||
|
||||
git remote -v | grep -q http || {
|
||||
DEVELOPER=1
|
||||
|
||||
bcmAllowed=0
|
||||
iceAllowed=0
|
||||
endptAllowed=0
|
||||
natalieAllowed=0
|
||||
|
||||
allowedRepos="$(ssh -o ConnectTimeout=5 git@private.inteno.se 2>/dev/null | grep -w 'R\|W' | awk '{print$NF}')"
|
||||
for repo in $allowedRepos; do
|
||||
case $repo in
|
||||
bcmkernel) bcmAllowed=1 ;;
|
||||
ice-client) iceAllowed=1 ;;
|
||||
endptcfg) endptAllowed=1 ;;
|
||||
natalie-dect*) natalieAllowed=1 ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
for p in $ramips; do
|
||||
if [ $p == $profile ]; then
|
||||
target="ramips"
|
||||
masterconfig=0
|
||||
return
|
||||
fi
|
||||
done
|
||||
v() {
|
||||
[ "$VERBOSE" -ge 1 ] && echo "$@"
|
||||
}
|
||||
|
||||
}
|
||||
usage() {
|
||||
echo
|
||||
echo 1>&2 "Usage: $0 [OPTIONS] BoardConfig Customerconfig"
|
||||
echo
|
||||
echo " -c, remove all files under ./files and import from config "
|
||||
echo " -v, verbose"
|
||||
echo " -u, Update customer config before applying"
|
||||
echo " -p, set profile (if exists)"
|
||||
echo " -t, use latest git tag and number of commits since as version for the build"
|
||||
echo " -s, enable 'Package source tree override'"
|
||||
echo
|
||||
echo "BoardConfig ex "
|
||||
ls -1 configs
|
||||
if [ -d "$CUSTCONF/$1" ]; then
|
||||
echo "Customerconfig ex"
|
||||
ls $CUSTCONF/*
|
||||
fi
|
||||
echo
|
||||
echo "Example ./genconfig vg50 TELIA"
|
||||
echo "(if no customerconfig is chosen the Inteno Config will be used)"
|
||||
echo
|
||||
exit 127
|
||||
}
|
||||
|
||||
git remote -v | grep -q http || {
|
||||
DEVELOPER=1
|
||||
use_local_mirror()
|
||||
{
|
||||
if wget -T 3 -t 2 -O /dev/null $LOCAL_MIRROR >/dev/null 2>/dev/null
|
||||
then
|
||||
echo "mirror [$LOCAL_MIRROR] exists. Using local mirror"
|
||||
sed -i "s;CONFIG_LOCALMIRROR=.*;CONFIG_LOCALMIRROR=\"$LOCAL_MIRROR\";" .config
|
||||
else
|
||||
echo "mirror [$LOCAL_MIRROR] does not exist. Not using local mirror"
|
||||
fi
|
||||
}
|
||||
|
||||
bcmAllowed=0
|
||||
iceAllowed=0
|
||||
endptAllowed=0
|
||||
natalieAllowed=0
|
||||
|
||||
allowedRepos="$(ssh -o ConnectTimeout=5 git@private.inteno.se 2>/dev/null | grep -w 'R\|W' | awk '{print$NF}')"
|
||||
for repo in $allowedRepos; do
|
||||
case $repo in
|
||||
bcmkernel) bcmAllowed=1 ;;
|
||||
ice-client) iceAllowed=1 ;;
|
||||
endptcfg) endptAllowed=1 ;;
|
||||
natalie-dect*) natalieAllowed=1 ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
v() {
|
||||
[ "$VERBOSE" -ge 1 ] && echo "$@"
|
||||
}
|
||||
|
||||
usage() {
|
||||
echo
|
||||
echo 1>&2 "Usage: $0 [ OPTIONS ] < Board_Type > [ Customer ]"
|
||||
echo
|
||||
echo -e " -c|--clean\tRemove all files under ./files and import from config "
|
||||
echo -e " -v|--verbose\tVerbose"
|
||||
echo -e " -n|--no-update\tDo NOT! Update customer config before applying"
|
||||
echo -e " -p|--profile\tSet profile (if exists) default juci"
|
||||
echo -e " -s|--override\tEnable 'Package source tree override'"
|
||||
echo -e " -h|--help\tShow this message"
|
||||
echo -e " -l|--list [customer]\tList all Customers or all boards for one customer"
|
||||
echo -e " -a|--list-all\tList all Customers and their board types"
|
||||
echo
|
||||
echo "Example ./iop genconfig vg50 TELIA"
|
||||
echo "(if no customerconfig is chosen the Inteno Config will be used)"
|
||||
echo
|
||||
exit 0
|
||||
}
|
||||
|
||||
list_customers()
|
||||
{
|
||||
local ALL="$1"
|
||||
local CUSTOMER="$2"
|
||||
if [ "$CUSTOMER" -a -d "$CUSTCONF/$CUSTOMER" ]; then
|
||||
local boards="$(ls -1 "$CUSTCONF/$CUSTOMER" | grep -v common)"
|
||||
if [ "$boards" ]; then
|
||||
echo "$CUSTOMER has following boards:"
|
||||
for board in $boards; do
|
||||
echo -e "\t$board"
|
||||
done
|
||||
else
|
||||
echo "No boards found for $CUSTOMER"
|
||||
fi
|
||||
elif [ "$CUSTOMER" ]; then
|
||||
echo "No customer called $CUSTOMER"
|
||||
exit 1
|
||||
elif [ -d $CUSTCONF ]; then
|
||||
local customers="$(ls -1 $CUSTCONF)"
|
||||
if [ "$customers" -a "$1" == 1 ]; then
|
||||
for customer in $customers; do
|
||||
echo $customer
|
||||
local boards="$(ls -1 $CUSTCONF/$customer | grep -v common)"
|
||||
if [ "$boards" ]; then
|
||||
for board in $boards; do
|
||||
echo -e "\t$board"
|
||||
done
|
||||
else
|
||||
echo "has no boards"
|
||||
fi
|
||||
done
|
||||
elif [ "$customers" ]; then
|
||||
echo -e "$customers"
|
||||
else
|
||||
echo "no customers found"
|
||||
fi
|
||||
else
|
||||
echo "No $CUSTCONF folder found"
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
||||
use_local_mirror()
|
||||
{
|
||||
if wget -T 3 -t 2 -O /dev/null $LOCAL_MIRROR >/dev/null 2>/dev/null; then
|
||||
echo "mirror [$LOCAL_MIRROR] exists. Using local mirror"
|
||||
sed -i "s;CONFIG_LOCALMIRROR=.*;CONFIG_LOCALMIRROR=\"$LOCAL_MIRROR\";" .config
|
||||
else
|
||||
echo "mirror [$LOCAL_MIRROR] does not exist. Not using local mirror"
|
||||
fi
|
||||
}
|
||||
|
||||
generate_config()
|
||||
{
|
||||
generate_config()
|
||||
{
|
||||
DIFFFILE="$1"
|
||||
MASTERFILE="$2"
|
||||
while read p; do
|
||||
v "$p"
|
||||
sed -r -i "$p" $MASTERFILE
|
||||
v "$p"
|
||||
sed -r -i "$p" $MASTERFILE
|
||||
done < $DIFFFILE
|
||||
}
|
||||
}
|
||||
|
||||
setup_dirs()
|
||||
{
|
||||
if [ $DEVELOPER -eq 1 ]; then
|
||||
if [ ! -d "$CUSTPATH" ]; then
|
||||
git clone "$CUSTREPO" "$CUSTPATH"
|
||||
elif [ $IMPORT -eq 1 ]; then
|
||||
cd $CUSTPATH
|
||||
v "git pull"
|
||||
git pull
|
||||
cd - >/dev/null #go back
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d "$FILEDIR" ]; then
|
||||
mkdir -p $FILEDIR
|
||||
elif [ -d "$FILEDIR" -a $CLEAN -eq 1 ]; then
|
||||
v "rm -rf $FILEDIR*"
|
||||
rm -rf $FILEDIR*
|
||||
fi
|
||||
|
||||
if [ ! -d "$THEMEDIR" ]; then
|
||||
mkdir -p $THEMEDIR
|
||||
elif [ -d "$THEMEDIR" -a $CLEAN -eq 1 ]; then
|
||||
v "rm -rf $THEMEDIR/*"
|
||||
rm -rf $THEMEDIR/*
|
||||
fi
|
||||
}
|
||||
|
||||
create_and_copy_files()
|
||||
{
|
||||
local BOARDTYPE=$1
|
||||
local CUSTOMER=$2
|
||||
|
||||
# Validate seleced board and customer
|
||||
set_target $BOARDTYPE
|
||||
if [ $target == "bogus" ]; then
|
||||
echo "Hardware profile does not exist"
|
||||
exit 1
|
||||
elif [ -n "$CUSTOMER" -a ! -d "$CUSTCONF/$CUSTOMER/$BOARDTYPE/" ]; then
|
||||
echo "Customer profile does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Generate base config
|
||||
# Used only for iopsys targets, not openwrt targets
|
||||
rm -f .config
|
||||
if [ $masterconfig -eq 1 ]; then
|
||||
v "Config $BOARDTYPE selected"
|
||||
v "cp $CONFIGPATH/config .config"
|
||||
cp $CONFIGPATH/config .config
|
||||
fi
|
||||
|
||||
# Apply profile diff to master config if selected
|
||||
if [ -n "$PROFILE" ]; then
|
||||
if [ -e "$CONFIGPATH/$PROFILE.diff" ]; then
|
||||
cat $CONFIGPATH/$PROFILE.diff >> .config
|
||||
elif [ "$PROFILE" == "juci" ]; then
|
||||
v "Default profile (juci) is selected."
|
||||
else
|
||||
echo "ERROR: profile $PROFILE does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
v "No profile selected! Using default."
|
||||
fi
|
||||
|
||||
# Set target and profile
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${BOARDTYPE}=y" >> .config
|
||||
|
||||
echo "$CUSTOMER $BOARDTYPE" > $CURRENT_CONFIG_FILE
|
||||
|
||||
# Add customerconfig diff if a customer is selected
|
||||
if [ -n "$CUSTOMER" ]; then
|
||||
if [ -d "$CUSTCONF/$CUSTOMER/common/fs" ]; then
|
||||
v "cp -ar $CUSTCONF/$CUSTOMER/common/fs/* $FILEDIR"
|
||||
cp -ar $CUSTCONF/$CUSTOMER/common/fs/* $FILEDIR
|
||||
fi
|
||||
if [ -d "$CUSTCONF/$CUSTOMER/$BOARDTYPE/fs" ]; then
|
||||
v "cp -ar $CUSTCONF/$CUSTOMER/$BOARDTYPE/fs/* $FILEDIR"
|
||||
cp -ar $CUSTCONF/$CUSTOMER/$BOARDTYPE/fs/* $FILEDIR
|
||||
fi
|
||||
if [ -d "$CUSTCONF/$CUSTOMER/juci-theme" ]; then
|
||||
customer="$(echo $CUSTOMER | tr 'A-Z' 'a-z')"
|
||||
v "cp -ar $CUSTCONF/$CUSTOMER/juci-theme $THEMEDIR/juci-theme-$customer"
|
||||
cp -ar $CUSTCONF/$CUSTOMER/juci-theme $THEMEDIR/juci-theme-$customer
|
||||
fi
|
||||
if [ -e "$CUSTCONF/$CUSTOMER/common/common.diff" ]; then
|
||||
v "Apply $CUSTCONF/$CUSTOMER/common/common.diff"
|
||||
cat $CUSTCONF/$CUSTOMER/common/common.diff >> .config
|
||||
fi
|
||||
if [ -e "$CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff" ]; then
|
||||
v "Apply $CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff"
|
||||
cat $CUSTCONF/$CUSTOMER/$BOARDTYPE/$BOARDTYPE.diff >> .config
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set target version
|
||||
local GIT_TAG=$(git describe --abbrev=0 --tags)
|
||||
echo "CONFIG_TARGET_VERSION=\"${GIT_TAG}\"" >> .config
|
||||
|
||||
# Enable Pckage source tree override if selected
|
||||
[ $SRCTREEOVERR -eq 1 ] && echo CONFIG_SRC_TREE_OVERRIDE=y >> .config
|
||||
|
||||
# developer mode selected ?
|
||||
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
|
||||
[ $endptAllowed -eq 0 ] && echo "CONFIG_ENDPT_OPEN=y" >> .config
|
||||
[ $natalieAllowed -eq 0 ] && echo "CONFIG_NATALIE_OPEN=y" >> .config
|
||||
else
|
||||
echo "CONFIG_BCM_OPEN=y" >> .config
|
||||
echo "CONFIG_ICE_OPEN=y" >> .config
|
||||
echo "CONFIG_ENDPT_OPEN=y" >> .config
|
||||
echo "CONFIG_NATALIE_OPEN=y" >> .config
|
||||
fi
|
||||
|
||||
# Force regeneration of themes
|
||||
touch package/feeds/feed_inteno_juci/juci/Makefile
|
||||
|
||||
# Force regeneration of kernel Makefile
|
||||
# Needed to disable kmods for iopsys-brcm targets
|
||||
touch package/kernel/linux/Makefile
|
||||
|
||||
# Set default values based on selected parameters
|
||||
v "$(make defconfig 2>&1)"
|
||||
|
||||
# Temporary fixup for juci/luci profile
|
||||
if [ "$PROFILE" == "luci" ]; then
|
||||
sed -i '/CONFIG_DEFAULT_juci/d' .config
|
||||
sed -i '/CONFIG_PACKAGE_juci/d' .config
|
||||
sed -i '/CONFIG_PACKAGE_uhttpd/d' .config
|
||||
fi
|
||||
|
||||
if [ $masterconfig -eq 1 ]; then
|
||||
echo Set version to $(grep -w CONFIG_TARGET_VERSION .config | cut -d'=' -f2 | tr -d '"')
|
||||
fi
|
||||
|
||||
# Clean base-file package to force rebuild when changing profile
|
||||
v "$(make package/base-files/clean 2>&1)"
|
||||
}
|
||||
|
||||
####### main #####
|
||||
if [ ! -e tmp/.iop_bootstrap ]; then
|
||||
echo "You have not installed feeds. Running genconfig in this state would create a non functional configuration."
|
||||
echo "Run: iop feeds_update"
|
||||
exit 0
|
||||
setup_dirs()
|
||||
{
|
||||
if [ $DEVELOPER -eq 1 ]; then
|
||||
if [ ! -d "$CUSTCONF" ]; then
|
||||
git clone git@private.inteno.se:customerconfigs
|
||||
elif [ $IMPORT -eq 1 ]; then
|
||||
cd customerconfigs
|
||||
v "git pull"
|
||||
git pull
|
||||
cd ..
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo Current profile:
|
||||
cat $CURRENT_CONFIG_FILE
|
||||
echo "Try ./iop genconfig -h' to get instructions if you want to change current config"
|
||||
exit 0
|
||||
|
||||
if [ ! -d "$FILEDIR" ]; then
|
||||
mkdir $FILEDIR
|
||||
elif [ -d "$FILEDIR" -a $CLEAN -eq 1 ]; then
|
||||
v "rm -rf $FILEDIR*"
|
||||
rm -rf $FILEDIR*
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
create_and_copy_files()
|
||||
{
|
||||
local BOARDTYPE=$1
|
||||
local CUSTOMER=$2
|
||||
|
||||
# Validate seleced board and customer
|
||||
set_target $BOARDTYPE
|
||||
if [ $target == "bogus" ]; then
|
||||
echo "Hardware profile does not exist"
|
||||
exit 1
|
||||
elif [ -n "$CUSTOMER" -a ! -d "$CUSTCONF/$BOARDTYPE/$CUSTOMER/" ]; then
|
||||
echo "Customer profile does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clean base-file package to force rebuild when changing profile
|
||||
make package/base-files/clean
|
||||
|
||||
# Base config on master
|
||||
v "Config $BOARDTYPE selected"
|
||||
v "cp $CONFIGPATH/config .config"
|
||||
cp $CONFIGPATH/config .config
|
||||
|
||||
# Apply profile diff to master config if selected
|
||||
if [ -n "$PROFILE" ]; then
|
||||
if [ -e "$CONFIGPATH/$PROFILE.diff" ]; then
|
||||
cat $CONFIGPATH/$PROFILE.diff >> .config
|
||||
elif [ "$PROFILE" == "juci" ]; then
|
||||
v "Default profile (juci) is selected."
|
||||
else
|
||||
echo "ERROR: profile $PROFILE does not exist!"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
v "No profile selected! Using default."
|
||||
fi
|
||||
|
||||
# Set target and profile
|
||||
echo "CONFIG_TARGET_${target}=y" >> .config
|
||||
echo "CONFIG_TARGET_${target}_${BOARDTYPE}=y" >> .config
|
||||
|
||||
# Add customerconfig diff if a customer is selected
|
||||
if [ -n "$CUSTOMER" ]; then
|
||||
echo "$BOARDTYPE $CUSTOMER" > .current_config_file
|
||||
if [ -d "$CUSTCONF/$BOARDTYPE/$CUSTOMER/fs" ]; then
|
||||
v "cp -rLp $CUSTCONF/$BOARDTYPE/$CUSTOMER/fs/* $FILEDIR"
|
||||
cp -rLp $CUSTCONF/$BOARDTYPE/$CUSTOMER/fs/* $FILEDIR
|
||||
fi
|
||||
if [ -e "$CUSTCONF/$BOARDTYPE/$CUSTOMER/$BOARDTYPE.diff" ]; then
|
||||
v "Apply $CUSTCONF/$BOARDTYPE/$CUSTOMER/$BOARDTYPE.diff"
|
||||
cat $CUSTCONF/$BOARDTYPE/$CUSTOMER/$BOARDTYPE.diff >> .config
|
||||
fi
|
||||
fi
|
||||
|
||||
# Set target version
|
||||
local GIT_TAG=$(git describe --abbrev=0 --tags)
|
||||
echo "CONFIG_TARGET_VERSION=\"${GIT_TAG}\"" >> .config
|
||||
|
||||
|
||||
# Enable Pckage source tree override if selected
|
||||
[ $SRCTREEOVERR -eq 1 ] && \
|
||||
echo CONFIG_SRC_TREE_OVERRIDE=y >> .config
|
||||
|
||||
|
||||
# developer mode selected ?
|
||||
if [ $DEVELOPER -eq 1 ]; then
|
||||
# rewrite url to clone with ssh instead of http
|
||||
echo "CONFIG_GITMIRROR_REWRITE=y" >>.config
|
||||
[ $bcmAllowed -eq 0 ] && echo "CONFIG_BCM_OPEN=y" >> .config
|
||||
[ $iceAllowed -eq 0 ] && echo "CONFIG_ICE_OPEN=y" >> .config
|
||||
[ $endptAllowed -eq 0 ] && echo "CONFIG_ENDPT_OPEN=y" >> .config
|
||||
[ $natalieAllowed -eq 0 ] && echo "CONFIG_NATALIE_OPEN=y" >> .config
|
||||
else
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
|
||||
-c|--clean) export CLEAN=1;;
|
||||
-n|--no-update) export IMPORT=0;;
|
||||
-v|--verbose) export VERBOSE="$(($VERBOSE + 1))";;
|
||||
-p|--profile) export PROFILE="$2"; shift;;
|
||||
-s|--override) export SRCTREEOVERR=1;;
|
||||
-h|--help) usage;;
|
||||
-l|--list) list_customers 0 $2;;
|
||||
-a|--list-all)list_customers 1;;
|
||||
-*)
|
||||
echo "Invalid option: $1 "
|
||||
echo "Try -h or --help for more information."
|
||||
exit 1
|
||||
;;
|
||||
*) break;;
|
||||
esac
|
||||
shift;
|
||||
done
|
||||
setup_dirs
|
||||
create_and_copy_files "$1" "$2"
|
||||
|
||||
if [ $masterconfig -eq 1 ]; then
|
||||
use_local_mirror
|
||||
fi
|
||||
echo "CONFIG_BCM_OPEN=y" >> .config
|
||||
echo "CONFIG_ICE_OPEN=y" >> .config
|
||||
echo "CONFIG_ENDPT_OPEN=y" >> .config
|
||||
echo "CONFIG_NATALIE_OPEN=y" >> .config
|
||||
fi
|
||||
|
||||
# Set default values based on selected parameters
|
||||
make defconfig
|
||||
|
||||
# Temporary fixup for juci/luci profile
|
||||
if [ "$PROFILE" == "luci" ]; then
|
||||
sed -i '/CONFIG_DEFAULT_juci/d' .config
|
||||
sed -i '/CONFIG_PACKAGE_juci/d' .config
|
||||
sed -i '/CONFIG_PACKAGE_uhttpd/d' .config
|
||||
fi
|
||||
|
||||
echo Set version to $(grep -w CONFIG_TARGET_VERSION .config | cut -d'=' -f2 | tr -d '"')
|
||||
}
|
||||
|
||||
####### main #####
|
||||
if [ ! -e tmp/.iop_bootstrap ]; then
|
||||
echo "You have not installed feeds. Running genconfig in this state would create a non functional configuration."
|
||||
echo "Run: iop feeds_update"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo Current profile:
|
||||
cat .current_config_file
|
||||
echo "Try ./iop_get_config.sh -h' to get instructions if you want to change current config"
|
||||
exit 0
|
||||
else
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
|
||||
-c) export CLEAN=1;;
|
||||
-u) export IMPORT=1;;
|
||||
-v) export VERBOSE="$(($VERBOSE + 1))";;
|
||||
-p) export PROFILE="$2"; shift;;
|
||||
-t) export USE_TAG=1;;
|
||||
-s) export SRCTREEOVERR=1;;
|
||||
-h) usage;;
|
||||
-*)
|
||||
echo "Invalid option: $1 "
|
||||
echo "Try -h' for more information."
|
||||
exit 1
|
||||
;;
|
||||
*) break;;
|
||||
esac
|
||||
shift;
|
||||
done
|
||||
setup_dirs
|
||||
create_and_copy_files "$1" "$2"
|
||||
use_local_mirror
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
register_command "genconfig" "Generate configuration for board and customer"
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
|
||||
build_bcmkernel_consumer() {
|
||||
local tarfile bcmkernelcommith
|
||||
bcmkernelcommith=$(grep -w "PKG_SOURCE_VERSION:" $curdir/feeds/feed_inteno_broadcom/bcmkernel/$sdkversion.mk | cut -d'=' -f2)
|
||||
# do not build bcmopen sdk if it was already built before
|
||||
ssh $SERVER "ls $FPATH/bcmopen-$profile-$bcmkernelcommith.tar.gz" && return
|
||||
ssh inteno@iopsys.inteno.se "ls public/www/iopsys/consumer/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-$profile-$bcmkernelcommith.tar.gz
|
||||
scp $tarfile inteno@ihgsp.inteno.se:/home/inteno/public/www/iopsys/consumer/bcmopen-$profile-$bcmkernelcommith.tar.gz
|
||||
rm -f $tarfile
|
||||
cd $curdir
|
||||
}
|
||||
@@ -21,12 +22,12 @@ build_natalie_consumer() {
|
||||
grep -q "CONFIG_TARGET_NO_DECT=y" .config && return
|
||||
natalieversion=$(grep -w "PKG_VERSION:" ./feeds/feed_inteno_packages/natalie-dect/Makefile | cut -d'=' -f2)
|
||||
nataliecommith=$(grep -w "PKG_SOURCE_VERSION:" ./feeds/feed_inteno_packages/natalie-dect/Makefile | cut -d'=' -f2)
|
||||
ssh $SERVER "ls $FPATH/natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz" && return
|
||||
ssh inteno@iopsys.inteno.se "ls public/www/iopsys/consumer/natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz" && return
|
||||
cd ./build_dir/target-*_uClibc-0.9.33.*/natalie-dect-$natalieversion/
|
||||
mkdir natalie-dect-open-$natalieversion
|
||||
cp NatalieFpCvm6362/Src/Projects/NatalieV3/FpCvm/Linux6362/dects.ko natalie-dect-open-$natalieversion/dect.ko
|
||||
tar -czv natalie-dect-open-$natalieversion/ -f natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz
|
||||
scp natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz $SERVER:$FPATH/
|
||||
scp natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz inteno@iopsys.inteno.se:/home/inteno/public/www/iopsys/consumer/
|
||||
cp natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz $curdir/
|
||||
rm -rf natalie-dect-open-$natalieversion
|
||||
rm -f natalie-dect-$profile-$natalieversion-$nataliecommith.tar.gz
|
||||
@@ -39,12 +40,12 @@ build_endptcfg_consumer() {
|
||||
grep -q "CONFIG_TARGET_NO_VOICE=y" .config && return
|
||||
endptversion=$(grep -w "PKG_VERSION:" ./feeds/feed_inteno_packages/endptcfg/Makefile | cut -d'=' -f2)
|
||||
endptcommith=$(grep -w "PKG_SOURCE_VERSION:" ./feeds/feed_inteno_packages/endptcfg/Makefile | cut -d'=' -f2)
|
||||
ssh $SERVER "ls $FPATH/endptcfg-$profile-$endptversion-$endptcommith.tar.gz" && return
|
||||
ssh inteno@iopsys.inteno.se "ls public/www/iopsys/consumer/endptcfg-$profile-$endptversion-$endptcommith.tar.gz" && return
|
||||
cd ./build_dir/target-*_uClibc-0.9.33.*/endptcfg-$endptversion/
|
||||
mkdir endptcfg-open-$endptversion
|
||||
cp endptcfg endptcfg-open-$endptversion/
|
||||
tar -czv endptcfg-open-$endptversion/ -f endptcfg-$profile-$endptversion-$endptcommith.tar.gz
|
||||
scp endptcfg-$profile-$endptversion-$endptcommith.tar.gz $SERVER:$FPATH/
|
||||
scp endptcfg-$profile-$endptversion-$endptcommith.tar.gz inteno@iopsys.inteno.se:/home/inteno/public/www/iopsys/consumer/
|
||||
cp endptcfg-$profile-$endptversion-$endptcommith.tar.gz $curdir/
|
||||
rm -rf endptcfg-open-$endptversion
|
||||
rm -f endptcfg-$profile-$endptversion-$endptcommith.tar.gz
|
||||
@@ -58,19 +59,17 @@ build_ice_consumer() {
|
||||
icebasever=$(grep -w "BASE_PKG_VERSION:" ./feeds/feed_inteno_packages/ice-client/Makefile | cut -d'=' -f2)
|
||||
icerelease=$(grep -w "PKG_RELEASE:" ./feeds/feed_inteno_packages/ice-client/Makefile | cut -d'=' -f2)
|
||||
iceversion=$icebasever$icerelease
|
||||
ssh $SERVER "ls $FPATH/ice-client-$profile-$iceversion-$icecommith.tar.gz" && return
|
||||
ssh inteno@iopsys.inteno.se "ls public/www/iopsys/consumer/ice-client-$profile-$iceversion-$icecommith.tar.gz" && return
|
||||
cd ./build_dir/target-*_uClibc-0.9.33.*/ice-client-$icebasever/ipkg-*
|
||||
tar -czv ice-client -f ice-client-$profile-$iceversion-$icecommith.tar.gz
|
||||
scp ice-client-$profile-$iceversion-$icecommith.tar.gz $SERVER:$FPATH/
|
||||
scp ice-client-$profile-$iceversion-$icecommith.tar.gz inteno@iopsys.inteno.se:/home/inteno/public/www/iopsys/consumer/
|
||||
cp ice-client-$profile-$iceversion-$icecommith.tar.gz $curdir/
|
||||
rm -f ice-client-$profile-$iceversion-$icecommith.tar.gz
|
||||
cd $curdir
|
||||
}
|
||||
|
||||
function generate_tarballs {
|
||||
|
||||
SERVER="god@software.inteno.se"
|
||||
FPATH="/var/www/html/iopsys/consumer"
|
||||
function generate_tarballs {
|
||||
|
||||
git remote -v | grep -q http && return # do not continue if this is an open SDK environment
|
||||
|
||||
@@ -85,5 +84,5 @@ function generate_tarballs {
|
||||
|
||||
}
|
||||
|
||||
register_command "generate_tarballs" "Generate tarballs for Open SDK"
|
||||
register_command "generate_tarballs" "Generate tarballs for openstk"
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ function ssh_sysupgrade_latest {
|
||||
exit 1
|
||||
fi
|
||||
{ cd `dirname $0`
|
||||
IMAGE=`ls -Art bin/*/*.y2 | tail -n1`
|
||||
IMAGE=`ls -Art bin/*/*.y | tail -n1`
|
||||
[ "$IMAGE" ] && [ -e "$IMAGE" ] && ./iop ssh_sysupgrade $1 $IMAGE $2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
UPDATE=0
|
||||
|
||||
print_git_update()
|
||||
{
|
||||
@@ -100,28 +99,6 @@ insert_hash_in_feed_makefile()
|
||||
(cd ${PKG_DIR}; git add ${name})
|
||||
}
|
||||
|
||||
insert_version_in_feed_makefile()
|
||||
{
|
||||
if [ -n "$PKG_SOURCE_VERSION_FILE" ]
|
||||
then
|
||||
name="$PKG_SOURCE_VERSION_FILE"
|
||||
else
|
||||
name=Makefile
|
||||
fi
|
||||
|
||||
last_version=$(awk -F '=' '/PKG_VERSION:=/ {print $2}' ${PKG_DIR}/${name})
|
||||
|
||||
echo -n "please enter version: "
|
||||
read -ei "$last_version" answer
|
||||
|
||||
if [ -z ${answer} ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
sed -i -e "s/\(^PKG_VERSION:=\).*/\1${answer}/" ${PKG_DIR}/${name}
|
||||
(cd ${PKG_DIR}; git add ${name})
|
||||
}
|
||||
|
||||
|
||||
# BUG: fix if only local branche name!
|
||||
branch_uptodate()
|
||||
@@ -399,13 +376,9 @@ check_packages()
|
||||
echo "Now checking if any changes has been done to the packages."
|
||||
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
|
||||
|
||||
# only scan in the build directory that is currently in use.
|
||||
CPU=$(grep "CONFIG_CPU_TYPE=" .config| cut -f2 -d\")
|
||||
LIBC=$(grep "CONFIG_LIBC=" .config| cut -f2 -d\")
|
||||
|
||||
# First scan all files in build dir for packages that have .git directories.
|
||||
all_pkgs=$(find build_dir/*${CPU}*${LIBC}* -name ".git")
|
||||
|
||||
all_pkgs=$(find build_dir/ -name ".git")
|
||||
|
||||
for pkg in `echo "$all_pkgs"`
|
||||
do
|
||||
pkg=$(dirname $pkg)
|
||||
@@ -427,7 +400,6 @@ check_packages()
|
||||
# print_git_update
|
||||
git_repos_uptodate
|
||||
insert_hash_in_feed_makefile
|
||||
[ "${UPDATE}" ] && insert_version_in_feed_makefile
|
||||
create_message >tmp/msg
|
||||
commit_feed tmp/msg
|
||||
insert_hash_in_feeds_config
|
||||
@@ -575,13 +547,6 @@ feeds_at_top()
|
||||
exit 0
|
||||
}
|
||||
|
||||
usage(){
|
||||
echo -e "$0 [flags]"
|
||||
echo -e "flags:"
|
||||
echo -e " -v\tVerbose mode"
|
||||
echo -e " -h\tShow this help"
|
||||
echo -e " -u\tUpdate package version\n"
|
||||
}
|
||||
|
||||
# Exported interface
|
||||
function update_package {
|
||||
@@ -598,18 +563,15 @@ function update_package {
|
||||
Cyan='\033[0;36m' # Cyan
|
||||
White='\033[0;37m' # White
|
||||
|
||||
while getopts "v:hu" opt; do
|
||||
while getopts "v:h" opt; do
|
||||
case $opt in
|
||||
v)
|
||||
verbose=$OPTARG
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
u)
|
||||
UPDATE=1
|
||||
;;
|
||||
echo "some help! No options yet"
|
||||
exit 1
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
|
||||
@@ -103,6 +103,10 @@ init_iup() {
|
||||
fi
|
||||
}
|
||||
|
||||
boot() {
|
||||
init_iup
|
||||
}
|
||||
|
||||
start_service() {
|
||||
init_iup
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ export IUPTEMP="/tmp/iup"
|
||||
export INTERACTIVE=0
|
||||
export VERBOSE=0
|
||||
export CONF=1
|
||||
export DESKEY=$(cat /proc/nvram/DesKey | tr -d '\n' | hexdump -e '16/1 "%02x"')
|
||||
export DESKEY=$(cat /proc/nvram/DesKey | hexdump -e '16/1 "%02x"')
|
||||
export MAC=$(cat /proc/nvram/BaseMacAddr)
|
||||
export RANGE=10
|
||||
export RETRYSTOP=5
|
||||
@@ -160,7 +160,7 @@ handle_Downloaded_file()
|
||||
{
|
||||
local DECKEY
|
||||
local KEY
|
||||
[ -n "$1" ] && DECKEY=$(echo $1 | tr -d '\n' | hexdump -e '16/1 "%02x"')
|
||||
[ -n "$1" ] && DECKEY=$(echo $1 | hexdump -e '16/1 "%02x"')
|
||||
KEY=${DECKEY:-$DESKEY}
|
||||
local img_type
|
||||
case "$(get_image_type "$IUPCONFFILES")" in
|
||||
@@ -201,9 +201,6 @@ handle_Downloaded_file()
|
||||
reload $CONFILESLURP
|
||||
fi
|
||||
rm -rf $IUPTEMP
|
||||
|
||||
cp /rom/etc/uci-defaults/* /etc/uci-defaults/
|
||||
sync
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
@@ -315,6 +312,11 @@ handle_option224()
|
||||
c=$(echo $1|cut -d',' -f4)
|
||||
fi
|
||||
|
||||
echo "url" $url
|
||||
echo "a" $a
|
||||
echo "b" $b
|
||||
echo "c" $c
|
||||
|
||||
currdate=$(date +"%Y-%m-%d")
|
||||
|
||||
active=0
|
||||
@@ -348,9 +350,8 @@ handle_option224()
|
||||
|
||||
if [ $url ] && [ $active -eq 1 ]; then
|
||||
echo "Software version to download $softwareminuspath"
|
||||
local sysinfo=$(ubus call router.system info)
|
||||
local sysinfo=$(ubus call router quest "{ \"info\": \"system\" }")
|
||||
json_load "$sysinfo"
|
||||
json_select system
|
||||
json_get_var firmware firmware
|
||||
local firmware_new=${softwareminuspath%.*} # remove extension (.w, .y or .y2) from filename
|
||||
if [ "$firmware_new" != "$firmware" ] ; then
|
||||
@@ -381,14 +382,12 @@ done
|
||||
|
||||
# Process IUP related DHCP options #
|
||||
if [ -n "$1" ]; then
|
||||
local privopt224 privopt225 privopt226 vendorspecinf httpurl128
|
||||
local privopt224 vendorspecinf httpurl128
|
||||
local tftp bootfile vlanid vlanpriority interface
|
||||
|
||||
json_load "$1"
|
||||
json_get_var interface interface
|
||||
json_get_var privopt224 privopt224
|
||||
json_get_var privopt225 privopt225
|
||||
json_get_var privopt226 privopt226
|
||||
json_get_var vendorspecinf vendorspecinf
|
||||
json_get_var httpurl128 httpurl128
|
||||
json_get_var tftp tftp
|
||||
@@ -424,27 +423,9 @@ if [ -n "$1" ]; then
|
||||
elif [ -n "$vlanid" ]; then
|
||||
logger -t dhcp_opt132 "vlanid: ${vlanid}"
|
||||
change_to_vlan ${vlanid} 0 ${interface}
|
||||
elif [ -n "$privopt225" ] || [ -n "$privopt226" ]; then
|
||||
# opt225 and opt226 can be used together or separatly
|
||||
if [ -n "$privopt225" ]; then
|
||||
echo "dhcp option 225: $privopt225" >/dev/console
|
||||
# option225 is allowd to change only once per CPE
|
||||
if [ "$(uci get -q ice.cloud.frozen)" != "1" ] ; then
|
||||
uci set ice.cloud.frozen="1"
|
||||
uci set ice.cloud.enabled="1"
|
||||
uci set ice.cloud.server="$privopt225"
|
||||
fi
|
||||
fi
|
||||
if [ -n "$privopt226" ]; then
|
||||
echo "dhcp option 226: $privopt226" >/dev/console
|
||||
[ -z "$(uci get -q ice.dhcp)" ] && uci set ice.dhcp="dhcp"
|
||||
uci set ice.dhcp.opt226connectionid="$privopt226"
|
||||
ubus send dhcp.opt226connectionid '{"opt226connectionid":"","value":"'$privopt226'"}'
|
||||
fi
|
||||
uci commit
|
||||
else
|
||||
logger -t dhcp_opt132 "no vlanid given"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
local iupurl
|
||||
@@ -474,9 +455,8 @@ sofwareminuspath=${software##*/}
|
||||
v "Software version to download $sofwareminuspath"
|
||||
|
||||
if [ $software ]; then
|
||||
local sysinfo=$(ubus call router.system info)
|
||||
local sysinfo=$(ubus call router quest "{ \"info\": \"system\" }")
|
||||
json_load "$sysinfo"
|
||||
json_select system
|
||||
json_get_var firmware firmware
|
||||
json_get_var filesystem filesystem
|
||||
if [ "$filesystem" == "JFFS2" ] ; then
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
. /usr/share/libubox/jshn.sh
|
||||
include /lib/network
|
||||
|
||||
START=22
|
||||
START=21
|
||||
USE_PROCD=1
|
||||
|
||||
start_service() {
|
||||
@@ -78,8 +78,7 @@ start_service() {
|
||||
|
||||
xtmctl start
|
||||
xtmctl operate intf --state 1 enable
|
||||
json_load "$(ubus call router.system info)"
|
||||
json_select specs
|
||||
json_load "$(ubus call router quest "{ \"info\": \"specs\" }")"
|
||||
json_get_var vdsl vdsl
|
||||
|
||||
if [ $vdsl -eq 1 ]; then
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
. /lib/functions.sh
|
||||
include /lib/network
|
||||
|
||||
START=22
|
||||
START=21
|
||||
USE_PROCD=1
|
||||
|
||||
checkpvc() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
. /lib/functions.sh
|
||||
include /lib/network
|
||||
|
||||
START=22
|
||||
START=21
|
||||
USE_PROCD=1
|
||||
|
||||
get_current_status() {
|
||||
@@ -72,9 +72,8 @@ boot() {
|
||||
fi
|
||||
for interf in `db get hw.board.ethernetPortOrder`; do ethswctl -c wan -i $interf -o disable ; done
|
||||
wanport=$(db get hw.board.ethernetWanPort)
|
||||
unit=$(echo $(get_port_number $wanport) | cut -d ' ' -f 1)
|
||||
port=$(echo $(get_port_number $wanport) | cut -d ' ' -f 2)
|
||||
ethswctl -c pause -n $unit -p $port -v 1
|
||||
portnum=$(get_port_number $wanport)
|
||||
ethswctl -c pause -p $portnum -v 1
|
||||
ethswctl -c hw-switching -o enable
|
||||
if [ $baseifname ]; then
|
||||
ethswctl -c wan -i $baseifname -o enable
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
. /lib/functions.sh
|
||||
include /lib/network
|
||||
|
||||
START=22
|
||||
START=21
|
||||
USE_PROCD=1
|
||||
|
||||
checkptm() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
. /lib/functions.sh
|
||||
include /lib/network
|
||||
|
||||
START=22
|
||||
START=21
|
||||
USE_PROCD=1
|
||||
|
||||
vlan_inf_conf() {
|
||||
|
||||
@@ -85,7 +85,6 @@ wlmngr_doWlConf() {
|
||||
|
||||
#wlctl -i wl$idx nreqd $nreqd
|
||||
wlconf wl$idx up
|
||||
wlctl -i wl$idx obss_coex 1
|
||||
}
|
||||
|
||||
wlmngr_setupMbssMacAddr() {
|
||||
@@ -99,6 +98,22 @@ wlmngr_setupMbssMacAddr() {
|
||||
done
|
||||
}
|
||||
|
||||
#enableBSD() {
|
||||
# nvram_set bsd_role=0
|
||||
# [ act_wl_cnt == 0 ] && return FALSE
|
||||
# for i in wl0 wl1; do
|
||||
# if [ m_instance_wl[i].m_wlVar.wlEnbl == TRUE && m_instance_wl[i].m_wlVar.bsdRole > 0 ]; then
|
||||
# nvram set bsd_role=m_instance_wl[i].m_wlVar.bsdRole
|
||||
# nvram set bsd_pport=m_instance_wl[i].m_wlVar.bsdPport
|
||||
# nvram set bsd_hpport=m_instance_wl[i].m_wlVar.bsdHport
|
||||
# nvram set bsd_helper=m_instance_wl[i].m_wlVar.bsdHelper
|
||||
# nvram set bsd_primary=m_instance_wl[i].m_wlVar.bsdPrimary
|
||||
# return TRUE
|
||||
# fi
|
||||
# done
|
||||
# return FALSE
|
||||
#}
|
||||
|
||||
#enableSSD() {
|
||||
# nvram set ssd_enable=0
|
||||
# [ act_wl_cnt == 0 ] && return FALSE
|
||||
@@ -154,89 +169,6 @@ wlmngr_startServices() {
|
||||
# }
|
||||
}
|
||||
|
||||
enableBSD() {
|
||||
local wdev wdev_to_steer
|
||||
local enabled policy
|
||||
local rssi_threshold bw_util
|
||||
|
||||
nvram set bsd_role=0
|
||||
nvram unset bsd_ifnames
|
||||
|
||||
enabled="$(uci -q get wireless.bandsteering.enabled)"
|
||||
|
||||
[ "$enabled" == "1" ] || return 1
|
||||
|
||||
policy="$(uci -q get wireless.bandsteering.policy)"
|
||||
policy=${policy:-0}
|
||||
rssi_threshold="$(uci -q get wireless.bandsteering.rssi_threshold)"
|
||||
rssi_threshold=${rssi_threshold:--75}
|
||||
bw_util="$(uci -q get wireless.bandsteering.bw_util)"
|
||||
bw_util=${bw_util:--60}
|
||||
|
||||
nvram set bsd_role=3
|
||||
nvram set bsd_pport=9878
|
||||
nvram set bsd_hpport=9877
|
||||
nvram set bsd_helper=192.168.1.2
|
||||
nvram set bsd_primary=192.168.1.1
|
||||
nvram set bsd_scheme=2
|
||||
nvram set bsd_poll_interval=1
|
||||
nvram set bsd_bounce_detect="180 8 3600"
|
||||
nvram set bsd_msglevel=0
|
||||
nvram set bsd_status_poll=5
|
||||
nvram set bsd_status=3
|
||||
|
||||
for wdev in wl0 wl1; do
|
||||
#if [ "$(uci -q get wireless.$wdev.band_steering)" == "1" ]; then
|
||||
nvram set bsd_ifnames="$(nvram get bsd_ifnames) $wdev"
|
||||
[ "$wdev" == "wl0" ] && wdev_to_steer="wl1" || wdev_to_steer="wl0"
|
||||
|
||||
if [ "$policy" == "0" ]; then
|
||||
# RSSI Threshold based policy #
|
||||
if [ "$(nvram get ${wdev}_nband)" == "2" ]; then
|
||||
# 2.4G
|
||||
nvram set ${wdev}_bsd_if_quality_policy="0 0x0 -100"
|
||||
nvram set ${wdev}_bsd_if_select_policy=$wdev_to_steer
|
||||
nvram set ${wdev}_bsd_sta_select_policy="10 0 0 0 1 1 0 0 0 0x400"
|
||||
nvram set ${wdev}_bsd_steer_prefix=$wdev
|
||||
nvram set ${wdev}_bsd_steering_policy="0 5 3 0 0 0x1"
|
||||
else
|
||||
# 5G
|
||||
nvram set ${wdev}_bsd_if_quality_policy="20 0x0 $rssi_threshold"
|
||||
nvram set ${wdev}_bsd_if_select_policy=$wdev_to_steer
|
||||
nvram set ${wdev}_bsd_sta_select_policy="100 0 0 0 0 1 0 0 0 0x40"
|
||||
nvram set ${wdev}_bsd_steer_prefix=$wdev
|
||||
nvram set ${wdev}_bsd_steering_policy="80 5 3 $rssi_threshold 0 0x40"
|
||||
fi
|
||||
else
|
||||
# Bandwidth Usage based policy #
|
||||
if [ "$(nvram get ${wdev}_nband)" == "2" ]; then
|
||||
# 2.4G
|
||||
nvram set ${wdev}_bsd_if_quality_policy="0 0x0 -75"
|
||||
nvram set ${wdev}_bsd_if_select_policy=$wdev_to_steer
|
||||
nvram set ${wdev}_bsd_sta_select_policy="0 0 0 0 0 1 0 0 0 0x600"
|
||||
nvram set ${wdev}_bsd_steer_prefix=$wdev
|
||||
nvram set ${wdev}_bsd_steering_policy="0 5 3 0 0 0x10"
|
||||
else
|
||||
# 5G
|
||||
nvram set ${wdev}_bsd_if_quality_policy="40 0x0 -75"
|
||||
nvram set ${wdev}_bsd_if_select_policy=$wdev_to_steer
|
||||
nvram set ${wdev}_bsd_sta_select_policy="0 0 0 0 0 1 0 0 0 0x240"
|
||||
nvram set ${wdev}_bsd_steer_prefix=$wdev
|
||||
nvram set ${wdev}_bsd_steering_policy="$bw_util 5 3 0 0 0x40"
|
||||
fi
|
||||
fi
|
||||
#fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
wlmngr_BSDCtrl() {
|
||||
killall -q -15 bsd 2>/dev/null
|
||||
if $(enableBSD); then
|
||||
bsd&
|
||||
fi
|
||||
}
|
||||
|
||||
wlmngr_startWsc()
|
||||
{
|
||||
local idx=$1
|
||||
@@ -251,7 +183,7 @@ wlmngr_startWsc()
|
||||
nvram set wl_wps_reg="enabled"
|
||||
nvram set lan_wps_reg=enabled #"enabled/disabled"
|
||||
nvram set wps_uuid=0x000102030405060708090a0b0c0d0ebb
|
||||
nvram set wps_device_name=Inteno
|
||||
nvram set wps_device_name=BroadcomAP
|
||||
nvram set wps_mfstring=Broadcom
|
||||
nvram set wps_modelname=Broadcom
|
||||
nvram set wps_modelnum=123456
|
||||
@@ -308,20 +240,6 @@ wlmngr_wlIfcUp() {
|
||||
ifconfig $vif down
|
||||
fi
|
||||
done
|
||||
|
||||
case "$(uci -q get wireless.wl$idx.monitor)" in
|
||||
1)
|
||||
wlctl -i wl$idx monitor 1
|
||||
ifconfig prism$idx up
|
||||
;;
|
||||
2)
|
||||
wlctl -i wl$idx monitor 2
|
||||
ifconfig radiotap$idx up
|
||||
;;
|
||||
*)
|
||||
wlctl -i wl$idx monitor 0
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
wlmngr_doWds() {
|
||||
@@ -354,7 +272,6 @@ wlmngr_finalize() {
|
||||
# local isac="$(db get hw.$pcid.is_ac)"
|
||||
# if [ "$isac" == "1" ]; then
|
||||
# wlctl -i $device msglevel +radar +dfs
|
||||
# #dhdctl -i $device dconpoll 200
|
||||
# fi
|
||||
local rdrthrs="$(db get hw.$pcid.radarthrs)"
|
||||
if [ -n "$rdrthrs" ]; then
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libtrace
|
||||
PKG_VERSION:=3.0.22
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/apietila/libtrace.git
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_VERSION:=HEAD
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
PKG_INSTALL:=1
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
include $(INCLUDE_DIR)/uclibc++.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/libtrace/Default
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Libtrace library for packet trace processing
|
||||
URL:=http://research.wand.net.nz/software/libtrace.php
|
||||
endef
|
||||
|
||||
define Package/libtrace
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Libtrace library for packet trace processing
|
||||
URL:=http://research.wand.net.nz/software/libtrace.php
|
||||
DEPENDS:=+libpcap +libpthread +zlib +libbz2 +liblzo +librt $(CXX_DEPENDS)
|
||||
endef
|
||||
|
||||
define Package/libtrace/description
|
||||
Network trace processing library for trace processing. Supports multiple
|
||||
input methods, including device capture, raw and gz-compressed
|
||||
trace, and sockets.
|
||||
endef
|
||||
|
||||
define Package/libtrace-tools
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
TITLE:=Libtrace tools for packet trace processing
|
||||
URL:=http://research.wand.net.nz/software/libtrace.php
|
||||
DEPENDS:=+libncurses +libtrace
|
||||
endef
|
||||
|
||||
define Package/libtrace-tools/description
|
||||
Network trace processing tools for trace processing.
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--with-bzip2 \
|
||||
--with-zlib \
|
||||
--with-lzo \
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libtrace.{a,so*} $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libwandio.{a,so*} $(1)/usr/lib/
|
||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpacketdump.{a,so*} $(1)/usr/lib/
|
||||
endef
|
||||
|
||||
define Package/libtrace/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libtrace.so.* $(1)/usr/lib/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libwandio.so.* $(1)/usr/lib/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libpacketdump.so.* $(1)/usr/lib/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/libpacketdump
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libpacketdump/*.so* $(1)/usr/lib/libpacketdump/
|
||||
endef
|
||||
|
||||
define Package/libtrace-tools/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{traceanon,tracediff,traceends,tracepktdump,tracereplay,tracereport,tracertstats,tracesplit,tracestats} $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libtrace))
|
||||
$(eval $(call BuildPackage,libtrace-tools))
|
||||
|
||||
122
lmbench/Makefile
122
lmbench/Makefile
@@ -1,122 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=lmbench
|
||||
PKG_VERSION:=3.0-a9
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
|
||||
PKG_SOURCE_URL:=@SF/lmbench/
|
||||
PKG_MD5SUM:=b3351a3294db66a72e2864a199d37cbf
|
||||
|
||||
PKG_BUILD_DEPENDS:=librpc
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/lmbench
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=lmbench microbenchmarks
|
||||
URL:=http://sourceforge.net/projects/lmbench
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/lmbench/description
|
||||
lmbench is a series of micro benchmarks intended to measure basic operating
|
||||
system and hardware system metrics.
|
||||
endef
|
||||
|
||||
define Package/lmbench/install
|
||||
true
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/src \
|
||||
CC="$(TARGET_CC)" \
|
||||
AR="$(TARGET_CROSS)ar" \
|
||||
OS="$(ARCH)" \
|
||||
BASE="$(PKG_INSTALL_DIR)" \
|
||||
LDLIBS="-lrpc" \
|
||||
COMPILE="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(TARGET_LDFLAGS)" \
|
||||
lmbench install
|
||||
endef
|
||||
|
||||
define PartGen
|
||||
define Package/lmbench-$(subst _,-,$(1))
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=$(1) microbenchmark
|
||||
URL:=http://sourceforge.net/projects/lmbench
|
||||
DEPENDS:=lmbench +librpc
|
||||
endef
|
||||
endef
|
||||
|
||||
define PartInstall
|
||||
define Package/lmbench-$(subst _,-,$(1))/install
|
||||
$(INSTALL_DIR) $$(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/$(1) $$(1)/usr/sbin/$(1)
|
||||
endef
|
||||
endef
|
||||
|
||||
LMBENCH_FILES:= \
|
||||
bw_file_rd \
|
||||
bw_mem \
|
||||
bw_mmap_rd \
|
||||
bw_pipe \
|
||||
bw_tcp \
|
||||
bw_unix \
|
||||
cache \
|
||||
disk \
|
||||
enough \
|
||||
flushdisk \
|
||||
hello \
|
||||
lat_cmd \
|
||||
lat_connect \
|
||||
lat_ctx \
|
||||
lat_dram_page \
|
||||
lat_fcntl \
|
||||
lat_fifo \
|
||||
lat_fs \
|
||||
lat_http \
|
||||
lat_mem_rd \
|
||||
lat_mmap \
|
||||
lat_ops \
|
||||
lat_pagefault \
|
||||
lat_pipe \
|
||||
lat_pmake \
|
||||
lat_proc \
|
||||
lat_rand \
|
||||
lat_rpc \
|
||||
lat_select \
|
||||
lat_sem \
|
||||
lat_sig \
|
||||
lat_syscall \
|
||||
lat_tcp \
|
||||
lat_udp \
|
||||
lat_unix \
|
||||
lat_unix_connect \
|
||||
lat_usleep \
|
||||
line \
|
||||
lmdd \
|
||||
lmhttp \
|
||||
loop_o \
|
||||
memsize \
|
||||
mhz \
|
||||
msleep \
|
||||
par_mem \
|
||||
par_ops \
|
||||
stream \
|
||||
timing_o \
|
||||
tlb
|
||||
|
||||
$(foreach file,$(LMBENCH_FILES),$(eval $(call PartGen,$(file))))
|
||||
$(foreach file,$(LMBENCH_FILES),$(eval $(call PartInstall,$(file))))
|
||||
|
||||
$(eval $(call BuildPackage,lmbench))
|
||||
$(foreach file,$(LMBENCH_FILES),$(eval $(call BuildPackage,lmbench-$(subst _,-,$(file)))))
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/src/bench.h
|
||||
+++ b/src/bench.h
|
||||
@@ -77,7 +77,7 @@ typedef long long int64;
|
||||
#endif /* HAVE_int64_t */
|
||||
#endif /* HAVE_int64 */
|
||||
|
||||
-#ifndef HAVE_socklen_t
|
||||
+#if (!defined(HAVE_socklen_t) && !defined(__socklen_t_defined))
|
||||
typedef int socklen_t;
|
||||
#endif
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
--- a/src/Makefile
|
||||
+++ b/src/Makefile
|
||||
@@ -144,6 +144,7 @@ install-target:
|
||||
if [ ! -d $(BASE)/include ]; then mkdir $(BASE)/include; fi
|
||||
if [ ! -d $(BASE)/lib ]; then mkdir $(BASE)/lib; fi
|
||||
cp $(EXES) $(BASE)/bin
|
||||
+ cp $(OPT_EXES) $(BASE)/bin
|
||||
cp $(INCS) $(BASE)/include
|
||||
cp $O/lmbench.a $(BASE)/lib/libmbench.a
|
||||
cd ../doc; env MAKEFLAGS="$(MAKEFLAGS)" make CC="${CC}" OS="${OS}" BASE="$(BASE)" install
|
||||
@@ -1,30 +0,0 @@
|
||||
--- a/scripts/build
|
||||
+++ b/scripts/build
|
||||
@@ -18,7 +18,7 @@ done
|
||||
|
||||
trap 'rm -f ${BASE}$$.s ${BASE}$$.c ${BASE}$$.o ${BASE}$$; exit 1' 1 2 15
|
||||
|
||||
-LDLIBS=-lm
|
||||
+LDLIBS=${LDLIBS-"-lm -lrpc"}
|
||||
|
||||
# check for HP-UX's ANSI compiler
|
||||
echo "main(int ac, char *av[]) { int i; }" > ${BASE}$$.c
|
||||
--- a/src/Makefile
|
||||
+++ b/src/Makefile
|
||||
@@ -38,6 +38,7 @@ CC=`../scripts/compiler`
|
||||
MAKE=`../scripts/make`
|
||||
AR=ar
|
||||
ARCREATE=cr
|
||||
+LDLIBS=
|
||||
|
||||
# base of installation location
|
||||
BASE=/usr/local
|
||||
@@ -111,7 +112,7 @@ LIBOBJS= $O/lib_tcp.o $O/lib_udp.o $O/li
|
||||
$O/lib_sched.o
|
||||
|
||||
lmbench: $(UTILS)
|
||||
- @env CFLAGS=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="$(CC)" OS="$(OS)" ../scripts/build all
|
||||
+ @env CFLAGS=-O MAKE="$(MAKE)" MAKEFLAGS="$(MAKEFLAGS)" CC="$(CC)" OS="$(OS)" LDLIBS="$(LDLIBS)" ../scripts/build all
|
||||
-@env CFLAGS=-O MAKE="$(MAKE)" MAKEFLAGS="k$(MAKEFLAGS)" CC="$(CC)" OS="$(OS)" ../scripts/build opt
|
||||
|
||||
results: lmbench
|
||||
@@ -1,11 +0,0 @@
|
||||
--- a/src/bw_mem.c
|
||||
+++ b/src/bw_mem.c
|
||||
@@ -65,7 +65,7 @@ main(int ac, char **av)
|
||||
size_t nbytes;
|
||||
state_t state;
|
||||
int c;
|
||||
- char *usage = "[-P <parallelism>] [-W <warmup>] [-N <repetitions>] <size> what [conflict]\nwhat: rd wr rdwr cp fwr frd fcp bzero bcopy\n<size> must be larger than 512";
|
||||
+ char *usage = "[-P <parallelism>] [-W <warmup>] [-N <repetitions>] <size> what [conflict]\nwhat: rd wr rdwr cp fwr frd fcp bzero bcopy\n<size> must be larger than 512\n";
|
||||
|
||||
state.overhead = 0;
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=logrotate
|
||||
PKG_VERSION:=3.7.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz
|
||||
PKG_SOURCE_URL:=http://ftp.de.debian.org/debian/pool/main/l/logrotate
|
||||
PKG_MD5SUM:=552639142e163745f6bcd4f1f3816d8a
|
||||
PKG_CAT:=zcat
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/logrotate
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+libpopt
|
||||
TITLE:=rotates, compresses, and mails system logs
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(call Build/Compile/Default, \
|
||||
RPM_OPT_FLAGS="$(TARGET_CFLAGS) $(EXTRA_CPPFLAGS)" \
|
||||
LDFLAGS="$(EXTRA_LDFLAGS)" \
|
||||
logrotate \
|
||||
)
|
||||
endef
|
||||
|
||||
define Package/logrotate/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(CP) ${PKG_BUILD_DIR}/logrotate $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(CP) ./files/logrotate.conf $(1)/etc/
|
||||
$(INSTALL_DIR) $(1)/etc/logrotate.d
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,logrotate))
|
||||
@@ -1,30 +0,0 @@
|
||||
# rotate log files weekly
|
||||
weekly
|
||||
#daily
|
||||
|
||||
# keep 4 weeks worth of backlogs
|
||||
rotate 4
|
||||
|
||||
# create new (empty) log files after rotating old ones
|
||||
create
|
||||
|
||||
notifempty
|
||||
nomail
|
||||
#olddir /var/log/backup/
|
||||
missingok
|
||||
#dateext
|
||||
|
||||
# uncomment this if you want your log files compressed
|
||||
#compress
|
||||
|
||||
# packages can drop log rotation information into this directory
|
||||
include /etc/logrotate.d
|
||||
|
||||
# no packages own lastlog or wtmp -- we'll rotate them here
|
||||
#/var/log/wtmp {
|
||||
# monthly
|
||||
# create 0664 root utmp
|
||||
# rotate 1
|
||||
#}
|
||||
|
||||
# system-specific logs may be also be configured here.
|
||||
@@ -1,433 +0,0 @@
|
||||
diff -u -ruN logrotate-3.7.1.orig/config.c logrotate-3.7.1/config.c
|
||||
--- logrotate-3.7.1.orig/config.c 2003-08-07 07:13:14.000000000 -0400
|
||||
+++ logrotate-3.7.1/config.c 2005-05-24 12:21:09.000000000 -0400
|
||||
@@ -511,6 +511,14 @@
|
||||
newlog->flags &= ~LOG_FLAG_IFEMPTY;
|
||||
|
||||
*endtag = oldchar, start = endtag;
|
||||
+ } else if (!strcmp(start, "dateext")) {
|
||||
+ newlog->flags |= LOG_FLAG_DATEEXT;
|
||||
+
|
||||
+ *endtag = oldchar, start = endtag;
|
||||
+ } else if (!strcmp(start, "nodateext")) {
|
||||
+ newlog->flags &= ~LOG_FLAG_DATEEXT;
|
||||
+
|
||||
+ *endtag = oldchar, start = endtag;
|
||||
} else if (!strcmp(start, "noolddir")) {
|
||||
newlog->oldDir = NULL;
|
||||
|
||||
@@ -670,6 +678,21 @@
|
||||
}
|
||||
*endtag = oldchar, start = endtag;
|
||||
}
|
||||
+ } else if (!strcmp(start, "maxage")) {
|
||||
+ *endtag = oldchar, start = endtag;
|
||||
+
|
||||
+ if (!isolateValue(configFile, lineNum, "maxage count", &start,
|
||||
+ &endtag)) {
|
||||
+ oldchar = *endtag, *endtag = '\0';
|
||||
+
|
||||
+ newlog->rotateAge = strtoul(start, &chptr, 0);
|
||||
+ if (*chptr || newlog->rotateAge < 0) {
|
||||
+ message(MESS_ERROR, "%s:%d bad maximum age '%s'\n",
|
||||
+ configFile, lineNum, start);
|
||||
+ return 1;
|
||||
+ }
|
||||
+ *endtag = oldchar, start = endtag;
|
||||
+ }
|
||||
} else if (!strcmp(start, "errors")) {
|
||||
message(MESS_DEBUG, "%s: %d: the errors directive is deprecated and no longer used.\n",
|
||||
configFile, lineNum);
|
||||
diff -u -ruN logrotate-3.7.1.orig/logrotate.8 logrotate-3.7.1/logrotate.8
|
||||
--- logrotate-3.7.1.orig/logrotate.8 2003-08-07 07:13:14.000000000 -0400
|
||||
+++ logrotate-3.7.1/logrotate.8 2005-05-24 12:21:09.000000000 -0400
|
||||
@@ -200,6 +200,11 @@
|
||||
Log files are rotated every day.
|
||||
|
||||
.TP
|
||||
+\fBdateext\fR
|
||||
+Archive old versions of log files adding a daily extension like YYYYMMDD
|
||||
+instead of simply adding a number.
|
||||
+
|
||||
+.TP
|
||||
\fBdelaycompress\fR
|
||||
Postpone compression of the previous log file to the next rotation cycle.
|
||||
This has only effect when used in combination with \fBcompress\fR.
|
||||
@@ -246,6 +251,12 @@
|
||||
instead of the just-rotated file (this is the default).
|
||||
|
||||
.TP
|
||||
+\fBmaxage\fR \fIcount\fR
|
||||
+Remove rotated logs older than <count> days. The age is only checked
|
||||
+if the logfile is to be rotated. The files are mailed to the
|
||||
+configured address if \fBmaillast\fR and \fBmail\fR are configured.
|
||||
+
|
||||
+.TP
|
||||
\fBmissingok\fR
|
||||
If the log file is missing, go on to the next one without issuing an error
|
||||
message. See also \fBnomissingok\fR.
|
||||
diff -u -ruN logrotate-3.7.1.orig/logrotate.c logrotate-3.7.1/logrotate.c
|
||||
--- logrotate-3.7.1.orig/logrotate.c 2004-10-19 17:41:24.000000000 -0400
|
||||
+++ logrotate-3.7.1/logrotate.c 2005-05-24 12:21:09.000000000 -0400
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <sys/wait.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
+#include <glob.h>
|
||||
|
||||
#ifdef WITH_SELINUX
|
||||
#include <selinux/selinux.h>
|
||||
@@ -22,6 +23,10 @@
|
||||
#include "log.h"
|
||||
#include "logrotate.h"
|
||||
|
||||
+#if !defined(GLOB_ABORTED) && defined(GLOB_ABEND)
|
||||
+#define GLOB_ABORTED GLOB_ABEND
|
||||
+#endif
|
||||
+
|
||||
typedef struct {
|
||||
char * fn;
|
||||
struct tm lastRotated; /* only tm.mon, tm_mday, tm_year are good! */
|
||||
@@ -42,6 +47,14 @@
|
||||
char * mailCommand = DEFAULT_MAIL_COMMAND;
|
||||
time_t nowSecs = 0;
|
||||
|
||||
+static int globerr(const char * pathname, int theerr) {
|
||||
+ message(MESS_ERROR, "error accessing %s: %s\n", pathname,
|
||||
+ strerror(theerr));
|
||||
+
|
||||
+ /* We want the glob operation to continue, so return 0 */
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
static logState * findState(const char * fn, struct stateSet * sip) {
|
||||
int i;
|
||||
logState * states = sip->states;
|
||||
@@ -49,9 +62,11 @@
|
||||
struct tm now = *localtime(&nowSecs);
|
||||
time_t lr_time;
|
||||
|
||||
+ /* find the filename fn in the statesPtr list */
|
||||
for (i = 0; i < numStates; i++)
|
||||
if (!strcmp(fn, states[i].fn)) break;
|
||||
|
||||
+ /* not in statesPtr list, so add new entry */
|
||||
if (i == numStates) {
|
||||
i = numStates++;
|
||||
states = realloc(states, sizeof(*states) * numStates);
|
||||
@@ -121,6 +136,17 @@
|
||||
return rc;
|
||||
}
|
||||
|
||||
+static int removeLogFile(char * name) {
|
||||
+ message(MESS_DEBUG, "removing old log %s\n", name);
|
||||
+
|
||||
+ if (!debug && unlink(name)) {
|
||||
+ message(MESS_ERROR, "Failed to remove old log %s: %s\n",
|
||||
+ name, strerror(errno));
|
||||
+ return 1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int compressLogFile(char * name, logInfo * log, struct stat *sb) {
|
||||
char * compressedName;
|
||||
const char ** fullCommand;
|
||||
@@ -265,6 +291,25 @@
|
||||
return rc;
|
||||
}
|
||||
|
||||
+static int mailLogWrapper (char * mailFilename, char * mailCommand, int logNum, logInfo * log) {
|
||||
+ /* if the log is compressed (and we're not mailing a
|
||||
+ * file whose compression has been delayed), we need
|
||||
+ * to uncompress it */
|
||||
+ if ((log->flags & LOG_FLAG_COMPRESS) &&
|
||||
+ !((log->flags & LOG_FLAG_DELAYCOMPRESS) &&
|
||||
+ (log->flags & LOG_FLAG_MAILFIRST))) {
|
||||
+ if (mailLog(mailFilename, mailCommand,
|
||||
+ log->uncompress_prog, log->logAddress,
|
||||
+ log->files[logNum]))
|
||||
+ return 1;
|
||||
+ } else {
|
||||
+ if (mailLog(mailFilename, mailCommand, NULL,
|
||||
+ log->logAddress, mailFilename))
|
||||
+ return 1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int copyTruncate(char * currLog, char * saveLog, struct stat * sb, int flags) {
|
||||
char buf[BUFSIZ];
|
||||
int fdcurr = -1, fdsave = -1;
|
||||
@@ -479,6 +524,9 @@
|
||||
char * baseName;
|
||||
char * dirName;
|
||||
char * firstRotated;
|
||||
+ char * glob_pattern;
|
||||
+ glob_t globResult;
|
||||
+ int rc;
|
||||
size_t alloc_size;
|
||||
int rotateCount = log->rotateCount ? log->rotateCount : 1;
|
||||
int logStart = (log->logStart == -1) ? 1 : log->logStart;
|
||||
@@ -509,7 +557,7 @@
|
||||
|
||||
alloc_size = strlen(dirName) + strlen(baseName) +
|
||||
strlen(log->files[logNum]) + strlen(fileext) +
|
||||
- strlen(compext) + 10;
|
||||
+ strlen(compext) + 18;
|
||||
|
||||
oldName = alloca(alloc_size);
|
||||
newName = alloca(alloc_size);
|
||||
@@ -531,16 +579,116 @@
|
||||
/* First compress the previous log when necessary */
|
||||
if (log->flags & LOG_FLAG_COMPRESS &&
|
||||
log->flags & LOG_FLAG_DELAYCOMPRESS) {
|
||||
- struct stat sbprev;
|
||||
-
|
||||
- sprintf(oldName, "%s/%s.%d%s", dirName, baseName, logStart, fileext);
|
||||
- if (stat(oldName, &sbprev)) {
|
||||
- message(MESS_DEBUG, "previous log %s does not exist\n",
|
||||
- oldName);
|
||||
- } else {
|
||||
- hasErrors = compressLogFile(oldName, log, &sbprev);
|
||||
+ if (log->flags & LOG_FLAG_DATEEXT) {
|
||||
+ /* glob for uncompressed files with our pattern */
|
||||
+ glob_pattern = malloc(strlen(dirName) + strlen(baseName)
|
||||
+ + strlen(fileext) + 44 );
|
||||
+ sprintf(glob_pattern,
|
||||
+ "%s/%s-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]%s",
|
||||
+ dirName, baseName, fileext);
|
||||
+ rc = glob(glob_pattern, 0, globerr, &globResult);
|
||||
+ if (!rc && globResult.gl_pathc > 0) {
|
||||
+ for (i = 0; i < globResult.gl_pathc && !hasErrors; i++) {
|
||||
+ struct stat sbprev;
|
||||
+ sprintf(oldName,"%s",(globResult.gl_pathv)[i]);
|
||||
+ if (stat(oldName, &sbprev)) {
|
||||
+ message(MESS_DEBUG, "previous log %s does not exist\n", oldName);
|
||||
+ } else {
|
||||
+ hasErrors = compressLogFile(oldName, log, &sbprev);
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ message (MESS_DEBUG, "glob finding logs to compress failed\n");
|
||||
+ /* fallback to old behaviour */
|
||||
+ sprintf(oldName, "%s/%s.%d%s", dirName, baseName, logStart, fileext);
|
||||
+ }
|
||||
+ globfree(&globResult);
|
||||
+ free(glob_pattern);
|
||||
+ } else {
|
||||
+ struct stat sbprev;
|
||||
+
|
||||
+ sprintf(oldName, "%s/%s.%d%s", dirName, baseName, logStart, fileext);
|
||||
+ if (stat(oldName, &sbprev)) {
|
||||
+ message(MESS_DEBUG, "previous log %s does not exist\n",
|
||||
+ oldName);
|
||||
+ } else {
|
||||
+ hasErrors = compressLogFile(oldName, log, &sbprev);
|
||||
+ }
|
||||
}
|
||||
}
|
||||
+
|
||||
+ firstRotated = alloca(strlen(dirName) + strlen(baseName) +
|
||||
+ strlen(fileext) + strlen(compext) + 30);
|
||||
+
|
||||
+ if(log->flags & LOG_FLAG_DATEEXT) {
|
||||
+ /* glob for compressed files with our pattern
|
||||
+ * and compress ext */
|
||||
+ glob_pattern = malloc(strlen(dirName)+strlen(baseName)
|
||||
+ +strlen(fileext)+strlen(compext)+44);
|
||||
+ sprintf(glob_pattern,
|
||||
+ "%s/%s-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]%s%s",
|
||||
+ dirName, baseName, fileext, compext);
|
||||
+ rc = glob(glob_pattern, 0, globerr, &globResult);
|
||||
+ if (!rc) {
|
||||
+ /* search for files to drop, if we find one remember it,
|
||||
+ * if we find another one mail and remove the first and
|
||||
+ * remember the second and so on */
|
||||
+ struct stat fst_buf;
|
||||
+ int mail_out = -1;
|
||||
+ /* remove the first (n - rotateCount) matches
|
||||
+ * no real rotation needed, since the files have
|
||||
+ * the date in their name */
|
||||
+ for (i = 0; i < globResult.gl_pathc; i++) {
|
||||
+ if( !stat((globResult.gl_pathv)[i],&fst_buf) ) {
|
||||
+ if ((i <= ((int)globResult.gl_pathc - rotateCount))
|
||||
+ || ((log->rotateAge > 0)
|
||||
+ && (((nowSecs - fst_buf.st_mtime)/60/60/24)
|
||||
+ > log->rotateAge))) {
|
||||
+ if ( mail_out != -1 ) {
|
||||
+ if (!hasErrors && log->logAddress) {
|
||||
+ char * mailFilename = (globResult.gl_pathv)[mail_out];
|
||||
+ hasErrors = mailLogWrapper(mailFilename, mailCommand, logNum, log);
|
||||
+ if (!hasErrors)
|
||||
+ hasErrors = removeLogFile(mailFilename);
|
||||
+ }
|
||||
+ }
|
||||
+ mail_out = i;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if ( mail_out != -1 ) {
|
||||
+ /* oldName is oldest Backup found (for unlink later) */
|
||||
+ sprintf(oldName, "%s", (globResult.gl_pathv)[mail_out]);
|
||||
+ strcpy(disposeName, oldName);
|
||||
+ } else
|
||||
+ disposeName = NULL;
|
||||
+ } else {
|
||||
+ message (MESS_DEBUG, "glob finding old rotated logs failed\n");
|
||||
+ disposeName = NULL;
|
||||
+ }
|
||||
+ /* firstRotated is most recently created/compressed rotated log */
|
||||
+ sprintf(firstRotated, "%s/%s-%04d%02d%02d%s%s",
|
||||
+ dirName, baseName, now.tm_year+1900,
|
||||
+ now.tm_mon+1, now.tm_mday, fileext, compext);
|
||||
+ globfree(&globResult);
|
||||
+ free(glob_pattern);
|
||||
+ } else {
|
||||
+ if ( log->rotateAge ) {
|
||||
+ struct stat fst_buf;
|
||||
+ for (i=1; i <= rotateCount; i++) {
|
||||
+ sprintf(oldName, "%s/%s.%d%s%s", dirName, baseName,
|
||||
+ rotateCount + 1, fileext, compext);
|
||||
+ if(!stat(oldName,&fst_buf)
|
||||
+ && (((nowSecs - fst_buf.st_mtime)/60/60/24)
|
||||
+ > log->rotateAge)) {
|
||||
+ char * mailFilename = (globResult.gl_pathv)[i];
|
||||
+ if (!hasErrors && log->logAddress)
|
||||
+ hasErrors = mailLogWrapper(mailFilename, mailCommand, logNum, log);
|
||||
+ if (!hasErrors)
|
||||
+ hasErrors = removeLogFile(mailFilename);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
sprintf(oldName, "%s/%s.%d%s%s", dirName, baseName,
|
||||
logStart + rotateCount, fileext, compext);
|
||||
@@ -548,8 +696,6 @@
|
||||
|
||||
strcpy(disposeName, oldName);
|
||||
|
||||
- firstRotated = alloca(strlen(dirName) + strlen(baseName) +
|
||||
- strlen(fileext) + strlen(compext) + 30);
|
||||
sprintf(firstRotated, "%s/%s.%d%s%s", dirName, baseName,
|
||||
logStart, fileext,
|
||||
(log->flags & LOG_FLAG_DELAYCOMPRESS) ? "" : compext);
|
||||
@@ -600,12 +746,27 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
-
|
||||
+ } /* !LOG_FLAG_DATEEXT */
|
||||
+
|
||||
finalName = oldName;
|
||||
-
|
||||
- /* note: the gzip extension is *not* used here! */
|
||||
- sprintf(finalName, "%s/%s.%d%s", dirName, baseName, logStart, fileext);
|
||||
-
|
||||
+
|
||||
+ if(log->flags & LOG_FLAG_DATEEXT) {
|
||||
+ char * destFile = alloca(strlen(dirName) + strlen(baseName) +
|
||||
+ strlen(fileext) + strlen(compext) + 30);
|
||||
+ struct stat fst_buf;
|
||||
+ sprintf(finalName, "%s/%s-%04d%02d%02d%s",
|
||||
+ dirName, baseName, now.tm_year+1900,
|
||||
+ now.tm_mon+1, now.tm_mday, fileext);
|
||||
+ sprintf(destFile, "%s%s", finalName, compext);
|
||||
+ if(!stat(destFile,&fst_buf)) {
|
||||
+ message (MESS_DEBUG, "destination %s already exists, skipping rotation\n", firstRotated);
|
||||
+ hasErrors = 1;
|
||||
+ }
|
||||
+ } else {
|
||||
+ /* note: the gzip extension is *not* used here! */
|
||||
+ sprintf(finalName, "%s/%s.%d%s", dirName, baseName, logStart, fileext);
|
||||
+ }
|
||||
+
|
||||
/* if the last rotation doesn't exist, that's okay */
|
||||
if (!debug && access(disposeName, F_OK)) {
|
||||
message(MESS_DEBUG, "log %s doesn't exist -- won't try to "
|
||||
@@ -613,9 +774,6 @@
|
||||
disposeName = NULL;
|
||||
}
|
||||
|
||||
- free(dirName);
|
||||
- free(baseName);
|
||||
-
|
||||
if (!hasErrors) {
|
||||
if (log->pre && !(log->flags & LOG_FLAG_SHAREDSCRIPTS)) {
|
||||
message(MESS_DEBUG, "running prerotate script\n");
|
||||
@@ -722,33 +880,12 @@
|
||||
else
|
||||
mailFilename = disposeName;
|
||||
|
||||
- if (mailFilename) {
|
||||
- /* if the log is compressed (and we're not mailing a
|
||||
- file whose compression has been delayed), we need
|
||||
- to uncompress it */
|
||||
- if ((log->flags & LOG_FLAG_COMPRESS) &&
|
||||
- !((log->flags & LOG_FLAG_DELAYCOMPRESS) &&
|
||||
- (log->flags & LOG_FLAG_MAILFIRST))) {
|
||||
- if (mailLog(mailFilename, mailCommand,
|
||||
- log->uncompress_prog, log->logAddress,
|
||||
- log->files[logNum]))
|
||||
- hasErrors = 1;
|
||||
- } else {
|
||||
- if (mailLog(mailFilename, mailCommand, NULL,
|
||||
- log->logAddress, mailFilename))
|
||||
- hasErrors = 1;
|
||||
- }
|
||||
- }
|
||||
+ if (mailFilename)
|
||||
+ hasErrors = mailLogWrapper(mailFilename, mailCommand, logNum, log);
|
||||
}
|
||||
|
||||
if (!hasErrors && disposeName) {
|
||||
- message(MESS_DEBUG, "removing old log %s\n", disposeName);
|
||||
-
|
||||
- if (!debug && unlink(disposeName)) {
|
||||
- message(MESS_ERROR, "Failed to remove old log %s: %s\n",
|
||||
- disposeName, strerror(errno));
|
||||
- hasErrors = 1;
|
||||
- }
|
||||
+ hasErrors = removeLogFile(disposeName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -761,6 +898,8 @@
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+ free(dirName);
|
||||
+ free(baseName);
|
||||
return hasErrors;
|
||||
}
|
||||
|
||||
@@ -1047,7 +1186,9 @@
|
||||
|
||||
int main(int argc, const char ** argv) {
|
||||
logInfo defConfig = { NULL, NULL, 0, NULL, ROT_SIZE,
|
||||
- /* threshHold */ 1024 * 1024, 0,
|
||||
+ /* threshHold */ 1024 * 1024,
|
||||
+ /* rotateCount */ 0,
|
||||
+ /* rotateAge */ 0,
|
||||
/* log start */ -1,
|
||||
/* pre, post */ NULL, NULL,
|
||||
/* first, last */ NULL, NULL,
|
||||
diff -u -ruN logrotate-3.7.1.orig/logrotate.h logrotate-3.7.1/logrotate.h
|
||||
--- logrotate-3.7.1.orig/logrotate.h 2003-08-07 07:13:14.000000000 -0400
|
||||
+++ logrotate-3.7.1/logrotate.h 2005-05-24 12:21:09.000000000 -0400
|
||||
@@ -15,6 +15,7 @@
|
||||
#define LOG_FLAG_MAILFIRST (1 << 6)
|
||||
#define LOG_FLAG_SHAREDSCRIPTS (1 << 7)
|
||||
#define LOG_FLAG_COPY (1 << 8)
|
||||
+#define LOG_FLAG_DATEEXT (1 << 9)
|
||||
|
||||
#define NO_FORCE_ROTATE 0
|
||||
#define FORCE_ROTATE 1
|
||||
@@ -34,6 +35,7 @@
|
||||
enum { ROT_DAYS, ROT_WEEKLY, ROT_MONTHLY, ROT_SIZE, ROT_FORCE } criterium;
|
||||
unsigned int threshhold;
|
||||
int rotateCount;
|
||||
+ int rotateAge;
|
||||
int logStart;
|
||||
char * pre, * post, * first, * last;
|
||||
char * logAddress;
|
||||
@@ -1,12 +0,0 @@
|
||||
diff -u -ruN logrotate-3.7.1.orig/logrotate.c logrotate-3.7.1/logrotate.c
|
||||
--- logrotate-3.7.1.orig/logrotate.c 2004-10-19 17:41:24.000000000 -0400
|
||||
+++ logrotate-3.7.1/logrotate.c 2005-05-24 12:12:26.000000000 -0400
|
||||
@@ -1002,7 +1002,7 @@
|
||||
}
|
||||
|
||||
/* Hack to hide earlier bug */
|
||||
- if ((year != 1900) && (year < 1996 || year > 2100)) {
|
||||
+ if ((year != 1900) && (year < 1970 || year > 2100)) {
|
||||
message(MESS_ERROR, "bad year %d for file %s in state file %s\n",
|
||||
year, argv[0], stateFilename);
|
||||
fclose(f);
|
||||
@@ -1,14 +0,0 @@
|
||||
--- logrotate-3.7/config.c.orig 2005-04-26 22:57:53.000000000 -0400
|
||||
+++ logrotate-3.7/config.c 2005-04-26 22:59:36.000000000 -0400
|
||||
@@ -142,6 +142,11 @@
|
||||
(!fname[1] || (fname[1] == '.' && !fname[2])))
|
||||
return 0;
|
||||
|
||||
+ /* Don't include 'hidden' files either; this breaks Gentoo
|
||||
+ portage config file management http://bugs.gentoo.org/87683 */
|
||||
+ if (fname[0] == '.')
|
||||
+ return 0;
|
||||
+
|
||||
/* Check if fname is ending in a taboo-extension; if so, return
|
||||
false */
|
||||
for (i = 0; i < tabooCount; i++) {
|
||||
@@ -1,54 +0,0 @@
|
||||
diff -u -ruN logrotate-3.7.1-cur/logrotate.c logrotate-3.7.1/logrotate.c
|
||||
--- logrotate-3.7.1-cur/logrotate.c 2005-05-25 18:20:41.000000000 -0400
|
||||
+++ logrotate-3.7.1/logrotate.c 2005-05-25 18:21:10.000000000 -0400
|
||||
@@ -90,10 +90,7 @@
|
||||
}
|
||||
|
||||
static int runScript(char * logfn, char * script) {
|
||||
- int fd;
|
||||
- char *filespec;
|
||||
int rc;
|
||||
- char buf[256];
|
||||
|
||||
if (debug) {
|
||||
message(MESS_DEBUG, "running script with arg %s: \"%s\"\n",
|
||||
@@ -101,38 +98,12 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
- filespec = buf;
|
||||
- snprintf(buf, sizeof(buf), "%s/logrotate.XXXXXX", getenv("TMPDIR") ?: "/tmp");
|
||||
- fd = -1;
|
||||
- if (!filespec || (fd = mkstemp(filespec)) < 0 || fchmod(fd, 0700)) {
|
||||
- message(MESS_DEBUG, "error creating %s: %s\n", filespec,
|
||||
- strerror(errno));
|
||||
- if (fd >= 0) {
|
||||
- close(fd);
|
||||
- unlink(filespec);
|
||||
- }
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- if (write(fd, "#!/bin/sh\n\n", 11) != 11 ||
|
||||
- write(fd, script, strlen(script)) != strlen(script)) {
|
||||
- message(MESS_DEBUG, "error writing %s\n", filespec);
|
||||
- close(fd);
|
||||
- unlink(filespec);
|
||||
- return -1;
|
||||
- }
|
||||
-
|
||||
- close(fd);
|
||||
-
|
||||
if (!fork()) {
|
||||
- execlp(filespec, filespec, logfn, NULL);
|
||||
+ execl("/bin/sh", "sh", "-c", script, NULL);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
wait(&rc);
|
||||
-
|
||||
- unlink(filespec);
|
||||
-
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
diff -u -ruN logrotate-3.7.1.orig/config.c logrotate-3.7.1/config.c
|
||||
--- logrotate-3.7.1.orig/config.c 2003-08-07 07:13:14.000000000 -0400
|
||||
+++ logrotate-3.7.1/config.c 2005-05-24 12:13:41.000000000 -0400
|
||||
@@ -147,7 +147,7 @@
|
||||
for (i = 0; i < tabooCount; i++) {
|
||||
if (!strcmp(fname + strlen(fname) - strlen(tabooExts[i]),
|
||||
tabooExts[i])) {
|
||||
- message(MESS_ERROR, "Ignoring %s, because of %s "
|
||||
+ message(MESS_DEBUG, "Ignoring %s, because of %s "
|
||||
"ending\n", fname, tabooExts[i]);
|
||||
|
||||
return 0;
|
||||
@@ -1,22 +0,0 @@
|
||||
--- logrotate-3.7.1-old/logrotate.c 2004-10-19 23:41:24.000000000 +0200
|
||||
+++ logrotate-3.7.1-new/logrotate.c 2005-10-02 17:29:22.380767321 +0200
|
||||
@@ -424,12 +424,15 @@ int findNeedRotating(logInfo * log, int
|
||||
switch (log->criterium) {
|
||||
case ROT_WEEKLY:
|
||||
/* rotate if:
|
||||
- 1) the current weekday is before the weekday of the
|
||||
- last rotation
|
||||
+ 1) the day of the week is the same as the day of the week of
|
||||
+ the previous rotation but not the same day of the year
|
||||
+ this will rotate it on the same day every week, but not
|
||||
+ twice a day.
|
||||
2) more then a week has passed since the last
|
||||
rotation */
|
||||
- state->doRotate = ((now.tm_wday < state->lastRotated.tm_wday) ||
|
||||
- ((mktime(&now) - mktime(&state->lastRotated)) >
|
||||
+ state->doRotate = ((now.tm_wday == state->lastRotated.tm_wday &&
|
||||
+ now.tm_yday != state->lastRotated.tm_yday) ||
|
||||
+ ((mktime(&now) - mktime(&state->lastRotated)) >
|
||||
(7 * 24 * 3600)));
|
||||
break;
|
||||
case ROT_MONTHLY:
|
||||
@@ -1,47 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2010-2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=multiwan
|
||||
PKG_VERSION:=1.0.22
|
||||
PKG_RELEASE:=2
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/multiwan
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
DEPENDS:=+ip +iptables +kmod-ipt-conntrack +iptables-mod-conntrack-extra +iptables-mod-ipopt
|
||||
TITLE:=Simple multi WAN configuration
|
||||
URL:=ftp://ftp.netlab7.com/
|
||||
MAINTAINER:=Craig M. Coffee <craigc@netlab7.com>
|
||||
endef
|
||||
|
||||
define Package/multiwan/description
|
||||
An agent script that makes Multi-WAN configuration simple,
|
||||
easy and manageable. Complete with load balancing, failover and an easy
|
||||
to manage traffic ruleset.
|
||||
endef
|
||||
|
||||
define Package/multiwan/conffiles
|
||||
/etc/config/multiwan
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/multiwan/install
|
||||
$(CP) ./files/* $(1)
|
||||
endef
|
||||
|
||||
define Package/multiwan/postinst
|
||||
[ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/multiwan enable
|
||||
exit 0
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,multiwan))
|
||||
@@ -1,57 +0,0 @@
|
||||
|
||||
config 'multiwan' 'config'
|
||||
# REMOVE THIS LINE OR PUT TO 1 TO ENABLE MULTIWAN
|
||||
option 'enabled' '0'
|
||||
|
||||
option 'default_route' 'balancer'
|
||||
# health_monitor below is defaulted to parallel, and can be set to
|
||||
# serial to save system resources.
|
||||
# option 'health_monitor' 'serial'
|
||||
# option 'debug' '1'
|
||||
|
||||
config 'interface' 'wan'
|
||||
option 'weight' '10'
|
||||
option 'health_interval' '10'
|
||||
option 'icmp_hosts' 'dns'
|
||||
# icmp_count is defaulted to 1, and can be increased to reduce
|
||||
# false positives.
|
||||
# option 'icmp_count' '3'
|
||||
option 'timeout' '3'
|
||||
option 'health_fail_retries' '3'
|
||||
option 'health_recovery_retries' '5'
|
||||
option 'failover_to' 'wwan'
|
||||
option 'dns' 'auto'
|
||||
|
||||
config 'interface' 'wwan'
|
||||
option 'weight' '10'
|
||||
option 'health_interval' '10'
|
||||
option 'icmp_hosts' 'gateway'
|
||||
option 'timeout' '3'
|
||||
option 'health_fail_retries' '3'
|
||||
option 'health_recovery_retries' '5'
|
||||
option 'failover_to' 'balancer'
|
||||
option 'dns' '208.67.222.222 208.67.220.220'
|
||||
|
||||
#config 'mwanfw'
|
||||
# option 'src' '192.168.1.0/24'
|
||||
# option 'dst' 'ftp.netlab7.com'
|
||||
# option 'proto' 'tcp'
|
||||
# option 'ports' '21'
|
||||
# option 'wanrule' 'wan2'
|
||||
|
||||
# VoIP traffic goes through wan
|
||||
# config 'mwanfw'
|
||||
# option 'src' '192.168.1.0/24'
|
||||
# option 'proto' 'udp'
|
||||
# option 'port_type' 'source-ports'
|
||||
# option 'ports' '5060,16384:16482'
|
||||
# option 'wanrule' 'wan'
|
||||
|
||||
#config 'mwanfw'
|
||||
# option 'src' '192.168.0.3'
|
||||
# option 'proto' 'icmp'
|
||||
# option 'wanrule' 'balancer'
|
||||
|
||||
#config 'mwanfw'
|
||||
# option 'dst' 'www.whatismyip.com'
|
||||
# option 'wanrule' 'fastbalancer'
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
START=99
|
||||
EXTRA_COMMANDS="single"
|
||||
USE_PROCD=1
|
||||
|
||||
start_service () {
|
||||
/usr/bin/multiwan agent &
|
||||
}
|
||||
|
||||
stop_service () {
|
||||
sh /usr/bin/multiwan stop
|
||||
}
|
||||
|
||||
reload_service () {
|
||||
/usr/bin/multiwan restart &
|
||||
}
|
||||
|
||||
single () {
|
||||
/usr/bin/multiwan single &
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger multiwan
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -42,10 +42,6 @@ define Package/natalie-dect
|
||||
DEPENDS:=bcmkernel
|
||||
endef
|
||||
|
||||
define Package/natalie-dect/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/natalie-dect/description
|
||||
Kernel dect driver
|
||||
endef
|
||||
@@ -55,16 +51,13 @@ define Build/Compile
|
||||
endef
|
||||
endif
|
||||
|
||||
define Package/natalie-dect/install
|
||||
mkdir -p $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/
|
||||
ifeq ($(CONFIG_NATALIE_OPEN),y)
|
||||
define Package/natalie-dect/install
|
||||
$(INSTALL_DIR) $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra
|
||||
$(CP) $(PKG_BUILD_DIR)/dect.ko $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/dect.ko
|
||||
endef
|
||||
else
|
||||
define Package/natalie-dect/install
|
||||
$(INSTALL_DIR) $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra
|
||||
$(CP) $(PKG_BUILD_DIR)/NatalieFpCvm6362/Src/Projects/NatalieV3/FpCvm/Linux6362/dects.ko $(1)/lib/modules/$(BCM_KERNEL_VERSION)/extra/dect.ko
|
||||
endef
|
||||
endif
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,natalie-dect))
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2012 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ndisc6
|
||||
PKG_VERSION:=1.0.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
|
||||
PKG_SOURCE_URL:=http://www.remlab.net/files/ndisc6
|
||||
PKG_MD5SUM:=50cb4c19606cf6ff2b7388e71832f579
|
||||
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/ndisc
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=IPv6 discovery tools
|
||||
TITLE:=IPv6 discovery tools
|
||||
URL:=http://www.remlab.net/ndisc6/
|
||||
DEPENDS:=+libpthread +librt
|
||||
endef
|
||||
|
||||
define Package/ndisc/description
|
||||
IPv6 discovery tools
|
||||
endef
|
||||
|
||||
define Package/ndisc6
|
||||
$(call Package/ndisc)
|
||||
TITLE:=An ICMPv6 neighbour discovery tool
|
||||
endef
|
||||
|
||||
define Package/ndisc6/description
|
||||
An ICMPv6 neighbour discovery tools
|
||||
endef
|
||||
|
||||
define Package/rdisc6
|
||||
$(call Package/ndisc)
|
||||
TITLE:=An ICMPv6 router discovery tool
|
||||
endef
|
||||
|
||||
define Package/rdisc6/description
|
||||
An ICMPv6 router discovery tool
|
||||
endef
|
||||
|
||||
define Package/traceroute6
|
||||
$(call Package/ndisc)
|
||||
TITLE:=An IPv6-based traceroute implementation
|
||||
endef
|
||||
|
||||
define Package/traceroute6/description
|
||||
An IPv6-based traceroute implementation
|
||||
endef
|
||||
|
||||
define Package/rdnssd
|
||||
$(call Package/ndisc)
|
||||
TITLE:=DNS server discovery daemon
|
||||
endef
|
||||
|
||||
define Package/rdnssd/description
|
||||
A recursive DNS server discovery daemon gathering
|
||||
information through stateless IPv6 autoconfiguration (RFC5006)
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -std=c99
|
||||
|
||||
define Package/ndisc6/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ndisc6 $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/rdisc6/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rdisc6 $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/traceroute6/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{rl,tcp}traceroute6 $(1)/usr/bin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tracert6 $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
define Package/rdnssd/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/rdnssd $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,ndisc6))
|
||||
$(eval $(call BuildPackage,rdisc6))
|
||||
$(eval $(call BuildPackage,traceroute6))
|
||||
$(eval $(call BuildPackage,rdnssd))
|
||||
@@ -1,20 +0,0 @@
|
||||
--- a/src/trace-tcp.c
|
||||
+++ b/src/trace-tcp.c
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#undef _GNU_SOURCE
|
||||
#define _BSD_SOURCE 1
|
||||
+#define __FAVOR_BSD 1
|
||||
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
--- a/src/trace-udp.c
|
||||
+++ b/src/trace-udp.c
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#undef _GNU_SOURCE
|
||||
#define _BSD_SOURCE 1
|
||||
+#define __FAVOR_BSD 1
|
||||
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
@@ -1,175 +0,0 @@
|
||||
--- a/rdnssd/Makefile.am
|
||||
+++ b/rdnssd/Makefile.am
|
||||
@@ -30,7 +30,8 @@ conf_SCRIPTS = merge-hook
|
||||
# rdnssd
|
||||
rdnssd_SOURCES = rdnssd.c rdnssd.h \
|
||||
icmp.c \
|
||||
- netlink.c
|
||||
+ netlink.c \
|
||||
+ strverscmp.c
|
||||
rdnssd_LDADD = $(LIBRT) \
|
||||
@top_builddir@/compat/libcompat.a
|
||||
|
||||
--- a/rdnssd/Makefile.in
|
||||
+++ b/rdnssd/Makefile.in
|
||||
@@ -60,7 +60,7 @@ CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(confdir)"
|
||||
PROGRAMS = $(sbin_PROGRAMS)
|
||||
-am_rdnssd_OBJECTS = rdnssd.$(OBJEXT) icmp.$(OBJEXT) netlink.$(OBJEXT)
|
||||
+am_rdnssd_OBJECTS = rdnssd.$(OBJEXT) icmp.$(OBJEXT) netlink.$(OBJEXT) strverscmp.$(OBJEXT)
|
||||
rdnssd_OBJECTS = $(am_rdnssd_OBJECTS)
|
||||
am__DEPENDENCIES_1 =
|
||||
rdnssd_DEPENDENCIES = $(am__DEPENDENCIES_1) \
|
||||
@@ -251,7 +251,8 @@ conf_SCRIPTS = merge-hook
|
||||
# rdnssd
|
||||
rdnssd_SOURCES = rdnssd.c rdnssd.h \
|
||||
icmp.c \
|
||||
- netlink.c
|
||||
+ netlink.c \
|
||||
+ strverscmp.c
|
||||
|
||||
rdnssd_LDADD = $(LIBRT) \
|
||||
@top_builddir@/compat/libcompat.a
|
||||
@@ -373,6 +374,7 @@ distclean-compile:
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/icmp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netlink.Po@am__quote@
|
||||
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strverscmp.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rdnssd.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
--- /dev/null
|
||||
+++ b/rdnssd/strverscmp.c
|
||||
@@ -0,0 +1,131 @@
|
||||
+/* Compare strings while treating digits characters numerically.
|
||||
+ Copyright (C) 1997, 2000, 2002, 2004 Free Software Foundation, Inc.
|
||||
+ This file is part of the GNU C Library.
|
||||
+ Contributed by Jean-François Bignolles <bignolle@ecoledoc.ibp.fr>, 1997.
|
||||
+
|
||||
+ This program is free software; you can redistribute it and/or modify
|
||||
+ it under the terms of the GNU General Public License as published by
|
||||
+ the Free Software Foundation; either version 2, or (at your option)
|
||||
+ any later version.
|
||||
+
|
||||
+ This program is distributed in the hope that it will be useful,
|
||||
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ GNU General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU General Public License along
|
||||
+ with this program; if not, write to the Free Software Foundation,
|
||||
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
+
|
||||
+#ifdef HAVE_CONFIG_H
|
||||
+# include <config.h>
|
||||
+#endif
|
||||
+
|
||||
+#include <string.h>
|
||||
+#include <ctype.h>
|
||||
+
|
||||
+/* states: S_N: normal, S_I: comparing integral part, S_F: comparing
|
||||
+ fractional parts, S_Z: idem but with leading Zeroes only */
|
||||
+#define S_N 0x0
|
||||
+#define S_I 0x4
|
||||
+#define S_F 0x8
|
||||
+#define S_Z 0xC
|
||||
+
|
||||
+/* result_type: CMP: return diff; LEN: compare using len_diff/diff */
|
||||
+#define CMP 2
|
||||
+#define LEN 3
|
||||
+
|
||||
+
|
||||
+/* ISDIGIT differs from isdigit, as follows:
|
||||
+ - Its arg may be any int or unsigned int; it need not be an unsigned char.
|
||||
+ - It's guaranteed to evaluate its argument exactly once.
|
||||
+ - It's typically faster.
|
||||
+ POSIX says that only '0' through '9' are digits. Prefer ISDIGIT to
|
||||
+ ISDIGIT_LOCALE unless it's important to use the locale's definition
|
||||
+ of `digit' even when the host does not conform to POSIX. */
|
||||
+#define ISDIGIT(c) ((unsigned int) (c) - '0' <= 9)
|
||||
+
|
||||
+#undef __strverscmp
|
||||
+#undef strverscmp
|
||||
+
|
||||
+#ifndef weak_alias
|
||||
+# define __strverscmp strverscmp
|
||||
+#endif
|
||||
+
|
||||
+/* Compare S1 and S2 as strings holding indices/version numbers,
|
||||
+ returning less than, equal to or greater than zero if S1 is less than,
|
||||
+ equal to or greater than S2 (for more info, see the texinfo doc).
|
||||
+*/
|
||||
+
|
||||
+int
|
||||
+__strverscmp (const char *s1, const char *s2)
|
||||
+{
|
||||
+ const unsigned char *p1 = (const unsigned char *) s1;
|
||||
+ const unsigned char *p2 = (const unsigned char *) s2;
|
||||
+ unsigned char c1, c2;
|
||||
+ int state;
|
||||
+ int diff;
|
||||
+
|
||||
+ /* Symbol(s) 0 [1-9] others (padding)
|
||||
+ Transition (10) 0 (01) d (00) x (11) - */
|
||||
+ static const unsigned int next_state[] =
|
||||
+ {
|
||||
+ /* state x d 0 - */
|
||||
+ /* S_N */ S_N, S_I, S_Z, S_N,
|
||||
+ /* S_I */ S_N, S_I, S_I, S_I,
|
||||
+ /* S_F */ S_N, S_F, S_F, S_F,
|
||||
+ /* S_Z */ S_N, S_F, S_Z, S_Z
|
||||
+ };
|
||||
+
|
||||
+ static const int result_type[] =
|
||||
+ {
|
||||
+ /* state x/x x/d x/0 x/- d/x d/d d/0 d/-
|
||||
+ 0/x 0/d 0/0 0/- -/x -/d -/0 -/- */
|
||||
+
|
||||
+ /* S_N */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
|
||||
+ CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
|
||||
+ /* S_I */ CMP, -1, -1, CMP, 1, LEN, LEN, CMP,
|
||||
+ 1, LEN, LEN, CMP, CMP, CMP, CMP, CMP,
|
||||
+ /* S_F */ CMP, CMP, CMP, CMP, CMP, LEN, CMP, CMP,
|
||||
+ CMP, CMP, CMP, CMP, CMP, CMP, CMP, CMP,
|
||||
+ /* S_Z */ CMP, 1, 1, CMP, -1, CMP, CMP, CMP,
|
||||
+ -1, CMP, CMP, CMP
|
||||
+ };
|
||||
+
|
||||
+ if (p1 == p2)
|
||||
+ return 0;
|
||||
+
|
||||
+ c1 = *p1++;
|
||||
+ c2 = *p2++;
|
||||
+ /* Hint: '0' is a digit too. */
|
||||
+ state = S_N | ((c1 == '0') + (ISDIGIT (c1) != 0));
|
||||
+
|
||||
+ while ((diff = c1 - c2) == 0 && c1 != '\0')
|
||||
+ {
|
||||
+ state = next_state[state];
|
||||
+ c1 = *p1++;
|
||||
+ c2 = *p2++;
|
||||
+ state |= (c1 == '0') + (ISDIGIT (c1) != 0);
|
||||
+ }
|
||||
+
|
||||
+ state = result_type[state << 2 | ((c2 == '0') + (ISDIGIT (c2) != 0))];
|
||||
+
|
||||
+ switch (state)
|
||||
+ {
|
||||
+ case CMP:
|
||||
+ return diff;
|
||||
+
|
||||
+ case LEN:
|
||||
+ while (ISDIGIT (*p1++))
|
||||
+ if (!ISDIGIT (*p2++))
|
||||
+ return 1;
|
||||
+
|
||||
+ return ISDIGIT (*p2) ? -1 : diff;
|
||||
+
|
||||
+ default:
|
||||
+ return state;
|
||||
+ }
|
||||
+}
|
||||
+#ifdef weak_alias
|
||||
+weak_alias (__strverscmp, strverscmp)
|
||||
+#endif
|
||||
45
netcheck/Makefile
Normal file
45
netcheck/Makefile
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# Copyright (C) 2013 Inteno
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=netcheck
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_LDFLAGS+= \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/lib -luci -ljson-c
|
||||
|
||||
TARGET_CFLAGS += $(FPIC) -std=gnu99
|
||||
|
||||
define Package/netcheck
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+libuci +libjson-c +questd
|
||||
TITLE:=netcheck utility
|
||||
endef
|
||||
|
||||
define Package/netcheck/description
|
||||
netcheck provides info about given network interface
|
||||
or host ip address
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
mkdir -p $(PKG_BUILD_DIR)
|
||||
$(CP) ./src/* $(PKG_BUILD_DIR)/
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
$(TARGET_CONFIGURE_OPTS) LINUX_DIR=$(LINUX_DIR) LDFLAGS="$(TARGET_LDFLAGS)" CFLAGS="$(TARGET_CFLAGS) -I$(LINUX_DIR)/include -I$(STAGING_DIR)/usr/include"
|
||||
endef
|
||||
|
||||
define Package/netcheck/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/netcheck $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,netcheck))
|
||||
25
netcheck/src/Makefile
Normal file
25
netcheck/src/Makefile
Normal file
@@ -0,0 +1,25 @@
|
||||
CC = gcc
|
||||
MAKEDEPEND = makedepend
|
||||
CDEBUG = -g
|
||||
CFLAGS = ${CDEBUG} ${INCL} -Wall
|
||||
LDFLAGS = ${CDEBUG}
|
||||
LIBDIR =
|
||||
LOCLIBS =
|
||||
LIBS = ${LOCLIBS} ${SYSLIBS}
|
||||
OBJS = netcheck.o arping.o
|
||||
SRCS = netcheck.c arping.c
|
||||
LIBSRCS =
|
||||
ISRCS =
|
||||
ALLSRCS = ${SRCS} ${ISRCS} ${LIBSRCS}
|
||||
|
||||
all: netcheck
|
||||
|
||||
netcheck: ${OBJS}
|
||||
${CC} ${LDFLAGS} -o netcheck ${OBJS} ${LIBDIR} ${LIBS}
|
||||
|
||||
clean:
|
||||
rm -f netcheck core *.o *.BAK *.bak *.CKP a.out
|
||||
|
||||
depend:
|
||||
${MAKEDEPEND} ${INCL} ${SRCS} ${LIBSRCS}
|
||||
|
||||
158
netcheck/src/arping.c
Normal file
158
netcheck/src/arping.c
Normal file
@@ -0,0 +1,158 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <netpacket/packet.h>
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if_arp.h>
|
||||
#include <netinet/ether.h>
|
||||
#include <sys/sysinfo.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
||||
struct in_addr src;
|
||||
struct in_addr dst;
|
||||
struct sockaddr_ll me;
|
||||
struct sockaddr_ll he;
|
||||
int sock_fd;
|
||||
|
||||
static int
|
||||
send_pack(struct in_addr *src_addr, struct in_addr *dst_addr, struct sockaddr_ll *ME, struct sockaddr_ll *HE)
|
||||
{
|
||||
int err;
|
||||
unsigned char buf[256];
|
||||
struct arphdr *ah = (struct arphdr *) buf;
|
||||
unsigned char *p = (unsigned char *) (ah + 1);
|
||||
|
||||
ah->ar_hrd = htons(ARPHRD_ETHER);
|
||||
ah->ar_pro = htons(ETH_P_IP);
|
||||
ah->ar_hln = ME->sll_halen;
|
||||
ah->ar_pln = 4;
|
||||
ah->ar_op = htons(ARPOP_REQUEST);
|
||||
|
||||
p = mempcpy(p, &ME->sll_addr, ah->ar_hln);
|
||||
p = mempcpy(p, src_addr, 4);
|
||||
|
||||
p = mempcpy(p, &HE->sll_addr, ah->ar_hln);
|
||||
p = mempcpy(p, dst_addr, 4);
|
||||
|
||||
err = sendto(sock_fd, buf, p - buf, 0, (struct sockaddr *) HE, sizeof(*HE));
|
||||
return err;
|
||||
}
|
||||
|
||||
static int
|
||||
recv_pack(char *buf, int len, struct sockaddr_ll *FROM)
|
||||
{
|
||||
struct arphdr *ah = (struct arphdr *) buf;
|
||||
unsigned char *p = (unsigned char *) (ah + 1);
|
||||
struct in_addr src_ip, dst_ip;
|
||||
|
||||
/* Filter out wild packets */
|
||||
if (FROM->sll_pkttype != PACKET_HOST
|
||||
&& FROM->sll_pkttype != PACKET_BROADCAST
|
||||
&& FROM->sll_pkttype != PACKET_MULTICAST)
|
||||
return 0;
|
||||
|
||||
/* Only these types are recognized */
|
||||
if (ah->ar_op != htons(ARPOP_REPLY))
|
||||
return 0;
|
||||
|
||||
/* ARPHRD check and this darned FDDI hack here :-( */
|
||||
if (ah->ar_hrd != htons(FROM->sll_hatype)
|
||||
&& (FROM->sll_hatype != ARPHRD_FDDI || ah->ar_hrd != htons(ARPHRD_ETHER)))
|
||||
return 0;
|
||||
|
||||
/* Protocol must be IP. */
|
||||
if (ah->ar_pro != htons(ETH_P_IP)
|
||||
|| (ah->ar_pln != 4)
|
||||
|| (ah->ar_hln != me.sll_halen)
|
||||
|| (len < (int)(sizeof(*ah) + 2 * (4 + ah->ar_hln))))
|
||||
return 0;
|
||||
|
||||
(src_ip.s_addr) = *(uint32_t*)(p + ah->ar_hln);
|
||||
(dst_ip.s_addr) = *(uint32_t*)(p + ah->ar_hln + 4 + ah->ar_hln);
|
||||
|
||||
if (dst.s_addr != src_ip.s_addr)
|
||||
return 0;
|
||||
|
||||
if ((src.s_addr != dst_ip.s_addr) || (memcmp(p + ah->ar_hln + 4, &me.sll_addr, ah->ar_hln)))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
arping(char *targetIP, char *device, long tmo)
|
||||
{
|
||||
struct sockaddr_in saddr;
|
||||
struct ifreq ifr;
|
||||
int probe_fd;
|
||||
|
||||
sock_fd = socket(AF_PACKET, SOCK_DGRAM, 0);
|
||||
|
||||
memset(&ifr, 0, sizeof(ifr));
|
||||
strncpy(ifr.ifr_name, device, IF_NAMESIZE);
|
||||
|
||||
if (ioctl(sock_fd, SIOCGIFINDEX, &ifr, sizeof(ifr)) < 0) {
|
||||
close(sock_fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
me.sll_family = AF_PACKET;
|
||||
me.sll_ifindex = ifr.ifr_ifindex;
|
||||
me.sll_protocol = htons(ETH_P_ARP);
|
||||
bind(sock_fd, (struct sockaddr *) &me, sizeof(me));
|
||||
|
||||
socklen_t mlen = sizeof(me);
|
||||
getsockname(sock_fd, (struct sockaddr *) &me, &mlen);
|
||||
|
||||
he = me;
|
||||
memset(he.sll_addr, -1, he.sll_halen);
|
||||
|
||||
inet_pton(AF_INET, targetIP, &(dst.s_addr));
|
||||
|
||||
/* Get the sender IP address */
|
||||
probe_fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
setsockopt(probe_fd, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr));
|
||||
memset(&saddr, 0, sizeof(saddr));
|
||||
saddr.sin_family = AF_INET;
|
||||
socklen_t slen = sizeof(saddr);
|
||||
saddr.sin_port = htons(1025);
|
||||
saddr.sin_addr = dst;
|
||||
connect(probe_fd, (struct sockaddr *) &saddr, sizeof(saddr));
|
||||
getsockname(probe_fd, (struct sockaddr *) &saddr, &slen);
|
||||
src = saddr.sin_addr;
|
||||
close(probe_fd);
|
||||
|
||||
send_pack(&src, &dst, &me, &he);
|
||||
|
||||
char packet[64];
|
||||
struct sockaddr_ll from;
|
||||
socklen_t alen = sizeof(from);
|
||||
int connected = 0;
|
||||
int cc = -1;
|
||||
|
||||
fd_set read_fds, write_fds, except_fds;
|
||||
FD_ZERO(&read_fds);
|
||||
FD_ZERO(&write_fds);
|
||||
FD_ZERO(&except_fds);
|
||||
FD_SET(sock_fd, &read_fds);
|
||||
|
||||
struct timeval timeout;
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = tmo * 1000;
|
||||
|
||||
if (select(sock_fd + 1, &read_fds, &write_fds, &except_fds, &timeout) == 1)
|
||||
{
|
||||
cc = recvfrom(sock_fd, packet, sizeof(packet), 0, (struct sockaddr *) &from, &alen);
|
||||
}
|
||||
|
||||
if (cc >= 0)
|
||||
connected = recv_pack(packet, cc, &from);
|
||||
|
||||
close(sock_fd);
|
||||
|
||||
return connected;
|
||||
}
|
||||
570
netcheck/src/netcheck.c
Normal file
570
netcheck/src/netcheck.c
Normal file
@@ -0,0 +1,570 @@
|
||||
/*
|
||||
* netcheck.c -- netcheck utility for Inteno CPE's
|
||||
*
|
||||
* Copyright (C) 2012-2013 Inteno Broadband Technology AB. All rights reserved.
|
||||
*
|
||||
* Author: sukru.senli@inteno.se
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <uci.h>
|
||||
#include <json-c/json.h>
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
static struct uci_context *uci_ctx;
|
||||
static struct uci_package *uci_network;
|
||||
|
||||
static void
|
||||
remove_newline(char *buf)
|
||||
{
|
||||
int len;
|
||||
len = strlen(buf) - 1;
|
||||
if (buf[len] == '\n')
|
||||
buf[len] = 0;
|
||||
}
|
||||
|
||||
static struct uci_package *
|
||||
init_package(const char *config)
|
||||
{
|
||||
struct uci_context *ctx = uci_ctx;
|
||||
struct uci_package *p = NULL;
|
||||
|
||||
if (!ctx) {
|
||||
ctx = uci_alloc_context();
|
||||
uci_ctx = ctx;
|
||||
} else {
|
||||
p = uci_lookup_package(ctx, config);
|
||||
if (p)
|
||||
uci_unload(ctx, p);
|
||||
}
|
||||
|
||||
if (uci_load(ctx, config, &p))
|
||||
return NULL;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
static void
|
||||
display_json_var(json_object *obj, char *var)
|
||||
{
|
||||
int ret = 0;
|
||||
json_object_object_foreach(obj, key, val) {
|
||||
if(!strcmp(key, var)) {
|
||||
switch (json_object_get_type(val)) {
|
||||
case json_type_object:
|
||||
break;
|
||||
case json_type_array:
|
||||
break;
|
||||
case json_type_string:
|
||||
fprintf(stdout, "%s\n", json_object_get_string(val));
|
||||
break;
|
||||
case json_type_boolean:
|
||||
fprintf(stdout, "%d\n", json_object_get_boolean(val));
|
||||
break;
|
||||
case json_type_int:
|
||||
fprintf(stdout, "%d\n", json_object_get_int(val));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
json_parse_and_display(const char *str, char *var)
|
||||
{
|
||||
json_object *obj;
|
||||
|
||||
obj = json_tokener_parse(str);
|
||||
if (is_error(obj) || json_object_get_type(obj) != json_type_object) {
|
||||
exit(1);
|
||||
}
|
||||
display_json_var(obj, var);
|
||||
}
|
||||
|
||||
static void
|
||||
connection_status(char *ipaddr)
|
||||
{
|
||||
json_object *new_obj, *my_string;
|
||||
FILE *in;
|
||||
char cmnd[256];
|
||||
char result[2048];
|
||||
|
||||
sprintf(cmnd, "ubus -S call router host \"{ \\\"ipaddr\\\" : \\\"%s\\\" }\"", ipaddr);
|
||||
|
||||
if ((in = popen(cmnd, "r")))
|
||||
fgets(result, sizeof(result), in);
|
||||
|
||||
pclose(in);
|
||||
|
||||
json_parse_and_display(result, "connected");
|
||||
}
|
||||
|
||||
static void
|
||||
match_host_to_network(struct uci_section *s, char *netname, char *hostaddr, unsigned int *local, unsigned char **dev)
|
||||
{
|
||||
const char *is_lan = NULL;
|
||||
const char *ifname = NULL;
|
||||
struct in_addr ip, mask, snet, host, rslt;
|
||||
const char *type = NULL;
|
||||
const char *ipaddr = NULL;
|
||||
const char *netmask = NULL;
|
||||
char devbuf[16];
|
||||
|
||||
is_lan = uci_lookup_option_string(uci_ctx, s, "is_lan");
|
||||
ifname = uci_lookup_option_string(uci_ctx, s, "ifname");
|
||||
|
||||
if (is_lan && !strcmp(is_lan, "1")) {
|
||||
|
||||
if (ifname && !strcmp(ifname, "lo"))
|
||||
return;
|
||||
|
||||
type = uci_lookup_option_string(uci_ctx, s, "type");
|
||||
ipaddr = uci_lookup_option_string(uci_ctx, s, "ipaddr");
|
||||
netmask = uci_lookup_option_string(uci_ctx, s, "netmask");
|
||||
|
||||
inet_pton(AF_INET, ipaddr, &(ip.s_addr));
|
||||
inet_pton(AF_INET, netmask, &(mask.s_addr));
|
||||
inet_pton(AF_INET, hostaddr, &(host.s_addr));
|
||||
|
||||
snet.s_addr = (ip.s_addr & mask.s_addr);
|
||||
rslt.s_addr = (host.s_addr & mask.s_addr);
|
||||
|
||||
if((snet.s_addr ^ rslt.s_addr) == 0) {
|
||||
*local = 1;
|
||||
if (type && !strcmp(type, "bridge")) {
|
||||
snprintf(devbuf, 16, "br-%s", netname);
|
||||
ifname = strdup(devbuf);
|
||||
}
|
||||
*dev = ifname;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
get_portname(char *ifname, unsigned char **lanport)
|
||||
{
|
||||
FILE *in;
|
||||
char buf[24];
|
||||
char cmnd[256];
|
||||
|
||||
sprintf(cmnd, ". /lib/network/config.sh && interfacename %s", ifname);
|
||||
if (!(in = popen(cmnd, "r")))
|
||||
exit(1);
|
||||
|
||||
fgets(buf, sizeof(buf), in);
|
||||
|
||||
remove_newline(&buf);
|
||||
|
||||
*lanport = strdup(buf);
|
||||
}
|
||||
|
||||
static void
|
||||
get_statistics(char *dev, char *stat)
|
||||
{
|
||||
FILE *in;
|
||||
char cmnd[256];
|
||||
char result[64];
|
||||
|
||||
sprintf(cmnd, "/sys/class/net/%s/statistics/%s", dev, stat);
|
||||
|
||||
if ((in = fopen(cmnd, "r")))
|
||||
fgets(result, sizeof(result), in);
|
||||
|
||||
fclose(in);
|
||||
|
||||
fprintf(stdout, "\t\t%s %s", stat, result);
|
||||
}
|
||||
|
||||
static void
|
||||
get_clientinfo(char *macaddr, char *val)
|
||||
{
|
||||
FILE *in;
|
||||
char cmnd[256];
|
||||
char result[2048];
|
||||
|
||||
sprintf(cmnd, "ubus -S call router host \"{ \\\"macaddr\\\": \\\"%s\\\" }\"", macaddr);
|
||||
|
||||
if ((in = popen(cmnd, "r")))
|
||||
fgets(result, sizeof(result), in);
|
||||
|
||||
pclose(in);
|
||||
|
||||
json_parse_and_display(result, val);
|
||||
}
|
||||
|
||||
static void
|
||||
find_clients(char *ipaddr, char *netmask, bool checkcon)
|
||||
{
|
||||
FILE *leases = fopen("/var/dhcp.leases", "r");
|
||||
char line[256];
|
||||
char leaseno[24];
|
||||
char macaddr[24];
|
||||
char hostaddr[24];
|
||||
char hostname[128];
|
||||
char hwaddr[24];
|
||||
struct in_addr ip, mask, snet, host, rslt;
|
||||
int cno = 0;
|
||||
|
||||
while(fgets(line, sizeof(line), leases) != NULL)
|
||||
{
|
||||
int len = strlen(line) - 1;
|
||||
|
||||
if (line[len] == '\n')
|
||||
line[len] = 0;
|
||||
|
||||
if (sscanf(line, "%s %s %s %s %s", leaseno, macaddr, hostaddr, hostname, hwaddr) != 5)
|
||||
exit(1);
|
||||
|
||||
inet_pton(AF_INET, ipaddr, &(ip.s_addr));
|
||||
inet_pton(AF_INET, netmask, &(mask.s_addr));
|
||||
inet_pton(AF_INET, hostaddr, &(host.s_addr));
|
||||
|
||||
snet.s_addr = (ip.s_addr & mask.s_addr);
|
||||
rslt.s_addr = (host.s_addr & mask.s_addr);
|
||||
|
||||
if((snet.s_addr ^ rslt.s_addr) == 0) {
|
||||
if (checkcon) {
|
||||
fprintf(stdout, "\t------\n");
|
||||
fprintf(stdout, "\tClient\n");
|
||||
fprintf(stdout, "\t------\n");
|
||||
fprintf(stdout, "\t\tHostname: ");
|
||||
get_clientinfo(macaddr, "hostname");
|
||||
fprintf(stdout, "\t\tIP Address: ");
|
||||
get_clientinfo(macaddr, "ipaddr");
|
||||
fprintf(stdout, "\t\tMAC Address: %s\n", macaddr);
|
||||
fprintf(stdout, "\t\tConnected: ");
|
||||
get_clientinfo(macaddr, "connected");
|
||||
}
|
||||
else {
|
||||
fprintf(stdout, "Lease[%d]\n", cno);
|
||||
fprintf(stdout, "\thostname[%d]: %s\n", cno, hostname);
|
||||
fprintf(stdout, "\thostaddr[%d]: %s\n", cno, hostaddr);
|
||||
fprintf(stdout, "\tmacaddr[%d]: %s\n", cno, macaddr);
|
||||
}
|
||||
cno++;
|
||||
}
|
||||
}
|
||||
fclose(leases);
|
||||
|
||||
if(!checkcon)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void
|
||||
find_ports(char *interface, char *ifname, char *ipaddr, char *netmask, bool bridge)
|
||||
{
|
||||
FILE *in;
|
||||
char line[256];
|
||||
int portno;
|
||||
char macaddr[24];
|
||||
char islocal[24];
|
||||
char ageing[24];
|
||||
char cmnd[256];
|
||||
|
||||
char *spl, ports[6][10];
|
||||
int i = 1;
|
||||
|
||||
spl = strtok (ifname, " ");
|
||||
while (spl != NULL)
|
||||
{
|
||||
strcpy(ports[i], spl);
|
||||
spl = strtok (NULL, " ");
|
||||
i++;
|
||||
}
|
||||
|
||||
fprintf(stdout, "\nETHERNET PORTS of '%s' interface\n", interface);
|
||||
fprintf(stdout, "___________________________________________\n");
|
||||
|
||||
for(i=1; i<=5; i++)
|
||||
{
|
||||
|
||||
char ethno[10];
|
||||
char *lanport;
|
||||
strncpy(ethno, ports[i]+3, strlen(ports[i]));
|
||||
|
||||
if(!strstr(ports[i], "eth") || strchr(ports[i], '.'))
|
||||
continue;
|
||||
|
||||
get_portname(ports[i], &lanport);
|
||||
|
||||
fprintf(stdout, "|%s|", lanport);
|
||||
|
||||
if(!bridge) {
|
||||
find_clients(ipaddr, netmask, true);
|
||||
goto stats;
|
||||
}
|
||||
|
||||
sprintf(cmnd, "brctl showmacs br-%s | grep -v ageing | grep -v yes", interface);
|
||||
if (!(in = popen(cmnd, "r")))
|
||||
exit(1);
|
||||
|
||||
while(fgets(line, sizeof(line), in) != NULL)
|
||||
{
|
||||
remove_newline(&line);
|
||||
|
||||
if (sscanf(line, "%d %s %s %s", &portno, macaddr, islocal, ageing) != 4)
|
||||
exit(1);
|
||||
|
||||
if (i == portno) {
|
||||
fprintf(stdout, "\t------\n");
|
||||
fprintf(stdout, "\tClient\n");
|
||||
fprintf(stdout, "\t------\n");
|
||||
fprintf(stdout, "\t\tHostname: ");
|
||||
get_clientinfo(macaddr, "hostname");
|
||||
fprintf(stdout, "\t\tIP Address: ");
|
||||
get_clientinfo(macaddr, "ipaddr");
|
||||
fprintf(stdout, "\t\tMAC Address: %s\n", macaddr);
|
||||
//fprintf(stdout, "\t\tConnected: ");
|
||||
//get_clientinfo(macaddr, "connected");
|
||||
}
|
||||
}
|
||||
|
||||
pclose(in);
|
||||
|
||||
stats:
|
||||
|
||||
fprintf(stdout, "\t----------\n");
|
||||
fprintf(stdout, "\tStatistics\n");
|
||||
fprintf(stdout, "\t----------\n");
|
||||
get_statistics(ports[i], "rx_bytes");
|
||||
get_statistics(ports[i], "rx_packets");
|
||||
get_statistics(ports[i], "rx_errors");
|
||||
get_statistics(ports[i], "tx_bytes");
|
||||
get_statistics(ports[i], "tx_packets");
|
||||
get_statistics(ports[i], "tx_errors");
|
||||
fprintf(stdout, "_____________________________________________\n");
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void
|
||||
arpscan(char *netname, char *ipaddr, char *netmask, char *device, long timeout)
|
||||
{
|
||||
struct in_addr ip, nmask, fmask, rmask, host;
|
||||
uint32_t last, addr;
|
||||
char str[INET_ADDRSTRLEN];
|
||||
|
||||
inet_pton(AF_INET, ipaddr, &(ip.s_addr));
|
||||
inet_pton(AF_INET, netmask, &(nmask.s_addr));
|
||||
inet_pton(AF_INET, "255.255.255.255", &(fmask.s_addr));
|
||||
|
||||
rmask.s_addr = (nmask.s_addr ^ fmask.s_addr);
|
||||
last = ntohl(ip.s_addr | rmask.s_addr);
|
||||
|
||||
fprintf(stdout, "Scanning network '%s'\n", netname);
|
||||
for(addr = ntohl(ip.s_addr); addr <= last; addr++) {
|
||||
host.s_addr = htonl(addr);
|
||||
inet_ntop(AF_INET, &(host.s_addr), str, INET_ADDRSTRLEN);
|
||||
if(arping(str, device, timeout))
|
||||
fprintf(stdout, "Host found: %s\n", str);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
handle_network(char *interface, int qaddr, int qmask, int qclnt, int qport, int qscan, long timeout)
|
||||
{
|
||||
struct uci_element *e;
|
||||
uci_network = init_package("network");
|
||||
const char *ipaddr = NULL;
|
||||
const char *netmask = NULL;
|
||||
const char *ifname = NULL;
|
||||
const char *type = NULL;
|
||||
const char *islan = NULL;
|
||||
char device[32];
|
||||
bool bridge = false;
|
||||
|
||||
uci_foreach_element(&uci_network->sections, e) {
|
||||
struct uci_section *s = uci_to_section(e);
|
||||
|
||||
if (!strcmp(s->type, "interface") && !strcmp(s->e.name, interface)) {
|
||||
ipaddr = uci_lookup_option_string(uci_ctx, s, "ipaddr");
|
||||
netmask = uci_lookup_option_string(uci_ctx, s, "netmask");
|
||||
ifname = uci_lookup_option_string(uci_ctx, s, "ifname");
|
||||
type = uci_lookup_option_string(uci_ctx, s, "type");
|
||||
islan = uci_lookup_option_string(uci_ctx, s, "is_lan");
|
||||
|
||||
if(!islan || strcmp(islan, "1")) {
|
||||
fprintf(stdout, "%s is not a LAN interface\n", interface);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (type && !strcmp(type, "bridge")) {
|
||||
bridge = true;
|
||||
sprintf(device, "br-%s", s->e.name);
|
||||
}
|
||||
else {
|
||||
strcpy(device, ifname);
|
||||
}
|
||||
|
||||
if (qaddr == 1)
|
||||
fprintf(stdout, "%s\n", ipaddr);
|
||||
if (qmask == 1)
|
||||
fprintf(stdout, "%s\n", netmask);
|
||||
if (qclnt == 1)
|
||||
find_clients(ipaddr, netmask, false);
|
||||
if (qport == 1)
|
||||
find_ports(interface, ifname, ipaddr, netmask, bridge);
|
||||
if (qscan == 1)
|
||||
arpscan(s->e.name, ipaddr, netmask, device, timeout);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
handle_ip(char *host, int qnet, int qlocal, int qdev, int qstat)
|
||||
{
|
||||
struct uci_element *e;
|
||||
unsigned int local = 0;
|
||||
unsigned char *dev;
|
||||
int ip[4];
|
||||
|
||||
if (sscanf(host, "%d.%d.%d.%d", &ip[0], &ip[1], &ip[2], &ip[3]) != 4) {
|
||||
fprintf(stderr, "Wrong IP address format\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
uci_network = init_package("network");
|
||||
|
||||
uci_foreach_element(&uci_network->sections, e) {
|
||||
struct uci_section *s = uci_to_section(e);
|
||||
|
||||
if (!strcmp(s->type, "interface")) {
|
||||
match_host_to_network(s, s->e.name, host, &local, &dev);
|
||||
if (local == 1) {
|
||||
if (qnet == 1)
|
||||
fprintf(stdout, "%s\n", s->e.name);
|
||||
if (qlocal == 1)
|
||||
fprintf(stdout, "1\n");
|
||||
if (qdev == 1)
|
||||
fprintf(stdout, "%s\n", dev);
|
||||
if (qstat == 1)
|
||||
connection_status(host);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (qlocal == 1)
|
||||
fprintf(stdout, "0\n");
|
||||
}
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
fprintf(stderr, "Usage: netcheck -[i|h] <interface|hostaddr> <option>\n");
|
||||
fprintf(stderr, "\tnetcheck -i <interface> <option>\n");
|
||||
fprintf(stderr, "\t\t-a\t\treturn ip address of the network interface\n");
|
||||
fprintf(stderr, "\t\t-c\t\treturn DHCP leases of the network interface\n");
|
||||
fprintf(stderr, "\t\t-m\t\treturn netmask of the network interface\n");
|
||||
fprintf(stderr, "\t\t-p\t\treturn ports information of the network interface\n");
|
||||
fprintf(stderr, "\t\t-q <timeout>\tarpscan the network with given timeout value in miliseconds\n");
|
||||
fprintf(stderr, "\tnetcheck -h <hostaddr> <option>\n");
|
||||
fprintf(stderr, "\t\t-d\t\treturn the device the host connects to\n");
|
||||
fprintf(stderr, "\t\t-l\t\treturn 1 if the host address is local otherwise return 0\n");
|
||||
fprintf(stderr, "\t\t-n\t\treturn the network interface the host belongs to\n");
|
||||
fprintf(stderr, "\t\t-s\t\treturn 1 if the host is reachable\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
int opt;
|
||||
int qinf = 0;
|
||||
int qhost = 0;
|
||||
int qaddr = 0;
|
||||
int qmask = 0;
|
||||
int qclnt = 0;
|
||||
int qport = 0;
|
||||
int qscan = 0;
|
||||
int qnet = 0;
|
||||
int qlocal = 0;
|
||||
int qdev = 0;
|
||||
int qstat = 0;
|
||||
long timeout = 100;
|
||||
const char *interface = NULL;
|
||||
const char *host = NULL;
|
||||
|
||||
if (argc < 2)
|
||||
usage();
|
||||
|
||||
while ((opt = getopt(argc, argv, "i:h:q:amcpnlds")) != -1) {
|
||||
|
||||
switch (opt) {
|
||||
case 'i':
|
||||
qinf = 1;
|
||||
interface = optarg;
|
||||
break;
|
||||
case 'h':
|
||||
qhost = 1;
|
||||
host = optarg;
|
||||
break;
|
||||
case 'a':
|
||||
qaddr = 1;
|
||||
break;
|
||||
case 'm':
|
||||
qmask = 1;
|
||||
break;
|
||||
case 'c':
|
||||
qclnt = 1;
|
||||
break;
|
||||
case 'p':
|
||||
qport = 1;
|
||||
break;
|
||||
case 'q':
|
||||
qscan = 1;
|
||||
timeout = atoi(optarg);
|
||||
break;
|
||||
case 'n':
|
||||
qnet = 1;
|
||||
break;
|
||||
case 'l':
|
||||
qlocal = 1;
|
||||
break;
|
||||
case 'd':
|
||||
qdev = 1;
|
||||
break;
|
||||
case 's':
|
||||
qstat = 1;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (qinf == 1 && qhost == 1)
|
||||
usage();
|
||||
else if (qinf == 1 && (qaddr + qmask + qclnt + qport + qscan) == 1)
|
||||
handle_network(interface, qaddr, qmask, qclnt, qport, qscan, timeout);
|
||||
else if (qhost == 1 && (qnet + qlocal + qdev + qstat) == 1)
|
||||
handle_ip(host, qnet, qlocal, qdev, qstat);
|
||||
else
|
||||
usage();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ PKG_NAME:=peripheral_manager
|
||||
PKG_VERSION:=1.0.0
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=db710fed768e20fba40212e11fa4191593e168fc
|
||||
PKG_SOURCE_VERSION:=71c89213516c735b6c12d0e8c17a5bd75333421c
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se/peripheral_manager
|
||||
|
||||
@@ -36,7 +36,7 @@ define Package/peripheral_manager
|
||||
CATEGORY:=Utilities
|
||||
TITLE:=Application deamon for handling of peripheral
|
||||
URL:=
|
||||
DEPENDS:=+libuci +libubus +libblobmsg-json +PACKAGE_bcmkernel:bcmkernel
|
||||
DEPENDS:=+libuci +libubus +libblobmsg-json bcmkernel
|
||||
endef
|
||||
|
||||
define Package/peripheral_manager/description
|
||||
@@ -54,7 +54,7 @@ define Package/peripheral_manager/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/peripheral_manager $(1)/sbin/
|
||||
# $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gpio_test $(1)/sbin/
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gpio_test $(1)/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,peripheral_manager))
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
DEBUG=0
|
||||
|
||||
START=15
|
||||
USE_PROCD=1
|
||||
|
||||
@@ -8,16 +10,18 @@ USE_PROCD=1
|
||||
|
||||
check_for_config(){
|
||||
if [ -s "/etc/config/ports" ]
|
||||
then
|
||||
then
|
||||
debug_print "file exists and has content"
|
||||
if uci -q get ports.@ethport[0] >/dev/null #are there any valid content then continue
|
||||
then
|
||||
then
|
||||
return 0
|
||||
else
|
||||
rm -f /etc/config/ports
|
||||
fi
|
||||
fi
|
||||
debug_print "ports config file doesn't exsist or is empty"
|
||||
touch /etc/config/ports
|
||||
local fiberorder="$(db get hw.board.fiberPortOrder)"
|
||||
local portnames="$(db get hw.board.ethernetPortNames)"
|
||||
local portorder="$(db get hw.board.ethernetPortOrder)"
|
||||
for port in $portorder
|
||||
do
|
||||
@@ -27,28 +31,42 @@ check_for_config(){
|
||||
uci set ports.@ethport[-1].ifname=$port
|
||||
uci set ports.@ethport[-1].speed='auto'
|
||||
if [ "$(interfacename $port)" = "WAN" ]
|
||||
then
|
||||
then
|
||||
uci set ports.@ethport[-1].pause=1
|
||||
else
|
||||
uci set ports.@ethport[-1].pause=0
|
||||
fi
|
||||
done
|
||||
for fiber in $fiberorder; do
|
||||
uci add ports sfpport
|
||||
uci rename ports.@sfpport[-1]="$(fibername $fiber)"
|
||||
uci set ports.@sfpport[-1].name="$(fibername $fiber)"
|
||||
uci set ports.@sfpport[-1].ifname=$fiber
|
||||
uci set ports.@sfpport[-1].speed='auto'
|
||||
uci set ports.@sfpport[-1].pause=1
|
||||
done
|
||||
uci commit ports
|
||||
[ $DEBUG ] && cat /etc/config/ports
|
||||
}
|
||||
|
||||
|
||||
debug_print(){
|
||||
if [ $DEBUG = "1" ]
|
||||
then
|
||||
echo -e $1 >/dev/console
|
||||
fi
|
||||
}
|
||||
|
||||
get_port_no() {
|
||||
local ports="0 1 2 3 4 5 6 7"
|
||||
local port="$1"
|
||||
local ifname
|
||||
|
||||
for p in $ports; do
|
||||
ifname="$(ethswctl getifname $p | awk '{print$NF}')"
|
||||
if [ "$ifname" == "$port" ]; then
|
||||
echo "$p"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
get_current_status() {
|
||||
local port="$1"
|
||||
local flag="$2"
|
||||
local media="$(ethctl $port media-type $flag 2>&1)"
|
||||
local media="$(ethctl $port media-type 2>&1)"
|
||||
#echo Media: $media >/dev/console
|
||||
if echo $media | grep "Auto-negotiation enabled" >/dev/null; then
|
||||
echo "auto"
|
||||
elif echo $media | grep "100 mbps, full-duplex" >/dev/null; then
|
||||
@@ -62,45 +80,37 @@ get_current_status() {
|
||||
fi
|
||||
}
|
||||
|
||||
sfp_flag(){
|
||||
local port=$1
|
||||
local sfptype=$2
|
||||
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=$(sfp_flag $port "copper")
|
||||
local curstatus=$(get_current_status $port $flag)
|
||||
local curstatus=$(get_current_status $port)
|
||||
local portno
|
||||
|
||||
ifconfig $port >/dev/null 2>&1 || return
|
||||
|
||||
case "$status" in
|
||||
disabled)
|
||||
ethctl $port phy-power down
|
||||
;;
|
||||
;;
|
||||
*)
|
||||
if [ "$status" != "$curstatus" ]; then
|
||||
case "$status" in
|
||||
1000*)
|
||||
local unit=$(echo $(get_port_number $port) | cut -d ' ' -f 1)
|
||||
local port=$(echo $(get_port_number $port) | cut -d ' ' -f 2)
|
||||
portno=$(get_port_no $port)
|
||||
case "$status" in
|
||||
1000FD) ethswctl -c phymode -n $unit -p $port -y 1000 -z 1 ;;
|
||||
1000HD) ethswctl -c phymode -n $unit -p $port -y 1000 -z 0 ;;
|
||||
1000FD) ethswctl -c phymode -p $portno -y 1000 -z 1 ;;
|
||||
1000HD) ethswctl -c phymode -p $portno -y 1000 -z 0 ;;
|
||||
esac
|
||||
;;
|
||||
10*AUTO)
|
||||
ethctl $port media-type $flag advertise $status
|
||||
ethctl $port media-type advertise $status
|
||||
;;
|
||||
10*)
|
||||
ethctl $port media-type $flag $status
|
||||
ethctl $port media-type $status
|
||||
;;
|
||||
*)
|
||||
ethctl $port media-type $flag advertise 1000FDAUTO
|
||||
ethctl $port media-type $flag auto
|
||||
ethctl $port media-type advertise 1000FDAUTO
|
||||
ethctl $port media-type auto
|
||||
;;
|
||||
esac
|
||||
else
|
||||
@@ -113,20 +123,18 @@ set_port_status() {
|
||||
configure_ethports(){
|
||||
local port ifname pause speed
|
||||
name=$1
|
||||
config_get speed $name speed
|
||||
config_get speed $name speed
|
||||
config_get ifname $name ifname
|
||||
config_get pause $name pause
|
||||
set_port_status $ifname $speed
|
||||
set_port_pause $ifname $pause
|
||||
}
|
||||
|
||||
#arg1: ethX
|
||||
#arg2: 0 or 1
|
||||
set_port_pause() {
|
||||
local pause="$2"
|
||||
unit=$(echo $(get_port_number $1) | cut -d ' ' -f 1)
|
||||
port=$(echo $(get_port_number $1) | cut -d ' ' -f 2)
|
||||
ethswctl -c pause -n $unit -p $port -v $pause
|
||||
portno=$(get_port_no $1)
|
||||
ethswctl -c pause -p $portno -v $pause
|
||||
}
|
||||
|
||||
start_service() {
|
||||
@@ -136,6 +144,6 @@ start_service() {
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger ports
|
||||
procd_add_reload_trigger ports
|
||||
}
|
||||
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=97
|
||||
USE_PROCD=1
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/network/config.sh
|
||||
|
||||
get_current_status() {
|
||||
local port="$1"
|
||||
local flag="$2"
|
||||
local media="$(ethctl $port media-type $flag 2>&1)"
|
||||
if echo $media | grep "Auto-negotiation enabled" >/dev/null; then
|
||||
echo "auto"
|
||||
elif echo $media | grep "100 mbps, full-duplex" >/dev/null; then
|
||||
echo "100FD"
|
||||
elif echo $media | grep "100 mbps, half-duplex" >/dev/null; then
|
||||
echo "100HD"
|
||||
elif echo $media | grep "10 mbps, full-duplex" >/dev/null; then
|
||||
echo "10FD"
|
||||
elif echo $media | grep "10 mbps, half-duplex" >/dev/null; then
|
||||
echo "10HD"
|
||||
fi
|
||||
}
|
||||
|
||||
sfp_flag(){
|
||||
local port=$1
|
||||
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=$(sfp_flag $port "fiber")
|
||||
local curstatus=$(get_current_status $port $flag)
|
||||
|
||||
case "$status" in
|
||||
disabled)
|
||||
ethctl $port phy-power down
|
||||
;;
|
||||
*)
|
||||
if [ "$status" != "$curstatus" ]; then
|
||||
case "$status" in
|
||||
100*FD|auto)
|
||||
ethctl $port media-type $status $flag
|
||||
ethctl $port phy-power up
|
||||
;;
|
||||
*)
|
||||
ethctl $port media-type advertise 1000FDAUTO $flag
|
||||
ethctl $port media-type auto $flag
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
ethctl $port phy-power up
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
configure_sfpports(){
|
||||
local port ifname pause speed
|
||||
name=$1
|
||||
config_get speed $name speed
|
||||
config_get ifname $name ifname
|
||||
config_get pause $name pause
|
||||
set_fiber_status $ifname $speed
|
||||
set_port_pause $ifname $pause
|
||||
}
|
||||
|
||||
#arg1: ethX
|
||||
#arg2: 0 or 1
|
||||
set_port_pause() {
|
||||
local pause="$2"
|
||||
unit=$(echo $(get_port_number $1) | cut -d ' ' -f 1)
|
||||
port=$(echo $(get_port_number $1) | cut -d ' ' -f 2)
|
||||
ethswctl -c pause -n $unit -p $port -v $pause
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load ports
|
||||
config_foreach configure_sfpports sfpport
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger ports
|
||||
}
|
||||
|
||||
53
qrencode/Makefile
Normal file
53
qrencode/Makefile
Normal file
@@ -0,0 +1,53 @@
|
||||
#
|
||||
# Copyright (C) 2009 ePoint Systems Ltd.
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=qrencode
|
||||
PKG_VERSION:=3.0.3
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_VERSION:=2f575b43703c801f4f7bfac65e8845ce967c3d9e
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/qrencode
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
TARGET_LDFLAGS+= \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib \
|
||||
-Wl,-rpath-link=$(STAGING_DIR)/lib -lpng
|
||||
|
||||
TARGET_CFLAGS += $(FPIC)
|
||||
|
||||
define Package/qrencode
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+libpng
|
||||
TITLE:=QRcode encoder library
|
||||
URL:=http://megaui.net/fukuchi/works/qrencode/index.en.html
|
||||
endef
|
||||
|
||||
define Package/qrencode/description
|
||||
Libqrencode is a C library for encodingdata in a QR Code symbol, a
|
||||
kind of 2D symbology that can be scanned by handy terminals such as
|
||||
a mobile phone with CCD. The capacity of QR Code is up to 7000
|
||||
digits or 4000 characters, and is highly robust.
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR) \
|
||||
$(TARGET_CONFIGURE_OPTS) LINUX_DIR=$(LINUX_DIR) LDFLAGS="$(TARGET_LDFLAGS)" CFLAGS="$(TARGET_CFLAGS) -I$(LINUX_DIR)/include -I$(STAGING_DIR)/usr/include"
|
||||
endef
|
||||
|
||||
define Package/qrencode/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/qrencode $(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,qrencode))
|
||||
@@ -6,9 +6,9 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=questd
|
||||
PKG_VERSION:=3.1.28
|
||||
PKG_VERSION:=3.1.11
|
||||
|
||||
PKG_SOURCE_VERSION:=ca6338b417026ebe5931f946aa4f40ca7771c7c5
|
||||
PKG_SOURCE_VERSION:=b8838ae06d17e9eb6e54d65311b7007d5431f824
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=http://public.inteno.se:/questd
|
||||
|
||||
@@ -19,20 +19,20 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_mips),y)
|
||||
QUESTD_CFLAGS:=-DIOPSYS_BROADCOM
|
||||
QUESTD_CLFAGS:=-DIOPSYS_BROADCOM
|
||||
KERNEL_DIR:=$(BUILD_DIR)/bcmkernel/bcm963xx
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
|
||||
QUESTD_CFLAGS:=-DIOPSYS_BROADCOM
|
||||
QUESTD_CLFAGS:=-DIOPSYS_BROADCOM
|
||||
else ifeq ($(CONFIG_TARGET_iopsys_linksys),y)
|
||||
QUESTD_CFLAGS:=-DIOPSYS_MARVELL
|
||||
QUESTD_CLFAGS:=-DIOPSYS_MARVELL
|
||||
else ifeq ($(CONFIG_TARGET_lantiq_xrx500),y)
|
||||
QUESTD_CFLAGS:=-DIOPSYS_LANTIQ
|
||||
QUESTD_CLFAGS:=-DIOPSYS_LANTIQ
|
||||
else
|
||||
$(info (UNEXPECTED CONFIG TARGET))
|
||||
endif
|
||||
|
||||
export KERNEL_DIR
|
||||
export QUESTD_CFLAGS
|
||||
export QUESTD_CLFAGS
|
||||
|
||||
define Package/questd
|
||||
CATEGORY:=Utilities
|
||||
@@ -49,12 +49,8 @@ define Package/questd/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/questd $(1)/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/uscriptd $(1)/sbin/
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wificontrol $(1)/sbin/
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/netcheck $(1)/usr/bin/
|
||||
$(INSTALL_DIR) $(1)/usr/libexec/rpcd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/router.sh $(1)/usr/libexec/rpcd/router
|
||||
#$(INSTALL_BIN) $(PKG_BUILD_DIR)/wps.sh $(1)/usr/libexec/rpcd/wps
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,questd))
|
||||
|
||||
@@ -12,11 +12,15 @@ start_service() {
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
|
||||
pidof questd-monitor > /dev/null 2>&1 || /sbin/questd-monitor &
|
||||
procd_open_instance
|
||||
procd_set_param command "/sbin/uscriptd"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop() {
|
||||
service_stop /sbin/questd
|
||||
service_stop /sbin/uscriptd
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
@@ -25,6 +29,6 @@ service_triggers()
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
ubus -t 5 call router.network reload
|
||||
ubus call router reload
|
||||
}
|
||||
|
||||
|
||||
@@ -1,159 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# 1. sleep for $SLEEP_LONG seconds
|
||||
# 2. run the check_* functions
|
||||
# 3. sleep for $SLEEP_SHORT seconds
|
||||
# 4. go to step 2. $SAMPLES-1 times (step 2. will run $SAMPLES times)
|
||||
# 5. go to step 1.
|
||||
SAMPLES=4
|
||||
SLEEP_SHORT=2
|
||||
SLEEP_LONG=10
|
||||
|
||||
# worst-case scenario:
|
||||
# quest will be restarted in:
|
||||
# SLEEP_LONG + (SAMPLES-1)*SLEEP_SHORT + UBUS_TIMEOUT + epsilon =
|
||||
# = 21 seconds
|
||||
|
||||
# number of process
|
||||
NPROC_LIMIT=2 # the value that is considered to be wrong (and above)
|
||||
NPROC_COUNT=4 # number of time that the NPROC_LIMIT has to be hit to trigger a process restart
|
||||
NPROC_NFAIL=0 # current consecutive Number of FAILures. process restarts when NPROC_NFAIL == NPROC_COUNT
|
||||
|
||||
# memmory limit
|
||||
MEM_LIMIT=50000
|
||||
MEM_COUNT=4
|
||||
MEM_NFAIL=0
|
||||
|
||||
# procentage of CPU usage
|
||||
PCPU_LIMIT=38
|
||||
PCPU_COUNT=4
|
||||
PCPU_NFAIL=0
|
||||
|
||||
UBUS_TIMEOUT=5
|
||||
|
||||
|
||||
restart_questd()
|
||||
{
|
||||
logger -s -t $0[$$] "Restarting questd. $NPROC_NFAIL $MEM_NFAIL $PCPU_NFAIL"
|
||||
|
||||
/etc/init.d/quest stop
|
||||
killall -q -KILL questd
|
||||
/etc/init.d/quest start
|
||||
|
||||
NPROC_NFAIL=0
|
||||
MEM_NFAIL=0
|
||||
PCPU_NFAIL=0
|
||||
}
|
||||
|
||||
|
||||
check_nproc()
|
||||
{
|
||||
local nproc="$@"
|
||||
|
||||
if [ "$nproc" -ge "$NPROC_LIMIT" ]; then
|
||||
NPROC_NFAIL=$((NPROC_NFAIL + 1))
|
||||
else
|
||||
NPROC_NFAIL=0
|
||||
fi
|
||||
|
||||
[ "$NPROC_NFAIL" -ge "$NPROC_COUNT" ] && return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
check_mem()
|
||||
{
|
||||
local mem="$@"
|
||||
local ok=true
|
||||
|
||||
for m in $mem; do
|
||||
if [ "$m" -ge "$MEM_LIMIT" ]; then
|
||||
ok=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
[ "$ok" = "true" ] && MEM_NFAIL=0
|
||||
[ "$ok" = "false" ] && MEM_NFAIL=$((MEM_NFAIL + 1))
|
||||
|
||||
[ "$MEM_NFAIL" -ge "$MEM_COUNT" ] && return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
check_pcpu()
|
||||
{
|
||||
local pcpu="$@"
|
||||
local ok=true
|
||||
|
||||
for p in $pcpu; do
|
||||
p=${p%%%*}
|
||||
if [ "$p" -ge "$PCPU_LIMIT" ]; then
|
||||
ok=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
[ "$ok" = "true" ] && PCPU_NFAIL=0
|
||||
[ "$ok" = "false" ] && PCPU_NFAIL=$((PCPU_NFAIL + 1))
|
||||
|
||||
[ "$PCPU_NFAIL" -ge "$PCPU_COUNT" ] && return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
check_ubuscall()
|
||||
{
|
||||
local rv
|
||||
|
||||
ubus -t $UBUS_TIMEOUT call router.system info >/dev/null 2>&1
|
||||
rv=$?
|
||||
|
||||
[ "$rv" = "0" ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
main()
|
||||
{
|
||||
local topline nproc mem pcpu
|
||||
local restart_nproc restart_mem restart_pcpu
|
||||
local sample=1
|
||||
|
||||
while true ; do
|
||||
|
||||
# collect info
|
||||
topline=$(top -bn1 | grep "/sbin/[q]uestd" | grep -v monitor)
|
||||
|
||||
nproc=$(echo "$topline" | wc -l)
|
||||
check_nproc $nproc
|
||||
restart_nproc=$?
|
||||
|
||||
mem=$(echo -en "$topline" | awk '{print $5}')
|
||||
check_mem $mem
|
||||
restart_mem=$?
|
||||
|
||||
pcpu=$(echo -en "$topline" | awk '{print $7}')
|
||||
check_pcpu $pcpu
|
||||
restart_pcpu=$?
|
||||
|
||||
# do the restart
|
||||
if [ "$restart_nproc" = "1" -o \
|
||||
"$restart_mem" = "1" -o \
|
||||
"$restart_pcpu" = "1" ]
|
||||
then
|
||||
check_ubuscall || restart_questd
|
||||
fi
|
||||
|
||||
# sleep
|
||||
if [ "$sample" -lt "$SAMPLES" ]; then
|
||||
sample=$((sample + 1))
|
||||
sleep $SLEEP_SHORT
|
||||
else
|
||||
sample=1
|
||||
sleep $SLEEP_LONG
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
main $@
|
||||
@@ -124,20 +124,10 @@ smb_add_share() {
|
||||
config_get dir_mask $1 dir_mask
|
||||
config_get browseable $1 browseable
|
||||
config_get dirpath $1 dirpath
|
||||
path="$path/$dirpath"
|
||||
|
||||
[ -z "$name" -o -z "$path" ] && return
|
||||
|
||||
path="$path/$dirpath"
|
||||
path=$(readlink -f $path)
|
||||
|
||||
# restrict the shared paths to always be under /mnt/ tree
|
||||
[ "${path:0:4}" == "/mnt" ] || path="/mnt/"$path
|
||||
|
||||
# if the real path is still not under /mnt/, overwrite it completely
|
||||
# (very unlikely case, but possible). increases security
|
||||
path=$(readlink -f $path)
|
||||
[ "${path:0:4}" == "/mnt" ] || path="/mnt/"
|
||||
|
||||
echo -e "\n[$name]\n\tpath = $path" >> /var/etc/smb.conf
|
||||
[ -n "$users" ] && echo -e "\tvalid users = $users" >> /var/etc/smb.conf
|
||||
[ -n "$read_only" ] && echo -e "\tread only = $read_only" >> /var/etc/smb.conf
|
||||
@@ -174,19 +164,5 @@ reload_service() {
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_open_trigger
|
||||
|
||||
add_interface_trigger() {
|
||||
local interface net
|
||||
config_get interface "$1" interface
|
||||
for net in $interface; do
|
||||
procd_add_interface_trigger "interface.*" "${net}" /etc/init.d/samba reload
|
||||
done
|
||||
}
|
||||
|
||||
config_load samba
|
||||
config_foreach add_interface_trigger "samba"
|
||||
procd_add_config_trigger "config.change" "samba" /etc/init.d/samba reload
|
||||
procd_add_config_trigger "config.change" "network" /etc/init.d/samba reload
|
||||
procd_close_trigger
|
||||
procd_add_reload_trigger samba network
|
||||
}
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
guest account = nobody
|
||||
invalid users = root
|
||||
smb passwd file = /etc/samba/smbpasswd
|
||||
interfaces = |INTERFACES|
|
||||
bind interfaces only = yes
|
||||
wide links = no
|
||||
interfaces = |INTERFACES|
|
||||
bind interfaces only = yes
|
||||
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2006-2011 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=syslog-ng
|
||||
PKG_VERSION:=3.0.5
|
||||
PKG_RELEASE:=5
|
||||
|
||||
PKG_SOURCE_URL:=http://www.balabit.com/downloads/files/syslog-ng/open-source-edition/$(PKG_VERSION)/source/
|
||||
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
|
||||
PKG_MD5SUM:=28f0d9ff2243b330e8cd6311ef9b2f12
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_IPV6 \
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/nls.mk
|
||||
|
||||
define Package/syslog-ng3
|
||||
SECTION:=admin
|
||||
CATEGORY:=Administration
|
||||
DEPENDS:=+libpcre +glib2 +libeventlog +libopenssl +libwrap +libpthread +librt +zlib +libdbi
|
||||
TITLE:=A powerful syslog daemon
|
||||
URL:=http://www.balabit.com/network-security/syslog-ng/opensource-logging-system/
|
||||
endef
|
||||
|
||||
define Package/syslog-ng3/description
|
||||
syslog-ng reads and logs messages to the system console, log
|
||||
files, other machines and/or users as specified by its
|
||||
configuration file.
|
||||
endef
|
||||
|
||||
define Package/syslog-ng3/conffiles
|
||||
/etc/syslog-ng.conf
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
$(SED) 's,-I/usr/include,,' $(PKG_BUILD_DIR)/configure
|
||||
$(Build/Configure/Default)
|
||||
endef
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
$(call autoconf_bool,CONFIG_IPV6,ipv6) \
|
||||
--disable-dependency-tracking \
|
||||
--enable-tcp-wrapper \
|
||||
--disable-glibtest \
|
||||
--disable-spoof-source \
|
||||
--disable-sql \
|
||||
--enable-prce \
|
||||
--disable-linux-caps \
|
||||
|
||||
TARGET_CPPFLAGS += \
|
||||
-I$(STAGING_DIR)/usr/include/eventlog
|
||||
|
||||
CONFIGURE_VARS += \
|
||||
LIBDBI_CFLAGS="-I$(STAGING_DIR)/usr/include"
|
||||
|
||||
define Package/syslog-ng3/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/syslog-ng $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/syslog-ng.init $(1)/etc/init.d/syslog-ng
|
||||
$(INSTALL_DIR) $(1)/etc
|
||||
$(INSTALL_DATA) ./files/syslog-ng.conf $(1)/etc
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,syslog-ng3))
|
||||
@@ -1,37 +0,0 @@
|
||||
@version:3.0
|
||||
|
||||
options {
|
||||
chain_hostnames(no);
|
||||
create_dirs(yes);
|
||||
flush_lines(0);
|
||||
keep_hostname(yes);
|
||||
log_fifo_size(256);
|
||||
log_msg_size(1024);
|
||||
stats_freq(0);
|
||||
flush_lines(0);
|
||||
use_fqdn(no);
|
||||
};
|
||||
|
||||
source src {
|
||||
internal();
|
||||
unix-stream("/dev/log");
|
||||
};
|
||||
|
||||
source net {
|
||||
udp(ip(0.0.0.0) port(514));
|
||||
};
|
||||
|
||||
source kernel {
|
||||
file("/proc/kmsg" program_override("kernel"));
|
||||
};
|
||||
|
||||
destination messages {
|
||||
file("/var/log/messages");
|
||||
};
|
||||
|
||||
log {
|
||||
source(src);
|
||||
source(net);
|
||||
source(kernel);
|
||||
destination(messages);
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2006-2011 OpenWrt.org
|
||||
|
||||
START=50
|
||||
|
||||
SERVICE_USE_PID=1
|
||||
|
||||
start() {
|
||||
[ -f /etc/syslog-ng.conf ] || return 1
|
||||
service_start /usr/sbin/syslog-ng
|
||||
}
|
||||
|
||||
stop() {
|
||||
service_stop /usr/sbin/syslog-ng
|
||||
}
|
||||
|
||||
reload() {
|
||||
service_reload /usr/sbin/syslog-ng
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -7357,6 +7357,9 @@ dynamic_threads () {
|
||||
esac
|
||||
}
|
||||
|
||||
+GLIB_LIBS="-Wl,-rpath-link=$STAGING_DIR/usr/lib/libiconv-full/lib $GLIB_LIBS"
|
||||
+LIBS="-Wl,-rpath-link=$STAGING_DIR/usr/lib/libiconv-full/lib $LIBS"
|
||||
+
|
||||
case "$ostype" in
|
||||
FreeBSD)
|
||||
GLIB_LIBS="$GLIB_LIBS -lintl"
|
||||
@@ -1,96 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2013-2014 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=u-boot
|
||||
PKG_VERSION:=2016.08
|
||||
PKG_RELEASE:=1
|
||||
PKG_SOURCE_URL:=git@private.inteno.se:uboot
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_VERSION:=e925b36e4e29416aac7f2a64ef40d44ef034d4c4
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define uboot/Default
|
||||
TITLE:=
|
||||
CONFIG:=
|
||||
IMAGE:=
|
||||
endef
|
||||
|
||||
define uboot/ex400
|
||||
TITLE:=U-Boot for the ex400
|
||||
endef
|
||||
|
||||
UBOOTS := \
|
||||
ex400
|
||||
|
||||
define Package/uboot/template
|
||||
define Package/uboot-$(1)
|
||||
SECTION:=boot
|
||||
CATEGORY:=Boot Loaders
|
||||
DEPENDS:=@TARGET_iopsys_ramips
|
||||
TITLE:=$(2)
|
||||
URL:=http://www.denx.de/wiki/U-Boot
|
||||
VARIANT:=$(1)
|
||||
endef
|
||||
endef
|
||||
|
||||
define BuildUBootPackage
|
||||
$(eval $(uboot/Default))
|
||||
$(eval $(uboot/$(1)))
|
||||
$(call Package/uboot/template,$(1),$(TITLE))
|
||||
endef
|
||||
|
||||
ifdef BUILD_VARIANT
|
||||
$(eval $(call uboot/$(BUILD_VARIANT)))
|
||||
UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
|
||||
UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
|
||||
endif
|
||||
|
||||
define Build/Configure
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
$(UBOOT_CONFIG)_config
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
CROSS_COMPILE=$(TARGET_CROSS)
|
||||
+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
|
||||
CROSS_COMPILE=$(TARGET_CROSS) env
|
||||
endef
|
||||
|
||||
define Package/uboot/install/default
|
||||
$(INSTALL_DIR) $(BIN_DIR)/$(TARGET)
|
||||
$(CP) \
|
||||
$(PKG_BUILD_DIR)/uboot.img \
|
||||
$(BIN_DIR)/$(TARGET)/
|
||||
$(INSTALL_DIR) $$(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/env/fw_printenv $$(1)/usr/sbin/
|
||||
ln -s /usr/sbin/fw_printenv $$(1)/usr/sbin/fw_setenv
|
||||
endef
|
||||
|
||||
define Package/uboot/install/template
|
||||
define Package/uboot-$(1)/install
|
||||
$(call Package/uboot/install/default,$(2))
|
||||
endef
|
||||
endef
|
||||
|
||||
$(foreach u,$(UBOOTS), \
|
||||
$(eval $(call Package/uboot/install/template,$(u),$(u))) \
|
||||
)
|
||||
|
||||
$(foreach u,$(UBOOTS), \
|
||||
$(eval $(call BuildUBootPackage,$(u))) \
|
||||
$(eval $(call BuildPackage,uboot-$(u))) \
|
||||
)
|
||||
@@ -1,37 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2016 Inteno
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=uci-diff
|
||||
PKG_VERSION:=1.0
|
||||
|
||||
PKG_SOURCE_VERSION:=bb5f9cfbf0f698c948e20ef6c4d3f9554ca99ecf
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=git@private.inteno.se:/uci-diff
|
||||
|
||||
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/uci-diff
|
||||
CATEGORY:=Utilities
|
||||
DEPENDS:=+libc +libuci +libubox +ubus +libjson-c +libblobmsg-json
|
||||
TITLE:=uci-diff
|
||||
endef
|
||||
|
||||
define Package/uci-diff/description
|
||||
uci-diff
|
||||
endef
|
||||
|
||||
define Package/uci-diff/install
|
||||
$(CP) ./files/* $(1)/
|
||||
$(INSTALL_DIR) $(1)/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/uci-diff $(1)/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,uci-diff))
|
||||
@@ -1,43 +0,0 @@
|
||||
{"wireless": {
|
||||
"wifi-device": {
|
||||
"type": "broadcom",
|
||||
"country": "EU/13",
|
||||
"band": "a",
|
||||
"bandwidth": "80",
|
||||
"hwmode": "11ac",
|
||||
"channel": "auto",
|
||||
"scantimer": "0",
|
||||
"wmm": "1",
|
||||
"wmm_noack": "0",
|
||||
"wmm_apsd": "1",
|
||||
"txpower": "100",
|
||||
"rateset": "default",
|
||||
"frag": "2346",
|
||||
"rts": "2347",
|
||||
"dtim_period": "1",
|
||||
"beacon_int": "100",
|
||||
"rxchainps": "0",
|
||||
"rxchainps_qt": "10",
|
||||
"rxchainps_pps": "10",
|
||||
"rifs": "0",
|
||||
"rifs_advert": "0",
|
||||
"maxassoc": "32",
|
||||
"doth": "1",
|
||||
"dfsc": "1",
|
||||
"disabled": "1"
|
||||
},
|
||||
"wifi-iface": {
|
||||
"device": "wl0",
|
||||
"network": "lan",
|
||||
"mode": "ap",
|
||||
"ssid": "Inteno-4BC8",
|
||||
"encryption": "mixed-psk",
|
||||
"cipher": "auto",
|
||||
"key": "1234567890",
|
||||
"gtk_rekey": "3600",
|
||||
"macfilter": "0",
|
||||
"wps_pbc": "1",
|
||||
"wmf_bss_enable": "1",
|
||||
"bss_max": "16"
|
||||
}
|
||||
}}
|
||||
@@ -1,22 +0,0 @@
|
||||
{"wireless": {
|
||||
"wl0": {
|
||||
".name": "wl0",
|
||||
".type": "wifi-device",
|
||||
"channel": 100
|
||||
},
|
||||
"wl1": {
|
||||
".name": "wl1",
|
||||
".type": "wifi-device",
|
||||
"wmm": 0
|
||||
},
|
||||
"wi0-0": {
|
||||
".type": "wifi-iface",
|
||||
"device": "wi0-0",
|
||||
"ssid": "Fredrik"
|
||||
},
|
||||
"wi1-0": {
|
||||
".type": "wifi-iface",
|
||||
"device": "wi1-0",
|
||||
"ssid": "blah"
|
||||
}
|
||||
}}
|
||||
@@ -1,25 +0,0 @@
|
||||
AUS;19x+
|
||||
BEL;09xx+
|
||||
BRA;05xx+
|
||||
CHL;
|
||||
CHN;
|
||||
CZE;9xx+
|
||||
DNK;90xx+
|
||||
ETS;
|
||||
FIN;0(7[0,5]|[1-3,6]0)x+
|
||||
FRA;0[8,9]xx+
|
||||
DEU;0(9xx|137)x+
|
||||
HUN;06-[8,9]x+
|
||||
IND;
|
||||
ITA;8
|
||||
JPN;0990x+
|
||||
NLD;09xx+
|
||||
NZL;0900x+
|
||||
USA;1-900x+
|
||||
ESP;([8,9]0x|118)x+
|
||||
SWE;90510,09(00|39|44)x+,099x+
|
||||
CHE;09xx+
|
||||
NOR;82x+
|
||||
TWN;020[3,4,9]x+
|
||||
GBR;0[8,9]xx+
|
||||
ARE;[2,6]00x+
|
||||
@@ -1,5 +0,0 @@
|
||||
[syslog]
|
||||
|
||||
facility = local0
|
||||
priority = cdr
|
||||
template = "callId:${CDR(clid)}, src:${CDR(src)}, dst:${CDR(dst)}, dstContext:${CDR(dcontext)}, chan:${CDR(channel)}, dstChan:${CDR(dstchannel)},$ app:${CDR(lastapp)}, arg:${CDR(lastdata)}, start:${CDR(start)}, answ:${CDR(answer)}, end:${CDR(end)}, duration:${CDR(duration)}, billsec:${CDR(billsec)}, dispos:${CDR(disposition)}, amaflag:${CDR(amaflags)}, accCode:${CDR(accountcode)}, uniqId:${CDR(uniqueid)}, userfield:${CDR(userfield)}"
|
||||
@@ -141,8 +141,7 @@ config log 'LOG'
|
||||
|
||||
config ringing_status 'RINGING_STATUS'
|
||||
option status '0'
|
||||
option enabled '0'
|
||||
option shouldring '1'
|
||||
option enabled '1'
|
||||
|
||||
config call_filter 'call_filter0'
|
||||
option block_foreign '0'
|
||||
@@ -167,6 +166,3 @@ config 'sip_service_provider' 'sip0'
|
||||
option 'is_fax' '0'
|
||||
option 'transport' 'udp'
|
||||
|
||||
config cdr_log 'CDR_LOG'
|
||||
option cdr_syslog '0'
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ TMPL_QUEUE=$TEMPLATEDIR/queue.TEMPLATE
|
||||
|
||||
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_LOGGER=$TEMPLATEDIR/logger.conf.TEMPLATE
|
||||
TMPL_MANAGER=$TEMPLATEDIR/manager.conf.TEMPLATE
|
||||
@@ -80,8 +79,6 @@ TMPL_BRCM_LINE=$TEMPLATEDIR/brcm_line.TEMPLATE
|
||||
|
||||
TMPL_MEETME=$TEMPLATEDIR/meetme.conf.TEMPLATE
|
||||
|
||||
SPECRATEDIR=$ASTERISKDIR/special_rate_nr.cfg
|
||||
|
||||
run_hook()
|
||||
{
|
||||
h="$1_hook"
|
||||
@@ -143,13 +140,11 @@ assemble_and_copy_config()
|
||||
# Copy the template files which we don't edit.
|
||||
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
|
||||
|
||||
@@ -845,7 +840,6 @@ encrypt_password()
|
||||
if [ -e /usr/bin/voicesec ] ; then
|
||||
echo "Encrypting password for $1"
|
||||
/usr/bin/voicesec -e $secret > /usr/lib/asterisk/voicesec_$1
|
||||
fsync /usr/lib/asterisk/voicesec_$1
|
||||
fi
|
||||
uci_remove voice_client $1 secret
|
||||
uci_commit voice_client
|
||||
@@ -1119,21 +1113,6 @@ configure_cdr()
|
||||
{
|
||||
mkdir -p /var/log/asterisk/cdr-csv
|
||||
touch /var/log/asterisk/cdr-csv/Master.csv
|
||||
|
||||
|
||||
local cdr_syslog
|
||||
config_get cdr_syslog CDR_LOG cdr_syslog
|
||||
|
||||
echo "cdr_syslog: $cdr_syslog"
|
||||
|
||||
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
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
@@ -1168,7 +1147,7 @@ configure_call_filters()
|
||||
break
|
||||
fi
|
||||
done < "/etc/idc_cc.cfg"
|
||||
|
||||
|
||||
echo "Found IDCs: $idc"
|
||||
echo "Found CCs: $cc"
|
||||
|
||||
@@ -1186,43 +1165,6 @@ configure_call_filters()
|
||||
echo "exten => s,n,MacroExit()" >> $WORKDIR/macros.tmp
|
||||
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
|
||||
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
|
||||
fi
|
||||
done < "/etc/asterisk/special_rate_nr.cfg"
|
||||
|
||||
echo "Found special rate numbers: $srn"
|
||||
|
||||
echo "[macro-check-special-rate]" >> $WORKDIR/macros.tmp
|
||||
echo "exten => s,1,NoOp(${srn})" >> $WORKDIR/macros.tmp
|
||||
|
||||
# Create regex patterns
|
||||
# All x characters are replaced with [0-9] to match a single digit
|
||||
srn="($(echo $srn | tr -s "" | tr "," "|" | sed 's/x/[0-9]/g'))"
|
||||
|
||||
echo "exten => s,n,GotoIf($[\"\${ARG1}\":\"(^$srn$)\">0]?special-rate:normal-rate)" >> $WORKDIR/macros.tmp
|
||||
echo "exten => s,n(special-rate),Set(SPECRATE=1)" >> $WORKDIR/macros.tmp
|
||||
echo "exten => s,n,MacroExit()" >> $WORKDIR/macros.tmp
|
||||
echo "exten => s,n(normal-rate),Set(SPECRATE=0)" >> $WORKDIR/macros.tmp
|
||||
echo "" >> $WORKDIR/macros.tmp
|
||||
}
|
||||
|
||||
#
|
||||
@@ -1252,7 +1194,7 @@ configure_call_filter_helper()
|
||||
config_get block_special_rate $1 block_special_rate
|
||||
|
||||
[ "$#" -ge 2 ] || return 0
|
||||
|
||||
|
||||
direction=$2
|
||||
if ! [ "x$direction" != "xincoming" -o "x$direction" != "xoutgoing" ] ; then
|
||||
return
|
||||
@@ -1278,11 +1220,6 @@ configure_call_filter_helper()
|
||||
echo "exten => s,n,GotoIf($[\${FOREIGN}==1]?block)" >> $WORKDIR/macros.tmp
|
||||
fi
|
||||
|
||||
if [ "x$direction" == "xoutgoing" -a "x$block_special_rate" == "x1" ] ; then
|
||||
echo "exten => s,n,Macro(check-special-rate,\${DIAL_EXTEN})" >> $WORKDIR/macros.tmp
|
||||
echo "exten => s,n,GotoIf($[\${SPECRATE}==1]?block)" >> $WORKDIR/macros.tmp
|
||||
fi
|
||||
|
||||
local section cfgtype owner
|
||||
for section in ${CONFIG_SECTIONS}; do
|
||||
config_get cfgtype "$section" TYPE
|
||||
@@ -1292,6 +1229,7 @@ configure_call_filter_helper()
|
||||
local rule_extension rule_enabled
|
||||
config_get rule_extension $section extension
|
||||
config_get rule_enabled $section enabled
|
||||
|
||||
[ -z "$rule_enabled" -o "$rule_enabled" = "0" ] && continue
|
||||
|
||||
# Regular expression for matching calling or called number
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user