From 5996520cc7dc307a380252cd59f30de320392257 Mon Sep 17 00:00:00 2001 From: Tim Wojtulewicz Date: Fri, 11 Nov 2022 08:22:08 -0700 Subject: [PATCH] Mask ports before inserting them into the map --- src/Val.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Val.cc b/src/Val.cc index 33c2cb2b0a..f706902e31 100644 --- a/src/Val.cc +++ b/src/Val.cc @@ -3972,10 +3972,11 @@ const PortValPtr& ValManager::Port(uint32_t port_num, TransportProto port_type) port_num = 0; } - if ( ports.find(port_num) == ports.end() ) - ports[port_num] = IntrusivePtr{AdoptRef{}, new PortVal(PortVal::Mask(port_num, port_type))}; + uint32_t port_masked = PortVal::Mask(port_num, port_type); + if ( ports.find(port_masked) == ports.end() ) + ports[port_masked] = IntrusivePtr{AdoptRef{}, new PortVal(PortVal::Mask(port_num, port_type))}; - return ports[port_num]; + return ports[port_masked]; } const PortValPtr& ValManager::Port(uint32_t port_num)