Commit Graph

91 Commits

Author SHA1 Message Date
Joshua Oreman 1cbea513e6 Make netfilterqueue a package and add type hints 2022-01-14 01:04:51 -07:00
Joshua Oreman a935aadb5f
Merge pull request #78 from oremanj/external-fd
Add a parameter NetfilterQueue(sockfd=N) for using an externally-allocated netlink socket
2022-01-13 18:19:52 -08:00
Joshua Oreman 6faaa7fe35 Add docs 2022-01-13 19:16:00 -07:00
Joshua Oreman 53e2db3cd2 Add a parameter NetfilterQueue(sockfd=N) for using an externally-allocated netlink socket
The chief use case for this is when `sockfd` was allocated in a different network namespace and passed to the current process over a UNIX domain socket or similar. It allows the current process to use netfilterqueue to manage traffic in a different network namespace.
2022-01-13 19:06:48 -07:00
Joshua Oreman 6fb345ee17
Merge pull request #77 from oremanj/fixes
Fixes for several open issues
2022-01-13 16:27:14 -08:00
Joshua Oreman c7fd3e5485 Fix CI on 3.8+ 2022-01-13 17:25:29 -07:00
Joshua Oreman 305b258a48 Fix CI, make COPY_META mode work 2022-01-13 17:19:28 -07:00
Joshua Oreman 62da18ee37 Document and test remaining attributes/methods; fix PyPy tests by not calling unbind() from tp_dealloc; misc other cleanups 2022-01-13 17:09:51 -07:00
Joshua Oreman 2c782b9619 CI fixes 2022-01-13 03:21:24 -07:00
Joshua Oreman 0187c89611 Fixes for several open issues
Propagate exceptions raised by the user's packet callback -- fixes #31, #50
Warn about exceptions raised by the packet callback during queue unbinding
Raise an error if a packet verdict is set after its parent queue is closed
set_payload() now affects the result of later get_payload() -- fixes #30
Handle signals received when run() is blocked in recv() -- fixes #65
2022-01-13 03:14:43 -07:00
Joshua Oreman ddbc12a6ab
Merge pull request #76 from oremanj/release-v0.9.0
Release v0.9.0
2022-01-12 22:55:58 -08:00
Joshua Oreman 8d3193f384 Release v0.9.0 2022-01-12 23:45:51 -07:00
Joshua Oreman ed4a63d033
Merge pull request #75 from oremanj/ci-updates
Misc CI and packaging updates
2022-01-12 20:01:03 -07:00
Joshua Oreman a5578d3122 Misc CI and packaging updates
- Add a pyproject.toml
- Run black on Python code
- Do a basic smoke test on Python 2.7, even though our test suite doesn't work there
- Don't check in `netfilterqueue.c`, but do include it in the sdist
2022-01-12 19:56:51 -07:00
Joshua Oreman afcee0d9bf
Merge pull request #74 from oremanj/updates
Modernize, add tests, allow Packet to outlive the callback it's passed to
2022-01-11 22:41:45 -07:00
Joshua Oreman c2d7ce868a Suppress warning harder 2022-01-11 22:39:30 -07:00
Joshua Oreman ba0e8bee0e Suppress warning again + update README 2022-01-11 22:36:13 -07:00
Joshua Oreman 99c13b3d8f Improve & test error handling 2022-01-11 22:01:53 -07:00
Joshua Oreman e7d451098b Use an actual warning, and avoid it in CI 2022-01-11 21:45:58 -07:00
Joshua Oreman 5d1d123be0 Use newer Cython when building 2022-01-11 21:37:22 -07:00
Joshua Oreman efcf94c277 Fix package name 2022-01-11 21:31:30 -07:00
Joshua Oreman a53c4d0b7e Make ci.sh executable 2022-01-11 21:30:24 -07:00
Joshua Oreman 9587d75aff Modernize, add tests, allow Packet to outlive the callback it's passed to 2022-01-11 21:28:21 -07:00
Matt Fox ec2ae29066
Merge pull request #47 from yangyinqi/nfq-dev
Adapt to new cython
2018-12-13 14:52:30 -08:00
yangyinqi 2600a1bf8e Adapt to new cython 2018-12-04 00:04:09 +08:00
Matt Fox 3fa8a3860b Update CHANGES 2017-01-30 23:44:23 -08:00
Matt Fox db750b7212 Merge pull request #26 from kti/25-Crash-in-iptables-OUTPUT-chain
25 crash in iptables output chain
2017-01-30 23:41:46 -08:00
Matt Fox 496694a502 Update version to 0.8.1 2017-01-30 23:40:48 -08:00
Matt Fox 1a9815fdfd To fix #25, only parse self._hw.hw_addr if self._hw is not NULL 2017-01-30 23:36:46 -08:00
Matt Fox 24e6ab5d5a Installation instructions- replace wget with git clone 2017-01-30 21:51:07 -08:00
Matt Fox 6218f3ba50 Update README with 0.8 download source and add get_hw() documentation. 2016-12-15 01:41:55 -08:00
Matt Fox 27cd73f7ca Update to 0.8 2016-12-15 01:34:19 -08:00
Matt Fox a4b3a44b08 Add simple example script from existing documentation. Regenerate netfilterqueue.c with Cython 0.25.2. 2016-12-15 01:26:35 -08:00
Matt Fox 2758696f6d Merge pull request #20 from yiannist/feature-expose-hw-addr
Expose packet's HW addr
2016-12-15 01:16:59 -08:00
Matt Fox 88808265d0 Merge pull request #19 from no2a/master
Remove unnecessary conversion of byte order for set_mark
2016-12-15 01:15:10 -08:00
Yiannis Tsiouris b55344e288 Expose packet's HW addr 2016-11-08 13:14:40 +02:00
Arata Notsu b0ccf8d2c8 Remove unnecessary conversion of byte order for set_mark
As nfq_set_verdict2 coverts byte order of "mark" (unlike
nfq_set_verdict_mark), we have not to do it on our own.
Otherwise, for example, Packet.set_mark(0x1234) results in
0x34120000 on little-endian machines.
2016-10-30 01:24:52 +09:00
Matt Fox adb254540b Merge pull request #18 from WGH-/master
use self.payload[:self.payload_len] for getting python string
2016-10-27 21:05:18 -07:00
WGH 949f894256 use self.payload[:self.payload_len] for getting python string
This is more Cythonic way, documented here
http://cython.readthedocs.io/en/latest/src/tutorial/strings.html#passing-byte-strings

