@@ -5,12 +5,14 @@ NetfilterQueue
5
5
NetfilterQueue provides access to packets matched by an iptables rule in
6
6
Linux. Packets so matched can be accepted, dropped, altered, or given a mark.
7
7
8
- Libnetfilter_queue (the netfilter library, not this module) is part of the `Netfilter project <http://netfilter.org/projects/libnetfilter_queue/ >`_.
8
+ Libnetfilter_queue (the netfilter library, not this module) is part of the
9
+ `Netfilter project <http://netfilter.org/projects/libnetfilter_queue/ >`_.
9
10
10
11
Example
11
12
=======
12
13
13
- The following script prints a short description of each packet before accepting it. ::
14
+ The following script prints a short description of each packet before accepting
15
+ it. ::
14
16
15
17
from netfilterqueue import QueueHandler
16
18
@@ -33,7 +35,8 @@ To send packets destined for your LAN to the script, type something like::
33
35
Installation
34
36
============
35
37
36
- NetfilterQueue is a C extention module that links against libnetfilter_queue. Before installing, ensure you have:
38
+ NetfilterQueue is a C extention module that links against libnetfilter_queue.
39
+ Before installing, ensure you have:
37
40
38
41
1. A C compiler
39
42
@@ -62,7 +65,8 @@ To install from source::
62
65
cd NetfilterQueue-0.2
63
66
python setup.py install
64
67
65
- Setup will use Cython if it is installed, regenerating the .c source from the .pyx before compiling the .so.
68
+ Setup will use Cython if it is installed, regenerating the .c source from the
69
+ .pyx before compiling the .so.
66
70
67
71
API
68
72
===
72
76
``NetfilterQueue.COPY_META ``
73
77
74
78
``NetfilterQueue.COPY_PACKET ``
75
- These constants specify how much of the packet should be given to the script- nothing, metadata, or the whole packet.
79
+ These constants specify how much of the packet should be given to the
80
+ script- nothing, metadata, or the whole packet.
76
81
77
82
QueueHandler objects
78
83
--------------------
@@ -97,7 +102,8 @@ handle() method. Handle() is called for each packet that appears in the queue.
97
102
98
103
``QueueHandler.handle(packet) ``
99
104
Handle a single packet from the queue. You must call either
100
- ``packet.accept() `` or ``packet.drop() ``.
105
+ ``packet.accept() `` or ``packet.drop() ``. If you don't override this
106
+ method, all packets will be accepted.
101
107
102
108
Packet objects
103
109
--------------
@@ -177,8 +183,8 @@ More details coming soon...
177
183
* Probably other stuff is omitted too
178
184
179
185
* When a packet has been marked, we use nfq_set_verdict_mark rather than
180
- nfq_set_verdict2. Apparently nfq_set_verdict_mark
181
- `is broken <http://netfilter.org/projects/libnetfilter_queue/doxygen/group__Queue.html#ga1986d6387c5aa2a837c02e87ae3b45ff >`_,
186
+ nfq_set_verdict2. Apparently nfq_set_verdict_mark is
187
+ `broken <http://netfilter.org/projects/libnetfilter_queue/doxygen/group__Queue.html#ga1986d6387c5aa2a837c02e87ae3b45ff >`_,
182
188
although it works for me.
183
189
184
190
Source
@@ -191,4 +197,5 @@ License
191
197
192
198
Copyright (c) 2011, Kerkhoff Technologies, Inc. All rights reserved.
193
199
194
- `BSD <https://github.com/kti/python-netfilterqueue/blob/master/LICENSE.txt >`_ licensed.
200
+ `BSD <https://github.com/kti/python-netfilterqueue/blob/master/LICENSE.txt >`_
201
+ licensed.
0 commit comments