From 487d7015b7848e83f38a99b5d66c3049266beb43 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Mon, 24 Oct 2022 16:37:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8iptables=E4=B8=AD?= =?UTF-8?q?=E5=8A=A0=E5=85=A5ipv6=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/iplibrary/action_iptables.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/iplibrary/action_iptables.go b/internal/iplibrary/action_iptables.go index dd23cd1..2aee19a 100644 --- a/internal/iplibrary/action_iptables.go +++ b/internal/iplibrary/action_iptables.go @@ -4,6 +4,7 @@ import ( "errors" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/firewallconfigs" + "github.com/TeaOSLab/EdgeNode/internal/utils" executils "github.com/TeaOSLab/EdgeNode/internal/utils/exec" "os/exec" "runtime" @@ -74,10 +75,16 @@ func (this *IPTablesAction) runAction(action string, listType IPListType, item * } func (this *IPTablesAction) runActionSingleIP(action string, listType IPListType, item *pb.IPItem) error { + // 暂时不支持ipv6 + // TODO 将来支持ipv6 + if utils.IsIPv6(item.IpFrom) { + return nil + } + if item.Type == "all" { return nil } - path := this.config.Path + var path = this.config.Path var err error if len(path) == 0 { path, err = exec.LookPath("iptables") @@ -88,6 +95,7 @@ func (this *IPTablesAction) runActionSingleIP(action string, listType IPListType this.iptablesNotFound = true return err } + this.config.Path = path } iptablesAction := "" switch action {