pub struct State<I: IpExt, A, BT: FilterBindingsTypes> {
pub installed_routines: ValidRoutines<I, BT::DeviceClass>,
pub conntrack: Table<I, NatConfig<I, A>, BT>,
pub nat_installed: OneWayBoolean,
/* private fields */
}
Expand description
IP version-specific filtering state.
Fields§
§installed_routines: ValidRoutines<I, BT::DeviceClass>
Routines used for filtering packets that are installed on hooks.
conntrack: Table<I, NatConfig<I, A>, BT>
Connection tracking state.
nat_installed: OneWayBoolean
One-way boolean toggle indicating whether any rules have ever been added to an installed NAT routine. If not, performing NAT can safely be skipped.
This is useful because if any NAT is being performed, we have to check whether it’s necessary to perform implicit NAT for all traffic – even if it doesn’t match any NAT rules – to avoid conflicting tracked connections. If we know that no NAT is being performed at all, this extra work can be avoided.
Note that this value will only ever go from false to true; it does not indicate whether any NAT rules are currently installed. This avoids a race condition where NAT rules are removed but connections are still being NATed based on those rules, and therefore must be considered when creating new connection tracking entries.
Implementations§
Source§impl<I: IpExt, A, BC: FilterBindingsContext> State<I, A, BC>
impl<I: IpExt, A, BC: FilterBindingsContext> State<I, A, BC>
Sourcepub fn new<CC: CoreTimerContext<FilterTimerId<I>, BC>>(
bindings_ctx: &mut BC,
) -> Self
pub fn new<CC: CoreTimerContext<FilterTimerId<I>, BC>>( bindings_ctx: &mut BC, ) -> Self
Create a new State.
Trait Implementations§
Source§impl<I: IpExt, A: InspectableValue, BT: FilterBindingsTypes> Inspectable for State<I, A, BT>
impl<I: IpExt, A: InspectableValue, BT: FilterBindingsTypes> Inspectable for State<I, A, BT>
Source§fn record<Inspector: Inspector>(&self, inspector: &mut Inspector)
fn record<Inspector: Inspector>(&self, inspector: &mut Inspector)
inspector
.Auto Trait Implementations§
impl<I, A, BT> !Freeze for State<I, A, BT>
impl<I, A, BT> RefUnwindSafe for State<I, A, BT>where
<I as Ip>::Addr: RefUnwindSafe,
<BT as FilterBindingsTypes>::DeviceClass: RefUnwindSafe,
<I as IpProtoExt>::Proto: RefUnwindSafe,
impl<I, A, BT> Send for State<I, A, BT>
impl<I, A, BT> Sync for State<I, A, BT>
impl<I, A, BT> Unpin for State<I, A, BT>where
<BT as TimerBindingsTypes>::Timer: Unpin,
<I as Ip>::Addr: Unpin,
<BT as FilterBindingsTypes>::DeviceClass: Unpin,
<I as IpProtoExt>::Proto: Unpin,
impl<I, A, BT> UnwindSafe for State<I, A, BT>where
<I as Ip>::Addr: RefUnwindSafe + UnwindSafe,
<BT as FilterBindingsTypes>::DeviceClass: RefUnwindSafe + UnwindSafe,
<I as IpProtoExt>::Proto: RefUnwindSafe + UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more