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 }