Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mwan3: error running 'mwan3 policies' #219

Closed
joaochainho opened this issue Aug 20, 2014 · 3 comments
Closed

mwan3: error running 'mwan3 policies' #219

joaochainho opened this issue Aug 20, 2014 · 3 comments

Comments

@joaochainho
Copy link

Hi @Adze1502 ,

Running 'mwan3 policies' returns the following error with certain interface names, e.g. 'wan' and 'wwan'

root@OpenWrt:~# mwan3 policies
Policy balanced:
 wwan (40%)
/etc/rc.common: line 138: arithmetic syntax error

I went through the code and found a way to fix it. Hope it helps.

diff --git a/net/mwan3/files/usr/sbin/mwan3 b/net/mwan3/files/usr/sbin/mwan3
index 3102728..a59213e 100755
--- a/net/mwan3/files/usr/sbin/mwan3
+++ b/net/mwan3/files/usr/sbin/mwan3
@@ -129,7 +129,7 @@ policies()

                if [ ! -z "${total_weight##*[!0-9]*}" ]; then
                        for iface in $($IPT -S $policy | cut -s -d'"' -f2 | awk '{print $1}'); do
-                               weight=$($IPT -S $policy | grep "$iface " | cut -s -d'"' -f2 | awk '{print $2}')
+                               weight=$($IPT -S $policy | grep "\"$iface " | cut -s -d'"' -f2 | awk '{print $2}')
                                percent=$(($weight*100/$total_weight))
                                echo " $iface ($percent%)"
                        done

Best regards,
João

@Adze1502
Copy link
Contributor

Thanks for reporting. Will look into this.

Adze1502 added a commit to Adze1502/packages that referenced this issue Aug 21, 2014
Fix issue openwrt#219: Policy status output returns arithmetic syntax error

Signed-off-by: Jeroen Louwes <jeroen.louwes@gmail.com>
sbyx pushed a commit that referenced this issue Aug 21, 2014
Fix issue #219: Policy status output returns arithmetic syntax error

Signed-off-by: Jeroen Louwes <jeroen.louwes@gmail.com>
@Adze1502
Copy link
Contributor

Fixed in version 1.5-4

@sbyx sbyx closed this as completed Aug 21, 2014
thess pushed a commit to thess/OpenWrt-packages that referenced this issue Sep 17, 2014
Fix issue openwrt#219: Policy status output returns arithmetic syntax error

Signed-off-by: Jeroen Louwes <jeroen.louwes@gmail.com>
@feckert
Copy link
Member

feckert commented Mar 4, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants