Release v0.9.0
This commit is contained in:
parent
ed4a63d033
commit
8d3193f384
|
@ -1,11 +1,11 @@
|
|||
v0.9.0, unreleased
|
||||
v0.9.0, 12 Jan 2021
|
||||
Improve usability when Packet objects are retained past the callback
|
||||
Add Packet.retain() to save the packet contents in such cases
|
||||
Eliminate warnings during build on py3
|
||||
Add CI and basic test suite
|
||||
Raise a warning, not an error, if we don't get the bufsize we want
|
||||
Don't allow bind() more than once on the same NetfilterQueue, since
|
||||
that would leak the old queue handle
|
||||
Don't allow bind() more than once on the same NetfilterQueue, since that would leak the old queue handle
|
||||
** This will be the last version with support for Python 2.7. **
|
||||
|
||||
v0.8.1, 30 Jan 2017
|
||||
Fix bug #25- crashing when used in OUTPUT or POSTROUTING chains
|
||||
|
|
|
@ -3,3 +3,4 @@ include *.rst
|
|||
include *.c
|
||||
include *.pyx
|
||||
include *.pxd
|
||||
recursive-include tests/ *.py
|
||||
|
|
5
ci.sh
5
ci.sh
|
@ -5,7 +5,12 @@ set -ex -o pipefail
|
|||
pip install -U pip setuptools wheel
|
||||
sudo apt-get install libnetfilter-queue-dev
|
||||
|
||||
# Cython is required to build the sdist...
|
||||
pip install cython
|
||||
python setup.py sdist --formats=zip
|
||||
|
||||
# ... but not to install it
|
||||
pip uninstall -y cython
|
||||
pip install dist/*.zip
|
||||
|
||||
if python --version 2>&1 | fgrep -q "Python 2.7"; then
|
||||
|
|
|
@ -5,7 +5,7 @@ function.
|
|||
Copyright: (c) 2011, Kerkhoff Technologies Inc.
|
||||
License: MIT; see LICENSE.txt
|
||||
"""
|
||||
VERSION = (0, 8, 1)
|
||||
VERSION = (0, 9, 0)
|
||||
|
||||
# Constants for module users
|
||||
COPY_NONE = 0
|
||||
|
@ -24,10 +24,6 @@ DEF SockCopySize = MaxCopySize + SockOverhead
|
|||
# Socket queue should hold max number of packets of copysize bytes
|
||||
DEF SockRcvSize = DEFAULT_MAX_QUEUELEN * SockCopySize // 2
|
||||
|
||||
cdef extern from "Python.h":
|
||||
const char* __FILE__
|
||||
int __LINE__
|
||||
|
||||
cdef extern from *:
|
||||
"""
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
|
@ -35,10 +31,6 @@ cdef extern from *:
|
|||
#endif
|
||||
"""
|
||||
|
||||
import socket
|
||||
import warnings
|
||||
cimport cpython.version
|
||||
|
||||
cdef int global_callback(nfq_q_handle *qh, nfgenmsg *nfmsg,
|
||||
nfq_data *nfa, void *data) with gil:
|
||||
"""Create a Packet and pass it to appropriate callback."""
|
||||
|
@ -227,11 +219,11 @@ cdef class NetfilterQueue:
|
|||
newsiz = nfnl_rcvbufsiz(nfq_nfnlh(self.h), sock_len)
|
||||
if newsiz != sock_len * 2:
|
||||
try:
|
||||
warnings.warn_explicit(
|
||||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"Socket rcvbuf limit is now %d, requested %d." % (newsiz, sock_len),
|
||||
category=RuntimeWarning,
|
||||
filename=bytes(__FILE__).decode("ascii"),
|
||||
lineno=__LINE__,
|
||||
)
|
||||
except: # if warnings are being treated as errors
|
||||
self.unbind()
|
||||
|
@ -267,6 +259,8 @@ cdef class NetfilterQueue:
|
|||
|
||||
def run_socket(self, s):
|
||||
"""Accept packets using socket.recv so that, for example, gevent can monkeypatch it."""
|
||||
import socket
|
||||
|
||||
while True:
|
||||
try:
|
||||
buf = s.recv(BufferSize)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
[build-system]
|
||||
requires = ["setuptools >= 42", "wheel", "cython"]
|
||||
requires = ["setuptools", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
|
11
setup.py
11
setup.py
|
@ -1,6 +1,7 @@
|
|||
import os, sys
|
||||
from setuptools import setup, Extension
|
||||
|
||||
VERSION = "0.8.1" # Remember to change CHANGES.txt and netfilterqueue.pyx when version changes.
|
||||
VERSION = "0.9.0" # Remember to change CHANGES.txt and netfilterqueue.pyx when version changes.
|
||||
|
||||
try:
|
||||
# Use Cython
|
||||
|
@ -14,6 +15,14 @@ try:
|
|||
)
|
||||
except ImportError:
|
||||
# No Cython
|
||||
if not os.path.exists(os.path.join(os.path.dirname(__file__), "netfilterqueue.c")):
|
||||
sys.stderr.write(
|
||||
"You must have Cython installed (`pip install cython`) to build this "
|
||||
"package from source.\nIf you're receiving this error when installing from "
|
||||
"PyPI, please file a bug report at "
|
||||
"https://github.com/oremanj/python-netfilterqueue/issues/new\n"
|
||||
)
|
||||
sys.exit(1)
|
||||
ext_modules = [
|
||||
Extension("netfilterqueue", ["netfilterqueue.c"], libraries=["netfilter_queue"])
|
||||
]
|
||||
|
|
|
@ -3,6 +3,5 @@ pytest
|
|||
trio
|
||||
pytest-trio
|
||||
async_generator
|
||||
cython
|
||||
black
|
||||
platformdirs <= 2.4.0 # needed by black; 2.4.1+ don't support py3.6
|
||||
|
|
|
@ -18,8 +18,6 @@ black==21.12b0
|
|||
# via -r test-requirements.in
|
||||
click==8.0.3
|
||||
# via black
|
||||
cython==0.29.26
|
||||
# via -r test-requirements.in
|
||||
idna==3.3
|
||||
# via trio
|
||||
iniconfig==1.1.1
|
||||
|
|
|
@ -79,10 +79,12 @@ async def test_rewrite_reorder(harness):
|
|||
|
||||
|
||||
async def test_errors(harness):
|
||||
with pytest.warns(RuntimeWarning, match="rcvbuf limit is"):
|
||||
with pytest.warns(RuntimeWarning, match="rcvbuf limit is") as record:
|
||||
async with harness.capture_packets_to(2, sock_len=2 ** 30):
|
||||
pass
|
||||
|
||||
assert record[0].filename.endswith("conftest.py")
|
||||
|
||||
async with harness.capture_packets_to(2, queue_num=0):
|
||||
with pytest.raises(OSError, match="Failed to create queue"):
|
||||
async with harness.capture_packets_to(2, queue_num=0):
|
||||
|
|
Loading…
Reference in New Issue