fn perform_aggregation_cycle()

in nfm-controller/src/events/nat_resolver.rs [60:82]


    fn perform_aggregation_cycle(&mut self) {
        let new_entries = match self.conntrack_listener.get_new_entries() {
            Ok(n) => n,
            Err(error) => {
                error!(error; "Failed to retrieve conntrack changes");
                return;
            }
        };

        let entry_cache = &mut self.conntrack_ringbuf[self.ringbuf_index];
        for new_entry in new_entries.iter() {
            // If the entry was not actually NAT'd, there's no need to store it.
            if !new_entry.was_natd() {
                continue;
            }

            // For locally-initiated connections, eBPF sock_ops sees the original flow, pre-NAT.
            // For remote-initiated connections, eBPF sees the reply flow, post-NAT.  Hence, we key
            // by both sides to allow for either lookup.
            entry_cache.insert(new_entry.original, new_entry.reply);
            entry_cache.insert(new_entry.reply, new_entry.original);
        }
    }