It compiles to
    __Pyx_PyBytes_FromStringAndSize(
        __pyx_v_self->payload + 0,
        __pyx_v_self->payload_len - 0)

Which is the Cython macro wrapper which handles both Python 2 and
Python3.

Fixes #17
2016-10-28 00:16:56 +03:00
Matt Fox 9c74558250 Update pypi download URL for 0.7 2016-06-28 00:27:27 -07:00
Matt Fox a8efde1ab5 Version update reminder in setup.py 2016-06-28 00:19:08 -07:00
Matt Fox 9329a05fcb Update VERSION in netfilterqueue.pyx to 0.7 2016-06-28 00:18:39 -07:00
Matt Fox 4637adbba7 Handle ENOBUFS in run_socket. 2016-06-28 00:13:40 -07:00
Matt Fox a2f2feec63 Bump version to 0.7 2016-06-28 00:03:15 -07:00
Matt Fox f425c49eac Change setup.py classifier from beta to stable. Aww yeah. 2016-06-27 23:57:58 -07:00
Matt Fox a6d0e8d57f Update license in setup.py to match LICENSE.txt, which was updated 5 years ago. ¯\_(ツ)_/¯ 2016-06-27 23:56:35 -07:00
Matt Fox 7e2c4df98f Update author email. 2016-06-27 23:52:50 -07:00
Matt Fox ccb353011a Add run_socket, which uses socket.recv so that gevent can monkeypatch it. Fixes #5 2016-06-27 23:48:53 -07:00
Matt Fox 2960dc3401 Use nfq_set_verdict2 instead of nfq_set_verdict_mark, like the libnetfilter_queue documentation says to do. 2016-06-27 21:27:12 -07:00
Matt Fox 405747fe36 Fix run() documentation omission. 2016-06-27 21:18:34 -07:00