mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +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
|
config_load dscp
|
||||||
|
|
||||||
_ipt() {
|
_ipt() {
|
||||||
|
_ipt "$@"
|
||||||
|
_ipt6 "$@"
|
||||||
|
}
|
||||||
|
_ipt4() {
|
||||||
iptables -w -t mangle "$@"
|
iptables -w -t mangle "$@"
|
||||||
}
|
}
|
||||||
|
_ipt6() {
|
||||||
|
ip6tables -w -t mangle "$@"
|
||||||
|
}
|
||||||
|
|
||||||
_add_dscp_rule() {
|
_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"
|
_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() {
|
_add_dscp_domains_rules() {
|
||||||
for class in cs0 cs1 cs2 cs3 cs4 cs5 cs6 cs7 ef; do
|
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"
|
ipset -q --exist restore <<-EOF
|
||||||
_ipt -A dscp_prerouting -m set --match-set omr-$class src,dst -m comment --comment "$class" -j RETURN
|
create omr-$class hash:net hashsize 64
|
||||||
_ipt -A dscp_postrouting -m set --match-set omr-$class src,dst -m comment --comment "$class" -j DSCP --set-dscp-class "$class"
|
create omr6-$class hash:net family inet6 hashsize 64
|
||||||
_ipt -A dscp_postrouting -m set --match-set omr-$class src,dst -m comment --comment "$class" -j RETURN
|
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
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue