Appendix 6.A PNP ABI Reference

Every name, value, offset and size in this appendix is generated from pkm/uapi/pkm/pnp.h by pkm/tools/gen-pnp-abi.py, with struct layouts measured by compiling a probe against the real header. Regenerate it whenever the ABI changes; do not edit it by hand. The names here are the ones a program actually compiles against.

What a compiler cannot measure -- the device's read and poll semantics, what each ioctl expects, the error vocabulary, and the bounds that are not in the header -- is in the notes appendix, §6.B, which this generator does not touch.

6.A.1 Ioctl requests #

Request numbers on /dev/peios-pnp, packed as <linux/ioctl.h> packs them (direction, argument size, type 'N', number).

ConstantValueDefinition
PEIOS_PNP_IOC_STATUS0x81604E01_IOR(PEIOS_PNP_IOC_TYPE, PEIOS_PNP_IOC_STATUS_NR, struct peios_pnp_status)
PEIOS_PNP_IOC_COUNTERS0xC0184E02_IOWR(PEIOS_PNP_IOC_TYPE, PEIOS_PNP_IOC_COUNTERS_NR, struct peios_pnp_counters_query)
PEIOS_PNP_IOC_FLOWS0xC0184E03_IOWR(PEIOS_PNP_IOC_TYPE, PEIOS_PNP_IOC_FLOWS_NR, struct peios_pnp_flows_query)

6.A.2 Structure layouts #

Offsets and sizes are measured, not declared.

6.A.2.1 struct peios_pnp_event #

Total size 176 bytes.

OffsetSizeTypeField
08__u64seq
88__u64t_ns
161__u8seat
171__u8layer
181__u8verdict
191__u8flags
201__u8direction
211__u8addr_family
221__u8protocol
231__u8flow_state
244__u32ifindex
282__u16src_port
302__u16dst_port
322__u16ether_type
341__u8reject_kind
351__u8_pad0
3616__u8[16]src_addr
5216__u8[16]dst_addr
684__u32length
724__u32effects
7696__u8[PEIOS_PNP_EV_ATTR_LEN]attributed
1724__u32_pad1

6.A.2.2 struct peios_pnp_status #

Total size 352 bytes.

OffsetSizeTypeField
08__u64abi
88__u64generation
168__u64enforcing
248__u64events_dropped
328__u64seen_ingress
408__u64seen_egress
488__u64seen_local_in
568__u64deferred
648__u64fallback_judged
728__u64parse_errors
808__u64judged
888__u64permissive
968__u64fail_closed
1048__u64verdict_pass
1128__u64verdict_drop
1208__u64verdict_reject
1288__u64reject_degraded
1368__u64fx_tags
1448__u64fx_counts
1528__u64fx_reports
1608__u64fx_prompts
1688__u64last_ingest_error
1768__u64last_ingest_t_ns
1848__u64tag_writes
1928__u64tag_untracked
2008__u64tag_refused
2088__u64count_writes
2168__u64count_key_absent
2248__u64count_refused
2328__u64reports_emitted
2408__u64counter_cells
2488__u64reporting_level
2568__u64seen_local_out
2648__u64flow_judged
2728__u64flow_cached
2808__u64flow_rejudged
2888__u64flow_expired
2968__u64flow_uncached
3048__u64refusals_emitted
3128__u64refusals_bypassed
3208__u64teardowns_emitted
32824__u64[3]_reserved

6.A.2.3 struct peios_pnp_counter_rec #

Total size 232 bytes.

OffsetSizeTypeField
064__u8[PEIOS_PNP_COUNTER_NAME_LEN]name
648__u64hash
721__u8keyspec
731__u8family
742__u8[2]_pad0
764__s32ifindex
8016__u8[16]src_addr
9616__u8[16]dst_addr
1128__u64total
1208__u64last_secs
1284__u32n_windows
1324__u32_pad1
13632__u32[PEIOS_PNP_COUNTER_MAX_WINDOWS]window_secs
16864__u64[PEIOS_PNP_COUNTER_MAX_WINDOWS]window_value

6.A.2.4 struct peios_pnp_counters_query #

Total size 24 bytes.

OffsetSizeTypeField
08__u64buf
84__u32buf_len
124__u32count
164__u32total
204__u32_pad0

6.A.2.5 struct peios_pnp_flow_rec #

Total size 288 bytes.

OffsetSizeTypeField
04__u32id
41__u8family
51__u8protocol
61__u8direction
71__u8loopback
81__u8seen_reply
91__u8assured
101__u8related
111__u8judged
124__s32ifindex
164__u32timeout_secs
2016__u8[16]src_addr
3616__u8[16]dst_addr
522__u16src_port
542__u16dst_port
561__u8icmp_type
571__u8icmp_code
581__u8n_tags
595__u8[5]_pad0
648__u64start_secs
7216__u64[2]packets
8816__u64[2]bytes
10416__u64[PEIOS_PNP_FLOW_SENTENCES]sentence_generation
12016__s64[PEIOS_PNP_FLOW_SENTENCES]sentence_expires_at
13616__u64[PEIOS_PNP_FLOW_SENTENCES]sentence_rule_hash
1522__u8[PEIOS_PNP_FLOW_SENTENCES]sentence_verdict
1542__u8[PEIOS_PNP_FLOW_SENTENCES]sentence_reject_kind
1564__u8[4]_pad1
16064__u64[PEIOS_PNP_FLOW_MAX_TAGS]tag_hash
22464__u64[PEIOS_PNP_FLOW_MAX_TAGS]tag_value

6.A.2.6 struct peios_pnp_flows_query #

Total size 24 bytes.

OffsetSizeTypeField
08__u64buf
84__u32buf_len
124__u32count
164__u32total
204__u32_pad0

6.A.3 Constants #

Grouped as the header groups them.

PNP — Peios Network Policy: the verdict event stream and engine status.

The engine (net/pnp) judges every traversal at its standing seats and appends one event per evaluation to a bounded ring. /dev/peios-pnp (mode 0600; one reader at a time) drains it: read() returns whole events only — never a partial record — and blocks when the ring is empty unless O_NONBLOCK; poll() raises POLLIN when events are waiting. A slow reader loses the OLDEST events, and the loss is confessed in peios_pnp_status.events_dropped (the honesty rule: drops are counted, never silent).

Events are emitted for real evaluations (a published forest judged the traversal) and for fail-closed drops; permissive traversals (a layer with no forest — all of them at generation 0) emit nothing, because there is no decision to attribute. Status tells that story instead: generation 0 means "not enforcing", loudly.

This ABI is EXPERIMENTAL while PNP grows: no stability promise until the design ships (PEI-598). Check abi before trusting the rest.

ConstantValue
PEIOS_PNP_ABI_VERSION3

Which standing seat judged the traversal.

ConstantValue
PEIOS_PNP_EV_SEAT_INGRESS1
PEIOS_PNP_EV_SEAT_EGRESS2
PEIOS_PNP_EV_SEAT_LOCAL_IN3
PEIOS_PNP_EV_SEAT_LOCAL_OUT4

Which rules layer.

ConstantValue
PEIOS_PNP_EV_LAYER_PACKET0
PEIOS_PNP_EV_LAYER_RAWPACKET1
PEIOS_PNP_EV_LAYER_FLOW2

The verdict, in strictness order.

ConstantValue
PEIOS_PNP_EV_VERDICT_PASS0
PEIOS_PNP_EV_VERDICT_REJECT1
PEIOS_PNP_EV_VERDICT_DROP2

The story a REJECT told (meaningful iff verdict == REJECT).

ConstantValueNotes
PEIOS_PNP_EV_REJECT_REFUSED0RST / port-unreachable
PEIOS_PNP_EV_REJECT_PROHIBITED1admin-prohibited

Traversal direction.

ConstantValue
PEIOS_PNP_EV_DIR_IN0
PEIOS_PNP_EV_DIR_OUT1

Flow state as the snapshot carried it (0 = the fact was absent).

ConstantValue
PEIOS_PNP_EV_FLOW_ABSENT0
PEIOS_PNP_EV_FLOW_NEW1
PEIOS_PNP_EV_FLOW_ESTABLISHED2
PEIOS_PNP_EV_FLOW_RELATED3
PEIOS_PNP_EV_FLOW_INVALID4
PEIOS_PNP_EV_FLOW_UNTRACKED5

Event flags.

ConstantValueNotes
PEIOS_PNP_EV_F_BACKSTOP0x01nothing yielded; DROP
PEIOS_PNP_EV_F_FAIL_CLOSED0x02evaluation failed; DROP
PEIOS_PNP_EV_F_REJECT_DEGRADED0x04REJECT emitted as DROP
PEIOS_PNP_EV_F_REJUDGED0x08Flow: a stale sentence re-judged
PEIOS_PNP_EV_ATTR_LEN96

One counter cell, as the counters dump reports it: the stream and key- spec of its table, the key it holds (only the facts the key-spec names are meaningful; the rest are zero), the cumulative total, and the value of every window the table answers.

ConstantValue
PEIOS_PNP_COUNTER_NAME_LEN64
PEIOS_PNP_COUNTER_MAX_WINDOWS8

Key-spec bits.

ConstantValue
PEIOS_PNP_KEY_SRC_ADDR0x01
PEIOS_PNP_KEY_DST_ADDR0x02
PEIOS_PNP_KEY_INTERFACE0x04

One live flow, as the flows dump reports it (ABI 3): conntrack's view of the flow (original-direction tuple, state, remaining lifetime, accounting), PNP's extension (start time, the interface and direction at first judgment, the sentences, the tags). Tags are reported by hash; the policy names them.

ConstantValue
PEIOS_PNP_FLOW_MAX_TAGS8
PEIOS_PNP_FLOW_SENTENCES2

The flows dump: fills buf with as many records as fit; count is how many were written, total how many live flows the walk saw. A best- effort snapshot of a table that changes under the walk.

ConstantValue
PEIOS_PNP_IOC_TYPE0x0000004E
PEIOS_PNP_IOC_STATUS_NR0x00000001
PEIOS_PNP_IOC_COUNTERS_NR0x00000002
PEIOS_PNP_IOC_FLOWS_NR0x00000003

Edit this page