From 751ed6d7766deeac13cb35aefcd1d401f5df938e Mon Sep 17 00:00:00 2001 From: mzz2017 Date: Thu, 5 Aug 2021 14:00:52 +0800 Subject: [PATCH] fix: incorrect routing when ipv6 is not supported --- service/core/v2ray/v2rayTmpl.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/service/core/v2ray/v2rayTmpl.go b/service/core/v2ray/v2rayTmpl.go index 2b690192..00e264b7 100644 --- a/service/core/v2ray/v2rayTmpl.go +++ b/service/core/v2ray/v2rayTmpl.go @@ -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...) } }