fix: 解决防火墙范围端口添加时备注不生效的问题 (#2507)

This commit is contained in:
ssongliu 2023-10-11 15:26:31 +08:00 committed by GitHub
parent 7f12beab8f
commit f9e22166c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
}