may or may not help with nftables duplicates

This commit is contained in:
chayleaf 2024-08-13 12:11:55 +07:00
parent feca3758a9
commit 07e3e45579
Signed by: chayleaf
GPG key ID: 78171AD46227E68E

View file

@ -420,7 +420,16 @@ where
iter_ip_trie(&self.ips).next(), iter_ip_trie(&self.ips).next(),
); );
} }
let ret = set.add_cidrs(socket, flush_set, iter_ip_trie(&self.ips).map(IpNet::from)); let ret = set.add_cidrs(
socket,
flush_set,
iter_ip_trie(&self.ips)
.map(|ip| {
self.all_ips.insert(ip);
ip
})
.map(IpNet::from),
);
self.ips = RTrieSet::new(); self.ips = RTrieSet::new();
ret ret
} else { } else {
@ -438,9 +447,9 @@ where
} else { } else {
self.set.is_some() self.set.is_some()
}) && should_add(&self.all_ips, &ip) }) && should_add(&self.all_ips, &ip)
&& should_add(&self.ips, &ip)
{ {
self.ips.insert(ip); self.ips.insert(ip);
self.all_ips.insert(ip);
} }
} }
#[cfg(test)] #[cfg(test)]