diff --git a/backend/app/service/firewall.go b/backend/app/service/firewall.go index 6ae63ca99..6fb19c9e9 100644 --- a/backend/app/service/firewall.go +++ b/backend/app/service/firewall.go @@ -109,10 +109,10 @@ func (u *FirewallService) SearchWithPage(req dto.RuleSearch) (int64, interface{} if len(req.Status) != 0 { for _, data := range datas { portItem, _ := strconv.Atoi(data.Port) - if req.Status == "free" && !common.ScanPort(portItem) { + if req.Status == "free" && !common.ScanPortWithProto(portItem, data.Protocol) { datasFilterStatus = append(datasFilterStatus, data) } - if req.Status == "used" && common.ScanPort(portItem) { + if req.Status == "used" && common.ScanPortWithProto(portItem, data.Protocol) { datasFilterStatus = append(datasFilterStatus, data) } } diff --git a/backend/utils/common/common.go b/backend/utils/common/common.go index 31e2f8e85..54f554456 100644 --- a/backend/utils/common/common.go +++ b/backend/utils/common/common.go @@ -113,6 +113,13 @@ func ScanUDPPort(port int) bool { return false } +func ScanPortWithProto(port int, proto string) bool { + if proto == "udp" { + return ScanUDPPort(port) + } + return ScanPort(port) +} + func ExistWithStrArray(str string, arr []string) bool { for _, a := range arr { if strings.Contains(a, str) { diff --git a/frontend/src/views/host/firewall/ip/index.vue b/frontend/src/views/host/firewall/ip/index.vue index 3eb0d3ee8..2d502eef2 100644 --- a/frontend/src/views/host/firewall/ip/index.vue +++ b/frontend/src/views/host/firewall/ip/index.vue @@ -88,6 +88,7 @@ :min-width="150" :label="$t('commons.table.description')" prop="description" + show-overflow-tooltip >