Adze1502 / mwan

Simple policy routing for multiple WANs in OpenWrt
84 stars 24 forks source link

support more protocols #10

Closed arfett closed 10 years ago

arfett commented 11 years ago

I recently added all protocols listed in /etc/protocols to the protocol dropdown on the luci application. I noticed, however, that the mwan3 script does not allow for anything besides icmp/tcp/udp/all.

I think the case loop should be modified to create the iptables entry for all protocols if $proto == "" or $proto == "all" and allow for the protocol to be set on anything else.

mwan3_add_rule_iptables()
{
    case $proto in
        icmp)
        iptables -I mwan3_rules $rulenumber -t mangle -p $proto -s $src_ip -d $dest_ip -m mark --mark 0/65280 $probability -j MARK --set-xmark $(($nf_mark*256))/65280 &> /dev/null
        ;;
        tcp|udp)
        iptables -I mwan3_rules $rulenumber -t mangle -p $proto -s $src_ip -d $dest_ip -m multiport --sports $src_port -m multiport --dports $dest_port -m mark --mark 0/65280 $probability -j MARK --set-xmark $(($nf_mark*256))/65280 &> /dev/null
        ;;
        *)
        iptables -I mwan3_rules $rulenumber -t mangle -s $src_ip -d $dest_ip -m mark --mark 0/65280 $probability -j MARK --set-xmark $(($nf_mark*256))/65280 &> /dev/null
        ;;
    esac
}
Adze1502 commented 11 years ago

Yes, this needs some attention

Op 11 jul. 2013, om 07:25 heeft arfett notifications@github.com het volgende geschreven:

I recently added all protocols listed in /etc/protocols to the protocol dropdown on the luci application. I noticed, however, that the mwan3 script does not allow for anything besides icmp/tcp/udp/all.

I think the case loop should be modified to create the iptables entry for all protocols if $proto == "" or $proto == "all" and allow for the protocol to be set on anything else.

mwan3_add_rule_iptables() { case $proto in icmp) iptables -I mwan3_rules $rulenumber -t mangle -p $proto -s $src_ip -d $dest_ip -m mark --mark 0/65280 $probability -j MARK --set-xmark $(($nf_mark_256))/65280 &> /dev/null ;; tcp|udp) iptables -I mwan3_rules $rulenumber -t mangle -p $proto -s $src_ip -d $dest_ip -m multiport --sports $src_port -m multiport --dports $dest_port -m mark --mark 0/65280 $probability -j MARK --set-xmark $(($nf_mark256))/65280 &> /dev/null ;; ) iptables -I mwan3_rules $rulenumber -t mangle -s $src_ip -d $dest_ip -m mark --mark 0/65280 $probability -j MARK --set-xmark $(($nf_mark_256))/65280 &> /dev/null ;; esac } — Reply to this email directly or view it on GitHub.

arfett commented 10 years ago

This has been corrected in mwan3 version 1.4