STRUCT DPKG_EXTRACT(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ struct dpkg_extract(9) πŸŽ€

okay so bestie, welcome to the Kernel API Manual β€” this is the page for struct dpkg_extract, and it's literally just a structure for defining a single extraction. one extraction. that's the whole vibe. let's get into it πŸ’…


✨ NAME ✨

struct dpkg_extract β€” a structure for defining a single extraction 🫢


🌸 SYNOPSIS 🌸

struct dpkg_extract {
    enum dpkg_extract_type type;
    union {
      struct {
        enum net_prot                   prot;
        enum dpkg_extract_from_hdr_type type;
        u32 field;
        u8 size;
        u8 offset;
        u8 hdr_index;
      } from_hdr;
      struct {
        u8 size;
        u8 offset;
      } from_data;
      struct {
        u8 size;
        u8 offset;
      } from_parse;
    } extract;
    u8 num_of_byte_masks;
    struct dpkg_mask        masks[DPKG_NUM_OF_MASKS];
 };

like, look at her. nested structs in a union in a struct. main character energy fr fr πŸ‘‘


πŸ¦‹ Members πŸ¦‹

okay so here's the cast of characters, no cap:

  • type β€” this one decides how the union down below gets read. it's giving "choose your fighter":
    • DPKG_EXTRACT_FROM_HDR: selects from_hdr πŸ’–
    • DPKG_EXTRACT_FROM_DATA: selects from_data πŸ’–
    • DPKG_EXTRACT_FROM_PARSE: selects from_parse πŸ’–
  • extract β€” selects the extraction method, iconic behavior
  • extract.from_hdr β€” used when type = DPKG_EXTRACT_FROM_HDR
  • extract.from_hdr.prot β€” any of the supported headers
  • extract.from_hdr.type β€” defines the type of header extraction, and it's a whole little menu:
    • DPKG_FROM_HDR: use size & offset below
    • DPKG_FROM_FIELD: use field, size and offset below
    • DPKG_FULL_FIELD: use field below
  • extract.from_hdr.field β€” one of the supported fields (NH_FLD_)
  • extract.from_hdr.size β€” size in bytes
  • extract.from_hdr.offset β€” byte offset
  • extract.from_hdr.hdr_index β€” clear for cases not listed below; used for protocols that may have more than a single header, 0 indicates an outer header. supported protocols (possible values): NET_PROT_VLAN (0, HDR_INDEX_LAST); NET_PROT_MPLS (0, 1, HDR_INDEX_LAST); NET_PROT_IP(0, HDR_INDEX_LAST); NET_PROT_IPv4(0, HDR_INDEX_LAST); NET_PROT_IPv6(0, HDR_INDEX_LAST); β€” ngl this one is doing the most but we respect her πŸ™ˆ
  • extract.from_data β€” used when type = DPKG_EXTRACT_FROM_DATA
  • extract.from_data.size β€” size in bytes
  • extract.from_data.offset β€” byte offset
  • extract.from_parse β€” used when type = DPKG_EXTRACT_FROM_PARSE
  • extract.from_parse.size β€” size in bytes
  • extract.from_parse.offset β€” byte offset
  • num_of_byte_masks β€” defines the number of valid entries in the array below; this is also the number of bytes to be used as masks ✨
  • masks β€” masks parameters
lowkey reminder bestie: from_hdr, from_data and from_parse all live in the same union β€” only one of them is the moment at a time, and type is what tells you which one πŸ’€

🌈 SEE ALSO 🌈

the whole squad, go say hi:


and that's the page, bestie! πŸ“ this lil gem lives in the kernel docs under ./drivers/net/ethernet/freesca... (yes the source line is literally truncated like that, we stan a mysterious queen) and it's dated October 2026. slay, go extract some packets πŸ’œπŸ§šβ­

πŸ“¦ where this page comes from