Skip to content

Commit 3ba30e3

Browse files
committed
Fix route_address_set duplicated IP sets causing route creation failure
The FlatMap calls pre-populated routeAddressSet and routeExcludeAddressSet before the for-loops which appended the same IP sets again, doubling every entry. On Windows this caused CreateIpForwardEntry2 to return ERROR_OBJECT_ALREADY_EXISTS. Fixes #3725
1 parent f2639a5 commit 3ba30e3

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

protocol/tun/inbound.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@ func (t *Inbound) Start(stage adapter.StartStage) error {
324324
t.tunOptions.Name = tun.CalculateInterfaceName("")
325325
}
326326
if t.platformInterface == nil {
327-
t.routeAddressSet = common.FlatMap(t.routeRuleSet, adapter.RuleSet.ExtractIPSet)
328327
for _, routeRuleSet := range t.routeRuleSet {
329328
ipSets := routeRuleSet.ExtractIPSet()
330329
if len(ipSets) == 0 {
@@ -336,7 +335,6 @@ func (t *Inbound) Start(stage adapter.StartStage) error {
336335
t.routeRuleSetCallback = append(t.routeRuleSetCallback, routeRuleSet.RegisterCallback(t.updateRouteAddressSet))
337336
}
338337
}
339-
t.routeExcludeAddressSet = common.FlatMap(t.routeExcludeRuleSet, adapter.RuleSet.ExtractIPSet)
340338
for _, routeExcludeRuleSet := range t.routeExcludeRuleSet {
341339
ipSets := routeExcludeRuleSet.ExtractIPSet()
342340
if len(ipSets) == 0 {

0 commit comments

Comments
 (0)