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

Refs #2487
This commit is contained in:
ssongliu 2023-10-10 18:38:29 +08:00 committed by GitHub
parent 7f75882811
commit 09341d2254
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -241,6 +241,9 @@ 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)
}
if len(req.Protocol) == 0 {
req.Protocol = "tcp/udp"
}
_ = u.addPortRecord(req)
}
return nil