mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-12 18:41:51 +00:00
Add ipv6 support and fix ipset for DSCP
This commit is contained in:
parent
2fe5e8911b
commit
e147d26428
1 changed files with 19 additions and 4 deletions
|
@ -19,8 +19,15 @@ config_get lan_device lan ifname
|
|||
config_load dscp
|
||||
|
||||
_ipt() {
|
||||
_ipt "$@"
|
||||
_ipt6 "$@"
|
||||
}
|
||||
_ipt4() {
|
||||
iptables -w -t mangle "$@"
|
||||
}
|
||||
_ipt6() {
|
||||
ip6tables -w -t mangle "$@"
|
||||
}
|
||||
|
||||
_add_dscp_rule() {
|
||||
_ipt -A dscp_prerouting -p "$proto" -s "$src_ip" -d "$dest_ip" "$@" -m comment --comment "$comment" -j DSCP --set-dscp-class "$class"
|
||||
|
@ -37,10 +44,18 @@ _add_dscp_domain() {
|
|||
|
||||
_add_dscp_domains_rules() {
|
||||
for class in cs0 cs1 cs2 cs3 cs4 cs5 cs6 cs7 ef; do
|
||||
_ipt -A dscp_prerouting -m set --match-set omr-$class src,dst -m comment --comment "$class" -j DSCP --set-dscp-class "$class"
|
||||
_ipt -A dscp_prerouting -m set --match-set omr-$class src,dst -m comment --comment "$class" -j RETURN
|
||||
_ipt -A dscp_postrouting -m set --match-set omr-$class src,dst -m comment --comment "$class" -j DSCP --set-dscp-class "$class"
|
||||
_ipt -A dscp_postrouting -m set --match-set omr-$class src,dst -m comment --comment "$class" -j RETURN
|
||||
ipset -q --exist restore <<-EOF
|
||||
create omr-$class hash:net hashsize 64
|
||||
create omr6-$class hash:net family inet6 hashsize 64
|
||||
EOF
|
||||
_ipt4 -A dscp_prerouting -m set --match-set omr-$class src,dst -m comment --comment "$class" -j DSCP --set-dscp-class "$class"
|
||||
_ipt4 -A dscp_prerouting -m set --match-set omr-$class src,dst -m comment --comment "$class" -j RETURN
|
||||
_ipt4 -A dscp_postrouting -m set --match-set omr-$class src,dst -m comment --comment "$class" -j DSCP --set-dscp-class "$class"
|
||||
_ipt4 -A dscp_postrouting -m set --match-set omr-$class src,dst -m comment --comment "$class" -j RETURN
|
||||
_ipt6 -A dscp_prerouting -m set --match-set omr6-$class src,dst -m comment --comment "$class" -j DSCP --set-dscp-class "$class"
|
||||
_ipt6 -A dscp_prerouting -m set --match-set omr6-$class src,dst -m comment --comment "$class" -j RETURN
|
||||
_ipt6 -A dscp_postrouting -m set --match-set omr6-$class src,dst -m comment --comment "$class" -j DSCP --set-dscp-class "$class"
|
||||
_ipt6 -A dscp_postrouting -m set --match-set omr6-$class src,dst -m comment --comment "$class" -j RETURN
|
||||
done
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue