// "duplicate" entry, as overlapping keys are considered equal (as neither is strictly less than the
// On lookups we'll set both ends of the port range to the same port number, which will find the one
// Methods then iterate through the set to determine if policy allows or denies. This is needed to
// support multiple rules on the same port, like when named ports are used, or when deny policies
// getServerTlsContext returns the server TLS context, if any. If a non-null pointer is returned,
// getClientTlsContext returns the client TLS context, if any. If a non-null pointer is returned,
// returning to the event loop, so after the posted lambda executes it is safe to delete the old
virtual bool allowed(bool ingress, uint32_t proxy_id, uint32_t remote_id, absl::string_view sni,
NetworkPolicyDecoder() : validation_visitor_(ProtobufMessage::getNullValidationVisitor()) {}
return fmt::format("{}", dynamic_cast<const cilium::NetworkPolicy&>(resource).endpoint_id());
using RawPolicyMap = absl::flat_hash_map<std::string, std::shared_ptr<const PolicyInstanceImpl>>;
absl::Status onConfigUpdate(const std::vector<Envoy::Config::DecodedResourceRef>& added_resources,
// Once a map is stored or swapped in to the atomic pointer by the main thread, it may be "loaded"
// - when a pointer stored or swapped in, 'std::memory_order_release' informs the compiler to make
// pointer itself is read, so that no values from the map are read before the map was "released"
// Typically it is easier to think about the release part of the acquire/release semantics, as at
// the point of the store or exchange operation the compiler and the CPU know the location of the
// happening. On the acquire side it seems less likely that the compiler or the CPU could know the
// new map pointer value in advance and even try to reorder any read operations to happen before
// the pointer is actually read. But consider the typical case where the pointer value is actually
// not changing between consecutice load operations. The compiler or the CPU could speculate that
// to be the case and read some values from the old memory location. 'std::memory_order_acquire'
// tells the compiler (which then "tells" the CPU) that this can not be done, and all reads must
class NetworkPolicyMap : public Singleton::Instance, public Logger::Loggable<Logger::Id::config> {
ProtobufTypes::MessagePtr dumpNetworkPolicyConfigs(const Matchers::StringMatcher& name_matcher);