IPQ_SET_VERDICT(3)
π IPQ_SET_VERDICT β the "okay bestie, here's my ruling" page π
So this is a page from the Linux Programmer's Manual (section 3, for the library girlies), and it's all about <pink>ipq_set_verdict</pink> β the function that lets you pass judgment on a packet. Iconic behavior honestly. π
β¨ NAME β¨
ipq_set_verdict β issue a verdict (and optionally a glow-up modified packet) back to the kernel π
πΈ SYNOPSIS πΈ
#include <linux/netfilter.h>
#include <libipq.h>
int ipq_set_verdict(const struct ipq_handle *h, ipq_id_t id, unsigned int verdict, size_t data_len, unsigned char *buf);
π¦ DESCRIPTION π¦
Okay so picture this: you already grabbed a packet with ipq_read, right? Now ipq_set_verdict is the function where you announce your decision about what should happen to it β like the packet's fate is literally in your hands, main character energy fr. And if you want, you can also hand back a modified version of the payload data. Glow-up delivered. β¨
Let me break down the parameters because every single one matters, no skipping:
hβ the context handle π«Ά and here's the thing: it must have previously been returned successfully from a call toipq_create_handle. No handle, no vibes, no verdict.idβ the packet identifier, which you got viaipq_get_packet. It's how the kernel knows which packet you're judging. iykyk.verdictβ the big one, the actual ruling π and it must be one of these three:NF_ACCEPTβ accept the packet and continue traversal within the kernel π’ (she's approved, let her through)NF_DROPβ drop the packet π (blocked, deleted, not today)NF_QUEUEβ requeue the packet π (back in line she goes)
- π¨
NF_STOLENandNF_REPEATare kernel-internal constants and should not be used from userspace β like, their exact side effects have not been investigated, so don't be brave. π data_lenβ the length of the data pointed to bybuf, aka the optional replacement payload data π¦bufβ the pointer to that optional replacement payload data.
π Pro tip straight from the page: if you're simply setting a verdict without modifying the payload data, use zero fordata_lenandNULLforbuf. Easy.
And one more thing bestie, listen: the application is responsible for recalculating any packet checksums when modifying packets. That's on you. Not the kernel. You. π«΅ Do not forget, I'm begging.
π RETURN VALUE π
- On failure,
-1is returned π - On success, a non-zero positive value is returned π slay
π ERRORS π
On error, a descriptive error message will be available via the ipq_errstr function. She literally tells you what went wrong. Communication queen. π
π BUGS π
None known. Flawless. Periodt. π
π AUTHOR π
James Morris <jmorris@intercode.com.au> β thank you king π«Ά
π COPYRIGHT π
Copyright (c) 2000-2001 Netfilter Core Team.
Distributed under the GNU General Public License. π
π₯ SEE ALSO π₯
Go read them, they're giving lore. β¨
Okay that's the whole page, mwah π β and just so we're fully cited, this came from Linux iptables 1.2, dated 16 October 2001, in the good old Linux Programmer's Manual. Vintage but still serving. πβ¨
π¦ where this page comes from
- alpine 3.22: iptables-doc 1.8.11-r1 Β· GPL-2.0-or-later
- alpine 3.23: iptables-doc 1.8.11-r1 Β· GPL-2.0-or-later
- alpine 3.24: iptables-doc 1.8.13-r0 Β· GPL-2.0-or-later
- nixpkgs unstable: iptables 1.8.13
- opensuse-leap 16.0: libipq-devel 1.8.11-160000.2.2 Β· Artistic-2.0 AND GPL-2.0-only
- opensuse-leap 16.0: libipq-devel 1.8.11-160000.2.2 Β· Artistic-2.0 AND GPL-2.0-only
- opensuse-leap 16.0: libipq-devel 1.8.11-160000.2.2 Β· Artistic-2.0 AND GPL-2.0-only
- opensuse-leap 16.0: libipq-devel 1.8.11-160000.2.2 Β· Artistic-2.0 AND GPL-2.0-only
- Copyright (c) 2000-2001 Netfilter Core Team
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms