Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.

Commit 3f118b7

Browse files
author
icymind
committed
bypass dst lan udp port
1 parent a340339 commit 3f118b7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/renderer/lib/generator.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,16 @@ class Generator {
388388
ip = await Utils.resolveDomain(ips[i])
389389
}
390390
contents.push(genFWRulesHelper(`-d ${ip} -j RETURN`))
391+
// bypass udp to serverIP to-port
392+
contents.push(`iptables -t mangle -A PREROUTING -p udp -d ${ip} -j RETURN`)
391393
}
392394

393395
// bypass lan_networks. 如果不想绕过lan, 生成一个空的lan ipset集合即可
394396
contents.push('# bypass lan networks')
395397
const rule = `-m set --match-set ${firewallInfo.ipset.lanSetName} dst -j RETURN`
396398
contents.push(genFWRulesHelper(rule))
399+
// bypass udp too
400+
contents.push(`iptables -t mangle -A PREROUTING -p udp -m set --match-set ${firewallInfo.ipset.lanSetName} dst -j RETURN`)
397401

398402
// whitelist mode: bypass whitelist and route others
399403
if (profile.mode === 'whitelist') {
@@ -404,7 +408,7 @@ class Generator {
404408

405409
if (profile.enableRelayUDP) {
406410
contents.push('ip rule add fwmark 1 lookup 100')
407-
contents.push('ip route add local default dev lo table 100')
411+
contents.push('ip route add local default dev lo table 100 2>/dev/null')
408412
contents.push(`iptables -t mangle -A PREROUTING -p udp -m set --match-set ${firewallInfo.ipset.blackSetName} dst -j TPROXY --on-port ${udpRedirPort} --tproxy-mark 0x01/0x01`)
409413
}
410414

0 commit comments

Comments
 (0)