Compare commits

..

1 Commits

Author SHA1 Message Date
Magier Marcin
d86c38d013 fix build errors
- use pre-compiled version of natalie dect
- disable 'cups' for samba packages
2016-10-31 17:06:15 +01:00
136 changed files with 1240 additions and 5007 deletions

View File

@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=asterisk18-mod
PKG_VERSION:=1.8.10.1
PKG_SOURCE_VERSION:=ee99af0d91a2197529b13075d802ebc37e644e40
PKG_SOURCE_VERSION:=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

View File

@@ -1,19 +0,0 @@
#!/bin/sh
[ "$ACTION" = ifup ] || exit 0
config_load voice_client
config_get bindintf SIP bindintf
[ "$INTERFACE" == "$bindintf" ] || exit 0
. /lib/functions/network.sh
if [ -n "$bindintf" ]; then
network_get_ipaddr bindaddr "$bindintf"
[ -z "$bindaddr" ] && network_get_ipaddr6 bindaddr "$bindintf"
bindaddr="${bindaddr:-0.0.0.0}"
sed -i "s/bindaddr=.*/bindaddr=$bindaddr/g" /etc/asterisk/sip.conf
[ -e /var/run/asterisk/asterisk.ctl ] && /etc/init.d/asterisk reload
fi

View File

@@ -9,9 +9,25 @@ USE_PROCD=1
NAME=asterisk
PROG=/usr/sbin/asterisk
DEFAULT=/etc/default/asterisk
CONFDIR=/etc/asterisk
init_asterisk() {
# do not start asterisk until the
# router receives a default route
config_load voice_client
local bindintf
config_get bindintf SIP bindintf ""
if [ "$bindintf" == "" ]; then
while ! ip r | grep -q default; do
sleep 1
done
else
network_get_ipaddr ip "$bindintf"
while [ "$ip" == "" ]; do
sleep 1
network_get_ipaddr ip "$bindintf"
done
fi
[ -f $DEFAULT ] && . $DEFAULT
[ -d /var/run/asterisk ] || mkdir -p /var/run/asterisk
[ -d /var/log/asterisk ] || mkdir -p /var/log/asterisk
@@ -39,8 +55,6 @@ start_service() {
}
reload_service() {
asterisk -rx "config reload $CONFDIR/sip.conf"
sleep 1
asterisk -rx "core reload"
asterisk -rx "dialplan reload"
asterisk -rx "brcm reload"

View File

@@ -1,67 +0,0 @@
#
# Copyright (C) 2016 inteno
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ated
PKG_VERSION:=1.2.2
PKG_RELEASE:=1
PKG_SOURCE_VERSION:=f614cba983d827d5185c60a6a5a35530621d44d2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=http://public.inteno.se:/ated
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
# support parallel build
#PKG_BUILD_PARALLEL:=1
#re create configure scripts if not present.
#PKG_FIXUP:=autoreconf
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
# this way we don't need to pick out the resulting files from the build dir.
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/ated
CATEGORY:=Utilities
TITLE:=Daemon for handling wifi calibration
URL:=
DEPENDS:= libc
endef
define Package/ated/description
Daemon for handling wifi calibration
endef
#TARGET_CFLAGS += -I$(LINUX_DIR)/include -I$(LINUX_DIR)/arch/mips/include
MAKE_FLAGS += \
v=2 \
m=3
#TARGET_CPPFLAGS := \
# -I$(STAGING_DIR)/usr/include/bcm963xx/shared/opensource/include/bcm963xx \
# -I$(STAGING_DIR)/usr/include/bcm963xx/bcmdrivers/opensource/include/bcm963xx \
# $(TARGET_CPPFLAGS)
# we donot wwant to have any install.
define Build/Install/Default
endef
define Package/ated/install
$(INSTALL_DIR) $(1)/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ated $(1)/sbin/
endef
$(eval $(call BuildPackage,ated))

View File

@@ -1,62 +0,0 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=bashdb
PKG_VERSION:=4.4-0.92
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
#PKG_SOURCE_URL:=http://sourceforge.net/projects/bashdb/files/bashdb/$(PKG_VERSION)
PKG_SOURCE_URL:=@SF/bashdb/
PKG_MD5SUM:=b72c17870bfab2fd791b1f6de4d79f9e
#PKG_CAT:=zcat
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
include $(INCLUDE_DIR)/package.mk
define Package/$(PKG_NAME)
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Bash script debugging utility.
URL:=http://sourceforge.net/projects/bashdb/
endef
define Package/$(PKG_NAME)/description
Bash script debugging utility.
endef
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) \
$(TARGET_CONFIGURE_OPTS) \
CFLAGS="$(TARGET_CFLAGS) -DLINUX $(TARGET_CPPFLAGS) \
-I./src" \
LIBS="$(TARGET_LDFLAGS)" \
DESTDIR="$(PKG_INSTALL_DIR)"
endef
define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bashdb $(1)/usr/sbin/
$(INSTALL_DIR) $(1)/usr/share
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)
$(INSTALL_DATA) $(PKG_BUILD_DIR)/*.sh $(1)/usr/share/$(PKG_NAME)/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/*.inc $(1)/usr/share/$(PKG_NAME)/
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/init
$(INSTALL_DATA) $(PKG_BUILD_DIR)/init/*.sh $(1)/usr/share/$(PKG_NAME)/init/
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/command
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/command/show_sub
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/command/set_sub
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/command/info_sub
$(INSTALL_DATA) $(PKG_BUILD_DIR)/command/*.sh $(1)/usr/share/$(PKG_NAME)/command/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/command/show_sub/*.sh $(1)/usr/share/$(PKG_NAME)/command/show_sub/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/command/set_sub/*.sh $(1)/usr/share/$(PKG_NAME)/command/set_sub/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/command/info_sub/*.sh $(1)/usr/share/$(PKG_NAME)/command/info_sub/
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)/lib
$(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/*.sh $(1)/usr/share/$(PKG_NAME)/lib/
endef
$(eval $(call BuildPackage,bashdb))

View File

@@ -1,47 +0,0 @@
#
# Copyright (C) 2006-2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_RELEASE:=1
PKG_VERSION:=0.1
PKG_SOURCE_URL:=git@private.inteno.se:brcmslic
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=837ec19e37650e424e77c921672a0806e198ba7b
PKG_NAME:=brcmslic
RSTRIP:=true
export BUILD_DIR
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
include $(INCLUDE_DIR)/package.mk
define Package/brcmslic
CATEGORY:=Utilities
TITLE:=Brcmslic
URL:=
DEPENDS:=
endef
define Package/brcmslic/description
Brcmslic
endef
define Package/brcmslic/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/brcmslic $(1)/usr/sbin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/endpt $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,brcmslic))

View File

@@ -1,4 +0,0 @@
config dect 'dect'
option radio 'auto'

View File

@@ -11,7 +11,7 @@ PKG_RELEASE:=1
PKG_VERSION:=1.1.0
PKG_SOURCE_URL:=http://public.inteno.se:/dectmngr2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=13da1568d57b8e6732dadc16de828d64c81906b8
PKG_SOURCE_VERSION:=3191d38385c8e46c3888859f196e41c7db4447bc
PKG_NAME:=dectmngr2

View File

@@ -1,54 +0,0 @@
#
# Copyright (C) 2016 Nikil Mehta <nikil.mehta@gmail.com>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=fping
PKG_VERSION:=4.0
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://fping.org/dist/
PKG_HASH:=67eb4152b98ad34f99d2eec4e1098a0bb52caf13c0c89cd147349d08190fe8ce
PKG_MAINTAINER:=Nikil Mehta <nikil.mehta@gmail.com>
PKG_LICENSE:=BSD-4-Clause
PKG_LICENSE_FILES:=COPYING
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/fping
SECTION:=net
CATEGORY:=Network
TITLE:=sends ICMP ECHO_REQUEST packets to network hosts
URL:=http://fping.org/
endef
define Package/fping/description
fping is a ping like program which uses the Internet Control Message Protocol
(ICMP) echo request to determine if a target host is responding. fping
differs from ping in that you can specify any number of targets on the command
line, or specify a file containing the lists of targets to ping. Instead of
sending to one target until it times out or replies, fping will send out a
ping packet and move on to the next target in a round-robin fashion.
endef
CONFIGURE_ARGS+= \
--enable-ipv4 \
--enable-ipv6
TARGET_CFLAGS += -std=gnu99
define Package/fping/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/fping $(1)/usr/bin/
endef
$(eval $(call BuildPackage,fping))

View File

@@ -19,18 +19,18 @@ export PLATFORM_INCLUDE:=platforms/iopsys/build.mk
export DATE:=$(shell date +%Y-%m-%d-%H-%M-%S)
export LOGIN:=$(shell whoami)
BASE_PKG_VERSION:=5.0.0
PKG_RELEASE:=RC7
BASE_PKG_VERSION:=4.0.1
PKG_RELEASE:=RC17
PKG_VERSION:=$(BASE_PKG_VERSION)-$(PKG_RELEASE)_$(DATE)_$(LOGIN)
export PKG_VERSION
###########################--RELEASE--################################
PKG_SOURCE_VERSION:=11a77f1e9ccc0d591ca69aeab9663e9ec4727b08
PKG_SOURCE_VERSION:=97a3da5fae8b5374a598c78346cb11477c85e293
ifeq ($(CONFIG_ICE_OPEN),y)
TARGET_PROFILE=$(shell echo $(CONFIG_TARGET_BOARD) | sed s/\"//g)
BRCM_KERNEL_PROFILE=$(shell echo $(CONFIG_BCM_KERNEL_PROFILE) | sed s/\"//g)
PKG_SOURCE_URL:=http://iopsys.inteno.se/iopsys/consumer/
PKG_SOURCE:=$(PKG_NAME)-$(TARGET_PROFILE)-$(BASE_PKG_VERSION)$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE:=$(PKG_NAME)-$(BRCM_KERNEL_PROFILE)-$(BASE_PKG_VERSION)$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
else
@@ -59,6 +59,7 @@ $(call Package/ice-client/Default)
TITLE:=ice-client
MENU:=1
DEPENDS:=+libopenssl +libstdcpp +libubus +ubus +ubusd +jshn +libubox +libpthread
# DEPENDS:=+libopenssl +uclibcxx +libubus +ubus +ubusd +jshn +libubox +libpthread
endef
define Package/ice-client/config
@@ -78,7 +79,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
@@ -154,7 +155,6 @@ define Package/ice-client/install
$(CP) $(PKG_BUILD_DIR)/scripts/etc/config/ice $(1)/etc/config
$(INSTALL_DIR) $(1)/etc/iopsys
$(CP) $(PKG_BUILD_DIR)/scripts/server.ini $(1)/etc/iopsys
$(CP) $(PKG_BUILD_DIR)/scripts/defaults.ini $(1)/etc/iopsys
$(CP) $(PKG_BUILD_DIR)/scripts/modify.ini $(1)/etc/iopsys
$(INSTALL_DIR) $(1)/etc/iopsys/certificates
$(CP) $(PKG_BUILD_DIR)/scripts/cert_server_ca.pem $(1)/etc/iopsys/certificates

View File

@@ -1,12 +1,11 @@
#!/bin/sh
grep -rq "^ice:" /etc/passwd || {
adduser -D -H -s /bin/false ice
uci -q delete passwords.ice
uci -q set passwords.ice=usertype
uci -q set passwords.ice.password="\$WPAKEY"
uci -q add_list passwords.ice._access_r=root
uci -q commit passwords
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 || {
@@ -23,8 +22,8 @@ config login
list write 'juci-broadcom-iptv'
list write 'juci-broadcom-vlan'
list write 'juci-broadcom-vlan-admin'
list write 'juci-wireless'
list write 'juci-wireless-admin'
list write 'juci-broadcom-wl'
list write 'juci-broadcom-wl-admin'
list write 'juci-catv'
list write 'juci-ddns'
list write 'juci-diagnostics'
@@ -48,7 +47,6 @@ config login
list write 'juci-network-netifd'
list write 'juci-owsd'
list write 'juci-printer'
list write 'juci-realtime-graphs'
list write 'juci-samba'
list write 'juci-sfp'
list write 'juci-snmpd'
@@ -58,7 +56,6 @@ config login
list write 'juci-usb'
list write 'core'
list write 'unauthenticated'
EOF
}

View File

@@ -8,11 +8,11 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=icwmp
PKG_VERSION:=3.0-2017-09-28
PKG_VERSION:=3.0-2016-10-20
PKG_FIXUP:=autoreconf
PKG_SOURCE_URL:=http://public.inteno.se:/icwmp.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=fd932429d3a656fccabcda934932d008dae6e526
PKG_SOURCE_VERSION:=fdaa1daa184205fe256bb155b7fb0f29a034baaa
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
@@ -122,18 +122,16 @@ endif
define Package/icwmp-$(BUILD_VARIANT)/install
$(INSTALL_DIR) $(1)/etc/icwmpd
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/dmmap $(1)/etc/icwmpd
$(INSTALL_DIR) $(1)/usr/sbin
$(CP) $(PKG_BUILD_DIR)/bin/icwmpd $(1)/usr/sbin
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/cwmp $(1)/etc/config
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/dmmap $(1)/etc/config
$(INSTALL_CONF) $(PKG_BUILD_DIR)/config/firewall.cwmp $(1)/etc/firewall.cwmp
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init/icwmpd.init $(1)/etc/init.d/icwmpd
$(INSTALL_DIR) $(1)/etc/uci-defaults
$(INSTALL_BIN) $(PKG_BUILD_DIR)/init/icwmpd.init $(1)/etc/init.d/icwmpd
$(INSTALL_BIN) $(PKG_BUILD_DIR)/uci-defaults/90-cwmpfirewall $(1)/etc/uci-defaults/90-cwmpfirewall
$(INSTALL_DIR) $(1)/etc/hotplug.d/iface
$(CP) ./files/icwmp.hotplug $(1)/etc/hotplug.d/iface/90-icwmp
ifeq ($(CONFIG_CWMP_SCRIPTS_FULL),y)
$(INSTALL_DIR) $(1)/usr/share/icwmp
$(CP) $(PKG_BUILD_DIR)/scripts/defaults $(1)/usr/share/icwmp

View File

@@ -1,44 +0,0 @@
#!/bin/sh
grep -q "Designated" /etc/banner || exit 0
. /lib/functions/network.sh
[ "$ACTION" == "ifup" ] || exit 0
local islan="$(uci -q get network.$INTERFACE.is_lan)"
[ "$islan" == "1" ] && exit 0
local proto="$(uci -q get network.$INTERFACE.proto)"
[ "$proto" == "none" ] && exit 0
local ifname="$(uci -q get network.$INTERFACE.ifname)"
[ "${ifname:0:1}" == "@" ] && exit 0
mkdir -p /tmp/ipv4
local previpaddr=""
local curipaddr=""
local ipaddrfile=/tmp/ipv4/$INTERFACE-ipaddr
previpaddr=$(cat $ipaddrfile 2>/dev/null)
network_get_ipaddr curipaddr $INTERFACE
[ -n "$curipaddr" ] && echo $curipaddr > $ipaddrfile || rm -f $ipaddrfile
local prevgateway=""
local curgateway=""
local gatewayfile=/tmp/ipv4/$INTERFACE-gateway
prevgateway=$(cat $gatewayfile 2>/dev/null)
network_get_gateway curgateway $INTERFACE
[ -n "$curgateway" ] && echo $curgateway > $gatewayfile || rm -f $gatewayfile
local prevsubnets=""
local cursubnets=""
local subnetsfile=/tmp/ipv4/$INTERFACE-subnets
prevsubnets=$(cat $subnetsfile 2>/dev/null)
network_get_subnets cursubnets $INTERFACE
[ -n "$cursubnets" ] && echo $cursubnets > $subnetsfile || rm -f $subnetsfile
[ "$previpaddr" = "$curipaddr" -a "$prevgateway" = "$curgateway" -a "$prevsubnets" = "$cursubnets" ] && exit 0
[ -f /etc/config/cwmp ] && /etc/init.d/icwmpd reload &

View File

@@ -1,53 +0,0 @@
#
# Copyright (C) 2016 Inteno
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=inbd
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_SOURCE_VERSION:=92f918d26c0ffc22d1704f5ea6cbb0bd7fdbdab9
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=http://public.inteno.se/inbd
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
# support parallel build
PKG_BUILD_PARALLEL:=1
#re create configure scripts if not present.
PKG_FIXUP:=autoreconf
# run install target when cross compiling. basically, make install DESTDIR=$(PKG_INSTALL_DIR)
# this way we don't need to pick out the resulting files from the build dir.
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
define Package/inbd
CATEGORY:=Utilities
TITLE:=Inteno Netlink Bridge Daemon
URL:=
DEPENDS:=+libuci +libubus +libblobmsg-json +libnl-genl
endef
define Package/inbd/description
Application handling netlink messages from kernel and sending them out on ubus.
endef
define Package/inbd/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/etc/init.d/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/inbd $(1)/usr/bin/
cp $(PKG_BUILD_DIR)/files/etc/init.d/inbd $(1)/etc/init.d/
endef
$(eval $(call BuildPackage,inbd))

View File

@@ -12,7 +12,6 @@ include $(INCLUDE_DIR)/package.mk
define Package/inteno-netmodes
CATEGORY:=Base system
DEPENDS:=+fping
TITLE:=Predefined Network Modes
endef

View File

@@ -1,119 +0,0 @@
#!/bin/sh
[ "$INTERFACE" != "wan" ] && exit
. /lib/functions/network.sh
network_get_ipaddr ip $INTERFACE
repeaterready="$(uci -q get netmode.setup.repeaterready)"
[ -z "$ip" ] && exit
toggle_firewall() {
local section=$1
local disable=$2
config_get name "$1" name
if [ "$name" == "wan" ]; then
uci -q set firewall.settings.disabled=$disable
if [ "$disable" == "1" ]; then
uci -q set firewall.$section.input="ACCEPT"
else
uci -q set firewall.$section.input="REJECT"
fi
uci -q commit firewall
fi
}
set_disabled() {
config_load firewall
config_foreach toggle_firewall zone $1
/etc/init.d/firewall reload
}
is_inteno_macaddr()
{
macaddr=$1
echo $macaddr | grep -i -e "^00:22:07" \
-e "^02:22:07" \
-e "^44:D4:37" \
-e "^00:0C:07" \
-e "^02:0C:07" \
-e "^06:0C:07" \
-e "^00:0C:43" \
-e "^02:0C:43" \
-e "^06:0C:43" \
&& return
false
}
switch_mode() {
[ "$repeaterready" == "1" ] || return
# flush the ip on br-lan; br-lan will anyhow be deleted.
# this is needed if the ip received on the wan is also from the same net
ip addr flush dev br-lan
# flush iptables in case the MASTER
# tries to configure us before
# firewall is disabled the proper way
iptables -F
ubus call leds set '{"state" : "allflash"}'
local ret=0
# let netmode-conf up to 20 seconds before switching mode
for tm in 2 4 6 8; do
if [ -f /tmp/wificontrol.txt ]; then
ret=1
break
fi
sleep $tm
done
# let netmode-conf take over
[ $ret -eq 1 ] && return
# go head with switching mode
touch -f /tmp/switching_mode
echo "Switching to 'extender' mode" > /dev/console
uci -q set netmode.setup.curmode='repeater'
uci set netmode.setup.repeaterready=0
uci commit netmode
/etc/init.d/netmode reload
echo "Restarting network services" > /dev/console
ubus call network reload
wifi reload nodat
ubus call router.network reload
ubus call leds set '{"state" : "normal"}'
rm -f /tmp/switching_mode
}
test_ip() {
if [ -n "$(echo $ip | grep -E '^(192\.168|10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.)')" ]; then
# private IP
switch_mode
set_disabled 1
else
# public IP
set_disabled 0
[ "$1" -eq "1" ] && {
uci set netmode.setup.repeaterready=0
uci commit netmode
local pid="$(ps | grep wificontro[l] | awk '/repeater/ {print $1}')"
[ "$pid" != "" ] && kill -9 $pid
pid="$(pidof netmode-client-detect)"
[ "$pid" == "" ] && /sbin/netmode-client-detect &
# set default JUCI page to overview
uci -q set juci.juci.homepage="overview"
uci commit juci
}
fi
}
case "$(uci -q get netmode.setup.curmode)" in
repeater*) test_ip ;;
*) [ "$repeaterready" == "1" ] && test_ip 1;;
esac

View File

@@ -1,251 +0,0 @@
#!/bin/sh
# this scripts shifts the lan network prefixes
# if a wan interface has the same network prefix.
. /lib/functions.sh
. /lib/functions/network.sh
local lockfile="/tmp/70-shiftrange.lock"
local restricted_nets=""
local all_nets=""
#####
##### initial functions
#####
initial_check()
{
# run only on ifup
[ "$ACTION" == "ifup" ] || exit 0
# run only for uplink (not is_lan) interfaces
local islan="$(uci -q get network.$INTERFACE.is_lan)"
[ "$islan" != "1" ] || exit 0
# run only if the uplink interface has a configured protocol
local proto="$(uci -q get network.$INTERFACE.proto)"
[ "$proto" != "none" ] || exit 0
}
finish()
{
lock -u $lockfile
rm -f $lockfile
}
# just one instance of this script at a time
just_one_instance()
{
local counter=0
local limit=10
#wait for the lock to become free
while [ -e $lockfile ] ; do
sleep 1
counter=$((counter + 1))
[ "$counter" -gt "$limit" ] && exit 1
done
lock $lockfile
trap finish EXIT INT TERM
}
#####
##### helper functions
#####
#given a an ip and a mask in the form of "192.168.1.1/24"
#return the network address like "192.168.1.0/24"
get_network_address()
{
local ip="$1"
[ -z "$ip" ] && return
local prefix=${ip##*/}
local ip1=${ip%%.*} ; ip=${ip#*.*}
local ip2=${ip%%.*} ; ip=${ip#*.*}
local ip3=${ip%%.*} ; ip=${ip#*.*}
local ip4=${ip%%/*}
local ip=$((($ip1 << 24) + ($ip2 << 16) + ($ip3 << 8) + $ip4))
local mask=$((0xFFFFFFFF >> (32 - $prefix) << (32 - $prefix)))
local network=$(($ip & $mask))
local n1=$((($network & 0xFF000000) >> 24))
local n2=$((($network & 0x00FF0000) >> 16))
local n3=$((($network & 0x0000FF00) >> 8))
local n4=$(( $network & 0x000000FF))
echo "$n1.$n2.$n3.$n4/$prefix"
}
#given a network address (192.168.1.0/24)
#find the next network address (192.168.2.0/24)
next_network_address()
{
local ip=$1
local prefix=${ip##*/}
local ip1=${ip%%.*} ; ip=${ip#*.*}
local ip2=${ip%%.*} ; ip=${ip#*.*}
local ip3=${ip%%.*} ; ip=${ip#*.*}
local ip4=${ip%%/*}
local ip=$((($ip1 << 24) + ($ip2 << 16) + ($ip3 << 8) + $ip4))
local one=$((1 << (32-$prefix)))
local new=$(($ip + $one))
local n1=$((($new & 0xFF000000) >> 24))
local n2=$((($new & 0x00FF0000) >> 16))
local n3=$((($new & 0x0000FF00) >> 8))
local n4=$(( $new & 0x000000FF))
echo "$n1.$n2.$n3.$n4/$prefix"
}
# given a network address and a prefix (192.168.2.0/24)
# return the first host ip available (192.168.2.1)
first_host_in_network ()
{
local ip=$1
local prefix=${ip##*/}
local ip1=${ip%%.*} ; ip=${ip#*.*}
local ip2=${ip%%.*} ; ip=${ip#*.*}
local ip3=${ip%%.*} ; ip=${ip#*.*}
local ip4=${ip%%/*}
local ip=$((($ip1 << 24) + ($ip2 << 16) + ($ip3 << 8) + $ip4))
local new=$(($ip + 1))
local n1=$((($new & 0xFF000000) >> 24))
local n2=$((($new & 0x00FF0000) >> 16))
local n3=$((($new & 0x0000FF00) >> 8))
local n4=$(( $new & 0x000000FF))
echo "$n1.$n2.$n3.$n4"
}
# given a network address,
# find the next available network address.
shift_range()
{
local net="$1"
while true ; do
if [ "$restricted_nets" == "${restricted_nets//$net/}" ] && [ "$all_nets" == "${all_nets//$net/}" ]; then
# found a net that is not in restricted nets nor in all nets
break
fi
net=$(next_network_address $net)
done
echo "$net"
}
#####
##### parse all interfaces section
#####
# restricted_nets = all the IPs on wan interfaces
# all_nets = all the IPs on any interface
parse_interface()
{
local interface=$1
local nets="" # "192.168.1.1/24"
local networks="" # "192.168.1.0/24"
config_get is_lan $interface is_lan
network_get_subnets nets $interface
for n in $nets ; do
networks="$networks $(get_network_address $n)"
done
[ "$is_lan" != "1" ] && restricted_nets="$restricted_nets $networks"
all_nets="$all_nets $networks"
}
# parse all the interfaces
# get all the IPs on wan interfaces and store them in restrict_nets
# get all the IPs on all interfaces and store them in all_nets
parse_interfaces()
{
config_foreach parse_interface "interface"
}
#####
##### parse all lan interfaces section
#####
parse_lan()
{
local interface=$1
local nets=""
local ips=""
local newips=""
local ips_changed=0
[ "$interface" == "loopback" ] && return
config_get is_lan $interface is_lan
[ "$is_lan" == "1" ] || return
network_get_subnets ips $interface
for ip in $ips ; do
net="$(get_network_address $ip)"
if [ "$restricted_nets" == "${restricted_nets//$net/}" ] ; then
# net is not in restricted nets
# append ip to newips
[ -z "$newips" ] && newips="${ip%/*}" || newips="$newips ${ip%/*}"
continue
fi
#net is in restricted_nets
local newnet=$(shift_range $net)
local newip="$(first_host_in_network $newnet)"
# append newip to newips
[ -z "$newips" ] && newips="$newip" || newips="$newips $newip"
ips_changed=1
logger "$0: Changing the ip on interface $interface from $ip to $newip/${newnet##*/}"
echo "$0: Changing the ip on interface $interface from $ip to $newip/${newnet##*/}" >/dev/console
done
#assign the new ips
if [ "$ips_changed" == "1" ] ; then
uci -q set network.$interface.ipaddr="$newips"
fi
}
# parse all the interface with is_lan=1
parse_lans()
{
config_foreach parse_lan "interface"
}
#####
##### main
#####
main()
{
initial_check
just_one_instance
config_load network
parse_interfaces
parse_lans
if [ -n "$(uci changes network)" ] ; then
ubus call uci commit '{"config":"network"}'
fi
}
main $@

View File

@@ -3,38 +3,25 @@
. /lib/functions.sh
include /lib/network
ps | grep hotplug | grep button && exit
MTK=0
[ "$(db -q get hw.board.hardware)" == "EX400" ] && MTK=1
WANDEV="$(uci get layer2_interface_ethernet.Wan.ifname)"
[ $MTK -eq 1 ] && WANDEV="eth0.2"
[ "$INTERFACE" != "$WANDEV" ] && exit
defroute=$(ip route | grep default | awk '{print$3}')
[ "$INTERFACE" != "$(uci get layer2_interface_ethernet.Wan.ifname)" ] && exit
[ "$(uci get netmode.setup.curmode)" != "repeater" ] && exit
case "$(uci get netmode.setup.curmode)" in
repeater*)
echo "Preparing to switch mode"
;;
*)
ping -c 1 -w 5 $defroute >/dev/null 2>&1 || killall -USR1 udhcpc
exit
;;
repeater|repeater_dualdown) echo "Preparing to switch mode" ;;
*) exit ;;
esac
get_wifi_wet_interface() {
handle_interface() {
config_get mode "$1" mode
if [ "$mode" == "sta" -o "$mode" == "wet" ] ; then
config_get ifname "$1" ifname
echo "$ifname"
fi
}
config_load wireless
config_foreach handle_interface wifi-iface
# handle_interface() {
# config_get mode "$1" mode
# if [ "$mode" == "wet" ] ; then
# config_get ifname "$1" ifname
# echo "$ifname"
# fi
# }
# config_load wireless
# config_foreach handle_interface wifi-iface "$device"
echo "wl1"
}
get_wifi_iface_cfgstr() {
@@ -43,60 +30,42 @@ get_wifi_iface_cfgstr() {
[ "$ifname" == "$2" ] && echo "wireless.$1"
}
config_load wireless
config_foreach get_cfgno wifi-iface $1
config_foreach get_cfgno wifi-iface $1 $2
}
link=$(cat /sys/class/net/${WANDEV:0:4}/operstate)
[ $MTK -eq 1 ] && link=$(swconfig dev switch0 port 0 get link | awk '{print$2}' | cut -d':' -f2)
case "$ACTION" in
add|register)
[ "$link" == "down" ] && return
ubus call leds set '{"state" : "allflash"}'
echo "Autoswitch to Extender mode" > /dev/console
sleep 2
wetif="$(get_wifi_wet_interface)"
# remove wifi client interface
case "$(uci get netmode.setup.curmode)" in
repeater*)
uci -q set $(get_wifi_iface_cfgstr $wetif).disabled=1
repeater_dualdown)
uci -q set $(get_wifi_iface_cfgstr $(get_wifi_wet_interface)).disabled=1
;;
repeater)
uci -q set $(get_wifi_iface_cfgstr $(get_wifi_wet_interface)).mode=ap
;;
esac
uci commit wireless
#add wan ethernet port
uci set network.wan.ifname="$(echo $WANDEV $(uci get network.wan.ifname) | sed 's/$/ /' | sed -r "s/$wetif //g" | tr ' ' '\n' | sort -u | tr '\n' ' ')"
uci commit network
ubus call network reload
[ -f /usr/sbin/wlctl ] && wlctl -i $wetif bss down 2>/dev/null
ping -c 1 -w 10 $defroute >/dev/null 2>&1 || killall -USR1 udhcpc
ubus call router.network reload
ubus call leds set '{"state" : "normal"}'
uci set network.wan.ifname="$(echo $(uci get layer2_interface_ethernet.Wan.ifname) $(uci get network.wan.ifname) | tr ' ' '\n' | sort -u | tr '\n' ' ')"
ubus call uci commit '{"config":"network"}'
;;
remove|unregister)
[ "$link" == "up" ] && return
ubus call leds set '{"state" : "allflash"}'
echo "Autoswitch to Repeater mode" > /dev/console
sleep 2
wetif="$(get_wifi_wet_interface)"
# add wifi client interface
case "$(uci get netmode.setup.curmode)" in
repeater*)
uci -q set $(get_wifi_iface_cfgstr $wetif).disabled=0
repeater_dualdown)
uci -q set $(get_wifi_iface_cfgstr $(get_wifi_wet_interface)).disabled=0
;;
repeater)
uci -q set $(get_wifi_iface_cfgstr $(get_wifi_wet_interface)).mode=wet
;;
esac
uci commit wireless
#remove wan ethernet port
uci set network.wan.ifname="$(echo $wetif $(uci get network.wan.ifname) | sed 's/$/ /' | sed -r "s/$WANDEV //g" | tr ' ' '\n' | sort -u | tr '\n' ' ')"
uci commit network
ubus call network reload
[ -f /usr/sbin/wlctl ] && wlctl -i $wetif bss up 2>/dev/null
ping -c 1 -w 10 $defroute >/dev/null 2>&1 || {
killall -9 wifi
wifi reload nodat
killall -USR1 udhcpc
}
ubus call router.network reload
ubus call leds set '{"state" : "normal"}'
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

