fix: incorrect routing when ipv6 is not supported

This commit is contained in:
mzz2017 committed 2021-08-14 21:16:14 +08:00
1 parent 973228dca8
commit 751ed6d776
1 file changed
+5 -5
+5 -5
View File
@@ -1242,15 +1242,15 @@ func (t *Template) SetDualStack(setting *configure.Setting) {
inbounds6[i].Tag += tag6Suffix
}
}
if !iptables.IsIPv6Supported() {
return
}
for i := len(inbounds6) - 1; i >= 0; i-- {
if inbounds6[i].Tag == "THIS_IS_A_DROPPED_TAG" {
inbounds6 = append(inbounds6[:i], inbounds6[i+1:]...)
}
}
t.Inbounds = append(t.Inbounds, inbounds6...)
if iptables.IsIPv6Supported() {
t.Inbounds = append(t.Inbounds, inbounds6...)
}
// set routing
for i := range t.Routing.Rules {
@@ -1261,7 +1261,7 @@ func (t *Template) SetDualStack(setting *configure.Setting) {
tag6 = append(tag6, tag+tag6Suffix)
}
}
if len(tag6) > 0 {
if len(tag6) > 0 && iptables.IsIPv6Supported() {
t.Routing.Rules[i].InboundTag = append(t.Routing.Rules[i].InboundTag, tag6...)
}
}