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,
}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)
noSee 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§
Source§impl BytecodeOpCode
impl BytecodeOpCode
pub fn from_value(value: u64) -> Option<Self>
Trait Implementations§
Source§impl Clone for BytecodeOpCode
impl Clone for BytecodeOpCode
Source§fn clone(&self) -> BytecodeOpCode
fn clone(&self) -> BytecodeOpCode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more