xt_copy_counters(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ xt_copy_counters(9) πŸŽ€

Kernel API Manual β€” bestie, we're copying counters and metadata from a sockptr_t, and yes, it's giving kernel-core πŸ’…

✨ NAME ✨

xt_copy_counters β€” copy counters and metadata from a sockptr_t πŸ’–

πŸ¦‹ SYNOPSIS πŸ¦‹

void * xt_copy_counters (sockptr_t arg , unsigned int len , struct
       xt_counters_info *info );

🌈 ARGUMENTS 🌈

  • arg β€” the src sockptr 🫢
  • len β€” the alleged size of userspace memory 😭 (yes, β€œalleged” is doing a lot of work here)
  • info β€” where to store the xt_counters_info metadata πŸ‘‘

πŸ’œ DESCRIPTION πŸ’œ

Okay so first things first: it copies counter meta data from user and stores it in info πŸ“₯.

Then it vmallocs memory to hold the counters 🧠, copies the counter data from user into that new memory, and returns a pointer to it πŸ”₯.

If called from a compat syscall, info gets converted automatically to the 64bit representation ✨.

The metadata associated with the counters is stored in info πŸŽ€.

πŸ‘‘ RETURN πŸ‘‘

It returns a pointer that the caller has to test via IS_ERR πŸ‘€. If IS_ERR is false, the caller has to vfree the pointer β€” periodt πŸ’€πŸ«Ά

🧚 SEE ALSO 🧚

Kernel file: ./net/netfilter/x_tables.c πŸ“

That's the whole vibe check, bestie 🫢 β€” source/version: ./net/netfilter, dated October 2026 πŸ’–βœ¨

πŸ“¦ where this page comes from