View File

@@ -3,9 +3,6 @@
START=10
USE_PROCD=1
TMPDIR=/var/netmodes
OLD_MODE_FILE=/var/netmodes/old_mode
. /usr/share/libubox/jshn.sh
. /lib/network/config.sh
@@ -44,29 +41,13 @@ get_device() {
populate_netmodes() {
[ -f /etc/config/netmode -a -d $modedir ] || return
local curmode
config_load netmode
config_get curmode setup curmode
mkdir -p $TMPDIR
if [ "$curmode" == "routed" ]; then
local hw="$(db -q get hw.board.hardware)"
if [ "$hw" == "EX400" ]; then
curmode="routed_mtk"
else
curmode="routed_brcm"
fi
fi
echo $curmode > $OLD_MODE_FILE
delete_netmode() {
uci delete netmode.$1
}
config_load netmode
config_foreach delete_netmode netmode
uci commit netmode
@@ -78,37 +59,21 @@ populate_netmodes() {
lan5=$(get_device LAN5)
for file in $(find $modedir -type f); do
conf="$(echo $file | cut -d'/' -f5)"
if [ "$conf" == "layer2_interface_ethernet" ]; then
grep -q "\$WAN" $file && sed -i "s/\$WAN/$wan/g" $file
fi
if [ "$conf" == "network" ]; then
grep -q "\$WAN" $file && sed -i "s/\$WAN/$wan/g" $file
grep -q "\$LAN1" $file && sed -i "s/\$LAN1/$lan1/g" $file
grep -q "\$LAN2" $file && sed -i "s/\$LAN2/$lan2/g" $file
grep -q "\$LAN3" $file && sed -i "s/\$LAN3/$lan3/g" $file
grep -q "\$LAN4" $file && sed -i "s/\$LAN4/$lan4/g" $file
ifname="$(uci -q get $file.wan.ifname | sed 's/[ \t]*$//')"
uci -q set $file.wan.ifname="$ifname"
uci -q commit $file
fi
grep -q "\$WAN" $file && sed -i "s/\$WAN/$wan/g" $file
grep -q "\$LAN1" $file && sed -i "s/\$LAN1/$lan1/g" $file
grep -q "\$LAN2" $file && sed -i "s/\$LAN2/$lan2/g" $file
grep -q "\$LAN3" $file && sed -i "s/\$LAN3/$lan3/g" $file
grep -q "\$LAN4" $file && sed -i "s/\$LAN4/$lan4/g" $file
done
local hardware=$(db get hw.board.hardware)
local keys lang desc exp exclude
for mode in $(ls $modedir); do
case "$mode" in
repeater*)
wlctl -i wl1 ap >/dev/null 2>&1 || ifconfig rai0 2>/dev/null | grep -q rai0 || continue
;;
esac
lang=""
desc=""
exp=""
uci -q set netmode.$mode=netmode
uci -q set netmode.$mode.conf=$mode
json_load "$(cat $modedir/$mode/DETAILS)"
if json_select excluded_boards; then
@@ -165,152 +130,36 @@ populate_netmodes() {
json_get_var cred credentials
uci -q set netmode.$mode.askcred="$cred"
json_get_var ulb uplink_band
uci -q set netmode.$mode.uplink_band="$ulb"
json_get_var reboot reboot
uci -q set netmode.$mode.reboot="$reboot"
done
config_get curmode setup curmode
[ -d /etc/netmodes/$curmode ] || {
[ "$(db -q get hw.board.hardware)" == "EX400" ] && uci -q set netmode.setup.curmode="routed_mtk" || uci -q set netmode.setup.curmode="routed_brcm"
}
uci commit netmode
}
switch_netmode() {
[ -f /etc/config/netmode -a -d $modedir ] || return
local curmode conf repeaterready old_mode
config_load netmode
config_get curmode setup curmode
config_get repeaterready setup repeaterready "0"
if [ "$repeaterready" == "1" ] ; then
uci -q set netmode.setup.repeaterready="0"
uci commit netmode
fi
if [ "$curmode" == "repeater" ]; then
local hw="$(db -q get hw.board.hardware)"
if [ "$hw" == "EX400" ]; then
curmode="repeater_mtk_5g_up_dual_down"
else
curmode="repeater_brcm_2g_up_dual_down"
fi
uci set netmode.setup.curmode="$curmode"
uci commit netmode
fi
if [ "$curmode" == "routed" ]; then
local hw="$(db -q get hw.board.hardware)"
if [ "$hw" == "EX400" ]; then
curmode="routed_mtk"
else
curmode="routed_brcm"
fi
uci set netmode.setup.curmode="$curmode"
uci commit netmode
fi
old_mode=`cat $OLD_MODE_FILE 2>/dev/null`
# if curmode has not changed do not copy configs
if [ "$curmode" == "$old_mode" ]; then
/etc/init.d/enviroment reload
return
fi
echo $curmode >$OLD_MODE_FILE
[ -d "/etc/netmodes/$curmode" ] || return
cp /etc/netmodes/$curmode/* /etc/config/
config_get conf $curmode conf
cp /etc/netmodes/$conf/* /etc/config/
rm -f /etc/config/DETAILS
sync
local reboot=$(uci -q get netmode.$curmode.reboot)
local askcred=$(uci -q get netmode.$curmode.askcred)
if [ "$reboot" == "0" ]; then
/etc/init.d/enviroment reload
case "$curmode" in
routed*)
ubus call uci commit '{"config":"network"}'
;;
repeater*)
[ -f /etc/init.d/omcproxy ] && /etc/init.d/omcproxy stop
;;
esac
else
reboot &
fi
}
start_client_listener() {
local curmode repeaterready ulcpid
config_load netmode
config_get repeaterready setup repeaterready 0
ulcpid=$(ps | grep "ubus listen client" | grep -v grep | awk '{print$1}')
[ $repeaterready -eq 1 ] && {
killall -SIGKILL netmode-client-detect >/dev/null 2>&1
kill -9 $ulcpid >/dev/null 2>&1
return
}
config_get curmode setup curmode
case "$curmode" in
repeater*)
killall -SIGKILL netmode-client-detect >/dev/null 2>&1
kill -9 $ulcpid >/dev/null 2>&1
;;
*)
pidof netmode-client-detect || /sbin/netmode-client-detect &
;;
esac
}
start_netmode_discover() {
local curmode repeaterready
killall -9 netmode-discover >/dev/null 2>&1
config_load netmode
config_get repeaterready setup repeaterready 0
[ $repeaterready -eq 1 ] && return
config_get curmode setup curmode
case "$curmode" in
repeater*)
/sbin/netmode-discover &
;;
esac
}
start_service() {
populate_netmodes
start_client_listener
start_netmode_discover
}
reload_service() {
switch_netmode
# set default JUCI page to overview
uci -q set juci.juci.homepage="overview"
uci commit juci
start_client_listener
start_netmode_discover
}
stop_service() {
killall -SIGKILL netmode-client-detect >/dev/null 2>&1
killall -9 netmode-discover >/dev/null 2>&1
}
service_triggers()

View File

@@ -10,8 +10,7 @@
"credentials" : 0,
"excluded_boards" : [
"CG300",
"CG301",
"EX400"
"CG301"
],
"acl" : [
"admin",

View File

@@ -1,6 +1,3 @@
config settings 'settings'
option disabled '0'
config defaults
option syn_flood 1
option input ACCEPT

View File

@@ -0,0 +1,23 @@
config atm_bridge
option link_type 'EoA'
option encapseoa 'llcsnap_eth'
option unit '0'
option ifname 'atm0.1'
option baseifname 'atm0'
option atmtype 'ubr'
option name 'atm_inet'
option vpi '8'
option vci '35'
config atm_bridge
option link_type 'EoA'
option encapseoa 'llcsnap_eth'
option unit '1'
option ifname 'atm1.1'
option baseifname 'atm1'
option atmtype 'ubr'
option name 'atm_tv'
option vpi '8'
option vci '45'

View File

@@ -0,0 +1,18 @@
config 'vlan_interface'
option name 'eth_tv'
option ifname '$WAN.100'
option baseifname '$WAN'
option vlan8021q '100'
option vlan8021p '0'
option bridge '1'
config 'vlan_interface'
option name 'vdsl_tv'
option ifname 'ptm0.100'
option baseifname 'ptm0'
option vlan8021q '100'
option vlan8021p '0'
option bridge '1'

View File

@@ -4,13 +4,6 @@ config wifi-status 'status'
option sched_status '0'
option schedule '0'
config bandsteering 'bandsteering'
option enabled '0'
option policy '0'
config apsteering 'apsteering'
option enabled '0'
config wifi-device 'wl0'
option type 'broadcom'
option country 'EU/13'

View File

@@ -10,9 +10,7 @@
"credentials" : 0,
"excluded_boards" : [
"CG300",
"CG301",
"EX400",
"F*"
"CG301"
],
"acl" : [
"admin",

View File

@@ -1,6 +1,3 @@
config settings 'settings'
option disabled '0'
config defaults
option syn_flood 1
option input ACCEPT

View File

@@ -0,0 +1,34 @@
config atm_bridge
option link_type 'EoA'
option encapseoa 'llcsnap_eth'
option unit '0'
option ifname 'atm0.1'
option baseifname 'atm0'
option atmtype 'ubr'
option name 'atm_inet'
option vpi '8'
option vci '35'
config atm_bridge
option link_type 'EoA'
option encapseoa 'llcsnap_eth'
option unit '1'
option ifname 'atm1.1'
option baseifname 'atm1'
option atmtype 'ubr'
option name 'atm_tv'
option vpi '8'
option vci '45'
config atm_bridge
option link_type 'EoA'
option encapseoa 'llcsnap_eth'
option unit '1'
option ifname 'atm2.1'
option baseifname 'atm2'
option atmtype 'ubr'
option name 'atm_voip'
option vpi '8'
option vci '55'

View File

@@ -0,0 +1,5 @@
config ethernet_interface 'Wan'
option baseifname '$WAN'
option ifname '$WAN.1'
option name 'WAN'

View File

@@ -0,0 +1,9 @@
config vdsl_interface
option unit '0'
option ifname 'ptm0.1'
option baseifname 'ptm0'
option name 'VDSL2'
option dslat '1'
option ptmprio '1'
option ipqos '1'

View File

@@ -0,0 +1,32 @@
config 'vlan_interface'
option name 'eth_tv'
option ifname '$WAN.100'
option baseifname '$WAN'
option vlan8021q '100'
option vlan8021p '0'
option bridge '1'
config 'vlan_interface'
option name 'eth_voip'
option ifname '$WAN.200'
option baseifname '$WAN'
option vlan8021q '200'
option vlan8021p '0'
config 'vlan_interface'
option name 'vdsl_tv'
option ifname 'ptm0.100'
option baseifname 'ptm0'
option vlan8021q '100'
option vlan8021p '0'
option bridge '1'
config 'vlan_interface'
option name 'vdsl_voip'
option ifname 'ptm0.200'
option baseifname 'ptm0'
option vlan8021q '200'
option vlan8021p '0'

View File

@@ -4,13 +4,6 @@ config wifi-status 'status'
option sched_status '0'
option schedule '0'
config bandsteering 'bandsteering'
option enabled '0'
option policy '0'
config apsteering 'apsteering'
option enabled '0'
config wifi-device 'wl0'
option type 'broadcom'
option country 'EU/13'

View File

@@ -8,10 +8,11 @@
{ "sv" : "Routern kommer att fungera som en trådbunden extender eller trådlös repeater till den valda trådlösa åtkomstpunkten. Uplink 2.4G & Downlink 2.4G + 5G" }
],
"excluded_boards" : [
"*G*",
"F*"
"DG*",
"EG*",
"VG*"
],
"uplink_band" : 'b',
"credentials" : 1,
"reboot" : 0
}

View File

@@ -1,6 +1,3 @@
config settings 'settings'
option disabled '0'
config defaults
option syn_flood 1
option input ACCEPT
@@ -19,7 +16,6 @@ config zone
config zone
option name wan
list network 'wan'
list network 'wan6'
option input REJECT
option output ACCEPT
option forward REJECT
@@ -39,6 +35,16 @@ config rule
option dest_port 68
option target ACCEPT
option family ipv4
option hidden 1
config rule
option name Repeater-Management
option src wan
option proto tcp
option dest_port '22 80 8080 8181 9876'
option target ACCEPT
option family ipv4
option hidden 1
# Allow IPv4 ping
config rule
@@ -48,13 +54,7 @@ config rule
option icmp_type echo-request
option family ipv4
option target ACCEPT
config rule
option name Allow-IGMP
option src wan
option proto igmp
option family ipv4
option target ACCEPT
option hidden 1
# Allow DHCPv6 replies
# see https://dev.openwrt.org/ticket/10381
@@ -68,24 +68,13 @@ config rule
option dest_port 546
option family ipv6
option target ACCEPT
config rule
option name Allow-MLD
option src wan
option proto icmp
option src_ip fe80::/10
list icmp_type '130/0'
list icmp_type '131/0'
list icmp_type '132/0'
list icmp_type '143/0'
option family ipv6
option target ACCEPT
option hidden 1
# Allow essential incoming IPv6 ICMP traffic
config rule
option name Allow-ICMPv6-Input
option src wan
option proto icmp
option proto icmp
list icmp_type echo-request
list icmp_type echo-reply
list icmp_type destination-unreachable
@@ -100,6 +89,7 @@ config rule
option limit 1000/sec
option family ipv6
option target ACCEPT
option hidden 1
# Allow essential forwarded IPv6 ICMP traffic
config rule
@@ -117,37 +107,15 @@ config rule
option limit 1000/sec
option family ipv6
option target ACCEPT
# allow IPsec/ESP and ISAKMP passthrough
config rule
option src wan
option dest lan
option proto esp
option target ACCEPT
config rule
option src wan
option dest lan
option dest_port 500
option proto udp
option target ACCEPT
config dmz dmz
option enabled '0'
option exclude_ports '5060 7547'
option hidden 1
# include a file with users custom iptables rules
config include
option path /etc/firewall.user
option reload 1
# include a file with rules for prioritizing some specific packets
# include a file with rules for SIP and RTP traffic
config include
option path /etc/firewall.qos
option reload 1
# include a file with rules for DMZ Host
config include dmzhost
option path /etc/firewall.dmz
option path /etc/firewall.sip
option reload 1

View File

@@ -0,0 +1,24 @@
config interface 'loopback'
option is_lan '1'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'wan'
option type 'bridge'
option proto 'dhcp'
option vendorid 'Inteno_Repeater_$MAC4'
option hostname 'Inteno_Repeater_$MAC4'
option ifname '$WAN.1'
option reqopts '43'
config interface 'lan'
option is_lan '1'
option type 'bridge'
option proto 'static'
option ifname '$LAN1 $LAN2 $LAN3 $LAN4'
option ipaddr '192.168.11.1'
option netmask '255.255.255.0'

View File

@@ -4,18 +4,11 @@ config wifi-status 'status'
option sched_status '0'
option schedule '0'
config bandsteering 'bandsteering'
option enabled '0'
option policy '0'
config apsteering 'apsteering'
option enabled '0'
config wifi-device 'wl0'
option type 'broadcom'
option country 'EU/13'
option band 'a'
option bandwidth '80'
option bandwidth '20'
option hwmode '11ac'
option channel 'auto'
option scantimer '15'
@@ -34,7 +27,7 @@ config wifi-device 'wl0'
option rifs '0'
option rifs_advert '0'
option maxassoc '32'
option beamforming '1'
option beamforming '0'
option doth '1'
option dfsc '1'

View File

@@ -1,15 +0,0 @@
config interface 'loopback'
option is_lan '1'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'wan'
option type 'bridge'
option proto 'dhcp'
option hostname 'Inteno-$BSSID4'
option ifname '$WAN.1 $LAN1 $LAN2 $LAN3 $LAN4'
option reqopts '43'

View File

@@ -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*",
"EX40*",
"F*"
],
"uplink_band" : "b",
"credentials" : 1,
"reboot" : 0
}

View File

@@ -1,15 +0,0 @@
config interface 'loopback'
option is_lan '1'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'wan'
option type 'bridge'
option proto 'dhcp'
option hostname 'Inteno-$BSSID4'
option ifname '$WAN.1 $LAN1 $LAN2 $LAN3 $LAN4'
option reqopts '43'

View File

@@ -8,13 +8,11 @@
{ "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*",
"EX40*",
"F*"
"DG*",
"EG*",
"VG*"
],
"uplink_band" : "b",
"credentials" : 1,
"reboot" : 0
}

View File

@@ -0,0 +1,121 @@
config defaults
option syn_flood 1
option input ACCEPT
option output ACCEPT
option forward REJECT
# Uncomment this line to disable ipv6 rules
# option disable_ipv6 1
config zone
option name lan
list network 'lan'
option input ACCEPT
option output ACCEPT
option forward ACCEPT
config zone
option name wan
list network 'wan'
option input REJECT
option output ACCEPT
option forward REJECT
option masq 1
option mtu_fix 1
config forwarding
option src lan
option dest wan
# We need to accept udp packets on port 68,
# see https://dev.openwrt.org/ticket/4108
config rule
option name Allow-DHCP-Renew
option src wan
option proto udp
option dest_port 68
option target ACCEPT
option family ipv4
option hidden 1
config rule
option name Repeater-Management
option src wan
option proto tcp
option dest_port '22 80 8080 8181 9876'
option target ACCEPT
option family ipv4
option hidden 1
# Allow IPv4 ping
config rule
option name Allow-Ping
option src wan
option proto icmp
option icmp_type echo-request
option family ipv4
option target ACCEPT
option hidden 1
# Allow DHCPv6 replies
# see https://dev.openwrt.org/ticket/10381
config rule
option name Allow-DHCPv6
option src wan
option proto udp
option src_ip fe80::/10
option src_port 547
option dest_ip fe80::/10
option dest_port 546
option family ipv6
option target ACCEPT
option hidden 1
# Allow essential incoming IPv6 ICMP traffic
config rule
option name Allow-ICMPv6-Input
option src wan
option proto icmp
list icmp_type echo-request
list icmp_type echo-reply
list icmp_type destination-unreachable
list icmp_type packet-too-big
list icmp_type time-exceeded
list icmp_type bad-header
list icmp_type unknown-header-type
list icmp_type router-solicitation
list icmp_type neighbour-solicitation
list icmp_type router-advertisement
list icmp_type neighbour-advertisement
option limit 1000/sec
option family ipv6
option target ACCEPT
option hidden 1
# Allow essential forwarded IPv6 ICMP traffic
config rule
option name Allow-ICMPv6-Forward
option src wan
option dest *
option proto icmp
list icmp_type echo-request
list icmp_type echo-reply
list icmp_type destination-unreachable
list icmp_type packet-too-big
list icmp_type time-exceeded
list icmp_type bad-header
list icmp_type unknown-header-type
option limit 1000/sec
option family ipv6
option target ACCEPT
option hidden 1
# include a file with users custom iptables rules
config include
option path /etc/firewall.user
option reload 1
# include a file with rules for SIP and RTP traffic
config include
option path /etc/firewall.sip
option reload 1

View File

@@ -0,0 +1,24 @@
config interface 'loopback'
option is_lan '1'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'wan'
option type 'bridge'
option proto 'dhcp'
option vendorid 'Inteno_Repeater_$MAC4'
option hostname 'Inteno_Repeater_$MAC4'
option ifname '$WAN.1'
option reqopts '43'
config interface 'lan'
option is_lan '1'
option type 'bridge'
option proto 'static'
option ifname '$LAN1 $LAN2 $LAN3 $LAN4'
option ipaddr '192.168.11.1'
option netmask '255.255.255.0'

View File

@@ -4,18 +4,11 @@ config wifi-status 'status'
option sched_status '0'
option schedule '0'
config bandsteering 'bandsteering'
option enabled '0'
option policy '0'
config apsteering 'apsteering'
option enabled '0'
config wifi-device 'wl0'
option type 'broadcom'
option country 'EU/13'
option band 'a'
option bandwidth '80'
option bandwidth '20'
option hwmode '11ac'
option channel 'auto'
option scantimer '15'
@@ -34,7 +27,7 @@ config wifi-device 'wl0'
option rifs '0'
option rifs_advert '0'
option maxassoc '32'
option beamforming '1'
option beamforming '0'
option doth '1'
option dfsc '1'

View File

@@ -1,41 +0,0 @@
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config device 'lan_dev'
option name 'eth0.1'
option macaddr '$MACLAN'
config interface 'wan'
option type 'bridge'
option ifname 'eth0.2 eth0.1'
option proto 'dhcp'
option hostname 'Inteno-$BSSID4'
option reqopts '66 67 128 224'
option igmp_snooping '0'
config device 'wan_dev'
option name 'eth0.2'
option macaddr '$MACWAN'
config interface 'wan6'
option ifname '@wan'
option proto 'dhcpv6'
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '1'
option ports '1 6t'
config switch_vlan
option device 'switch0'
option vlan '2'
option ports '0 5t'

View File

@@ -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 '*'

View File

@@ -1,59 +0,0 @@
config wifi-status 'status'
option wlan '1'
option wps '1'
option sched_status '0'
option schedule '0'
config bandsteering 'bandsteering'
option enabled '0'
option policy '0'
config apsteering 'apsteering'
option enabled '0'
config wifi-device ra0
option band b
option channel auto
option bandwidth '20'
option hwmode auto
option htmode HT20
option country 'DE'
config wifi-iface
option device ra0
option network wan
option mode ap
option ssid Inteno-$BSSID4
option encryption psk2
option key $WPAKEY
option ifname ra0
option wps_pbc 1
config wifi-device rai0
option band a
option channel auto
option bandwidth '80'
option hwmode 11ac
option htmode VHT80
option country 'DE'
option beamforming 1
config wifi-iface
option device rai0
option network wan
option mode ap
option ssid Inteno-$BSSID4
option encryption psk2
option key $WPAKEY
option ifname rai0
option wps_pbc 1
config wifi-iface
option device ra0
option network wan
option mode wet
option ssid Inteno-$BSSID4
option encryption psk2
option key $WPAKEY
option ifname apcli0

View File

@@ -1,17 +0,0 @@
{
"description": [
{ "en" : "Repeater 5▴▾2.4&5" },
{ "sv" : "Repeater 5▴▾2.4&5" }
],
"explanation": [
{ "en" : "Your router is going to act as a wired extender or wireless repeater to the selected Wireless Access Point. Uplink 5G & Downlink 2.4G + 5G" },
{ "sv" : "Routern kommer att fungera som en trådbunden extender eller trådlös repeater till den valda trådlösa åtkomstpunkten. Uplink 5G & Downlink 2.4G + 5G" }
],
"excluded_boards" : [
"*G*",
"F*"
],
"uplink_band" : 'a',
"credentials" : 1,
"reboot" : 0
}

View File

@@ -1,41 +0,0 @@
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config device 'lan_dev'
option name 'eth0.1'
option macaddr '$MACLAN'
config interface 'wan'
option type 'bridge'
option ifname 'eth0.2 eth0.1'
option proto 'dhcp'
option hostname 'Inteno-$BSSID4'
option reqopts '66 67 128 224'
option igmp_snooping '0'
config device 'wan_dev'
option name 'eth0.2'
option macaddr '$MACWAN'
config interface 'wan6'
option ifname '@wan'
option proto 'dhcpv6'
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '1'
option ports '1 6t'
config switch_vlan
option device 'switch0'
option vlan '2'
option ports '0 5t'

View File

@@ -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 '*'

View File

@@ -1,59 +0,0 @@
config wifi-status 'status'
option wlan '1'
option wps '1'
option sched_status '0'
option schedule '0'
config bandsteering 'bandsteering'
option enabled '0'
option policy '0'
config apsteering 'apsteering'
option enabled '0'
config wifi-device ra0
option band b
option channel auto
option bandwidth '20'
option hwmode auto
option htmode HT20
option country 'DE'
config wifi-iface
option device ra0
option network wan
option mode ap
option ssid Inteno-$BSSID4
option encryption psk2
option key $WPAKEY
option ifname ra0
option wps_pbc 1
config wifi-device rai0
option band a
option channel auto
option bandwidth '80'
option hwmode 11ac
option htmode VHT80
option country 'DE'
option beamforming 1
config wifi-iface
option device rai0
option network wan
option mode ap
option ssid Inteno-$BSSID4
option encryption psk2
option key $WPAKEY
option ifname rai0
option wps_pbc 1
config wifi-iface
option device rai0
option network wan
option mode wet
option ssid Inteno-$BSSID4
option encryption psk2
option key $WPAKEY
option ifname apclii0

View File

@@ -7,9 +7,6 @@
{ "en" : "" },
{ "sv" : "" }
],
"excluded_boards" : [
"EX4*"
],
"credentials" : 0
}

View File

@@ -1,5 +1,5 @@
config settings 'settings'
option disabled '0'
config settings settings
option disabled 0
config defaults
option syn_flood 1

View File

@@ -0,0 +1,5 @@
config ethernet_interface 'Wan'
option baseifname '$WAN'
option ifname '$WAN.1'
option name 'WAN'

View File

@@ -0,0 +1,9 @@
config vdsl_interface
option unit '0'
option ifname 'ptm0.1'
option baseifname 'ptm0'
option name 'VDSL2'
option dslat '1'
option ptmprio '1'
option ipqos '1'

View File

@@ -4,13 +4,6 @@ config wifi-status 'status'
option sched_status '0'
option schedule '0'
config bandsteering 'bandsteering'
option enabled '0'
option policy '0'
config apsteering 'apsteering'
option enabled '0'
config wifi-device 'wl0'
option type 'broadcom'
option country 'EU/13'

View File

@@ -1,17 +0,0 @@
{
"description": [
{ "en" : "Fully Routed (NAT)" },
{ "sv" : "Fullt Omdirigerad (NAT)" }
],
"explanation": [
{ "en" : "" },
{ "sv" : "" }
],
"excluded_boards" : [
"*G*",
"F*"
],
"reboot" : 0,
"credentials" : 0
}

View File

@@ -1,22 +0,0 @@
config dnsmasq
option domainneeded 1
option boguspriv 1
option filterwin2k 0
option localise_queries 1
option rebind_protection 0
option rebind_localhost 1
option local '/lan/'
option domain 'lan'
option expandhosts 1
option nonegcache 0
option authoritative 1
option readethers 1
option leasefile '/tmp/dhcp.leases'
option resolvfile '/tmp/resolv.conf.auto'
config dhcp lan
option interface lan
option start 100
option limit 150
option leasetime 12h

View File

@@ -1,47 +0,0 @@
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'lan'
option type 'bridge'
option proto 'static'
option is_lan '1'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'
option ifname 'eth0.1 ra0 rai0'
config device 'lan_dev'
option name 'eth0.1'
option macaddr '$MACLAN'
config interface 'wan'
option ifname 'eth0.2'
option proto 'dhcp'
option reqopts '66 67 128 224'
config device 'wan_dev'
option name 'eth0.2'
option macaddr '$MACWAN'
config interface 'wan6'
option ifname '@wan'
option proto 'dhcpv6'
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '1'
option ports '1 6t'
config switch_vlan
option device 'switch0'
option vlan '2'
option ports '0 5t'

View File

@@ -1,48 +0,0 @@
config wifi-status 'status'
option wlan '1'
option wps '1'
option sched_status '0'
option schedule '0'
config bandsteering 'bandsteering'
option enabled '0'
option policy '0'
config apsteering 'apsteering'
option enabled '0'
config wifi-device ra0
option band b
option channel auto
option bandwidth '20'
option hwmode auto
option htmode HT20
option country 'DE'
config wifi-iface
option device ra0
option network lan
option mode ap
option ssid Inteno-$BSSID4
option encryption psk2
option key $WPAKEY
option wps_pbc 1
config wifi-device rai0
option band a
option channel auto
option bandwidth '80'
option hwmode 11ac
option htmode VHT80
option country 'DE'
option beamforming 1
config wifi-iface
option device rai0
option network lan
option mode ap
option ssid Inteno-$BSSID4
option encryption psk2
option key $WPAKEY
option wps_pbc 1

View File

@@ -1,56 +0,0 @@
#!/bin/sh
# receive new client events
# and trigger wificontrol in --router mode for that client
. /usr/share/libubox/jshn.sh
local action ipaddr macaddr network
timed_check() {
while true; do
network=${network:-lan}
ubus call repeater get_creds '{"network":"'$network'","file":"/tmp/wificontrol.txt"}'
wificontrol --router
sleep $1
done
}
is_inteno_macaddr()
{
macaddr=$1
echo $macaddr | grep -i -e "^00:22:07" \
-e "^02:22:07" \
-e "^44:D4:37" \
-e "^00:0C:07" \
-e "^02:0C:07" \
-e "^06:0C:07" \
-e "^00:0C:43" \
-e "^02:0C:43" \
-e "^06:0C:43" \
&& return
false
}
timed_check 60 &
while true ; do
ubus listen client | \
while read event ; do
#echo "netmode-client-detect got event: $event" >/dev/console
json_load "$event"
json_select client
json_get_var action action
[ "$action" == "connect" ] || continue
json_get_var macaddr macaddr
json_get_var ipaddr ipaddr
json_get_var network network "lan"
if is_inteno_macaddr $macaddr; then
echo "netmode-client-detect: a new Inteno device detected on '$network' network (MACAddr:$macaddr IPAddr:$ipaddr)" >/dev/console
ubus call repeater get_creds '{"network":"'$network'","file":"/tmp/wificontrol.txt"}'
/sbin/wificontrol --router --destination $ipaddr
fi
done
done

View File

@@ -1,288 +0,0 @@
#!/bin/sh
. /usr/share/libubox/jshn.sh
. /lib/functions.sh
state="exit"
TMPPATH="/tmp/netmode_config_backup"
CURMODE=""
SLEEPTIME=300
set_wireless_values() {
local iface_num="$1"
local ssid="$2"
local key="$3"
local encryption="$4"
local device="$5"
local old_ssid old_key old_encryption
if ! uci -q get wireless.@wifi-iface[$iface_num] >/dev/null 2>&1; then
state="reload"
uci add wireless wifi-iface >/dev/null 2>&1
uci set wireless.@wifi-iface[$iface_num].device="$device"
fi
local network="$(uci -q get wireless.@wifi-iface[$iface_num].network)"
old_ssid="$(uci -q get wireless.@wifi-iface[$iface_num].ssid)"
old_key="$(uci -q get wireless.@wifi-iface[$iface_num].key)"
old_encryption="$(uci -q get wireless.@wifi-iface[$iface_num].encryption)"
if [ "$old_ssid" != "$ssid" -o "$old_encryption" != "$encryption" -o "$old_key" != "$key" -o -z "$network" ]; then
#TODO: get network dynamicaly
[ "$state" == "exit" ] && state="apply"
[ -z "$network" ] && network="wan"
uci set wireless.@wifi-iface[$iface_num].network="$network"
uci set wireless.@wifi-iface[$iface_num].ssid="$ssid"
uci set wireless.@wifi-iface[$iface_num].key="$key"
uci set wireless.@wifi-iface[$iface_num].encryption="$encryption"
fi
}
get_wifi_device_from_band(){
local section="$1"
local band="$2"
local __ret="$3"
local b
config_get b $section "band"
if [ "$band" == "$b" ]; then
eval "export -- \"$__ret=$section\""
fi
}
get_device(){
local band="$1"
config_foreach get_wifi_device_from_band "wifi-device" "$band" "$2"
}
get_iface_num() {
local device="$1"
local prev="$2"
local __save="$3"
local i=0
local dev
while true; do
[ $i -gt 100 ] && break ## just a safty messure
if ! uci -q get wireless.@wifi-iface[$i] >/dev/null; then
break
fi
mode="$(uci -q get wireless.@wifi-iface[$i].mode)"
if [ "$mode" == "wet" -o "$mode" == "sta" ]; then
i=$((i+1))
continue
fi
dev="$(uci -q get wireless.@wifi-iface[$i].device)"
if [ "$dev" != "$device" ]; then
[ -z "$dev" ] && break
i=$((i+1))
elif [ $prev -ne 0 ]; then
i=$((i+1))
prev=$((prev-1))
else
break
fi
done
eval "export -- \"$__save=$i\""
}
restore() {
if [ "$1" == "back" ]; then
uci set juci.juci.homepage='netmode-wizard'
uci commit juci
cp $TMPPATH/* /etc/config/
uci set netmode.setup.curmode=$CURMODE
uci commit netmode
ubus call network reload
wifi reload
ubus call router.network reload
fi
rm -r $TMPPATH
ubus call leds set '{"state":"normal"}'
}
backup() {
mkdir -p $TMPPATH
cp /etc/config/* $TMPPATH/
CURMODE="$(uci -q get netmode.setup.curmode)"
ubus call leds set '{"state":"allflash"}'
}
###### START HERE #######
file="$1"
from_gui="$2"
[ -f "$file" ] || exit
# let netmode-handler up to 20 seconds to finish switching mode
for tm in 2 4 6 8; do
if [ ! -f /tmp/switching_mode ]; then
break
fi
sleep $tm
done
[ "$from_gui" == "true" ] && backup
json_load "`cat $file`"
json_select "wifi_ifaces"
local curmode repmode
config_load netmode
config_get curmode setup curmode
case $curmode in
*repeater*)
;;
*)
uci set netmode.setup.curmode="repeater"
uci commit netmode
/etc/init.d/netmode reload
curmode="$(uci -q get netmode.setup.curmode)"
;;
esac
local apcliband="a"
case $curmode in
*_2g_*) apcliband="b";;
esac
i=1
local dummy band ssid key encryption device iface_num
while json_get_var dummy $i; do
json_select $i
json_get_var band band
[ "$band" == "" -o "$apcliband" == "$band" ] && break
json_select ..
i=$((i+1))
done
[ "$apcliband" == "$band" -o "$band" == "" ] || {
[ "$from_gui" == "true" ] && restore "back"
exit
}
repeater_iface_num=$(uci -q show wireless | grep -e ".mode='wet'" -e ".mode='sta'" | sed 's/.*\[\([0-9]\)\].*/\1/')
[ -z "$repeater_iface_num" ] && {
[ "$from_gui" == "true" ] && restore "back"
exit
}
json_get_var ssid ssid
json_get_var key key
json_get_var encryption encryption
set_wireless_values "$repeater_iface_num" "$ssid" "$key" "$encryption"
json_load "`cat $file`"
json_select "wifi_ifaces"
config_load wireless
local b_num=0
local a_num=0
i=1
while json_get_var dummy $i; do
json_select $i
json_get_var band band
json_get_var ssid ssid
json_get_var encryption encryption
json_get_var key key
if [ "$band" == "" ]; then
get_device "a" device
get_iface_num "$device" "$a_num" iface_num
a_num=$((a_num+1))
[ -z $iface_num ] && {
[ "$from_gui" == "true" ] && restore "back"
exit
}
set_wireless_values "$iface_num" "$ssid" "$key" "$encryption" "$device"
get_device "b" device
get_iface_num "$device" "$b_num" iface_num
b_num=$((b_num+1))
[ -z $iface_num ] && {
[ "$from_gui" == "true" ] && restore "back"
exit
}
set_wireless_values "$iface_num" "$ssid" "$key" "$encryption" "$device"
else
get_device "$band" device
case $band in
a)
get_iface_num "$device" "$a_num" iface_num
a_num=$((a_num+1))
;;
b)
get_iface_num "$device" "$b_num" iface_num
b_num=$((b_num+1))
;;
esac
[ -z $iface_num ] && {
[ "$from_gui" == "true" ] && restore "back"
exit
}
set_wireless_values "$iface_num" "$ssid" "$key" "$encryption" "$device"
fi
i=$((i+1))
json_select ..
done
i=$((b_num + a_num + 1))
if [ $repeater_iface_num -gt $i ]; then
i=$((i-1))
fi
while uci -q get wireless.@wifi-iface[$i] >/dev/null; do
# if repeater_iface_num is greater than the number of
# configured downlink we need to make sure its not deleted
local mode="$(uci -q get wireless.@wifi-iface[$i].mode)"
if [ "$mode" == "wet" -o "$mode" == "sta" ]; then
i=$((i+1))
continue
fi
state="reload"
uci -q delete wireless.@wifi-iface[$i] >/dev/null
# do not increment i. The next interface will now
# have the same index as the deleted interface
done
uci commit wireless
if [ "$from_gui" == "true" ]; then
# check for connectivity
wifi reload
[ -f /etc/init.d/layer2_interface_ethernet -a -f /etc/config/layer2_interface_ethernet ] && /etc/init.d/layer2_interface_ethernet reload
i=$SLEEPTIME;
while [ $i -gt 0 ]; do
ip=`route -n | awk '/^0.0.0.0/{print $2}'`
if [ "$ip" == "" ]; then
i=$((i-10))
sleep 10
continue
fi
ping -w1 $ip
if [ $? -eq 0 ]; then
restore
exit
else
i=$((i-10))
sleep 9
fi
done
restore "back"
else
if [ "$state" == "exit" ]; then
return
fi
ubus call leds set '{"state":"allflash"}'
if [ "$state" == "apply" ]; then
# wifi apply
wifi reload
else
# wifi reload
wifi reload
fi
[ -f /etc/init.d/layer2_interface_ethernet -a -f /etc/config/layer2_interface_ethernet ] && /etc/init.d/layer2_interface_ethernet reload
ubus call leds set '{"state":"normal"}'
fi

View File

@@ -1,44 +0,0 @@
#!/bin/sh
local unlisted mac ipaddr netmask mask
mask_to_cidr() {
nbits=0
IFS=.
for dec in $1 ; do
case $dec in
255) let nbits+=8;;
254) let nbits+=7;;
252) let nbits+=6;;
248) let nbits+=5;;
240) let nbits+=4;;
224) let nbits+=3;;
192) let nbits+=2;;
128) let nbits+=1;;
0);;
*) echo "Error: $dec is not recognised"; exit 1
esac
done
echo "$nbits"
}
while true; do
unlisted=0
ps | grep -q wifi | grep -q reload || {
for mac in $(brctl showmacs br-wan 2>/dev/null | tail -n +2 | grep no | awk '{print$2}'); do
grep -q "$mac" /proc/net/arp || unlisted=$((unlisted+1))
done
ipaddr=$(ifconfig br-wan | grep -v inet6 | grep inet | tr ':' ' ' | awk '{print$3}')
netmask=$(ifconfig br-wan | grep -v inet6 | grep inet | tr ':' ' ' | awk '{print$7}')
mask=$(mask_to_cidr $netmask)
}
if [ $unlisted -gt 0 -a -n "$ipaddr" -a -n "$netmask" ]; then
fping -c 1 -t 1000 -g $ipaddr/$mask -q >/dev/null 2>&1
fi
sleep 20
done

View File

@@ -1,19 +0,0 @@
#!/bin/sh
MTK=0
[ "$(db -q get hw.board.hardware)" == "EX400" ] && MTK=1
if [ $MTK -eq 1 ]; then
WANDEV="eth0.2"
link=$(swconfig dev switch0 port 0 get link | awk '{print$2}' | cut -d':' -f2)
else
WANDEV="$(uci get layer2_interface_ethernet.Wan.ifname)"
link=$(cat /sys/class/net/${WANDEV:0:4}/operstate)
fi
[ "$link" == "up" ] && action=add
[ "$link" == "down" ] && action=remove
[ -z "$action" ] && exit
# trigger a fake hotplug net event
INTERFACE=$WANDEV ACTION=$action /sbin/hotplug-call net

View File

@@ -1,142 +0,0 @@
#!/bin/sh
. /usr/share/libubox/jshn.sh
. /lib/functions.sh
get_if_creds() {
local section=$1
local network=$2
local net dev ssid key encryption band
config_get net $section "network" "lan"
if [ "$net" == "$network" ]; then
config_get dev $section "device"
band="$(uci -q get wireless.$dev.band)"
config_get ssid $section ssid
config_get key $section key
config_get encryption $section encryption
config_get disabled $section disabled 0
echo "disabled for $band = $disabled" >>/tmp/dbg
[ $disabled -eq 1 ] && return
[ "$ssid" == "" -o "$band" == "" ] && return
json_add_object
json_add_string "ssid" "$ssid"
json_add_string "band" "$band"
json_add_string "key" "$key"
json_add_string "encryption" "$encryption"
json_close_object
fi
}
validate_file() {
local file="$1"
local real="$(readlink -f `dirname $file`)"
real="${real}/`basename $file`"
case "$real" in
/tmp/*)
touch $real && return 0 || return 1
;;
*)
return 1
;;
esac
}
write_error(){
json_init
json_add_string "status" "error: $1"
json_dump
exit 1
}
duplicate_if_single_radio() {
json_select "wifi-ifaces"
local i=1
local dummy band dup_band num_radios
num_radios="$(uci -q show wireless | grep wifi-device | wc -l)"
[ "$num_radios" == "2" ] && return
band="$(uci -q get wireless.@wifi-device[0].band)"
[ "$band" == "a" ] && dup_band="b"
[ "$band" == "b" ] && dup_band="a"
[ -z "$dup_band" ] && return
while json_get_var dummy $i; do
i=$((i+1))
done
i=$((i-1))
local ssid key encryption
while [ $i -gt 0 ]; do
json_select $i
json_get_var ssid ssid
json_get_var key key
json_get_var encryption encryption
json_select ..
json_add_object
json_add_string "ssid" "$ssid"
json_add_string "band" "$dup_band"
json_add_string "key" "$key"
json_add_string "encryption" "$encryption"
json_close_object
i=$((i-1))
done
}
case "$1" in
list)
echo '{ "get_creds": { "network": "str", "file": "str" }, "set_creds": { "file": "str", "from_gui": "str" } }'
;;
call)
case "$2" in
get_creds)
#TODO: if not routed exit
local curmode="$(uci -q get netmode.setup.curmode)"
case $curmode in
*repeater*) write_error "not in repeater mode";;
esac
local network file input
read input
json_load $input
json_get_var network network
json_get_var file file
json_init
json_add_array "wifi-ifaces"
config_load wireless
config_foreach get_if_creds "wifi-iface" "$network"
json_close_array
duplicate_if_single_radio
if [ "$file" == "" ]; then
json_dump
else
validate_file $file && json_dump -i >$file || write_error "invalid filename (\"$file\"), file must be in /tmp/ and in an existing directory"
fi
json_init
json_add_string "status" success
json_dump
;;
set_creds)
local file from_gui
read input
json_load "$input"
json_get_var file file
json_get_var from_gui from_gui
validate_file "$file" || write_error "invalid filename (\"$file\"), file must be in /tmp and exist"
json_load "`cat $file`" || write_error "invalid file content"
json_select "wifi_ifaces" || write_error "invalid file content"
json_init
json_add_string "status" success
json_dump
netmode-conf "$file" "$from_gui" >/dev/null 2>&1 &
;;
esac
;;
esac

View File

@@ -47,7 +47,7 @@ CONFIG_PACKAGE_juci-broadcom-ethernet=y
CONFIG_PACKAGE_juci-broadcom-iptv=y
CONFIG_PACKAGE_juci-broadcom-pwrmgmt=y
CONFIG_PACKAGE_juci-broadcom-vlan=y
CONFIG_PACKAGE_juci-wireless=y
CONFIG_PACKAGE_juci-broadcom-wl=y
CONFIG_PACKAGE_juci-broadcom-xdsl=y
CONFIG_PACKAGE_juci-ddns=y
CONFIG_PACKAGE_juci-diagnostics=y
@@ -56,11 +56,10 @@ CONFIG_PACKAGE_juci-dropbear=y
CONFIG_PACKAGE_juci-ethernet=y
CONFIG_PACKAGE_juci-event=y
CONFIG_PACKAGE_juci-firewall-fw3=y
CONFIG_PACKAGE_juci-ice-client=y
CONFIG_PACKAGE_juci-icwmp=y
CONFIG_PACKAGE_juci-igmpinfo=y
CONFIG_PACKAGE_juci-inteno-backup=y
CONFIG_PACKAGE_juci-mwan3=y
CONFIG_PACKAGE_juci-inteno-multiwan=y
CONFIG_PACKAGE_juci-inteno-provisioning=y
CONFIG_PACKAGE_juci-inteno-qos=y
CONFIG_PACKAGE_juci-inteno-voice-client=y
@@ -73,7 +72,6 @@ CONFIG_PACKAGE_juci-netmode=y
CONFIG_PACKAGE_juci-network-netifd=y
CONFIG_PACKAGE_juci-owsd=y
CONFIG_PACKAGE_juci-printer=y
CONFIG_PACKAGE_juci-realtime-graphs=y
CONFIG_PACKAGE_juci-samba=y
CONFIG_PACKAGE_juci-simple-gui=y
CONFIG_PACKAGE_juci-snmpd=y
@@ -102,7 +100,7 @@ CONFIG_PACKAGE_mtd-utils-deubinize=y
CONFIG_PACKAGE_mtd-utils-imagewrite=y
CONFIG_PACKAGE_mtd-utils-mkfs.jffs2=y
CONFIG_PACKAGE_mtd-utils-nanddump=y
CONFIG_PACKAGE_mwan3=y
CONFIG_PACKAGE_multiwan=y
CONFIG_PACKAGE_ndisc6=y
CONFIG_PACKAGE_ntfs-3g=y
CONFIG_PACKAGE_odhcp6c=y
@@ -116,7 +114,6 @@ CONFIG_PACKAGE_port-management=y
CONFIG_PACKAGE_power-management=y
CONFIG_PACKAGE_ppp-mod-pppoa=y
CONFIG_PACKAGE_ppp-mod-pppol2tp=y
CONFIG_PACKAGE_ppp-mod-pptp=y
CONFIG_PACKAGE_ppp-multilink=y
# CONFIG_PACKAGE_ppp is not set
CONFIG_PACKAGE_qos-scripts=y
@@ -139,7 +136,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
@@ -158,14 +154,6 @@ CONFIG_BUSYBOX_CONFIG_FEATURE_UDHCP_8021Q=y
CONFIG_BUSYBOX_CONFIG_FIRST_SYSTEM_ID=100
CONFIG_BUSYBOX_CONFIG_HTTPD=y
CONFIG_BUSYBOX_CONFIG_INSMOD=y
CONFIG_BUSYBOX_CONFIG_MODINFO=y
CONFIG_BUSYBOX_CONFIG_MODPROBE=y
CONFIG_BUSYBOX_CONFIG_FEATURE_MODPROBE_BLACKLIST=y
CONFIG_BUSYBOX_CONFIG_FEATURE_CHECK_TAINTED_MODULE=y
CONFIG_BUSYBOX_CONFIG_FEATURE_MODUTILS_ALIAS=y
CONFIG_BUSYBOX_CONFIG_FEATURE_MODUTILS_SYMBOLS=y
CONFIG_BUSYBOX_CONFIG_DEFAULT_MODULES_DIR="/lib/modules"
CONFIG_BUSYBOX_CONFIG_DEFAULT_DEPMOD_FILE="modules.dep"
CONFIG_BUSYBOX_CONFIG_LAST_SYSTEM_ID=999
CONFIG_BUSYBOX_CONFIG_LOGIN=y
CONFIG_BUSYBOX_CONFIG_LSMOD=y
@@ -197,7 +185,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
@@ -206,5 +193,3 @@ CONFIG_LIBCURL_CRYPTO_AUTH=y
CONFIG_OPENVPN_openssl_ENABLE_IPROUTE2=y
# CONFIG_SAMBA3_CONFIG_NO_PRINTING is not set
# CONFIG_SIGNED_PACKAGES is not set
CONFIG_KERNEL_DEVTMPFS=y
CONFIG_KERNEL_DEVTMPFS_MOUNT=y

View File

@@ -1,135 +1,88 @@
#!/bin/bash
function extract_core {
initial_commit=1427738ac4b77f474999ae21af1a8b916468df36
patch_dir=extract_core_patches
topdir=$(pwd)
# Intermediate repo for core packages
core_repo=git@public.inteno.se:iopsys-cc-core.git
# Paths to packages that should be exported.
paths+='package/network/services/samba36 '
paths+='package/network/services/dnsmasq '
paths+='package/network/services/dropbear '
paths+='package/network/services/odhcpd '
paths+='package/network/config/firewall '
paths+='package/network/config/netifd '
paths+='package/network/config/qos-scripts '
paths+='package/network/utils/iproute2 '
paths+='package/network/utils/curl '
paths+='package/utils/busybox '
# Repo to which core packages should be imported
import_repo=git@public.inteno.se:feed-inteno-openwrt.git
import_branch=openwrt-cc-core
function print_usage {
echo "Usage: $0 extract_core"
echo " -p <path-to-package> | default"
echo " -r <import-repo>"
echo " -b <import-branch>"
echo ""
echo "Example: $0 extract_core"
echo " -p package/utils/busybox"
echo " -r feeds/feed_inteno_openwrt"
echo " -b devel"
}
function orphan_branch {
local branch=$1
function export_core {
git checkout --orphan $branch
git rm -rf --cached *
git rm -rf --cached .empty
rm -rf *
rm -rf .empty
}
local path=$1
function export_core {
local path=$1
echo "Extracting ${path} from core to ${import_repo}:${import_branch}"
# Generate patches from start of openwrt repo.
mkdir -p $patch_dir
repo=$(basename $path)
dir=$(dirname $path)
git format-patch $initial_commit $path -o $patch_dir
# Remove dirname from patches to commit the packages to the
# top directory in the destination repo.
ls $patch_dir | while read line; do
sdir=$(echo "$dir/" | sed 's/\//\\\//g')
sed -i "s/$sdir//g" $patch_dir/$line
done
cd $import_repo
if [ -n "$(git rev-parse -q --verify remotes/origin/$repo)" ]; then
# Create temporary branch to apply patches on.
# We need to do this as git am does not like it
# when patches have already been applied.
orphan_branch tmp
git am $topdir/$patch_dir/*
# Rebase and merge.
git rebase origin/$repo
git checkout --track -b $repo origin/$repo
git merge tmp
git br -d tmp
else
# Remote branch does not exist for packet so create it.
orphan_branch $repo
git am $topdir/$patch_dir/*
fi
git push origin $repo
# Merge the package branch into the main branch.
git checkout $import_branch
git merge $repo -m "Syncing $repo"
git push origin $import_branch
git br -d $repo
rm -rf $topdir/$patch_dir
cd $topdir
}
# Execute user command
while getopts "p:r:b:h" opt; do
case $opt in
p)
export_path=${OPTARG}
;;
r)
import_repo=${OPTARG}
;;
b)
import_branch=${OPTARG}
;;
h)
print_usage
exit 1
;;
\?)
print_usage
exit 1
;;
esac
done
if [ ! -n "$export_path" ] || [ ! -n "$import_repo" ] || [ ! -n "$import_branch" ]; then
print_usage
exit 1
fi
if [ "$export_path" == "default" ]; then
echo "Extracting default packages:"
for p in $paths; do
export_core $p
done
else
export_core $export_path
fi
exit 0
# export paths to their own branches in an intermediate repo
repo=$(basename $path)
git subtree push -q --prefix=$path $core_repo $repo
}
register_command "extract_core" "Extract core package to separate feed"
function update_core {
local path=$1
if [ ! -d $topdir/feeds/feed_inteno_openwrt ]; then
echo "You need to run ./iop feeds_update"
exit -1
fi
# ensure that we are synced with the remote
cd $topdir/feeds/feed_inteno_openwrt
git checkout $import_branch
git pull
# first install subtrees if they don't already exist
repo=$(basename $path)
git subtree add --prefix=$repo $core_repo $repo
# install subtrees in feed from intermediate repo
repo=$(basename $path)
echo "Exporting $repo"
git subtree pull -q -m "Exporting $repo" --prefix=$repo $core_repo $repo
# update import repo sync branch
git push origin $import_branch
}
function display_help {
echo "Usage: ./iop export_core -e path/to/package"
}
function extract_core {
# Dir of script location
topdir=$(pwd)
if [ $# -eq 0 ]; then
display_help
exit -1
fi
# Execute user command
while getopts "he:" opt; do
case $opt in
e)
path=${OPTARG}
echo "Extracting ${path} from core to ${import_repo}:${import_branch}"
export_core $path
update_core $path
;;
h)
display_help
exit 0
;;
\?)
display_help
exit -1
;;
esac
done
}
register_command "extract_core" "Extract core package to feeds_inteno_openwrt"

View File

@@ -24,7 +24,6 @@ function feeds_update {
else
./scripts/feeds update
fi
./scripts/feeds update -ai
# replace core packages with iopsys versions
if [ $override == 1 ]; then
@@ -35,8 +34,7 @@ function feeds_update {
./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
./scripts/feeds install -p feed_inteno_targets iopsys-realtek
# install all packages
./scripts/feeds install -a

View File

@@ -1,368 +1,297 @@
#!/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"
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 f104w f104 dg400prime dg400primeb 963138REF_P502"
iopsys_ramips="ex400"
iopsys_realtek="rtl8685g"
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 eg400"
iopsys_ramips="ex400"
ramips="mt7621"
target="bogus"
masterconfig=1
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"
return
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"
return
fi
done
for p in $iopsys_ramips; do
if [ $p == $profile ]; then
target="iopsys_ramips"
return
fi
done
for p in $iopsys_realtek; do
if [ $p == $profile ]; then
target="iopsys_realtek"
return
fi
if [ $p == $profile ]; then
target="iopsys_ramips"
return
fi
done
for p in $ramips; do
if [ $p == $profile ]; then
target="ramips"
masterconfig=0
return
fi
if [ $p == $profile ]; then
target="ramips"
masterconfig=0
return
fi
done
}
git remote -v | grep -q http || {
DEVELOPER=1
bcmAllowed=0
iceAllowed=0
endptAllowed=0
natalieAllowed=0
mediatekAllowed=0
allowedRepos="$(ssh -o ConnectTimeout=5 git@private.inteno.se 2>/dev/null | grep -w 'R\|W' | awk '{print$NF}')"
for repo in $allowedRepos; do
case $repo in
bcmkernel) bcmAllowed=1 ;;
ice-client) iceAllowed=1 ;;
endptcfg) endptAllowed=1 ;;
natalie-dect*) natalieAllowed=1 ;;
linux) mediatekAllowed=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 | grep -v juci-theme)"
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 "$ALL" == 1 ]; then
for customer in $customers; do
echo $customer
local boards="$(ls -1 $CUSTCONF/$customer | grep -v common | grep -v juci-theme)"
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
}
}
generate_config()
{
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
}
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
}
use_local_mirror()
{
if wget -T 3 -t 2 -O /dev/null $LOCAL_MIRROR >/dev/null 2>/dev/null
then
echo "mirror [$LOCAL_MIRROR] exists. Using local mirror"
sed -i "s;CONFIG_LOCALMIRROR=.*;CONFIG_LOCALMIRROR=\"$LOCAL_MIRROR\";" .config
else
echo "mirror [$LOCAL_MIRROR] does not exist. Not using local mirror"
fi
}
generate_config()
{
DIFFFILE="$1"
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 ssh -o ConnectTimeout=5 git@private.inteno.se 2>/dev/null | grep -qw ${CUSTREPO:22}; 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
else
echo "You do not have access to $CUSTREPO"
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
# Add target diff
local target_name=$(echo $target | sed 's/_/-/g')
local target_conf=target/linux/${target_name}/config
if [ -f $target_conf ]; then
cat $target_conf >> .config
fi
# Apply profile diff to master config if selected
if [ -n "$PROFILE" ]; then
if [ -e "$CONFIGPATH/$PROFILE.diff" ]; then
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 ?
echo "CONFIG_DEVEL=y" >>.config
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
[ $mediatekAllowed -eq 0 ] && echo "CONFIG_MEDIATEK_OPEN=y" >> .config
else
echo "CONFIG_GITMIRROR_REWRITE=n" >>.config
echo "CONFIG_BCM_OPEN=y" >> .config
echo "CONFIG_ICE_OPEN=y" >> .config
echo "CONFIG_ENDPT_OPEN=y" >> .config
echo "CONFIG_NATALIE_OPEN=y" >> .config
echo "CONFIG_MEDIATEK_OPEN=y" >> .config
fi
# Force regeneration of themes
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
# we need to signal to bradcom SDK that we have changed the board id
# currently boardparms.c and boardparms_voice.c is the only place that is depending on inteno boardid name
# so just touch that file.
[ -d ./build_dir ] && find build_dir/ -name "boardparms*c" -print0 2>/dev/null | xargs -0 touch 2>/dev/null
# Set default values based on selected parameters
v "$(make defconfig 2>&1)"
# 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
# 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 "$BOARDTYPE $CUSTOMER" > .current_config_file
# Add customerconfig diff if a customer is selected
if [ -n "$CUSTOMER" ]; then
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_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
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;;
-r|--repo) export CUSTREPO="$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
CUSTREPO="${CUSTREPO:-git@private.inteno.se:customerconfigs}"
setup_dirs
create_and_copy_files "$1" "$2"
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 kernel Makefile
# Needed to disable kmods for iopsys-brcm targets
touch package/kernel/linux/Makefile
# 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
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
make package/base-files/clean
}
####### 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"
if [ $masterconfig -eq 1 ]; then
use_local_mirror
fi
fi
}
register_command "genconfig" "Generate configuration for board and customer"

View File

@@ -2,16 +2,15 @@
build_bcmkernel_consumer() {
local tarfile bcmkernelcommith sdkversion
sdkversion=$(grep "CONFIG_BRCM_SDK_VER.*=y" .config | awk -F'[_,=]' '{print$5}')
local tarfile bcmkernelcommith
bcmkernelcommith=$(grep -w "PKG_SOURCE_VERSION:" $curdir/feeds/feed_inteno_broadcom/bcmkernel/$sdkversion.mk | cut -d'=' -f2)
# do not build bcmopen sdk if it was already built before
ssh $SERVER "ls $FPATH/bcmopen-$board-$bcmkernelcommith.tar.gz" && return
ssh $SERVER "ls $FPATH/bcmopen-$profile-$bcmkernelcommith.tar.gz" && return
cd ./build_dir/target-*_uClibc-0.9.33.*/bcmkernel-3.4-$sdkversion/bcm963xx/release
sh do_consumer_release -p $profile -y
tarfile='out/bcm963xx_*_consumer.tar.gz'
[ $(ls -1 $tarfile |wc -l) -ne 1 ] && echo "Too many tar files: '$tarfile'" && return
scp $tarfile $SERVER:$FPATH/bcmopen-$board-$bcmkernelcommith.tar.gz
scp $tarfile $SERVER:$FPATH/bcmopen-$profile-$bcmkernelcommith.tar.gz
rm -f $tarfile
cd $curdir
}
@@ -59,48 +58,15 @@ build_ice_consumer() {
icebasever=$(grep -w "BASE_PKG_VERSION:" ./feeds/feed_inteno_packages/ice-client/Makefile | cut -d'=' -f2)
icerelease=$(grep -w "PKG_RELEASE:" ./feeds/feed_inteno_packages/ice-client/Makefile | cut -d'=' -f2)
iceversion=$icebasever$icerelease
ssh $SERVER "ls $FPATH/ice-client-$target-$iceversion-$icecommith.tar.gz" && return
cd ./build_dir/target-*_uClibc-0.9.33.*/ice-client-$icebasever/ipkg-* || cd ./build_dir/target-mips*musl-*/ice-client-$icebasever/ipkg-*
tar -czv ice-client -f ice-client-$target-$iceversion-$icecommith.tar.gz
scp ice-client-$target-$iceversion-$icecommith.tar.gz $SERVER:$FPATH/
cp ice-client-$target-$iceversion-$icecommith.tar.gz $curdir/
rm -f ice-client-$target-$iceversion-$icecommith.tar.gz
ssh $SERVER "ls $FPATH/ice-client-$profile-$iceversion-$icecommith.tar.gz" && return
cd ./build_dir/target-*_uClibc-0.9.33.*/ice-client-$icebasever/ipkg-*
tar -czv ice-client -f ice-client-$profile-$iceversion-$icecommith.tar.gz
scp ice-client-$profile-$iceversion-$icecommith.tar.gz $SERVER:$FPATH/
cp ice-client-$profile-$iceversion-$icecommith.tar.gz $curdir/
rm -f ice-client-$profile-$iceversion-$icecommith.tar.gz
cd $curdir
}
build_mediatek_kernel() {
local mediatek_commit kernel_version kernel
mediatek_commit=$(grep CONFIG_KERNEL_GIT_COMMIT .config | cut -d '=' -f2 | tr -d '"')
kernel_version=$(grep KERNEL_PATCHVER target/linux/iopsys-ramips/Makefile | cut -d '=' -f2)
kernel=linux-${kernel_version}.*
ssh $SERVER "ls $FPATH/mediatek-kernel-open-$mediatek_commit.tar.gz" && return
echo "Building mediatek kernel tarball from kernel commit:"
echo $mediatek_commit
cd build_dir/target-mipsel_1004kc*/linux-iopsys-ramips_*/$kernel
# Save Kconfig files to recreate the same kernel config,
# delete everyting else.
find drivers/net/wireless/mt_wifi -type f ! -name Kconfig | xargs rm
find drivers/net/wireless/rlt_wifi -type f ! -name Kconfig | xargs rm
# remove git repo
rm -rf .git
# patch kernel for openstk
ls consumer_release | while read line; do patch -p1 < consumer_release/$line; done
cd ..
tar -czv $kernel -f mediatek-kernel-open-$mediatek_commit.tar.gz
scp mediatek-kernel-open-$mediatek_commit.tar.gz $SERVER:$FPATH/
cd $curdir
}
function print_usage {
echo "Usage: $0 generate_tarballs"
echo " -t <target>"
}
function generate_tarballs {
SERVER="god@software.inteno.se"
@@ -108,47 +74,14 @@ function generate_tarballs {
git remote -v | grep -q http && return # do not continue if this is an open SDK environment
target=$(grep CONFIG_TARGET_BOARD .config | cut -d'=' -f2 | tr -d '"')
board=$(grep CONFIG_TARGET_IBOARDID .config | cut -d'=' -f2 | tr -d '"')
profile=$(grep CONFIG_BCM_KERNEL_PROFILE .config | cut -d'=' -f2 | tr -d '"')
sdkversion=$(grep "CONFIG_BRCM_SDK_VER.*=y" .config | awk -F'[_,=]' '{print$5}')
curdir=$(pwd)
# Execute user command
while getopts "t:h" opt; do
case $opt in
t)
stk_target=${OPTARG}
;;
h)
print_usage
exit 1
;;
\?)
print_usage
exit 1
;;
esac
done
if [ ! -n "$stk_target" ]; then
print_usage
exit 1
fi
if [ "$stk_target" == "broadcom" ]; then
build_bcmkernel_consumer
build_natalie_consumer
build_endptcfg_consumer
build_ice_consumer
elif [ "$stk_target" == "mediatek" ]; then
build_mediatek_kernel
build_ice_consumer
else
echo "Invalid target: $stk_target"
print_usage
exit 1
fi
build_bcmkernel_consumer
build_natalie_consumer
build_endptcfg_consumer
build_ice_consumer
}

View File

@@ -34,7 +34,7 @@ function ssh_sysupgrade_latest {
exit 1
fi
{ cd `dirname $0`
IMAGE=`ls -Art bin/*/*.y[23] | tail -n1`
IMAGE=`ls -Art bin/*/*.y2 | tail -n1`
[ "$IMAGE" ] && [ -e "$IMAGE" ] && ./iop ssh_sysupgrade $1 $IMAGE $2
}
}

View File

@@ -1,5 +1,6 @@
#!/bin/bash
print_git_update()
{
echo "pkg -> ${PKG_NAME}"
@@ -98,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()
@@ -394,16 +373,12 @@ insert_hash_in_feeds_config()
check_packages()
{
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
echo "Now checking if any changes have been done to the packages."
echo "Now checking if any changes has been done to the packages."
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
# only scan in the build directory that is currently in use.
CPU=$(grep "CONFIG_CPU_TYPE=" .config| cut -f2 -d\")
LIBC=$(grep "CONFIG_LIBC=" .config| cut -f2 -d\")
# First scan all files in build dir for packages that have .git directories.
all_pkgs=$(find build_dir/*${CPU}*${LIBC}* -name ".git")
all_pkgs=$(find build_dir/ -name ".git")
for pkg in `echo "$all_pkgs"`
do
pkg=$(dirname $pkg)
@@ -425,7 +400,6 @@ check_packages()
# print_git_update
git_repos_uptodate
insert_hash_in_feed_makefile
[ ${UPDATE} -eq 1 ] && insert_version_in_feed_makefile
create_message >tmp/msg
commit_feed tmp/msg
insert_hash_in_feeds_config
@@ -489,7 +463,7 @@ Date: %ai%n\
check_feeds()
{
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
echo "Now checking if any changes have been done to the feeds."
echo "Now checking if any changes has been done to the feeds."
echo -e "${Green}_______________________________________________________________________________${Color_Off}"
feeds=$(grep -v "^#" feeds.conf| awk '{print $2}')
@@ -536,7 +510,7 @@ check_feeds()
read answer
case $answer in
n|N|'')
n|N)
continue;;
esac
branch_uptodate feeds/${feed}
@@ -573,19 +547,10 @@ 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 {
UPDATE=0
Color_Off='\033[0m' # Text Reset
# Regular Colors
@@ -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

View File

@@ -21,7 +21,7 @@ define Package/iup
endef
define Package/iup/description
This package contains Inteno's IUP Client
This package contains Intenos IUP Client
endef
define Build/Compile

View File

@@ -31,16 +31,19 @@ management_interfaces() {
}
init_iup() {
local polling_enabled
local interval
local starttime
local nummber
number=$RANDOM
[ -f $CRONPATH ] || touch $CRONPATH
if [ -f $CRONPATH ]; then
echo "File $CRONPATH exists"
else
echo "File $CRONPATH did not exists"
touch $CRONPATH
fi
config_load provisioning
config_get polling_enabled polling enabled on
config_get interval polling interval
config_get starttime polling starttime
@@ -51,12 +54,12 @@ init_iup() {
local newreqopts=
local baseopts=
local reqopts="$(uci -q get network.$net.reqopts)"
local iupopts="66 67 128 224 225 226"
local iupopts="66 67 128 224"
local ropt iopt
config_get enabled iup enabled "on"
for ropt in $reqopts; do
case $ropt in
66|67|128|224|225|226) ;;
66|67|128|224) ;;
*) baseopts="$baseopts $ropt" ;;
esac
done
@@ -64,7 +67,7 @@ init_iup() {
reqopts="$baseopts $iupopts"
for ropt in $reqopts; do
case $ropt in
66|67|128|224|225|226) [ $enabled == "on" ] && newreqopts="$newreqopts $ropt" ;;
66|67|128|224) [ $enabled == "on" ] && newreqopts="$newreqopts $ropt" ;;
*) newreqopts="$newreqopts $ropt" ;;
esac
done
@@ -79,18 +82,8 @@ init_iup() {
ubus call network reload
#################################################################
if [ $polling_enabled == "off" ]; then
sed -i "/\/sbin\/iup/d" $CRONPATH
logger -s -t /etc/init.d/iup[$$] "Provisioning polling unscheduled" 2>/dev/console
return
fi
local log_hour=$starttime
local log_minute
local log_interval=$interval
if [ $interval == "weekly" ]; then
interval="0"
log_interval="$log_interval/sunday"
elif [ $interval == "hourly" ]; then
interval='*'
starttime='*'
@@ -98,7 +91,9 @@ init_iup() {
interval='*'
fi
let "number %= $RANGE"
if ! grep -q "$starttime \* \* \\$interval /sbin/iup" "$CRONPATH" ; then
if grep -q "$starttime \* \* \\$interval /sbin/iup" "$CRONPATH" ; then
echo "IUP is scheduled $starttime \* \* \\$interval "
else
if grep -q "iup" "$CRONPATH" ; then
sed -i "/iup/d" $CRONPATH
fi
@@ -106,14 +101,15 @@ init_iup() {
fsync $CRONPATH
/etc/init.d/cron restart
fi
log_minute=$(awk '/\/sbin\/iup/ {print $1}' /etc/crontabs/root)
logger -s -t /etc/init.d/iup[$$] "Provisioning is scheduled at $log_hour:$log_minute $log_interval" 2>/dev/console
}
start_service() {
init_iup
/sbin/iup -v &
test_default_route
if [ "$?" -eq 0 ]; then
/sbin/iup -v &
fi
}
stop_service() {

View File

@@ -4,7 +4,6 @@ echo $$ > /var/run/iup.pid
. /lib/functions.sh
. /lib/functions/network.sh
. /lib/functions/savecfg.sh
. /usr/share/libubox/jshn.sh
include /lib/upgrade
@@ -17,44 +16,38 @@ export IUPTEMP="/tmp/iup"
export INTERACTIVE=0
export VERBOSE=0
export CONF=1
export DESKEY=
export MAC=
export DESKEY=$(cat /proc/nvram/DesKey | tr -d '\n' | hexdump -e '16/1 "%02x"')
export MAC=$(cat /proc/nvram/BaseMacAddr)
export RANGE=10
export RETRYSTOP=5
export SLEEP=10
#remove whitespace
MAC=${MAC// /}
#lower to upper Conversion
MAC=$(echo $MAC | tr '[a-z]' '[A-Z]')
local sysinfo=$(ubus call router.system info)
json_load "$sysinfo"
json_select system
json_get_var MAC basemac
json_select ..
json_select keys
json_get_var DESKEY des
json_select ..
# MAC lowercase to uppercase and remove ':'
MAC=$(echo $MAC | tr '[a-z]' '[A-Z]' | tr -d ':')
# Convert DESKEY to HEX format
DESKEY=$(echo $DESKEY | tr -d '\n' | hexdump -e '16/1 "%02x"')
# no verbose: no output
# -v log to system log
# -v -v log to system log and console
# -v -v -v log to system log, console and stderr
v() {
[ "$VERBOSE" -eq 0 ] && return
[ "$VERBOSE" -eq 1 ] && logger -t $0[$$] "$@" && return
[ "$VERBOSE" -eq 2 ] && logger -s -t $0[$$] "$@" >/dev/console 2>&1 && return
[ "$VERBOSE" -eq 3 ] && logger -s -t $0[$$] "$@" 2>&1 | tee /dev/console && return
[ "$VERBOSE" -ge 1 ] && logger -t iup "$@"
}
vv() {
VERBOSE="$(($VERBOSE + 1))"
v "$@"
VERBOSE="$(($VERBOSE - 1))"
if [ -f $IUPMD5 ]; then
v "File $IUPMD5 exists"
else
v "File $IUPMD5 did not exists"
touch $IUPMD5
fi
handle_ucitrack()
{
local config="$1"
config_get init "$config" init
echo $init
config_get affects "$config" affects
for aff in $affects
do
config_foreach handle_ucitrack $aff
done
}
get_packages()
@@ -68,34 +61,35 @@ get_packages()
reload ()
{
local reload
local initlist
local reload
local pack
pack=$(get_packages $1)
v "Calling ubus call uci commit for $pack"
config_load ucitrack
for packname in $pack
do
ubus call uci commit '{"config":"'$packname'"}'
sleep 1
initlist=$(config_foreach handle_ucitrack $packname)
for reltest in $initlist
do
case $reload in
*" $reltest "*) v "already added to reload $reltest" ;;
*) reload="$reload"" ""$reltest" ;;
esac
done
done
}
save_usercfg()
{
savecfg_save_config fw_redirect fw_parental wifi
}
apply_usercfg()
{
# decide to save the user changes based on keepuserconfig received through provisioning
local keep
config_load provisioning
config_get_bool keep configserver keepuserconfig "0"
v "apply_usercfg(): keepuserconfig = $keep"
if [ "$keep" != "1" ] ; then
savecfg_rm_files
return
v "Init scripts to be run $reload"
for inittoreload in $reload
do
if [ "$inittoreload" != "iup" ]; then
/etc/init.d/$inittoreload restart
fi
done
#Ugly hack need to figure out something here
test_default_route
if [ "$?" -eq 1 ]; then
sleep 5
fi
savecfg_apply_config fw_redirect fw_parental wifi
}
handle_provisioning() {
@@ -123,15 +117,15 @@ handle_provisioning() {
config_get deckey "$config" deckey
if [ "$enabled" -eq 1 ]; then
if [ "$config" == "iup" ]; then
v "Using url received in dhcp options"
v "using url from dhcp options"
config_get url "$config" urliup
else
else
config_get url "$config" url
fi
url=${url//\$MAC/$MAC}
v "Downloading from url \"$url\""
while [ $retry -le $RETRYSTOP ]
v "Download from $url"
while [ $retry -le $RETRYSTOP ]
do
if [ ${url%%:*} == "tftp" ]; then
tftpfile=${url#*\/\/}
@@ -143,17 +137,17 @@ handle_provisioning() {
get_image "$url" "cat" > $IUPCONFFILES
fi
if [ -s $IUPCONFFILES ]; then
v "Download finished"
v "File Downloaded"
retry=$((RETRYSTOP + 1))
else
v "Download failed, retrying in $incsleep seconds"
else
v "Download failed will try again in $incsleep sec"
sleep $incsleep
incsleep=$((incsleep * retry + number))
retry=$((retry+1))
fi
done
fi
if [ ! -s "$IUPCONFFILES" ] && [ "$enabled" -eq 1 ]; then
if [ ! -s "$IUPCONFFILES" ]; then
echo "File not Found"
reboot="off"
CONF=0
@@ -169,44 +163,41 @@ handle_Downloaded_file()
[ -n "$1" ] && DECKEY=$(echo $1 | tr -d '\n' | hexdump -e '16/1 "%02x"')
KEY=${DECKEY:-$DESKEY}
local img_type
case "$(get_image_type "$IUPCONFFILES")" in
"INTENO") img_type=2 ;;
"CFE+FS") img_type=1 ;;
"FS") img_type=0 ;;
*) img_type="UNKNOWN";;
esac
case "$(get_image_type "$IUPCONFFILES")" in
"INTENO") img_type=2 ;;
"CFE+FS") img_type=1 ;;
"FS") img_type=0 ;;
*) img_type="UNKNOWN";;
esac
if [ "$img_type" == "UNKNOWN" ] ; then
case "$(hexdump -v -n 2 -e '1/1 "%02x"' $IUPCONFFILES)" in
1f8b)
v "Downloaded file is an unencrypted config"
v "Found Config"
md5=$(md5sum $IUPCONFFILES)
md5="${md5%% *}" # remove the first space and everything after it
md5sum "$IUPCONFFILES" >> "$IUPMD5.temp"
if grep -q "$md5" "$IUPMD5"; then
v "Config is already up to date, nothing to do"
#because config is up to date we need to disable last step reboot if set
v "Config Already Up to Date"
#becuse config is up to date we need to disable last step reboot if set
reboot="off"
rm -rf $IUPTEMP
else
save_usercfg
cd $IUPTEMP
cd /tmp/iup/
tar xvzf $IUPCONFFILES
for f in $CONFILESLURP
do
v "File to be applied $f and config $(cat $f)"
uci -f $f import
v "file to be applied $f and config $(cat $f)"
uci import -f $f
done
pack=$(get_packages $CONFILESLURP)
v "Packages to be commited: $pack"
v "$pack packages to be commited"
for packname in $pack
do
uci commit $packname
done
apply_usercfg
reboot=`uci -q get provisioning.configserver.reboot`
if [ "$reboot" != "on" ]; then
sync
reload $CONFILESLURP
fi
rm -rf $IUPTEMP
@@ -216,11 +207,11 @@ handle_Downloaded_file()
fi
;;
*)
v "Downloaded file is an encrypted config"
v "encrypted"
if [ $KEY ]; then
openssl enc -d -des-ede -nosalt -K $KEY -iv "0000000000000000" -in $IUPCONFFILES -out $IUPCONFFILES.tmp
if [ $? -eq 0 ]; then
v "Decryption successful"
v "Decrypted Content"
mv $IUPCONFFILES.tmp $IUPCONFFILES
handle_Downloaded_file
else
@@ -236,12 +227,11 @@ handle_Downloaded_file()
;;
esac
else
v "Downloaded file is a firmware, will start reflashing"
v "Image found will start flashing"
if [ "$defaultreset" -eq 1 ]; then
v "Not saving configuration over reflash"
v "nuke config"
/sbin/sysupgrade -v -n $IUPCONFFILES
else
v "Saving configuration over reflash"
/sbin/sysupgrade -v $IUPCONFFILES
fi
fi
@@ -263,7 +253,7 @@ change_to_vlan() {
# bring down old interface/device.
ifdown "${base_dev}"
v "option 132: bringing down old if: ${base_dev}"
logger -t dhcp_opt132 "bringing down old if: ${base_dev}"
# extract base name of device.
base_dev=$(echo ${base_dev} | cut -d. -f1)
@@ -277,15 +267,15 @@ change_to_vlan() {
uci set layer2_interface_vlan.@vlan_interface[-1].baseifname=${base_dev}
# and commit the change.
uci commit layer2_interface_vlan
v "option 132: committed update to file layer2_interface_vlan"
logger -t dhcp_opt132 "committed update to file layer2_interface_vlan"
# reload configuration files.
/etc/init.d/layer2_interface_vlan reload
v "option 132: reload layer2_interface_vlan config"
logger -t dhcp_opt132 "reload layer2_interface_vlan config"
# replace old interface (like eth0.1 with new eth0.101).
wan_if=$(uci get network.$3.ifname)
v "option 132: old network.${3}.ifname: $wan_if"
logger -t dhcp_opt132 "old network.${3}.ifname: $wan_if"
# loop through the string, remove any word close to "base_dev".
for word in ${wan_if}; do
@@ -303,12 +293,10 @@ change_to_vlan() {
uci set network.wan.ifname="${new_wan_if}"
# and commit the change.
uci commit network
v "option 132: committed update to file network: ifname=${new_wan_if}"
logger -t dhcp_opt132 "committed update to file network: ifname=${new_wan_if}"
# reboot into new if configuration.
vv "Rebooting"
export REBOOT_REASON=iup
/sbin/reboot
reboot
}
handle_option224()
@@ -359,65 +347,67 @@ handle_option224()
softwareminuspath=${url##*/}
if [ $url ] && [ $active -eq 1 ]; then
v "Software version to download \"$softwareminuspath\""
echo "Software version to download $softwareminuspath"
local sysinfo=$(ubus call router.system info)
json_load "$sysinfo"
json_select system
json_get_var firmware firmware
local firmware_new=${softwareminuspath%.*} # remove extension (.w, .y or .y2) from filename
if [ "$firmware_new" != "$firmware" ] ; then
v "Firmware found $url will start flashing"
v "Currently running firmware: \"$firmware\""
v "Newly received firmware: \"$firmware_new\""
echo "Image found $url will start flashing"
wait_for_dns $url
v "Start flashing"
/sbin/sysupgrade -v $url &
return 1
else
v "Firmware is up to date, nothing to do"
echo "Will not update software, already up to date"
return 0
fi
fi
}
### MAIN ###
while [ -n "$1" ]; do
case "$1" in
-v) export VERBOSE="$(($VERBOSE + 1))";;
-q) export VERBOSE="$(($VERBOSE - 1))";;
-*)
echo "Invalid option: $1"
exit 1
;;
*) break;;
esac
shift;
done
parse_dhcp_options()
{
local the_json="$@"
# Process IUP related DHCP options #
local privopt224 privopt225 privopt226 vendorspecinf httpurl128
# Process IUP related DHCP options #
if [ -n "$1" ]; then
local privopt224 vendorspecinf httpurl128
local tftp bootfile vlanid vlanpriority interface
json_load "$the_json"
json_load "$1"
json_get_var interface interface
json_get_var privopt224 privopt224
json_get_var privopt225 privopt225
json_get_var privopt226 privopt226
json_get_var vendorspecinf vendorspecinf # option 43
json_get_var vendorspecinf vendorspecinf
json_get_var httpurl128 httpurl128
json_get_var tftp tftp # option 66
json_get_var bootfile bootfile #option 67
json_get_var vlanid vlanid # option 132
json_get_var vlanpriority vlanpriority # option 133
json_get_var tftp tftp
json_get_var bootfile bootfile
json_get_var vlanid vlanid
json_get_var vlanpriority vlanpriority
if [ $privopt224 ]; then
v "dhcp option 224 firmware url $privopt224"
echo "Option224 recived " $privopt224 > /dev/console
handle_option224 $privopt224
[ $? -eq 1 ] && exit
fi
if [ $vendorspecinf ]; then
v "dhcp option 43 tr69 url $vendorspecinf"
url=${vendorspecinf%%,*}; rest=${vendorspecinf#*,}
provisioningcode=${rest%%,*};
uci_set_state provisioning iup urlcwmp "$url"
uci_set_state provisioning iup url "$url"
uci_set_state provisioning iup provisioningcode "$provisioningcode"
elif [ $httpurl128 ]; then
v "dhcp option 128 http config url $httpurl128"
uci_set_state provisioning iup urliup "$httpurl128"
elif [ $tftp ]; then
v "dhcp option 66 tftp config url $tftp"
if [ ${bootfile:0:1} == '/' ]; then
uci_set_state provisioning iup urliup "tftp://$tftp$bootfile"
else
@@ -425,165 +415,70 @@ parse_dhcp_options()
fi
fi
# vlanid (and vlanpriority)
# if we get vlanid and maybe vlanpriority, configure for that.
if [ -n "$vlanid" -a -n "$vlanpriority" ]; then
v "dhcp option 132 vlanid: ${vlanid} vlanpriority: ${vlanpriority}"
logger -t dhcp_opt132 "vlanid: ${vlanid}, vlanpriority: ${vlanpriority}"
change_to_vlan ${vlanid} ${vlanpriority} ${interface}
elif [ -n "$vlanid" ]; then
v "dhcp option 132 vlanid: ${vlanid}"
logger -t dhcp_opt132 "vlanid: ${vlanid}"
change_to_vlan ${vlanid} 0 ${interface}
elif [ -n "$privopt225" ] || [ -n "$privopt226" ]; then
# opt225 and opt226 can be used together or separatly
if [ -n "$privopt225" ]; then
v "dhcp option 225: $privopt225"
# 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
v "dhcp option 226: $privopt226"
[ -z "$(uci get -q ice.dhcp)" ] && uci set ice.dhcp="dhcp"
uci set ice.dhcp.opt226connectionid="$privopt226"
ubus send dhcp.opt226connectionid '{"opt226connectionid":"","value":"'$privopt226'"}'
fi
uci commit
fi
}
# wait_for_default_gateway to become reachable
# return 0 if the default gateway is reachable
# return 1 if the default gateway is not reachable after $wait_time
wait_for_default_gateway()
{
local gateway
local device
local wait_time=120
local wait_interval=10
while [ true ] ; do
gateway=""
device=""
network_flush_cache
network_get_gateway gateway wan #true
network_get_device device wan
device="${device:+-I }$device"
if ping -q -w 1 -c 1 $device $gateway >/dev/null 2>&1 ; then
[ "$wait_time" -lt "60" ] && v "Default gateway $gateway is reachable"
sleep $wait_interval
return 0
fi
# try the nameservers too
for ns in $(grep nameserver /var/resolv.conf.auto | awk '{print $2}'); do
if ping -q -w 1 -c 1 $device $ns >/dev/null 2>&1 ; then
[ "$wait_time" -lt "60" ] && v "Name server $ns is reachable"
sleep $wait_interval
return 0
fi
done
v "Waiting for default gateway or name server. Countdown $wait_time seconds"
sleep $wait_interval
wait_time=$((wait_time - wait_interval))
[ "$wait_time" -le "0" ] && break # timer expired
done
return 1 # default gateway and name server are not reachable
}
main()
{
while [ -n "$1" ]; do
case "$1" in
-v) export VERBOSE="$(($VERBOSE + 1))";;
-q) export VERBOSE="$(($VERBOSE - 1))";;
--dhcp-options)
shift
parse_dhcp_options "$@"
exit 0
;;
-*)
echo "Invalid option: $1"
exit 1
;;
*) break;;
esac
shift;
done
if ! wait_for_default_gateway ; then
v "Neither default gateway nor name server are reachable. Aborting iup."
exit 1
fi
if [ ! -f $IUPMD5 ]; then
v "Creating file $IUPMD5"
touch $IUPMD5
fi
exit 0
fi
local iupurl
local configurl
local software
local sofwareminuspath
local iupurl
local configurl
local software
local sofwareminuspath
config_load provisioning
#check if iup should be used or if its overridden by /etc/config
config_get configurl configserver url
config_get reboot configserver reboot
config_get iupurl iup urliup
config_load provisioning
#check if iup should be used or if its overridden by /etc/config
config_get configurl configserver url
config_get reboot configserver reboot
config_get iupurl iup urliup
if [ $configurl ]; then
handle_provisioning configserver "0"
elif [ $iupurl ]; then
handle_provisioning iup "1"
else
v "No Provisioning Server Found"
exit
fi
if [ $configurl ]; then
handle_provisioning configserver "0"
elif [ $iupurl ]; then
handle_provisioning iup "1"
config_load provisioning
config_foreach handle_provisioning subconfig "0"
config_get software uppgradeserver url
sofwareminuspath=${software##*/}
v "Software version to download $sofwareminuspath"
if [ $software ]; then
local sysinfo=$(ubus call router.system info)
json_load "$sysinfo"
json_select system
json_get_var firmware firmware
json_get_var filesystem filesystem
if [ "$filesystem" == "JFFS2" ] ; then
firmware=$firmware.w
else
firmware=$firmware.y
fi
if [ "$sofwareminuspath" == "${sofwareminuspath/$firmware/}" ] ; then
echo $software
handle_provisioning uppgradeserver "0"
else
v "No provisioning server configured"
exit
v "Will not update software, already up to date"
fi
fi
config_load provisioning
config_foreach handle_provisioning subconfig "0"
config_get software uppgradeserver url
sofwareminuspath=${software##*/}
if [ $CONF -eq 1 ]; then
mv "$IUPMD5.temp" $IUPMD5
fi
if [ $software ]; then
v "Software version to download \"$sofwareminuspath\""
local sysinfo=$(ubus call router.system info)
json_load "$sysinfo"
json_select system
json_get_var firmware firmware
json_get_var filesystem filesystem
if [ "$filesystem" == "JFFS2" ] ; then
firmware=$firmware.w
else
firmware=$firmware.y
fi
if [ "$sofwareminuspath" == "${sofwareminuspath/$firmware/}" ] ; then
v "Software \"$software\""
handle_provisioning uppgradeserver "0"
else
v "Will not update software, already up to date"
fi
fi
if [ "$reboot" == "on" ]; then
v "Reboot Signaled"
/sbin/reboot
fi
if [ $CONF -eq 1 ]; then
mv "$IUPMD5.temp" $IUPMD5
fi
if [ "$reboot" == "on" ]; then
vv "Rebooting"
export REBOOT_REASON=iup
/sbin/reboot
fi
rm -rf /var/run/iup.pid
}
main $@
rm -rf /var/run/iup.pid

View File

@@ -29,14 +29,8 @@ endef
define Build/Compile
endef
ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_mips),y)
define Package/layer2interface/install
$(CP) ./broadcom/* $(1)/
endef
else ifeq ($(CONFIG_TARGET_iopsys_brcm63xx_arm),y)
define Package/layer2interface/install
$(CP) ./broadcom/* $(1)/
endef
endif
$(eval $(call BuildPackage,layer2interface))

View File

@@ -1,113 +0,0 @@
. /lib/network/config.sh
# FIX: for EG300 WAN port for release 3.13.1 - 4.x
if [ "$INTERFACE" == "eth2" ]; then
touch /var/update.eth2
fi
# end FIX
addif() {
# check if wan had a event and start all related services
wan=`uci -q get layer2_interface_ethernet.Wan.baseifname`
if [ "$INTERFACE" == "$wan" ]; then
/etc/init.d/layer2_interface_ethernet start
/etc/init.d/layer2_interface_vlan start
fi
}
delif() {
##remove ethernet wan and nuke any vlans associated
wan=`uci -q get layer2_interface_ethernet.Wan.baseifname`
if [ "$INTERFACE" == "$wan" ]; then
/etc/init.d/layer2_interface_ethernet stop
fi
}
# true if speed on interface is Gbit
gigatest() {
local speed=$(ethctl $INTERFACE media-type 2>&1 | awk '{if (NR == 2) print $6}')
case "$speed" in
1000*) return 0 ;;
*) return 1 ;;
esac
}
# true if there is a link on any lan port
lan_test () {
local landev=$(db get hw.board.ethernetLanPorts)
local ledontest
for dev in $landev; do
ledontest=$(cat /sys/class/net/$dev/operstate)
if [ "$ledontest" == "up" ]; then
return 0
fi
done
return 1
}
# true if adsl or vdsl is up.
dsltest() {
if cat /var/state/layer2_interface 2>/dev/null | grep 'adsl\|vdsl' | grep up; then
return 0
else
return 1
fi
}
case "$ACTION" in
add|register)
case "$PHYSDEVDRIVER" in
natsemi) sleep 1 ;;
esac
addif
local interfname=$(interfacename $INTERFACE)
local operstate=$(cat /sys/class/net/$INTERFACE/operstate)
# if [ "$operstate" == "up" ]; then
if true ; then
case "$interfname" in
GbE*)
ubus call led.lan set '{"state" : "ok"}'
ubus call led.gbe set '{"state" : "ok"}'
ubus call led.gbe_phy_link set '{"state" : "ok"}'
ubus call led.gbe_phy_speed set '{"state": "off"}'
$(gigatest) && ubus call led.gbe_phy_speed set '{"state":"ok"}'
;;
LAN*)
ubus call led.lan set '{"state":"ok"}'
;;
WAN*)
ubus call led.wan set '{"state" : "ok"}'
ubus call led.wan_phy_link set '{"state" : "ok"}'
ubus call led.wan_phy_speed set '{"state" : "off"}'
$(gigatest) && ubus call led.wan_phy_speed set '{"state":"ok"}'
;;
esac
fi
;;
remove|unregister)
local interfname=$(interfacename $INTERFACE)
local operstate=$(cat /sys/class/net/$INTERFACE/operstate)
if [ "$operstate" == "down" ]; then
case "$interfname" in
GbE*)
ubus call led.gbe set '{"state" : "off"}'
ubus call led.gbe_phy_link set '{"state" : "off"}'
ubus call led.gbe_phy_speed set '{"state" : "off"}'
$(lan_test) || ubus call led.lan set '{"state":"off"}'
;;
LAN*)
$(lan_test) || ubus call led.lan set '{"state":"off"}'
;;
WAN*)
ubus call led.wan set '{"state" : "off"}'
ubus call led.wan_phy_speed set '{"state" : "off"}'
ubus call led.wan_phy_link set '{"state" : "off"}'
# is this needed here ?? don't the dsl hotplug event control this ???
# $(dsltest) || ubus call led.dsl set '{"state":"off"}'
;;
esac
fi
delif
;;
esac

View File

@@ -16,7 +16,6 @@ start_service() {
local AnnexL
local ADSL2plus
local VDSL2
local GFast
local a8a
local b8b
local c8c
@@ -24,14 +23,11 @@ start_service() {
local a12a
local b12b
local a17a
local a30a
local b35b
local US0
local bitswap
local sra
local vdsl
config_load layer2_interface
config_get Glite capabilities Glite
config_get GDmt capabilities GDmt
@@ -40,7 +36,6 @@ start_service() {
config_get ADSL2plus capabilities ADSL2plus
config_get AnnexL capabilities AnnexL
config_get VDSL2 capabilities VDSL2
config_get GFast capabilities GFast
config_get AnnexM capabilities AnnexM
config_get a8a capabilities 8a
@@ -50,9 +45,6 @@ start_service() {
config_get a12a capabilities 12a
config_get b12b capabilities 12b
config_get a17a capabilities 17a
config_get a30a capabilities 30a
config_get b35b capabilities 35b
config_get BrcmPriv1 capabilities BrcmPriv1
config_get US0 capabilities US0
config_get bitswap capabilities bitswap
@@ -66,7 +58,6 @@ start_service() {
ADSL2plus=$(echo $ADSL2plus | sed 's/Enabled\|1/p/g')
AnnexM=$(echo $AnnexM | sed 's/Enabled\|1/m/g')
VDSL2=$(echo $VDSL2 | sed 's/Enabled\|1/v/g')
GFast=$(echo $GFast | sed 's/Enabled\|1/f/g')
a8a=$(echo $a8a | sed 's/Enabled\|1/8a/g')
b8b=$(echo $b8b | sed 's/Enabled\|1/8b/g')
@@ -75,10 +66,7 @@ start_service() {
a12a=$(echo $a12a | sed 's/Enabled\|1/12a/g')
b12b=$(echo $b12b | sed 's/Enabled\|1/12b/g')
a17a=$(echo $a17a | sed 's/Enabled\|1/17a/g')
a30a=$(echo $a30a | sed 's/Enabled\|1/30a/g')
b35b=$(echo $b35b | sed 's/Enabled\|1/BrcmPriv1/g')
BrcmPriv1=$(echo $BrcmPriv1 | sed 's/Enabled\|1/BrcmPriv1/g')
[ -n "$b35b" ] && BrcmPriv1=""
US0=$(echo $US0 | sed 's/1/on/g')
US0=$(echo $US0 | sed 's/0/off/g')
bitswap=$(echo $bitswap | sed 's/1/on/g')
@@ -95,8 +83,8 @@ start_service() {
json_get_var vdsl vdsl
if [ $vdsl -eq 1 ]; then
echo "xdslctl start --up --mod $GDmt$Glite$T1413$ADSL2$AnnexL$ADSL2plus$AnnexM$VDSL2$GFast --profile \"$a8a $b8b $c8c $d8d $a12a $b12b $a17a $a30a $b35b $BrcmPriv1\" --sra $sra --bitswap $bitswap --us0 $US0"
xdslctl start --up --mod $GDmt$Glite$T1413$ADSL2$AnnexL$ADSL2plus$AnnexM$VDSL2$GFast --profile "$a8a $b8b $c8c $d8d $a12a $b12b $a17a $a30a $b35b $BrcmPriv1" --sra $sra --bitswap $bitswap --us0 $US0
echo "xdslctl start --up --mod $GDmt$Glite$T1413$ADSL2$AnnexL$ADSL2plus$AnnexM$VDSL2 --profile \"$a8a $b8b $c8c $d8d $a12a $b12b $a17a\" --sra $sra --bitswap $bitswap --us0 $US0"
xdslctl start --up --mod $GDmt$Glite$T1413$ADSL2$AnnexL$ADSL2plus$AnnexM$VDSL2 --profile "$a8a $b8b $c8c $d8d $a12a $b12b $a17a" --sra $sra --bitswap $bitswap --us0 $US0
else
echo "xdslctl start --up --mod $GDmt$Glite$T1413$ADSL2$AnnexL$ADSL2plus$AnnexM --sra $sra --bitswap $bitswap"
xdslctl start --up --mod $GDmt$Glite$T1413$ADSL2$AnnexL$ADSL2plus$AnnexM --sra $sra --bitswap $bitswap

View File

@@ -50,11 +50,10 @@ addethernet() {
config_get baseifname $1 baseifname
config_get ifname $1 ifname
config_get bridge $1 bridge
config_get mac2 $1 mac2
ifname="${ifname:-$baseifname.1}"
brcm_virtual_interface_rules "$baseifname" "$ifname" "$bridge" "$mac2"
brcm_virtual_interface_rules "$baseifname" "$ifname" "$bridge"
}

View File

@@ -1,13 +1,30 @@
#!/bin/sh
local hasEthWan="$(db -q get hw.board.hasEthWan)"
hasEthWan=${hasEthWan:-1}
local hasEthWan="1"
local hasAdsl="$(db -q get hw.board.hasAdsl)"
local hasVdsl="$(db -q get hw.board.hasVdsl)"
local LANPORTS="$(db -q get hw.board.ethernetLanPorts)"
local WANPORTS=""
# populate layer2_interface_ethernet #
if [ "$hasEthWan" == "1" ]; then
local wanEthernetPort="$(db -q get hw.board.ethernetWanPort)"
wanEthernetPort="${wanEthernetPort:-eth0}"
if [ ! -f /etc/config/layer2_interface_ethernet -o -z "$(uci -q get layer2_interface_ethernet.@ethernet_interface[0].ifname)" ]; then
cat > /etc/config/layer2_interface_ethernet <<EOF
config ethernet_interface 'Wan'
option name 'WAN'
option baseifname '${wanEthernetPort}'
option ifname '${wanEthernetPort}.1'
EOF
fi
local ifname="$(uci -q get layer2_interface_ethernet.@ethernet_interface[0].ifname)"
[ -n "$WANPORTS" ] && WANPORTS="$WANPORTS $ifname" || WANPORTS="$ifname"
elif [ "$hasEthWan" == "0" ]; then
echo "" > /etc/config/layer2_interface_ethernet
fi
# populate layer2_interface #
if [ "$hasAdsl" == "1" ]; then
if [ ! -f /etc/config/layer2_interface -o -z "$(uci -q get layer2_interface.capabilities)" ]; then
@@ -43,28 +60,6 @@ elif [ "$hasAdsl" == "0" -a "$hasVdsl" == "0" ]; then
echo "" > /etc/config/layer2_interface
fi
# populate layer2_interface_vdsl #
if [ "$hasVdsl" == "1" ]; then
local wanVdslPort=$(db -q get hw.board.vdslWanPort)
wanVdslPort="${wanVdslPort:-ptm0}"
if [ ! -f /etc/config/layer2_interface_vdsl -o -z "$(uci -q get layer2_interface_vdsl.@vdsl_interface[0].ifname)" ]; then
cat > /etc/config/layer2_interface_vdsl <<EOF
config vdsl_interface
option 'unit' '0'
option 'ifname' '${wanVdslPort}.1'
option 'baseifname' '${wanVdslPort}'
option 'name' 'VDSL2'
option 'dslat' '1'
option 'ptmprio' '1'
option 'ipqos' '1'
EOF
fi
local ifname="$(uci -q get layer2_interface_vdsl.@vdsl_interface[0].ifname)"
[ -n "$WANPORTS" ] && WANPORTS="$WANPORTS $ifname" || WANPORTS="$ifname"
elif [ "$hasVdsl" == "0" ]; then
echo "" > /etc/config/layer2_interface_vdsl
fi
# populate layer2_interface_adsl #
if [ "$hasAdsl" == "1" ]; then
local wanAdslPort=$(db -q get hw.board.adslWanPort)
@@ -89,22 +84,26 @@ elif [ "$hasAdsl" == "0" ]; then
echo "" > /etc/config/layer2_interface_adsl
fi
# populate layer2_interface_ethernet #
if [ "$hasEthWan" == "1" ]; then
local wanEthernetPort="$(db -q get hw.board.ethernetWanPort)"
wanEthernetPort="${wanEthernetPort:-eth0}"
if [ ! -f /etc/config/layer2_interface_ethernet -o -z "$(uci -q get layer2_interface_ethernet.@ethernet_interface[0].ifname)" ]; then
cat > /etc/config/layer2_interface_ethernet <<EOF
config ethernet_interface 'Wan'
option name 'WAN'
option baseifname '${wanEthernetPort}'
option ifname '${wanEthernetPort}.1'
# populate layer2_interface_vdsl #
if [ "$hasVdsl" == "1" ]; then
local wanVdslPort=$(db -q get hw.board.vdslWanPort)
wanVdslPort="${wanVdslPort:-ptm0}"
if [ ! -f /etc/config/layer2_interface_vdsl -o -z "$(uci -q get layer2_interface_vdsl.@vdsl_interface[0].ifname)" ]; then
cat > /etc/config/layer2_interface_vdsl <<EOF
config vdsl_interface
option 'unit' '0'
option 'ifname' '${wanVdslPort}.1'
option 'baseifname' '${wanVdslPort}'
option 'name' 'VDSL2'
option 'dslat' '1'
option 'ptmprio' '1'
option 'ipqos' '1'
EOF
fi
local ifname="$(uci -q get layer2_interface_ethernet.@ethernet_interface[0].ifname)"
local ifname="$(uci -q get layer2_interface_vdsl.@vdsl_interface[0].ifname)"
[ -n "$WANPORTS" ] && WANPORTS="$WANPORTS $ifname" || WANPORTS="$ifname"
elif [ "$hasEthWan" == "0" ]; then
echo "" > /etc/config/layer2_interface_ethernet
elif [ "$hasVdsl" == "0" ]; then
echo "" > /etc/config/layer2_interface_vdsl
fi
# populate network config ifnames #

View File

@@ -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,91 +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 2 3600"
nvram set bsd_msglevel=0
nvram set bsd_status_poll=5
nvram set bsd_status=3
nvram set bsd_actframe=1
nvram set bsd_steer_no_deauth=1
for wdev in wl0 wl1; do
#if [ "$(uci -q get wireless.$wdev.band_steering)" == "1" ]; then
nvram set bsd_ifnames="$(nvram get bsd_ifnames) $wdev"
[ "$wdev" == "wl0" ] && wdev_to_steer="wl1" || wdev_to_steer="wl0"
if [ "$policy" == "0" ]; then
# RSSI Threshold based policy #
if [ "$(nvram get ${wdev}_nband)" == "2" ]; then
# 2.4G
nvram set ${wdev}_bsd_if_qualify_policy="0 0x0"
nvram set ${wdev}_bsd_if_select_policy=$wdev_to_steer
nvram set ${wdev}_bsd_sta_select_policy="20 -60 0 0 1 0 0 0 0 0x42"
nvram set ${wdev}_bsd_steer_prefix=$wdev
nvram set ${wdev}_bsd_steering_policy="0 0 0 -60 0 0x52"
else
# 5G
nvram set ${wdev}_bsd_if_qualify_policy="30 0x0"
nvram set ${wdev}_bsd_if_select_policy=$wdev_to_steer
nvram set ${wdev}_bsd_sta_select_policy="20 $rssi_threshold 0 0 1 0 0 0 0 0x40"
nvram set ${wdev}_bsd_steer_prefix=$wdev
nvram set ${wdev}_bsd_steering_policy="80 5 3 $rssi_threshold 0 0x40"
fi
else
# Bandwidth Usage based policy #
if [ "$(nvram get ${wdev}_nband)" == "2" ]; then
# 2.4G
nvram set ${wdev}_bsd_if_qualify_policy="0 0x0 -75"
nvram set ${wdev}_bsd_if_select_policy=$wdev_to_steer
nvram set ${wdev}_bsd_sta_select_policy="0 0 0 0 0 1 0 0 0 0x600"
nvram set ${wdev}_bsd_steer_prefix=$wdev
nvram set ${wdev}_bsd_steering_policy="0 5 3 0 0 0x10"
else
# 5G
nvram set ${wdev}_bsd_if_qualify_policy="40 0x0 -75"
nvram set ${wdev}_bsd_if_select_policy=$wdev_to_steer
nvram set ${wdev}_bsd_sta_select_policy="0 0 0 0 0 1 0 0 0 0x240"
nvram set ${wdev}_bsd_steer_prefix=$wdev
nvram set ${wdev}_bsd_steering_policy="$bw_util 5 3 0 0 0x40"
fi
fi
#fi
done
return 0
}
wlmngr_BSDCtrl() {
killall -q -15 bsd 2>/dev/null
if $(enableBSD); then
bsd&
fi
}
wlmngr_startWsc()
{
local idx=$1
@@ -261,7 +191,6 @@ wlmngr_startWsc()
nvram set wps_timeout_enable=0
#nvram get wps_config_method
nvram set wps_version2=enabled # extra
nvram set wps_oob_configured=1
nvram set lan_wps_oob=disabled # extra
nvram set lan_wps_reg=enabled # extra
@@ -311,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,11 +269,10 @@ wlmngr_finalize() {
# RADAR THRESHOLD VALUES #
local pcid="$(wlctl -i wl$idx revinfo | awk 'FNR == 2 {print}' | cut -d'x' -f2)"
local isac="$(db get hw.$pcid.is_ac)"
if [ "$isac" == "1" ]; then
wlctl -i wl$idx msglevel +radar +dfs 2>/dev/null
dhdctl -i wl$idx dconpoll 200 2>/dev/null
fi
# local isac="$(db get hw.$pcid.is_ac)"
# if [ "$isac" == "1" ]; then
# wlctl -i $device msglevel +radar +dfs
# fi
local rdrthrs="$(db get hw.$pcid.radarthrs)"
if [ -n "$rdrthrs" ]; then
wlctl -i wl$idx radarthrs $rdrthrs

View File

@@ -58,19 +58,6 @@ ifbaseexists()
return 0
}
check_mac_address()
{
local baseifname="$1"
local vlan="$2"
local basemac
local mac=$(ifconfig -a | grep "^${baseifname}.${vlan} " | awk '{print $NF}')
local mac_in_use=$(ifconfig -a | grep "$mac" | grep -v "^${baseifname}.${vlan}[ ]")
if [ "$mac_in_use" ]; then
basemac=$(ifconfig -a | grep "^$baseifname " | awk '{print $NF}')
ifconfig ${baseifname}.${vlan} hw ether $basemac
fi
}
addbrcmvlan()
{
local baseifname=$1
@@ -115,11 +102,9 @@ addbrcmvlan()
vlanctl --if-create $baseifname $vlan8021q
else
vlanctl --dhcp-bridged --if-create $baseifname $vlan8021q
check_mac_address $baseifname $vlan8021q
fi
else
vlanctl --routed --if-create $baseifname $vlan8021q
check_mac_address $baseifname $vlan8021q
fi
if [ "$bridge" -eq 1 ]; then
@@ -161,38 +146,12 @@ addbrcmvlan()
fi
}
update_last_mac_group()
{
local ifname=$1
local last_mac_group=$2
local full_mac modified_mac dev_mac
full_mac="$(ifconfig $ifname | awk '{print $NF; exit}')"
[ "${full_mac}" == "" ] && return
modified_mac="${full_mac:0:15}${last_mac_group}"
devs="wl0 wl1 bcmsw"
for dev in $devs; do
dev_mac="$(ifconfig $dev | awk '{print $NF; exit}')"
if [ "$dev_mac" == "$modified_mac" ]; then
return
fi
done
ifconfig $ifname hw ether "${modified_mac}"
}
brcm_virtual_interface_rules()
{
local baseifname=$1
local ifname=$2
local bridge=$3
local last_mac_group=$4
bridge="${bridge:-0}"
@@ -256,10 +215,6 @@ brcm_virtual_interface_rules()
vlanctl --if $baseifname --rx --tags 0 --set-rxif $ifname --filter-vlan-dev-mac-addr 1 --rule-insert-before -1
fi
if [ "$last_mac_group" != "" ]; then
update_last_mac_group $ifname $last_mac_group
fi
ifconfig $ifname up
ifconfig $ifname multicast
}

View File

@@ -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:=e4b4c5cce35a52da152776a00532aa0b80879c5b
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))

View File

@@ -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))

View File

@@ -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.

Some files were not shown because too many files have changed in this diff Show More