ENUM NFT_BITWISE_ATTRIBUTES(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… enum nft_bitwise_attributes(9) ✨

okay so you opened the Kernel API Manual page for enum nft_bitwise_attributes(9) β€” bestie you are in the right place, this is the netlink attribute enum for the nf_tables bitwise expression, and yes it's as cute as it sounds πŸŽ€


✨ NAME ✨

enum nft_bitwise_attributes β€” the nf_tables bitwise expression netlink attributes, fr fr πŸ¦‹


🌸 SYNOPSIS 🌸

enum nft_bitwise_attributes {
    NFTA_BITWISE_UNSPEC ,
    NFTA_BITWISE_SREG ,
    NFTA_BITWISE_DREG ,
    NFTA_BITWISE_LEN ,
    NFTA_BITWISE_MASK ,
    NFTA_BITWISE_XOR ,
    NFTA_BITWISE_OP ,
    NFTA_BITWISE_DATA ,
    NFTA_BITWISE_SREG2 ,
    __NFTA_BITWISE_MAX

};

like, that's the whole squad right there πŸ‘‘


πŸ’œ Constants πŸ’œ

okay so here's every single member, no cap, not skipping a one:

  • NFTA_BITWISE_UNSPEC β€” nope, no description given for this one, it's giving mystery 😭 (-- undescribed --)
  • NFTA_BITWISE_SREG β€” the source register, and it's a NLA_U32: nft_registers πŸ’…
  • NFTA_BITWISE_DREG β€” the destination register, also NLA_U32: nft_registers ✨
  • NFTA_BITWISE_LEN β€” the length of the operands, NLA_U32 πŸŽ€
  • NFTA_BITWISE_MASK β€” the mask value, and it's NLA_NESTED: nft_data_attributes πŸ¦‹
  • NFTA_BITWISE_XOR β€” the xor value, also NLA_NESTED: nft_data_attributes 🌸
  • NFTA_BITWISE_OP β€” the type of operation, NLA_U32: nft_bitwise_ops πŸ”₯
  • NFTA_BITWISE_DATA β€” the argument for non-boolean operations, NLA_NESTED: nft_data_attributes ⭐
  • NFTA_BITWISE_SREG2 β€” the second source register, NLA_U32: nft_registers (yes bestie there's a second one, main character energy) πŸ‘‘
  • __NFTA_BITWISE_MAX β€” also undescribed, it's the internal max sentinel vibe, -- undescribed -- πŸ’€

🌈 Description 🌈

so the bitwise expression supports boolean and shift operations β€” iconic range honestly. it implements the boolean operations by performing this exact operation:

dreg = (sreg & mask) ^ xor

and these are the mask and xor values for each one, keep them exactly as they are:

  • NOT: mask = 1, xor = 1
  • OR: mask = ~x, xor = x
  • XOR: mask = 1, xor = x
  • AND: mask = x, xor = 0

like, that's it, that's the whole trick and it slays 🫢


πŸ¦‹ SEE ALSO πŸ¦‹

the kernel file is ./include/uapi/linux/netfilter/nf_tables.h, and here's the entire friend group, nobody left behind 🧚:

  • enum nft_registers(9)
  • enum nft_verdicts(9)
  • enum nf_tables_msg_types(9)
  • enum nft_list_attributes(9)
  • enum nft_hook_attributes(9)
  • enum nft_table_flags(9)
  • enum nft_table_attributes(9)
  • enum nft_chain_attributes(9)
  • enum nft_rule_attributes(9)
  • enum nft_rule_compat_flags(9)
  • enum nft_rule_compat_attributes(9)
  • enum nft_set_flags(9)
  • enum nft_set_policies(9)
  • enum nft_set_desc_attributes(9)
  • enum nft_set_field_attributes(9)
  • enum nft_set_attributes(9)
  • enum nft_set_elem_flags(9)
  • enum nft_set_elem_attributes(9)
  • enum nft_set_elem_list_attributes(9)
  • enum nft_data_types(9)
  • enum nft_data_attributes(9)
  • enum nft_verdict_attributes(9)
  • enum nft_expr_attributes(9)
  • enum nft_immediate_attributes(9)
  • enum nft_bitwise_ops(9)
  • enum nft_byteorder_ops(9)
  • enum nft_byteorder_attributes(9)
  • enum nft_cmp_ops(9)
  • enum nft_cmp_attributes(9)
  • enum nft_range_ops(9)
  • enum nft_range_attributes(9)
  • enum nft_lookup_attributes(9)
  • enum nft_dynset_attributes(9)
  • enum nft_payload_bases(9)
  • enum nft_payload_csum_types(9)
  • enum nft_payload_attributes(9)
  • enum nft_exthdr_op(9)
  • enum nft_exthdr_attributes(9)
  • enum nft_meta_keys(9)
  • enum nft_rt_keys(9)
  • enum nft_hash_types(9)
  • enum nft_hash_attributes(9)
  • enum nft_meta_attributes(9)
  • enum nft_rt_attributes(9)
  • enum nft_socket_attributes(9)
  • enum nft_ct_keys(9)
  • enum nft_ct_attributes(9)
  • enum nft_offload_attributes(9)
  • enum nft_limit_attributes(9)
  • enum nft_connlimit_attributes(9)
  • enum nft_counter_attributes(9)
  • enum nft_last_attributes(9)
  • enum nft_log_attributes(9)
  • enum nft_log_level(9)
  • enum nft_queue_attributes(9)
  • enum nft_quota_attributes(9)
  • enum nft_secmark_attributes(9)
  • enum nft_reject_types(9)
  • enum nft_reject_inet_code(9)
  • enum nft_reject_attributes(9)
  • enum nft_nat_types(9)
  • enum nft_nat_attributes(9)
  • enum nft_tproxy_attributes(9)
  • enum nft_masq_attributes(9)
  • enum nft_redir_attributes(9)
  • enum nft_dup_attributes(9)
  • enum nft_fwd_attributes(9)
  • enum nft_objref_attributes(9)
  • enum nft_gen_attributes(9)
  • enum nft_object_attributes(9)
  • enum nft_flowtable_flags(9)
  • enum nft_flowtable_attributes(9)
  • enum nft_flowtable_hook_attributes(9)
  • enum nft_osf_attributes(9)
  • enum nft_synproxy_attributes(9)
  • enum nft_devices_attributes(9)
  • enum nft_trace_attributes(9)
  • enum nft_ng_attributes(9)

that's the whole page bestie, go read nf_tables.h and be free πŸ’–

mwah πŸ’‹ β€” this one's from ./include/uapi/linux/netfilter, dated October 2026, and it's the enum nft_bitwise_attributes(9) manual, signing off πŸŽ€βœ¨

πŸ“¦ where this page comes from