IPQ_READ(3)
πΈ NAME πΈ
okay bestie, this is IPQ_READ(3) β the manual page for ipq_read β straight from the Linux Programmer's Manual, and she reads queue messages from ip_queue and reads them into the supplied buffer. she's giving kernel gossip courier and honestly? iconic. π
β¨
β¨ SYNOPSIS β¨
#include <linux/netfilter.h>
#include <libipq.h>
ssize_t ipq_read(const struct ipq_handle *h, unsigned char *buf, size_t
len, int timeout);
π DESCRIPTION π
okay so the ipq_read function reads a queue message from the kernel and copies it into the memory pointed to by buf, up to a maximum length of len. copy that, bestie.
The h parameter is a context handle, and it must have already come back successfully from a call to ipq_create_handle. no random handles, no shortcuts β she needs the real one.
The caller is responsible for making sure the memory pointed to by buf is large enough to hold len bytes. translation: you brought the buffer, you make sure it fits. π
The timeout parameter can set a timeout for the operation, specified in microseconds. This is implemented internally by the library via the select system call. A value of zero gives normal, backwards-compatible blocking behaviour with no timeout. A negative value causes the function to return immediately. so: zero means normal blocking, negative means return immediately; the timeout itself is in microseconds. π«
β οΈ bestie, do not access the data returned viabufdirectly. Useipq_message_type,ipq_get_packet, andipq_get_msgerrto access the queue message in the buffer. that's the whole vibe check. π«Ά
π«Ά RETURN VALUE π«Ά
- On failure,
-1is returned. oop. - On success, a non-zero positive value is returned when no timeout value is specified. positive vibes, positive return.
- On success with a timeout value specified, zero is returned if no data was available to read, or if a non-blocked signal was caught. In the latter case, the global
errnovalue will be set toEINTR. that'sEINTR, not a personality flaw.
π ERRORS π
On error, a descriptive error message will be available via the ipq_errstr function. go read the message, bestie β she left you notes.
π₯ DIAGNOSTICS π₯
Even when the ipq_read function returns successfully, the queue message copied into the buffer may itself be an error message from a higher level kernel component. Use ipq_message_type to determine if it is an error message, and ipq_get_msgerr to access the value of the message. success at the read level does not automatically mean success at the message level β check before you celebrate. π₯
π BUGS π
None known. genuinely none known β no cap, no secret bug section lurking. π
π AUTHOR π
James Morris <jmorris@intercode.com.au> the author, the icon, the legend. π
π COPYRIGHT π
Copyright (c) 2000-2001 Netfilter Core Team.
Distributed under the GNU General Public License. open source, bestie. π
π¦ CREDITS π¦
Joost Remijn implemented the timeout feature, which appeared in the 1.2.4 release of iptables. shoutout Joost for the timeout feature β she ate. π¦
β SEE ALSO β
mwah π this page is from Linux iptables 1.2, dated 16 October 2001, and the manual name is IPQ_READ(3).
π¦ 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