Skip to main content

BytecodeOpCode

Enum BytecodeOpCode 

Source
pub enum BytecodeOpCode {
Show 14 variants Nop = 0, Jmp = 1, SportGe = 2, SportLe = 3, DportGe = 4, DportLe = 5, PortAuto = 6, SaddrCond = 7, DaddrCond = 8, DevCond = 9, MarkCond = 10, SportEq = 11, DportEq = 12, CgroupCond = 13,
}
Available on crate feature inet-diag only.
Expand description

Enum - defines an integer enumeration, with values for each entry incrementing by 1, (e.g. 0, 1, 2, 3)

Variants§

§

Nop = 0

§

Jmp = 1

unconditional jump. "no" value is ignored.

§

SportGe = 2

sock.sport >= next_instruction.no (big endian)

§

SportLe = 3

sock.sport <= next_instruction.no (big endian)

§

DportGe = 4

sock.dport >= next_instruction.no (big endian)

§

DportLe = 5

sock.dport <= next_instruction.no (big endian)

§

PortAuto = 6

check if sock is NOT bound to a port by user, i.e. !(sk->userlocks & SOCK_BINDPORT_LOCK)

§

SaddrCond = 7

Check aginst source socket addr packed as hostcond struct (hc), followed by big-endian ipv4 or ipv6 address (yes, it's that cursed).

The check equivalent to the following (in order):

no if hc.port != -1 && hc.port != sock.sport
yes if hc.family == AF_INET && sock.family == AF_INET6
    && &sock.saddr_u32[0..3] == &[0, 0, 0xffff.to_be()]
    && bits_eq(&sock.saddr_u8[12..], &hc.addr[..], hc.prefix_len)
no if hc.family != AF_UNSPEC && hc.family != family
yes if hc.prefix_len == 0
yes if bits_eq(&sock.addr[..], &hc.addr[..], hc.prefix_len)
no

See inet_diag_bc_run() in net/ipv4/inet_diag.c

§

DaddrCond = 8

Check aginst source socket addr using hostcond struct. Same as [saddr-cond]{.title-ref}, see its description.

§

DevCond = 9

socket ifindex == next_instruction (native endian u32)

§

MarkCond = 10

Check check socket mark bits against markcond struct (mc). The check is equivalent to: sock.mark & mc.mask == mc.mark

§

SportEq = 11

sock.sport == next_instruction.no (big endian)

§

DportEq = 12

sock.dport == next_instruction.no (big endian)

§

CgroupCond = 13

sock.cgroup_id == next_2_instructions (native endian u64)

Implementations§

Trait Implementations§

Source§

impl Clone for BytecodeOpCode

Source§

fn clone(&self) -> BytecodeOpCode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for BytecodeOpCode

Source§

impl Debug for BytecodeOpCode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.