Commit e66e88c6 authored by nanahira's avatar nanahira

fix chnrouter

parent 4a0ebff3
...@@ -44,5 +44,5 @@ interface_switch_chnroute() { ...@@ -44,5 +44,5 @@ interface_switch_chnroute() {
IPSET=$2 IPSET=$2
MARK=$3 MARK=$3
ipset create "$IPSET" hash:net maxelem 1000000 || true ipset create "$IPSET" hash:net maxelem 1000000 || true
iptables -t mangle "$OPTION" NEXTGEN_SWITCH -m mark --mark 0 -m set --match-set "$IPSET" src -m set --match-set chnroute_reverse dst -j CONNMARK --set-xmark "$MARK" iptables -t mangle "$OPTION" NEXTGEN_SWITCH -m mark --mark 0 -m set --match-set "$IPSET" src -m set --match-set chnrouter dst -j CONNMARK --set-xmark "$MARK"
} }
...@@ -18,10 +18,10 @@ def write_yaml_file(name, data): ...@@ -18,10 +18,10 @@ def write_yaml_file(name, data):
universe = IPSet(['0.0.0.0/0']) universe = IPSet(['0.0.0.0/0'])
special = IPSet([line.strip() for line in open('special.txt')]) special = IPSet([line.strip() for line in open('special.txt')])
chnroutes = IPSet([line.strip() for line in open('chnroutes.txt') if not line.startswith('#')]) chnroutes = IPSet([line.strip() for line in open('chnroutes.txt') if not line.startswith('#')])
result = { 'chnroute_reverse': [] } result = { 'chnrouter': [] }
chnroute_reverse = universe - special - chnroutes chnrouter = universe - special - chnroutes
for route in chnroute_reverse.iter_cidrs(): for route in chnrouter.iter_cidrs():
result['chnroute_reverse'].append(str(route)) result['chnrouter'].append(str(route))
write_yaml_file("result.yaml", result) write_yaml_file("result.yaml", result)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment