From 4bcf0bc5a85fa072d0c79c7e8355e9448d59aff4 Mon Sep 17 00:00:00 2001 From: Gui Iribarren Date: Sun, 15 Dec 2013 08:31:50 -0300 Subject: [PATCH 1/7] nodogsplash: check if TrafficControl is enabled before testing imq module requirement. This avoids failing to start in current OpenWrt Attitude Adjustment and trunk, which lack IMQ support (and WONTFIX). Suggested in the issue discussed in: http://ml.ninux.org/pipermail/nodogsplash/2013-May/000009.html Signed-off-by: Gui Iribarren --- nodogsplash/Makefile | 2 +- nodogsplash/files/nodogsplash.init | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/nodogsplash/Makefile b/nodogsplash/Makefile index a599823..dd2b1e4 100644 --- a/nodogsplash/Makefile +++ b/nodogsplash/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nodogsplash PKG_FIXUP:=autoreconf PKG_VERSION:=0.9_beta9.9.8 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/nodogsplash/files/nodogsplash.init b/nodogsplash/files/nodogsplash.init index 7eba60b..588e20e 100644 --- a/nodogsplash/files/nodogsplash.init +++ b/nodogsplash/files/nodogsplash.init @@ -13,6 +13,7 @@ IPT=/usr/sbin/iptables WD_DIR=/usr/bin +NDS_CONF=/etc/nodogsplash/nodogsplash.conf OPTIONS="" START=65 STOP=65 @@ -168,9 +169,11 @@ test_module() { do_module_tests "ipt_mac" do_module_tests "ipt_mark" - # if not using traffic control, - # you can comment out the following 3 lines: - do_module_tests "imq" "numdevs=2" - do_module_tests "ipt_IMQ" - do_module_tests "sch_htb" + + # test for imq modules, only if TrafficControl is enabled in conf + if ( grep -q '^[[:space:]]*TrafficControl[[:space:]]\+yes' "$NDS_CONF" ) ; then + do_module_tests "imq" "numdevs=2" + do_module_tests "ipt_IMQ" + do_module_tests "sch_htb" + fi } From 0c2656c4029a60f096198c87f60de7b18b004c50 Mon Sep 17 00:00:00 2001 From: Gui Iribarren Date: Sun, 15 Dec 2013 08:47:17 -0300 Subject: [PATCH 2/7] nodogsplash: recognize yes, true or 1 as valid TrafficControl values --- nodogsplash/files/nodogsplash.init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodogsplash/files/nodogsplash.init b/nodogsplash/files/nodogsplash.init index 588e20e..b465792 100644 --- a/nodogsplash/files/nodogsplash.init +++ b/nodogsplash/files/nodogsplash.init @@ -171,7 +171,7 @@ test_module() { do_module_tests "ipt_mark" # test for imq modules, only if TrafficControl is enabled in conf - if ( grep -q '^[[:space:]]*TrafficControl[[:space:]]\+yes' "$NDS_CONF" ) ; then + if ( grep -q -E '^[[:space:]]*TrafficControl[[:space:]]+(yes|true|1)' "$NDS_CONF" ) ; then do_module_tests "imq" "numdevs=2" do_module_tests "ipt_IMQ" do_module_tests "sch_htb" From 47a466ede6ad5a729b9be336cd28160a388fdcb7 Mon Sep 17 00:00:00 2001 From: Gui Iribarren Date: Fri, 13 Dec 2013 16:03:47 -0300 Subject: [PATCH 3/7] alfred: fix batadv-vis invocation in init.d script broken (wouldn't start, failing silently) since the following commit: * "renamed vis to batadv-vis to avoid collisions with other vis binaries" which renamed only some instances of the "vis" command Signed-off-by: Gui Iribarren Signed-off-by: Simon Wunderlich --- alfred/Makefile | 2 +- alfred/files/alfred.init | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/alfred/Makefile b/alfred/Makefile index ffc8026..b9c2c33 100644 --- a/alfred/Makefile +++ b/alfred/Makefile @@ -12,7 +12,7 @@ include $(TOPDIR)/rules.mk # PKG_NAME:=alfred PKG_VERSION:=2013.4.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MD5SUM:=3891697e127b1037cfc9349fd96e9993 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/alfred/files/alfred.init b/alfred/files/alfred.init index e52a7bd..b678d4c 100755 --- a/alfred/files/alfred.init +++ b/alfred/files/alfred.init @@ -13,7 +13,7 @@ alfred_args="" vis_args="" facters_dir="/etc/alfred" pid_file_alfred="/var/run/alfred.pid" -pid_file_vis="/var/run/vis.pid" +pid_file_vis="/var/run/batadv-vis.pid" enable=0 vis_enable=0 SERVICE_DAEMONIZE=1 @@ -44,7 +44,7 @@ alfred_start() enable=1 config_get_bool start_vis "$section" start_vis 0 - if [ "$start_vis" = 1 ] && [ -x /usr/sbin/vis ]; then + if [ "$start_vis" = 1 ] && [ -x /usr/sbin/batadv-vis ]; then vis_enable=1 append vis_args "-i $batmanif -s" fi @@ -67,9 +67,9 @@ start() service_start /usr/sbin/alfred ${alfred_args} if [ "$vis_enable" = "1" ]; then - echo "${initscript}: starting vis" + echo "${initscript}: starting batadv-vis" SERVICE_PID_FILE="$pid_file_vis" - service_start /usr/sbin/vis ${vis_args} + service_start /usr/sbin/batadv-vis ${vis_args} fi if [ "$run_facters" = "1" ]; then @@ -87,7 +87,7 @@ stop() SERVICE_PID_FILE="$pid_file_alfred" service_stop /usr/sbin/alfred SERVICE_PID_FILE="$pid_file_vis" - [ -x /usr/sbin/vis ] && service_stop /usr/sbin/vis + [ -x /usr/sbin/batadv-vis ] && service_stop /usr/sbin/batadv-vis sed "\|for file in $facters_dir/\* ; do |d" -i /etc/crontabs/root /etc/init.d/cron restart } From e2cfab7f287673b1d6854c59db6e710668d145f3 Mon Sep 17 00:00:00 2001 From: Gui Iribarren Date: Fri, 13 Dec 2013 16:05:26 -0300 Subject: [PATCH 4/7] alfred: workaround race condition when batmanif is not ready at boot time Wait up to 30 seconds during init.d script on boot, so that batmanif can come up. If the timeout is reached, the init.d script refuses to start alfred and related daemons. This prevents an alfred crash when it would start during early boot, before batmanif is available. Instead, alfred is started as soon as batmanif appears, if that happens during the 30-second window. Signed-off-by: Gui Iribarren Signed-off-by: Simon Wunderlich --- alfred/Makefile | 2 +- alfred/files/alfred.init | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/alfred/Makefile b/alfred/Makefile index b9c2c33..c8e73c2 100644 --- a/alfred/Makefile +++ b/alfred/Makefile @@ -12,7 +12,7 @@ include $(TOPDIR)/rules.mk # PKG_NAME:=alfred PKG_VERSION:=2013.4.0 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_MD5SUM:=3891697e127b1037cfc9349fd96e9993 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz diff --git a/alfred/files/alfred.init b/alfred/files/alfred.init index b678d4c..b777b53 100755 --- a/alfred/files/alfred.init +++ b/alfred/files/alfred.init @@ -16,6 +16,7 @@ pid_file_alfred="/var/run/alfred.pid" pid_file_vis="/var/run/batadv-vis.pid" enable=0 vis_enable=0 +batmanif="" SERVICE_DAEMONIZE=1 SERVICE_WRITE_PID=1 @@ -23,7 +24,7 @@ alfred_start() { local args="" local section="$1" - local disabled interface mode batmanif + local disabled interface mode # check if section is disabled config_get_bool disabled "$section" disabled 0 @@ -62,6 +63,21 @@ start() if [ "$enable" = "0" ]; then exit 0 fi + + mesh_dir="/sys/class/net/$batmanif/mesh/" + if ! [ -d "$mesh_dir" ] ; then + timeout=30 + echo "${initscript}: waiting $timeout secs for $batmanif interface..." + for i in $(seq $timeout); do + sleep 1 + [ -d "$mesh_dir" ] && break + if [ $i == $timeout ] ; then + echo "${initscript}: $batmanif not detected, alfred not starting." + exit 1 + fi + done + fi + echo "${initscript}: starting alfred" SERVICE_PID_FILE="$pid_file_alfred" service_start /usr/sbin/alfred ${alfred_args} From 3a1fd118833e8c6d341fde4ef99d31786c3614c9 Mon Sep 17 00:00:00 2001 From: Bastian Bittorf Date: Fri, 3 Jan 2014 21:00:45 +0100 Subject: [PATCH 5/7] olsrd: hotplug: optimize execution-speed and simplify using already existing GLOBAL vars instead of encapsulating vars from function to function, cleanups and comments in source --- olsrd/files/olsrd.hotplug.sh | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/olsrd/files/olsrd.hotplug.sh b/olsrd/files/olsrd.hotplug.sh index 8b110d4..76e801a 100755 --- a/olsrd/files/olsrd.hotplug.sh +++ b/olsrd/files/olsrd.hotplug.sh @@ -11,7 +11,7 @@ olsrd_list_configured_interfaces() # is disabled ;; *) - echo "$interface" + echo "$interface" # e.g. 'lan' ;; esac @@ -19,26 +19,32 @@ olsrd_list_configured_interfaces() } done } +olsrd_interface_already_in_config() +{ + # e.g.: 'Interface "eth0.1" "eth0.2" "wlan0"' + if grep -s ^'Interface ' '/var/etc/olsrd.conf' | grep -q "\"$DEVICE\""; then + logger -t olsrd_hotplug -p daemon.debug "[OK] already_active: '$INTERFACE' => '$DEVICE'" + return 0 + else + logger -t olsrd_hotplug -p daemon.info "[OK] ifup: '$INTERFACE' => '$DEVICE'" + return 1 + fi +} + olsrd_interface_needs_adding() { - local interface="$1" # e.g. wlanadhocRADIO1 - local device="$2" # e.g. wlan1-1 - local myif - local config="/var/etc/olsrd.conf" + local testif + + # likely and cheap operation: + olsrd_interface_already_in_config && return 1 for myif in $(olsrd_list_configured_interfaces); do { [ "$myif" = "$interface" ] && { - if grep -s ^'Interface ' "$config" | grep -q "\"$device\""; then - logger -t olsrd_hotplug -p daemon.debug "[OK] already_active: $INTERFACE => $DEVICE" - return 1 - else - logger -t olsrd_hotplug -p daemon.info "[OK] ifup: $INTERFACE => $DEVICE" - return 0 - fi + olsrd_interface_already_in_config || return 0 } } done - logger -t olsrd_hotplug -p daemon.debug "[OK] interface $INTERFACE not used for olsrd" + logger -t olsrd_hotplug -p daemon.debug "[OK] interface '$INTERFACE' => '$DEVICE' not used for olsrd" return 1 } @@ -47,7 +53,9 @@ case "$ACTION" in # only work after the first normal startup # also: no need to test, if enabled [ -e '/var/etc/olsrd.conf' ] && { - olsrd_interface_needs_adding "$INTERFACE" "$DEVICE" && { + # INTERFACE = e.g. 'wlanadhocRADIO1' or 'cfg144d8f' + # DEVICE = e.g. 'wlan1-1' + olsrd_interface_needs_adding && { . /etc/rc.common /etc/init.d/olsrd restart } } From 003a28d88dc0adda5f8b83bdc32cd4fc211de4ec Mon Sep 17 00:00:00 2001 From: Bastian Bittorf Date: Sat, 4 Jan 2014 07:54:22 +0100 Subject: [PATCH 6/7] olsrd: hotplug: changed a varname which broke in 3a1fd118833e8c6d341fde4ef99d31786c3614c9 --- olsrd/files/olsrd.hotplug.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/olsrd/files/olsrd.hotplug.sh b/olsrd/files/olsrd.hotplug.sh index 76e801a..2094463 100755 --- a/olsrd/files/olsrd.hotplug.sh +++ b/olsrd/files/olsrd.hotplug.sh @@ -33,13 +33,13 @@ olsrd_interface_already_in_config() olsrd_interface_needs_adding() { - local testif + local interface # likely and cheap operation: olsrd_interface_already_in_config && return 1 - for myif in $(olsrd_list_configured_interfaces); do { - [ "$myif" = "$interface" ] && { + for interface in $(olsrd_list_configured_interfaces); do { + [ "$interface" = "$INTERFACE" ] && { olsrd_interface_already_in_config || return 0 } } done From 8ec444256292e50344fbd46efaaa1b5859d88e69 Mon Sep 17 00:00:00 2001 From: Pau Escrich Date: Fri, 10 Jan 2014 17:37:57 +0100 Subject: [PATCH 7/7] luci-app-bmx6: Initialize tun6in6 variable and add further checks Signed-off-by: Pau Escrich --- luci-app-bmx6/files/usr/lib/lua/luci/view/bmx6/nodes_j.htm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/luci-app-bmx6/files/usr/lib/lua/luci/view/bmx6/nodes_j.htm b/luci-app-bmx6/files/usr/lib/lua/luci/view/bmx6/nodes_j.htm index 730fd29..c9e3c9c 100644 --- a/luci-app-bmx6/files/usr/lib/lua/luci/view/bmx6/nodes_j.htm +++ b/luci-app-bmx6/files/usr/lib/lua/luci/view/bmx6/nodes_j.htm @@ -113,7 +113,8 @@ // Looking for the extensions var hna6 = []; var tun4in6 = []; - var tun6 = []; + var tun6in6 = []; + for( var e = 0; e < extensions.length; e++) { if( extensions[e].HNA6_EXTENSION ) @@ -125,6 +126,7 @@ // Gateways var gateways = '
    '; + if ( typeof(tun4in6) !== "undefined" && tun4in6 !== null ) for ( var t = 0; t < tun4in6.length; t++) { if ( tun4in6[t].networklen == "32" ) @@ -133,6 +135,7 @@ gateways += "
  • "+tun4in6[t].network+'/'+tun4in6[t].networklen + ' | ' + tun4in6[t].bandwidth+'
  • '; } + if ( typeof(tun6in6) !== "undefined" && tun6in6 !== null ) for ( var t = 0; t < tun6in6.length; t++) { if ( tun6in6[t].networklen == "128" )