1IPQ_SET_MODE(3)            Linux Programmer's Manual           IPQ_SET_MODE(3)
2
3
4

NAME

6       ipq_set_mode — set the ip_queue queuing mode
7

SYNOPSIS

9       #include <linux/netfilter.h>
10       #include <libipq.h>
11
12       int  ipq_set_mode(const  struct  ipq_handle  *h,  u_int8_t mode, size_t
13       range);
14

DESCRIPTION

16       The ipq_set_mode function sends a message to the kernel  ip_queue  mod‐
17       ule,  specifying  whether  packet  metadata only, or packet payloads as
18       well as metadata should be copied to userspace.
19
20       The h parameter is a context handle which  must  previously  have  been
21       returned successfully from a call to ipq_create_handle.
22
23       The mode parameter must be one of:
24
25       IPQ_COPY_META
26              Copy only packet metadata to userspace.
27
28       IPQ_COPY_PACKET
29              Copy packet metadata and packet payloads to userspace.
30
31       The range parameter is used to specify how many bytes of the payload to
32       copy to userspace.  It is only valid for IPQ_COPY_PACKET  mode  and  is
33       otherwise  ignored.   The  maximum  useful  value  for  range  is 65535
34       (greater values will be clamped to this by ip_queue).
35
36       ipq_set_mode is usually used immediately following ipq_create_handle to
37       enable the flow of packets to userspace.
38
39       Note  that as the underlying Netlink messaging transport is connection‐
40       less, the ip_queue module does not know that a userspace application is
41       ready to communicate until it receives a message such as this.
42

RETURN VALUE

44       On failure, -1 is returned.
45       On success, a non-zero positive value is returned.
46

ERRORS

48       On  failure,  a  descriptive  error  message  will be available via the
49       ipq_errstr function.
50

DIAGNOSTICS

52       A relatively common failure may occur if the  ip_queue  module  is  not
53       loaded.  In this case, the following code excerpt:
54
55              status = ipq_set_mode(h, IPQ_COPY_META, 0);
56              if (status < 0) {
57                   ipq_perror("myapp");
58                   ipq_destroy_handle(h);
59                   exit(1);
60              }
61
62       would generate the following output:
63
64       myapp: Failed to send netlink message: Connection refused
65

BUGS

67       None known.
68

AUTHOR

70       James Morris <jmorris@intercode.com.au>
71
73       Copyright (c) 2000-2001 Netfilter Core Team.
74
75       Distributed under the GNU General Public License.
76

SEE ALSO

78       libipq(3), iptables(8).
79
80
81
82Linux iptables 1.2              16 October 2001                IPQ_SET_MODE(3)
Impressum