From fd24fe8653260b9b6cf526b65e00f3bab8c8a73b Mon Sep 17 00:00:00 2001 From: Jouko Virtanen Date: Thu, 24 Oct 2024 07:42:27 -0700 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Mauro Ezequiel Moltrasio --- integration-tests/pkg/mock_sensor/server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/pkg/mock_sensor/server.go b/integration-tests/pkg/mock_sensor/server.go index 43fb0f6bd1..d19445dba5 100644 --- a/integration-tests/pkg/mock_sensor/server.go +++ b/integration-tests/pkg/mock_sensor/server.go @@ -516,11 +516,11 @@ func (m *MockSensor) translateAddress(addr *sensorAPI.NetworkAddress) string { } ipNetwork := utils.IPNetworkFromCIDRBytes(ipNetworkData) - numBytes := len(ipNetworkData) prefixLen := ipNetwork.PrefixLen() // If this is IPv4 and the prefix length is 32 or this is IPv6 and the prefix length // is 128 this is a regular IP address and not a CIDR block - if (numBytes == 5 && prefixLen == byte(32)) || (numBytes == 17 && prefixLen == byte(128)) { + if (ipNetwork.Family() == utils.IPv4 && prefixLen == byte(32)) || + (ipNetwork.Family() == utils.IPv6 && prefixLen == byte(128)) { peerId.Address = ipNetwork.IP() } else { peerId.IPNetwork = ipNetwork