Skip to content

Commit

Permalink
kernel/linux: fix handle matching
Browse files Browse the repository at this point in the history
  • Loading branch information
hack3ric committed Jan 10, 2025
1 parent 6ef171e commit d974721
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/kernel/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,18 @@ impl Kernel for Linux {

let handle: Self::Handle = (result.objects.iter())
.filter_map(|x| {
if let NfObject::CmdObject(NfCmd::Add(NfListObject::Rule(rule))) = x {
if let NfObject::CmdObject(NfCmd::Add(NfListObject::Rule(rule)))
| NfObject::CmdObject(NfCmd::Insert(NfListObject::Rule(rule))) = x
{
Some(rule.handle.unwrap())
} else {
None
}
})
.collect();

debug_assert_eq!(nftables.objects.len(), handle.len());

if let Some((next_hop, table_id)) = rt_info {
let rtnl = self.rtnl.as_mut().expect("RtNetlink should be initialized");
let real_table_id = rtnl.add(handle.clone(), spec, next_hop).await?;
Expand Down

0 comments on commit d974721

Please sign in to comment.