From dbf349ee9db0fcdb67f0f899578df81ea6d0ca23 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Mon, 4 Sep 2023 15:56:12 +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=E7=AD=9B=E9=80=89=E9=97=AE=E9=A2=98=20(#2170)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/firewall.go | 4 ++-- backend/utils/common/common.go | 7 +++++++ frontend/src/views/host/firewall/ip/index.vue | 1 + frontend/src/views/host/firewall/port/index.vue | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) 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 >