From: Adze1502 Date: Thu, 2 Oct 2014 07:57:50 +0000 (+0200) Subject: mwan3: update to version 1.5-7 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=4c5ee1bc420db1d58c7e093016d14a3ccbf7313a;p=feed%2Fpackages.git mwan3: update to version 1.5-7 Fixed issue where an manual ifup-ed interface would immediatly go down again Remove from init as mwan3 is not a service Signed-off-by: Jeroen Louwes --- diff --git a/net/mwan3/Makefile b/net/mwan3/Makefile index 454965d065..6ddeef4ea8 100644 --- a/net/mwan3/Makefile +++ b/net/mwan3/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mwan3 PKG_VERSION:=1.5 -PKG_RELEASE:=6 +PKG_RELEASE:=7 PKG_MAINTAINER:=Jeroen Louwes PKG_LICENSE:=GPLv2 @@ -42,9 +42,4 @@ define Package/mwan3/install $(CP) ./files/* $(1) endef -define Package/mwan3/postinst - [ -n "$${IPKG_INSTROOT}" ] || /etc/init.d/mwan3 enable - exit 0 -endef - $(eval $(call BuildPackage,mwan3)) diff --git a/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 b/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 index 5c9aa07f7c..ea00bd05fa 100644 --- a/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 +++ b/net/mwan3/files/etc/hotplug.d/iface/15-mwan3 @@ -49,6 +49,17 @@ mwan3_set_general_iptables() $IPT -F mwan3_rules } +mwan3_set_general_rules() +{ + if [ -z "$($IP rule list | awk '$1 == "2253:"')" ]; then + $IP rule add pref 2253 fwmark 0xfd00/0xff00 blackhole + fi + + if [ -z "$($IP rule list | awk '$1 == "2254:"')" ]; then + $IP rule add pref 2254 fwmark 0xfe00/0xff00 unreachable + fi +} + mwan3_set_connected_iptables() { local connected_networks @@ -112,18 +123,8 @@ mwan3_set_iface_rules() $IP rule del pref $(($iface_id+2000)) done - while [ -n "$($IP rule list | awk '$1 == "2253:"')" ]; do - $IP rule del pref 2253 - done - - while [ -n "$($IP rule list | awk '$1 == "2254:"')" ]; do - $IP rule del pref 2254 - done - [ $ACTION == "ifup" ] && $IP rule add pref $(($iface_id+1000)) iif $DEVICE lookup main [ $ACTION == "ifup" ] && $IP rule add pref $(($iface_id+2000)) fwmark $(($iface_id*256))/0xff00 lookup $iface_id - $IP rule add pref 2253 fwmark 0xfd00/0xff00 blackhole - $IP rule add pref 2254 fwmark 0xfe00/0xff00 unreachable } mwan3_track() @@ -136,6 +137,11 @@ mwan3_track() } config_list_foreach $INTERFACE track_ip mwan3_list_track_ips + if [ -e /var/run/mwan3track-$INTERFACE.pid ] ; then + kill $(cat /var/run/mwan3track-$INTERFACE.pid) &> /dev/null + rm /var/run/mwan3track-$INTERFACE.pid &> /dev/null + fi + if [ -n "$track_ips" ]; then config_get reliability $INTERFACE reliability 1 config_get count $INTERFACE count 1 @@ -299,7 +305,7 @@ mwan3_ifupdown() sleep 1 let counter++ if [ "$counter" -ge 10 ]; then - $LOG warn "Could not find gateway for interface $INTERFACE (${DEVICE:-unknown})" && return 0 + $LOG warn "Could not find gateway for interface $INTERFACE ($DEVICE)" && return 0 fi done @@ -318,6 +324,7 @@ mwan3_ifupdown() $LOG notice "$ACTION interface $INTERFACE (${DEVICE:-unknown})" mwan3_set_general_iptables + mwan3_set_general_rules mwan3_set_iface_iptables mwan3_set_iface_route mwan3_set_iface_rules @@ -328,14 +335,15 @@ mwan3_ifupdown() config_foreach mwan3_set_user_rules_iptables rule } -local IP IPT LOG - +[ -n "$ACTION" ] || exit 0 [ -n "$INTERFACE" ] || exit 0 if [ $ACTION == "ifup" ]; then [ -n "$DEVICE" ] || exit 0 fi +local IP IPT LOG + IP="/usr/sbin/ip -4" IPT="/usr/sbin/iptables -t mangle -w" LOG="/usr/bin/logger -t mwan3 -p" diff --git a/net/mwan3/files/etc/init.d/mwan3 b/net/mwan3/files/etc/init.d/mwan3 deleted file mode 100755 index 981154c7dc..0000000000 --- a/net/mwan3/files/etc/init.d/mwan3 +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh /etc/rc.common -START=99 - -start() { - /usr/sbin/mwan3 start -} - -stop() { - /usr/sbin/mwan3 stop -} - -restart() { - stop - start -} - -boot() { - return 0 -} diff --git a/net/mwan3/files/usr/sbin/mwan3 b/net/mwan3/files/usr/sbin/mwan3 index ed648aeb2d..5734b8a25a 100755 --- a/net/mwan3/files/usr/sbin/mwan3 +++ b/net/mwan3/files/usr/sbin/mwan3 @@ -1,24 +1,28 @@ -#!/bin/sh /etc/rc.common +#!/bin/sh +. /lib/functions.sh -. /lib/network/config.sh +IP="/usr/sbin/ip -4" +IPT="/usr/sbin/iptables -t mangle -w" -extra_help() { - cat < Load rules and routes for specific interface + ifdown Unload rules and routes for specific interface + interfaces Show interfaces status + policies Show policies status + rules Show rules status + status Show all status - ifup Start service on interface - ifdown Stop service on interface - interfaces Show interfaces status - policies Show policies status - rules Show rules status - status Show all status EOF } -EXTRA_COMMANDS="ifdown ifup interfaces policies rules status" -EXTRA_HELP="$(extra_help)" -IP="/usr/sbin/ip -4" -IPT="/usr/sbin/iptables -t mangle -w" - ifdown() { if [ -z "$1" ]; then @@ -197,3 +201,6 @@ restart() { stop start } + +action=${1:-help} +$action