From e6ea6e2b832bef8680c686b47db615ea70204139 Mon Sep 17 00:00:00 2001 From: Cybwan Date: Sat, 4 Nov 2023 01:40:46 +0800 Subject: [PATCH 1/2] remove unnecessary check --- loxinet/zones.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/loxinet/zones.go b/loxinet/zones.go index 1853d5147..7ea05360a 100644 --- a/loxinet/zones.go +++ b/loxinet/zones.go @@ -187,12 +187,7 @@ func (z *ZoneH) ZonePortIsValid(name string, zns string) (int, error) { // GetPortZone - routine to identify the zone of a port func (z *ZoneH) GetPortZone(port string) *Zone { - zone := z.ZonePorts[port] - if zone == nil { - return nil - } - - return zone + return z.ZonePorts[port] } // ZonePortAdd - routine to add a port to a zone From 01a78467e344a1557560837de68246ad1f7d5934 Mon Sep 17 00:00:00 2001 From: Cybwan Date: Sat, 4 Nov 2023 01:41:44 +0800 Subject: [PATCH 2/2] fix zone's name check --- loxinet/zones.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loxinet/zones.go b/loxinet/zones.go index 7ea05360a..1ee30eb44 100644 --- a/loxinet/zones.go +++ b/loxinet/zones.go @@ -194,7 +194,7 @@ func (z *ZoneH) GetPortZone(port string) *Zone { func (z *ZoneH) ZonePortAdd(name string, zns string) (int, error) { zone := z.ZonePorts[name] if zone != nil { - if zone.Name == name { + if zone.Name == zns { return 0, nil } return ZoneExistsErr, errors.New("zone exists")