Skip to content

Commit db1ff62

Browse files
mvachharqmonnet
authored andcommitted
feat(net): Add flow_info to PacketMeta
Signed-off-by: Manish Vachharajani <manish@githedgehog.com>
1 parent 34f92b9 commit db1ff62

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

net/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ ahash = { workspace = true }
1717
arrayvec = { workspace = true, features = ["serde", "std"] }
1818
bitflags = { workspace = true }
1919
bolero = { workspace = true, features = ["alloc", "arbitrary", "std"], optional = true }
20+
concurrency = { workspace = true }
2021
derive_builder = { workspace = true, features = ["alloc"] }
2122
etherparse = { workspace = true, features = ["std"] }
23+
flow-info = { workspace = true }
2224
linux-raw-sys = { workspace = true, features = ["std", "if_ether"] }
2325
multi_index_map = { workspace = true, default-features = false, features = ["serde"] }
2426
ordermap = { workspace = true, features = ["std"] }

net/src/packet/meta.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
use crate::vxlan::Vni;
77
use bitflags::bitflags;
8+
use concurrency::sync::Arc;
9+
use flow_info::FlowInfo;
810
use serde::Serialize;
911
use std::collections::HashMap;
1012
use std::fmt::Display;
@@ -126,6 +128,7 @@ pub struct PacketMeta {
126128
pub done: Option<DoneReason>, /* if Some, the reason why a packet was marked as done, including delivery to NF */
127129
pub src_vpcd: Option<VpcDiscriminant>, /* the vpc discriminant of a received encapsulated packet */
128130
pub dst_vpcd: Option<VpcDiscriminant>, /* the vpc discriminant of a packet to be (or already) re-encapsulated by the gateway */
131+
pub flow_info: Option<Arc<FlowInfo>>, /* flow specific information that can be looked up in the flow table */
129132
}
130133
impl PacketMeta {
131134
#[must_use]
@@ -134,10 +137,9 @@ impl PacketMeta {
134137
if keep {
135138
flags |= MetaFlags::KEEP;
136139
}
137-
Self {
138-
flags,
139-
..Default::default()
140-
}
140+
let mut ret = Self::default();
141+
ret.flags = flags;
142+
ret
141143
}
142144
#[must_use]
143145
pub fn nat(&self) -> bool {

0 commit comments

Comments
 (0)