From f9e22166c1e6ad0f8160ad9a876308b2be9ef476 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Wed, 11 Oct 2023 15:26:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E9=98=B2=E7=81=AB?= =?UTF-8?q?=E5=A2=99=E8=8C=83=E5=9B=B4=E7=AB=AF=E5=8F=A3=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=97=B6=E5=A4=87=E6=B3=A8=E4=B8=8D=E7=94=9F=E6=95=88=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#2507)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/firewall.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/app/service/firewall.go b/backend/app/service/firewall.go index e5e1aa83f..f937a2323 100644 --- a/backend/app/service/firewall.go +++ b/backend/app/service/firewall.go @@ -225,7 +225,10 @@ func (u *FirewallService) OperatePortRule(req dto.PortRuleOperate, reload bool) if err := u.operatePort(client, req); err != nil { global.LOG.Errorf("%s port %s/%s failed (strategy: %s, address: %s), err: %v", req.Operation, req.Port, req.Protocol, req.Strategy, req.Address, err) } - _ = u.addPortRecord(req) + req.Port = strings.ReplaceAll(req.Port, ":", "-") + if err := u.addPortRecord(req); err != nil { + global.LOG.Errorf("add record %s/%s failed (strategy: %s, address: %s), err: %v", req.Port, req.Protocol, req.Strategy, req.Address, err) + } } } return nil @@ -244,7 +247,9 @@ func (u *FirewallService) OperatePortRule(req dto.PortRuleOperate, reload bool) if len(req.Protocol) == 0 { req.Protocol = "tcp/udp" } - _ = u.addPortRecord(req) + if err := u.addPortRecord(req); err != nil { + global.LOG.Errorf("add record %s/%s failed (strategy: %s, address: %s), err: %v", req.Port, req.Protocol, req.Strategy, req.Address, err) + } } return nil }