diff --git a/netfilterqueue.c b/netfilterqueue.c index b52ab2f..a274485 100644 --- a/netfilterqueue.c +++ b/netfilterqueue.c @@ -261,10 +261,12 @@ static CYTHON_INLINE float __PYX_NAN() { #define __PYX_HAVE__netfilterqueue #define __PYX_HAVE_API__netfilterqueue #include "sys/types.h" +#include #include "netinet/ip.h" #include "sys/time.h" #include "netinet/in.h" #include "libnfnetlink/linux_nfnetlink.h" +#include "libnfnetlink/libnfnetlink.h" #include "libnetfilter_queue/linux_nfnetlink_queue.h" #include "libnetfilter_queue/libnetfilter_queue.h" #include "sys/socket.h" @@ -491,7 +493,18 @@ static const char *__pyx_f[] = { struct __pyx_obj_14netfilterqueue_Packet; struct __pyx_obj_14netfilterqueue_NetfilterQueue; -/* "netfilterqueue.pxd":19 +/* "netfilterqueue.pxd":10 + * + * # dummy defines from asm-generic/errno.h: + * cdef enum: # <<<<<<<<<<<<<< + * ENOBUFS = 105 # No buffer space available + * + */ +enum { + __pyx_e_14netfilterqueue_ENOBUFS = 0x69 +}; + +/* "netfilterqueue.pxd":26 * * # Dummy defines from netinet/in.h: * cdef enum: # <<<<<<<<<<<<<< @@ -529,7 +542,7 @@ enum { __pyx_e_14netfilterqueue_IPPROTO_MAX }; -/* "netfilterqueue.pxd":136 +/* "netfilterqueue.pxd":149 * * # Dummy defines from linux/socket.h: * cdef enum: # Protocol families, same as address families. # <<<<<<<<<<<<<< @@ -541,7 +554,7 @@ enum { __pyx_e_14netfilterqueue_PF_INET6 = 10 }; -/* "netfilterqueue.pxd":144 +/* "netfilterqueue.pxd":157 * * # Dummy defines from linux/netfilter.h * cdef enum: # <<<<<<<<<<<<<< @@ -550,7 +563,7 @@ enum { */ enum { - /* "netfilterqueue.pxd":151 + /* "netfilterqueue.pxd":164 * NF_REPEAT * NF_STOP * NF_MAX_VERDICT = NF_STOP # <<<<<<<<<<<<<< @@ -566,7 +579,7 @@ enum { __pyx_e_14netfilterqueue_NF_MAX_VERDICT = __pyx_e_14netfilterqueue_NF_STOP }; -/* "netfilterqueue.pxd":153 +/* "netfilterqueue.pxd":166 * NF_MAX_VERDICT = NF_STOP * * cdef class Packet: # <<<<<<<<<<<<<< @@ -593,7 +606,7 @@ struct __pyx_obj_14netfilterqueue_Packet { }; -/* "netfilterqueue.pxd":192 +/* "netfilterqueue.pxd":205 * cpdef repeat(self) * * cdef class NetfilterQueue: # <<<<<<<<<<<<<< @@ -611,7 +624,7 @@ struct __pyx_obj_14netfilterqueue_NetfilterQueue { -/* "netfilterqueue.pyx":36 +/* "netfilterqueue.pyx":40 * return 1 * * cdef class Packet: # <<<<<<<<<<<<<< @@ -834,6 +847,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_u_int16_t(u_int16_t value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value); + /* CIntFromPy.proto */ static CYTHON_INLINE u_int32_t __Pyx_PyInt_As_u_int32_t(PyObject *); @@ -1016,6 +1032,7 @@ static const char __pyx_k_SSCOPMCE[] = "SSCOPMCE"; static const char __pyx_k_WB_EXPAK[] = "WB-EXPAK"; static const char __pyx_k_get_mark[] = "get_mark"; static const char __pyx_k_set_mark[] = "set_mark"; +static const char __pyx_k_sock_len[] = "sock_len"; static const char __pyx_k_COPY_META[] = "COPY_META"; static const char __pyx_k_COPY_NONE[] = "COPY_NONE"; static const char __pyx_k_IDPR_CMTP[] = "IDPR-CMTP"; @@ -1049,7 +1066,6 @@ static const char __pyx_k_Unknown_protocol[] = "Unknown protocol"; static const char __pyx_k_s_packet_s_bytes[] = "%s packet, %s bytes"; static const char __pyx_k_any_local_network[] = "any local network"; static const char __pyx_k_any_0_hop_protocol[] = "any 0-hop protocol"; -static const char __pyx_k_DEFAULT_MAX_QUEUELEN[] = "DEFAULT_MAX_QUEUELEN"; static const char __pyx_k_Failed_to_open_NFQueue[] = "Failed to open NFQueue."; static const char __pyx_k_Failed_to_create_queue_s[] = "Failed to create queue %s."; static const char __pyx_k_any_host_internal_protocol[] = "any host internal protocol"; @@ -1059,6 +1075,7 @@ static const char __pyx_k_Failed_to_set_packet_copy_mode[] = "Failed to set pack static const char __pyx_k_Bind_to_a_Linux_netfilter_queue[] = "\nBind to a Linux netfilter queue. Send packets to a user-specified callback\nfunction.\n\nCopyright: (c) 2011, Kerkhoff Technologies Inc.\nLicense: MIT; see LICENSE.txt\n"; static const char __pyx_k_Failed_to_bind_family_s_Are_you[] = "Failed to bind family %s. Are you root?"; static const char __pyx_k_Failed_to_get_payload_of_packet[] = "Failed to get payload of packet."; +static const char __pyx_k_Socket_rcvbuf_limit_is_now_d_req[] = "Socket rcvbuf limit is now %d, requested %d."; static const char __pyx_k_Verdict_already_given_for_this_p[] = "Verdict already given for this packet."; static PyObject *__pyx_kp_s_3PC; static PyObject *__pyx_n_s_AH; @@ -1084,7 +1101,6 @@ static PyObject *__pyx_n_s_DCCP; static PyObject *__pyx_kp_s_DCN_MEAS; static PyObject *__pyx_n_s_DDP; static PyObject *__pyx_n_s_DDX; -static PyObject *__pyx_n_s_DEFAULT_MAX_QUEUELEN; static PyObject *__pyx_n_s_DGP; static PyObject *__pyx_n_s_DSR; static PyObject *__pyx_n_s_EGP; @@ -1187,6 +1203,7 @@ static PyObject *__pyx_n_s_STP; static PyObject *__pyx_kp_s_SUN_ND; static PyObject *__pyx_n_s_SWIPE; static PyObject *__pyx_n_s_Shim6; +static PyObject *__pyx_kp_s_Socket_rcvbuf_limit_is_now_d_req; static PyObject *__pyx_kp_s_Sprite_RPC; static PyObject *__pyx_n_s_TCF; static PyObject *__pyx_n_s_TCP; @@ -1234,6 +1251,7 @@ static PyObject *__pyx_n_s_repeat; static PyObject *__pyx_kp_s_s_packet_s_bytes; static PyObject *__pyx_n_s_set_mark; static PyObject *__pyx_n_s_set_payload; +static PyObject *__pyx_n_s_sock_len; static PyObject *__pyx_n_s_test; static PyObject *__pyx_n_s_user_callback; static int __pyx_pf_14netfilterqueue_6Packet___cinit__(struct __pyx_obj_14netfilterqueue_Packet *__pyx_v_self); /* proto */ @@ -1254,7 +1272,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_4mark___get__(struct __pyx_ob static PyObject *__pyx_pf_14netfilterqueue_6Packet_7payload___get__(struct __pyx_obj_14netfilterqueue_Packet *__pyx_v_self); /* proto */ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(struct __pyx_obj_14netfilterqueue_NetfilterQueue *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */ static void __pyx_pf_14netfilterqueue_14NetfilterQueue_2__dealloc__(struct __pyx_obj_14netfilterqueue_NetfilterQueue *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(struct __pyx_obj_14netfilterqueue_NetfilterQueue *__pyx_v_self, int __pyx_v_queue_num, PyObject *__pyx_v_user_callback, u_int32_t __pyx_v_max_len, u_int8_t __pyx_v_mode, u_int32_t __pyx_v_range); /* proto */ +static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(struct __pyx_obj_14netfilterqueue_NetfilterQueue *__pyx_v_self, int __pyx_v_queue_num, PyObject *__pyx_v_user_callback, u_int32_t __pyx_v_max_len, u_int8_t __pyx_v_mode, u_int32_t __pyx_v_range, u_int32_t __pyx_v_sock_len); /* proto */ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_6unbind(struct __pyx_obj_14netfilterqueue_NetfilterQueue *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_8run(struct __pyx_obj_14netfilterqueue_NetfilterQueue *__pyx_v_self); /* proto */ static PyObject *__pyx_tp_new_14netfilterqueue_Packet(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ @@ -1401,16 +1419,14 @@ static PyObject *__pyx_int_138; static PyObject *__pyx_int_139; static PyObject *__pyx_int_140; static PyObject *__pyx_int_255; -static PyObject *__pyx_int_1024; -static u_int32_t __pyx_k__4; -static u_int8_t __pyx_k__5; +static u_int8_t __pyx_k__4; static PyObject *__pyx_tuple_; static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__3; +static PyObject *__pyx_tuple__5; static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__7; -/* "netfilterqueue.pyx":25 +/* "netfilterqueue.pyx":29 * cimport cpython.version * * cdef int global_callback(nfq_q_handle *qh, nfgenmsg *nfmsg, # <<<<<<<<<<<<<< @@ -1433,7 +1449,7 @@ static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *__pyx_v #endif __Pyx_RefNannySetupContext("global_callback", 0); - /* "netfilterqueue.pyx":28 + /* "netfilterqueue.pyx":32 * nfq_data *nfa, void *data) with gil: * """Create a Packet and pass it to appropriate callback.""" * cdef NetfilterQueue nfqueue = data # <<<<<<<<<<<<<< @@ -1445,7 +1461,7 @@ static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *__pyx_v __pyx_v_nfqueue = ((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_t_1); __pyx_t_1 = 0; - /* "netfilterqueue.pyx":29 + /* "netfilterqueue.pyx":33 * """Create a Packet and pass it to appropriate callback.""" * cdef NetfilterQueue nfqueue = data * cdef object user_callback = nfqueue.user_callback # <<<<<<<<<<<<<< @@ -1457,30 +1473,30 @@ static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *__pyx_v __pyx_v_user_callback = __pyx_t_1; __pyx_t_1 = 0; - /* "netfilterqueue.pyx":31 + /* "netfilterqueue.pyx":35 * cdef object user_callback = nfqueue.user_callback * * packet = Packet() # <<<<<<<<<<<<<< * packet.set_nfq_data(qh, nfa) * user_callback(packet) */ - __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_14netfilterqueue_Packet), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_14netfilterqueue_Packet), __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_packet = ((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_t_1); __pyx_t_1 = 0; - /* "netfilterqueue.pyx":32 + /* "netfilterqueue.pyx":36 * * packet = Packet() * packet.set_nfq_data(qh, nfa) # <<<<<<<<<<<<<< * user_callback(packet) * return 1 */ - __pyx_t_1 = ((struct __pyx_vtabstruct_14netfilterqueue_Packet *)__pyx_v_packet->__pyx_vtab)->set_nfq_data(__pyx_v_packet, __pyx_v_qh, __pyx_v_nfa); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_1 = ((struct __pyx_vtabstruct_14netfilterqueue_Packet *)__pyx_v_packet->__pyx_vtab)->set_nfq_data(__pyx_v_packet, __pyx_v_qh, __pyx_v_nfa); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "netfilterqueue.pyx":33 + /* "netfilterqueue.pyx":37 * packet = Packet() * packet.set_nfq_data(qh, nfa) * user_callback(packet) # <<<<<<<<<<<<<< @@ -1499,23 +1515,23 @@ static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *__pyx_v } } if (!__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_packet)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_packet)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { - __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 33, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; __Pyx_INCREF(((PyObject *)__pyx_v_packet)); __Pyx_GIVEREF(((PyObject *)__pyx_v_packet)); PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_packet)); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "netfilterqueue.pyx":34 + /* "netfilterqueue.pyx":38 * packet.set_nfq_data(qh, nfa) * user_callback(packet) * return 1 # <<<<<<<<<<<<<< @@ -1525,7 +1541,7 @@ static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *__pyx_v __pyx_r = 1; goto __pyx_L0; - /* "netfilterqueue.pyx":25 + /* "netfilterqueue.pyx":29 * cimport cpython.version * * cdef int global_callback(nfq_q_handle *qh, nfgenmsg *nfmsg, # <<<<<<<<<<<<<< @@ -1552,7 +1568,7 @@ static int __pyx_f_14netfilterqueue_global_callback(struct nfq_q_handle *__pyx_v return __pyx_r; } -/* "netfilterqueue.pyx":38 +/* "netfilterqueue.pyx":42 * cdef class Packet: * """A packet received from NetfilterQueue.""" * def __cinit__(self): # <<<<<<<<<<<<<< @@ -1581,7 +1597,7 @@ static int __pyx_pf_14netfilterqueue_6Packet___cinit__(struct __pyx_obj_14netfil __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); - /* "netfilterqueue.pyx":39 + /* "netfilterqueue.pyx":43 * """A packet received from NetfilterQueue.""" * def __cinit__(self): * self._verdict_is_set = False # <<<<<<<<<<<<<< @@ -1590,7 +1606,7 @@ static int __pyx_pf_14netfilterqueue_6Packet___cinit__(struct __pyx_obj_14netfil */ __pyx_v_self->_verdict_is_set = 0; - /* "netfilterqueue.pyx":40 + /* "netfilterqueue.pyx":44 * def __cinit__(self): * self._verdict_is_set = False * self._mark_is_set = False # <<<<<<<<<<<<<< @@ -1599,7 +1615,7 @@ static int __pyx_pf_14netfilterqueue_6Packet___cinit__(struct __pyx_obj_14netfil */ __pyx_v_self->_mark_is_set = 0; - /* "netfilterqueue.pyx":41 + /* "netfilterqueue.pyx":45 * self._verdict_is_set = False * self._mark_is_set = False * self._given_payload = None # <<<<<<<<<<<<<< @@ -1612,7 +1628,7 @@ static int __pyx_pf_14netfilterqueue_6Packet___cinit__(struct __pyx_obj_14netfil __Pyx_DECREF(__pyx_v_self->_given_payload); __pyx_v_self->_given_payload = ((PyObject*)Py_None); - /* "netfilterqueue.pyx":38 + /* "netfilterqueue.pyx":42 * cdef class Packet: * """A packet received from NetfilterQueue.""" * def __cinit__(self): # <<<<<<<<<<<<<< @@ -1626,7 +1642,7 @@ static int __pyx_pf_14netfilterqueue_6Packet___cinit__(struct __pyx_obj_14netfil return __pyx_r; } -/* "netfilterqueue.pyx":43 +/* "netfilterqueue.pyx":47 * self._given_payload = None * * def __str__(self): # <<<<<<<<<<<<<< @@ -1660,7 +1676,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_2__str__(struct __pyx_obj_14n PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__str__", 0); - /* "netfilterqueue.pyx":44 + /* "netfilterqueue.pyx":48 * * def __str__(self): * cdef iphdr *hdr = self.payload # <<<<<<<<<<<<<< @@ -1669,19 +1685,19 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_2__str__(struct __pyx_obj_14n */ __pyx_v_hdr = ((struct iphdr *)__pyx_v_self->payload); - /* "netfilterqueue.pyx":45 + /* "netfilterqueue.pyx":49 * def __str__(self): * cdef iphdr *hdr = self.payload * protocol = PROTOCOLS.get(hdr.protocol, "Unknown protocol") # <<<<<<<<<<<<<< * return "%s packet, %s bytes" % (protocol, self.payload_len) * */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_PROTOCOLS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_PROTOCOLS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_From_u_int8_t(__pyx_v_hdr->protocol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_u_int8_t(__pyx_v_hdr->protocol); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = NULL; __pyx_t_5 = 0; @@ -1695,7 +1711,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_2__str__(struct __pyx_obj_14n __pyx_t_5 = 1; } } - __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; @@ -1706,14 +1722,14 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_2__str__(struct __pyx_obj_14n __Pyx_GIVEREF(__pyx_kp_s_Unknown_protocol); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_kp_s_Unknown_protocol); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_protocol = __pyx_t_1; __pyx_t_1 = 0; - /* "netfilterqueue.pyx":46 + /* "netfilterqueue.pyx":50 * cdef iphdr *hdr = self.payload * protocol = PROTOCOLS.get(hdr.protocol, "Unknown protocol") * return "%s packet, %s bytes" % (protocol, self.payload_len) # <<<<<<<<<<<<<< @@ -1721,9 +1737,9 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_2__str__(struct __pyx_obj_14n * cdef set_nfq_data(self, nfq_q_handle *qh, nfq_data *nfa): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->payload_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) + __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->payload_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_protocol); __Pyx_GIVEREF(__pyx_v_protocol); @@ -1731,14 +1747,14 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_2__str__(struct __pyx_obj_14n __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_packet_s_bytes, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_packet_s_bytes, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "netfilterqueue.pyx":43 + /* "netfilterqueue.pyx":47 * self._given_payload = None * * def __str__(self): # <<<<<<<<<<<<<< @@ -1762,7 +1778,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_2__str__(struct __pyx_obj_14n return __pyx_r; } -/* "netfilterqueue.pyx":48 +/* "netfilterqueue.pyx":52 * return "%s packet, %s bytes" % (protocol, self.payload_len) * * cdef set_nfq_data(self, nfq_q_handle *qh, nfq_data *nfa): # <<<<<<<<<<<<<< @@ -1778,7 +1794,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ PyObject *__pyx_t_3 = NULL; __Pyx_RefNannySetupContext("set_nfq_data", 0); - /* "netfilterqueue.pyx":53 + /* "netfilterqueue.pyx":57 * local values. * """ * self._qh = qh # <<<<<<<<<<<<<< @@ -1787,7 +1803,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ __pyx_v_self->_qh = __pyx_v_qh; - /* "netfilterqueue.pyx":54 + /* "netfilterqueue.pyx":58 * """ * self._qh = qh * self._nfa = nfa # <<<<<<<<<<<<<< @@ -1796,7 +1812,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ __pyx_v_self->_nfa = __pyx_v_nfa; - /* "netfilterqueue.pyx":55 + /* "netfilterqueue.pyx":59 * self._qh = qh * self._nfa = nfa * self._hdr = nfq_get_msg_packet_hdr(nfa) # <<<<<<<<<<<<<< @@ -1805,7 +1821,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ __pyx_v_self->_hdr = nfq_get_msg_packet_hdr(__pyx_v_nfa); - /* "netfilterqueue.pyx":57 + /* "netfilterqueue.pyx":61 * self._hdr = nfq_get_msg_packet_hdr(nfa) * * self.id = ntohl(self._hdr.packet_id) # <<<<<<<<<<<<<< @@ -1814,7 +1830,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ __pyx_v_self->id = ntohl(__pyx_v_self->_hdr->packet_id); - /* "netfilterqueue.pyx":58 + /* "netfilterqueue.pyx":62 * * self.id = ntohl(self._hdr.packet_id) * self.hw_protocol = ntohs(self._hdr.hw_protocol) # <<<<<<<<<<<<<< @@ -1823,7 +1839,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ __pyx_v_self->hw_protocol = ntohs(__pyx_v_self->_hdr->hw_protocol); - /* "netfilterqueue.pyx":59 + /* "netfilterqueue.pyx":63 * self.id = ntohl(self._hdr.packet_id) * self.hw_protocol = ntohs(self._hdr.hw_protocol) * self.hook = self._hdr.hook # <<<<<<<<<<<<<< @@ -1833,7 +1849,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ __pyx_t_1 = __pyx_v_self->_hdr->hook; __pyx_v_self->hook = __pyx_t_1; - /* "netfilterqueue.pyx":61 + /* "netfilterqueue.pyx":65 * self.hook = self._hdr.hook * * self.payload_len = nfq_get_payload(self._nfa, &self.payload) # <<<<<<<<<<<<<< @@ -1842,7 +1858,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ __pyx_v_self->payload_len = nfq_get_payload(__pyx_v_self->_nfa, (&__pyx_v_self->payload)); - /* "netfilterqueue.pyx":62 + /* "netfilterqueue.pyx":66 * * self.payload_len = nfq_get_payload(self._nfa, &self.payload) * if self.payload_len < 0: # <<<<<<<<<<<<<< @@ -1852,20 +1868,20 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ __pyx_t_2 = ((__pyx_v_self->payload_len < 0) != 0); if (__pyx_t_2) { - /* "netfilterqueue.pyx":63 + /* "netfilterqueue.pyx":67 * self.payload_len = nfq_get_payload(self._nfa, &self.payload) * if self.payload_len < 0: * raise OSError("Failed to get payload of packet.") # <<<<<<<<<<<<<< * * nfq_get_timestamp(self._nfa, &self.timestamp) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 63, __pyx_L1_error) + __PYX_ERR(0, 67, __pyx_L1_error) - /* "netfilterqueue.pyx":62 + /* "netfilterqueue.pyx":66 * * self.payload_len = nfq_get_payload(self._nfa, &self.payload) * if self.payload_len < 0: # <<<<<<<<<<<<<< @@ -1874,7 +1890,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ } - /* "netfilterqueue.pyx":65 + /* "netfilterqueue.pyx":69 * raise OSError("Failed to get payload of packet.") * * nfq_get_timestamp(self._nfa, &self.timestamp) # <<<<<<<<<<<<<< @@ -1883,7 +1899,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ nfq_get_timestamp(__pyx_v_self->_nfa, (&__pyx_v_self->timestamp)); - /* "netfilterqueue.pyx":66 + /* "netfilterqueue.pyx":70 * * nfq_get_timestamp(self._nfa, &self.timestamp) * self.mark = nfq_get_nfmark(nfa) # <<<<<<<<<<<<<< @@ -1892,7 +1908,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ */ __pyx_v_self->mark = nfq_get_nfmark(__pyx_v_nfa); - /* "netfilterqueue.pyx":48 + /* "netfilterqueue.pyx":52 * return "%s packet, %s bytes" % (protocol, self.payload_len) * * cdef set_nfq_data(self, nfq_q_handle *qh, nfq_data *nfa): # <<<<<<<<<<<<<< @@ -1913,7 +1929,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_nfq_data(struct __pyx_obj_ return __pyx_r; } -/* "netfilterqueue.pyx":68 +/* "netfilterqueue.pyx":72 * self.mark = nfq_get_nfmark(nfa) * * cdef void verdict(self, u_int8_t verdict): # <<<<<<<<<<<<<< @@ -1931,7 +1947,7 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte unsigned char *__pyx_t_4; __Pyx_RefNannySetupContext("verdict", 0); - /* "netfilterqueue.pyx":70 + /* "netfilterqueue.pyx":74 * cdef void verdict(self, u_int8_t verdict): * """Call appropriate set_verdict... function on packet.""" * if self._verdict_is_set: # <<<<<<<<<<<<<< @@ -1941,20 +1957,20 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte __pyx_t_1 = (__pyx_v_self->_verdict_is_set != 0); if (__pyx_t_1) { - /* "netfilterqueue.pyx":71 + /* "netfilterqueue.pyx":75 * """Call appropriate set_verdict... function on packet.""" * if self._verdict_is_set: * raise RuntimeWarning("Verdict already given for this packet.") # <<<<<<<<<<<<<< * * cdef u_int32_t modified_payload_len = 0 */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeWarning, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeWarning, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 71, __pyx_L1_error) + __PYX_ERR(0, 75, __pyx_L1_error) - /* "netfilterqueue.pyx":70 + /* "netfilterqueue.pyx":74 * cdef void verdict(self, u_int8_t verdict): * """Call appropriate set_verdict... function on packet.""" * if self._verdict_is_set: # <<<<<<<<<<<<<< @@ -1963,7 +1979,7 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte */ } - /* "netfilterqueue.pyx":73 + /* "netfilterqueue.pyx":77 * raise RuntimeWarning("Verdict already given for this packet.") * * cdef u_int32_t modified_payload_len = 0 # <<<<<<<<<<<<<< @@ -1972,7 +1988,7 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte */ __pyx_v_modified_payload_len = 0; - /* "netfilterqueue.pyx":74 + /* "netfilterqueue.pyx":78 * * cdef u_int32_t modified_payload_len = 0 * cdef unsigned char *modified_payload = NULL # <<<<<<<<<<<<<< @@ -1981,7 +1997,7 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte */ __pyx_v_modified_payload = NULL; - /* "netfilterqueue.pyx":75 + /* "netfilterqueue.pyx":79 * cdef u_int32_t modified_payload_len = 0 * cdef unsigned char *modified_payload = NULL * if self._given_payload: # <<<<<<<<<<<<<< @@ -1991,7 +2007,7 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte __pyx_t_1 = (__pyx_v_self->_given_payload != Py_None) && (PyBytes_GET_SIZE(__pyx_v_self->_given_payload) != 0); if (__pyx_t_1) { - /* "netfilterqueue.pyx":76 + /* "netfilterqueue.pyx":80 * cdef unsigned char *modified_payload = NULL * if self._given_payload: * modified_payload_len = len(self._given_payload) # <<<<<<<<<<<<<< @@ -2002,23 +2018,23 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte __Pyx_INCREF(__pyx_t_2); if (unlikely(__pyx_t_2 == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - __PYX_ERR(0, 76, __pyx_L1_error) + __PYX_ERR(0, 80, __pyx_L1_error) } - __pyx_t_3 = PyBytes_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 76, __pyx_L1_error) + __pyx_t_3 = PyBytes_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_modified_payload_len = __pyx_t_3; - /* "netfilterqueue.pyx":77 + /* "netfilterqueue.pyx":81 * if self._given_payload: * modified_payload_len = len(self._given_payload) * modified_payload = self._given_payload # <<<<<<<<<<<<<< * if self._mark_is_set: * nfq_set_verdict_mark( */ - __pyx_t_4 = __Pyx_PyObject_AsUString(__pyx_v_self->_given_payload); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_AsUString(__pyx_v_self->_given_payload); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error) __pyx_v_modified_payload = __pyx_t_4; - /* "netfilterqueue.pyx":75 + /* "netfilterqueue.pyx":79 * cdef u_int32_t modified_payload_len = 0 * cdef unsigned char *modified_payload = NULL * if self._given_payload: # <<<<<<<<<<<<<< @@ -2027,7 +2043,7 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte */ } - /* "netfilterqueue.pyx":78 + /* "netfilterqueue.pyx":82 * modified_payload_len = len(self._given_payload) * modified_payload = self._given_payload * if self._mark_is_set: # <<<<<<<<<<<<<< @@ -2037,7 +2053,7 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte __pyx_t_1 = (__pyx_v_self->_mark_is_set != 0); if (__pyx_t_1) { - /* "netfilterqueue.pyx":79 + /* "netfilterqueue.pyx":83 * modified_payload = self._given_payload * if self._mark_is_set: * nfq_set_verdict_mark( # <<<<<<<<<<<<<< @@ -2046,7 +2062,7 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte */ nfq_set_verdict_mark(__pyx_v_self->_qh, __pyx_v_self->id, __pyx_v_verdict, htonl(__pyx_v_self->_given_mark), __pyx_v_modified_payload_len, __pyx_v_modified_payload); - /* "netfilterqueue.pyx":78 + /* "netfilterqueue.pyx":82 * modified_payload_len = len(self._given_payload) * modified_payload = self._given_payload * if self._mark_is_set: # <<<<<<<<<<<<<< @@ -2056,7 +2072,7 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte goto __pyx_L5; } - /* "netfilterqueue.pyx":87 + /* "netfilterqueue.pyx":91 * modified_payload) * else: * nfq_set_verdict( # <<<<<<<<<<<<<< @@ -2065,7 +2081,7 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte */ /*else*/ { - /* "netfilterqueue.pyx":92 + /* "netfilterqueue.pyx":96 * verdict, * modified_payload_len, * modified_payload) # <<<<<<<<<<<<<< @@ -2076,7 +2092,7 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte } __pyx_L5:; - /* "netfilterqueue.pyx":94 + /* "netfilterqueue.pyx":98 * modified_payload) * * self._verdict_is_set = True # <<<<<<<<<<<<<< @@ -2085,7 +2101,7 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte */ __pyx_v_self->_verdict_is_set = 1; - /* "netfilterqueue.pyx":68 + /* "netfilterqueue.pyx":72 * self.mark = nfq_get_nfmark(nfa) * * cdef void verdict(self, u_int8_t verdict): # <<<<<<<<<<<<<< @@ -2102,7 +2118,7 @@ static void __pyx_f_14netfilterqueue_6Packet_verdict(struct __pyx_obj_14netfilte __Pyx_RefNannyFinishContext(); } -/* "netfilterqueue.pyx":96 +/* "netfilterqueue.pyx":100 * self._verdict_is_set = True * * def get_payload(self): # <<<<<<<<<<<<<< @@ -2132,7 +2148,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_4get_payload(struct __pyx_obj PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("get_payload", 0); - /* "netfilterqueue.pyx":99 + /* "netfilterqueue.pyx":103 * """Return payload as Python string.""" * cdef object py_string * if cpython.version.PY_MAJOR_VERSION >= 3: # <<<<<<<<<<<<<< @@ -2142,19 +2158,19 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_4get_payload(struct __pyx_obj __pyx_t_1 = ((PY_MAJOR_VERSION >= 3) != 0); if (__pyx_t_1) { - /* "netfilterqueue.pyx":100 + /* "netfilterqueue.pyx":104 * cdef object py_string * if cpython.version.PY_MAJOR_VERSION >= 3: * py_string = PyBytes_FromStringAndSize( # <<<<<<<<<<<<<< * self.payload, self.payload_len) * else: */ - __pyx_t_2 = PyBytes_FromStringAndSize(__pyx_v_self->payload, __pyx_v_self->payload_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error) + __pyx_t_2 = PyBytes_FromStringAndSize(__pyx_v_self->payload, __pyx_v_self->payload_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_py_string = __pyx_t_2; __pyx_t_2 = 0; - /* "netfilterqueue.pyx":99 + /* "netfilterqueue.pyx":103 * """Return payload as Python string.""" * cdef object py_string * if cpython.version.PY_MAJOR_VERSION >= 3: # <<<<<<<<<<<<<< @@ -2164,7 +2180,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_4get_payload(struct __pyx_obj goto __pyx_L3; } - /* "netfilterqueue.pyx":103 + /* "netfilterqueue.pyx":107 * self.payload, self.payload_len) * else: * py_string = PyString_FromStringAndSize( # <<<<<<<<<<<<<< @@ -2173,21 +2189,21 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_4get_payload(struct __pyx_obj */ /*else*/ { - /* "netfilterqueue.pyx":104 + /* "netfilterqueue.pyx":108 * else: * py_string = PyString_FromStringAndSize( * self.payload, self.payload_len) # <<<<<<<<<<<<<< * return py_string * */ - __pyx_t_2 = PyString_FromStringAndSize(__pyx_v_self->payload, __pyx_v_self->payload_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) + __pyx_t_2 = PyString_FromStringAndSize(__pyx_v_self->payload, __pyx_v_self->payload_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_py_string = __pyx_t_2; __pyx_t_2 = 0; } __pyx_L3:; - /* "netfilterqueue.pyx":105 + /* "netfilterqueue.pyx":109 * py_string = PyString_FromStringAndSize( * self.payload, self.payload_len) * return py_string # <<<<<<<<<<<<<< @@ -2199,7 +2215,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_4get_payload(struct __pyx_obj __pyx_r = __pyx_v_py_string; goto __pyx_L0; - /* "netfilterqueue.pyx":96 + /* "netfilterqueue.pyx":100 * self._verdict_is_set = True * * def get_payload(self): # <<<<<<<<<<<<<< @@ -2219,7 +2235,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_4get_payload(struct __pyx_obj return __pyx_r; } -/* "netfilterqueue.pyx":107 +/* "netfilterqueue.pyx":111 * return py_string * * cpdef Py_ssize_t get_payload_len(self): # <<<<<<<<<<<<<< @@ -2241,7 +2257,7 @@ static Py_ssize_t __pyx_f_14netfilterqueue_6Packet_get_payload_len(struct __pyx_ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_payload_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_payload_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_14netfilterqueue_6Packet_7get_payload_len)) { __Pyx_INCREF(__pyx_t_1); @@ -2256,14 +2272,14 @@ static Py_ssize_t __pyx_f_14netfilterqueue_6Packet_get_payload_len(struct __pyx_ } } if (__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -2272,7 +2288,7 @@ static Py_ssize_t __pyx_f_14netfilterqueue_6Packet_get_payload_len(struct __pyx_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "netfilterqueue.pyx":108 + /* "netfilterqueue.pyx":112 * * cpdef Py_ssize_t get_payload_len(self): * return self.payload_len # <<<<<<<<<<<<<< @@ -2282,7 +2298,7 @@ static Py_ssize_t __pyx_f_14netfilterqueue_6Packet_get_payload_len(struct __pyx_ __pyx_r = __pyx_v_self->payload_len; goto __pyx_L0; - /* "netfilterqueue.pyx":107 + /* "netfilterqueue.pyx":111 * return py_string * * cpdef Py_ssize_t get_payload_len(self): # <<<<<<<<<<<<<< @@ -2322,7 +2338,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_6get_payload_len(struct __pyx PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_payload_len", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromSsize_t(__pyx_f_14netfilterqueue_6Packet_get_payload_len(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error) + __pyx_t_1 = PyInt_FromSsize_t(__pyx_f_14netfilterqueue_6Packet_get_payload_len(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2339,7 +2355,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_6get_payload_len(struct __pyx return __pyx_r; } -/* "netfilterqueue.pyx":110 +/* "netfilterqueue.pyx":114 * return self.payload_len * * cpdef double get_timestamp(self): # <<<<<<<<<<<<<< @@ -2361,7 +2377,7 @@ static double __pyx_f_14netfilterqueue_6Packet_get_timestamp(struct __pyx_obj_14 if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_timestamp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_timestamp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_14netfilterqueue_6Packet_9get_timestamp)) { __Pyx_INCREF(__pyx_t_1); @@ -2376,14 +2392,14 @@ static double __pyx_f_14netfilterqueue_6Packet_get_timestamp(struct __pyx_obj_14 } } if (__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -2392,7 +2408,7 @@ static double __pyx_f_14netfilterqueue_6Packet_get_timestamp(struct __pyx_obj_14 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "netfilterqueue.pyx":111 + /* "netfilterqueue.pyx":115 * * cpdef double get_timestamp(self): * return self.timestamp.tv_sec + (self.timestamp.tv_usec/1000000.0) # <<<<<<<<<<<<<< @@ -2402,7 +2418,7 @@ static double __pyx_f_14netfilterqueue_6Packet_get_timestamp(struct __pyx_obj_14 __pyx_r = (__pyx_v_self->timestamp.tv_sec + (__pyx_v_self->timestamp.tv_usec / 1000000.0)); goto __pyx_L0; - /* "netfilterqueue.pyx":110 + /* "netfilterqueue.pyx":114 * return self.payload_len * * cpdef double get_timestamp(self): # <<<<<<<<<<<<<< @@ -2442,7 +2458,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_8get_timestamp(struct __pyx_o PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_timestamp", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_f_14netfilterqueue_6Packet_get_timestamp(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_1 = PyFloat_FromDouble(__pyx_f_14netfilterqueue_6Packet_get_timestamp(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2459,7 +2475,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_8get_timestamp(struct __pyx_o return __pyx_r; } -/* "netfilterqueue.pyx":113 +/* "netfilterqueue.pyx":117 * return self.timestamp.tv_sec + (self.timestamp.tv_usec/1000000.0) * * cpdef set_payload(self, bytes payload): # <<<<<<<<<<<<<< @@ -2481,7 +2497,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_payload(struct __pyx_obj_1 if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_payload); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_payload); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_14netfilterqueue_6Packet_11set_payload)) { __Pyx_XDECREF(__pyx_r); @@ -2497,16 +2513,16 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_payload(struct __pyx_obj_1 } } if (!__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_payload); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_payload); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } else { - __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; __Pyx_INCREF(__pyx_v_payload); __Pyx_GIVEREF(__pyx_v_payload); PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_payload); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } @@ -2519,7 +2535,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_payload(struct __pyx_obj_1 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "netfilterqueue.pyx":115 + /* "netfilterqueue.pyx":119 * cpdef set_payload(self, bytes payload): * """Set the new payload of this packet.""" * self._given_payload = payload # <<<<<<<<<<<<<< @@ -2532,7 +2548,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_payload(struct __pyx_obj_1 __Pyx_DECREF(__pyx_v_self->_given_payload); __pyx_v_self->_given_payload = __pyx_v_payload; - /* "netfilterqueue.pyx":113 + /* "netfilterqueue.pyx":117 * return self.timestamp.tv_sec + (self.timestamp.tv_usec/1000000.0) * * cpdef set_payload(self, bytes payload): # <<<<<<<<<<<<<< @@ -2564,7 +2580,7 @@ static PyObject *__pyx_pw_14netfilterqueue_6Packet_11set_payload(PyObject *__pyx PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_payload (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_payload), (&PyBytes_Type), 1, "payload", 1))) __PYX_ERR(0, 113, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_payload), (&PyBytes_Type), 1, "payload", 1))) __PYX_ERR(0, 117, __pyx_L1_error) __pyx_r = __pyx_pf_14netfilterqueue_6Packet_10set_payload(((struct __pyx_obj_14netfilterqueue_Packet *)__pyx_v_self), ((PyObject*)__pyx_v_payload)); /* function exit code */ @@ -2582,7 +2598,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_10set_payload(struct __pyx_ob PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_payload", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_14netfilterqueue_6Packet_set_payload(__pyx_v_self, __pyx_v_payload, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_t_1 = __pyx_f_14netfilterqueue_6Packet_set_payload(__pyx_v_self, __pyx_v_payload, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2599,7 +2615,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_10set_payload(struct __pyx_ob return __pyx_r; } -/* "netfilterqueue.pyx":117 +/* "netfilterqueue.pyx":121 * self._given_payload = payload * * cpdef set_mark(self, u_int32_t mark): # <<<<<<<<<<<<<< @@ -2622,11 +2638,11 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_mark(struct __pyx_obj_14ne if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_mark); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_mark); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_14netfilterqueue_6Packet_13set_mark)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyInt_From_u_int32_t(__pyx_v_mark); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_u_int32_t(__pyx_v_mark); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; @@ -2640,17 +2656,17 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_mark(struct __pyx_obj_14ne } } if (!__pyx_t_5) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); } else { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } @@ -2663,7 +2679,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_mark(struct __pyx_obj_14ne __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "netfilterqueue.pyx":118 + /* "netfilterqueue.pyx":122 * * cpdef set_mark(self, u_int32_t mark): * self._given_mark = mark # <<<<<<<<<<<<<< @@ -2672,7 +2688,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_mark(struct __pyx_obj_14ne */ __pyx_v_self->_given_mark = __pyx_v_mark; - /* "netfilterqueue.pyx":119 + /* "netfilterqueue.pyx":123 * cpdef set_mark(self, u_int32_t mark): * self._given_mark = mark * self._mark_is_set = True # <<<<<<<<<<<<<< @@ -2681,7 +2697,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_set_mark(struct __pyx_obj_14ne */ __pyx_v_self->_mark_is_set = 1; - /* "netfilterqueue.pyx":117 + /* "netfilterqueue.pyx":121 * self._given_payload = payload * * cpdef set_mark(self, u_int32_t mark): # <<<<<<<<<<<<<< @@ -2715,7 +2731,7 @@ static PyObject *__pyx_pw_14netfilterqueue_6Packet_13set_mark(PyObject *__pyx_v_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_mark (wrapper)", 0); assert(__pyx_arg_mark); { - __pyx_v_mark = __Pyx_PyInt_As_u_int32_t(__pyx_arg_mark); if (unlikely((__pyx_v_mark == (u_int32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 117, __pyx_L3_error) + __pyx_v_mark = __Pyx_PyInt_As_u_int32_t(__pyx_arg_mark); if (unlikely((__pyx_v_mark == (u_int32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -2736,7 +2752,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_12set_mark(struct __pyx_obj_1 PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_mark", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_14netfilterqueue_6Packet_set_mark(__pyx_v_self, __pyx_v_mark, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_t_1 = __pyx_f_14netfilterqueue_6Packet_set_mark(__pyx_v_self, __pyx_v_mark, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2753,7 +2769,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_12set_mark(struct __pyx_obj_1 return __pyx_r; } -/* "netfilterqueue.pyx":121 +/* "netfilterqueue.pyx":125 * self._mark_is_set = True * * cpdef get_mark(self): # <<<<<<<<<<<<<< @@ -2775,7 +2791,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_get_mark(struct __pyx_obj_14ne if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_mark); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_mark); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_14netfilterqueue_6Packet_15get_mark)) { __Pyx_XDECREF(__pyx_r); @@ -2791,10 +2807,10 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_get_mark(struct __pyx_obj_14ne } } if (__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -2806,7 +2822,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_get_mark(struct __pyx_obj_14ne __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "netfilterqueue.pyx":122 + /* "netfilterqueue.pyx":126 * * cpdef get_mark(self): * if self._mark_is_set: # <<<<<<<<<<<<<< @@ -2816,7 +2832,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_get_mark(struct __pyx_obj_14ne __pyx_t_5 = (__pyx_v_self->_mark_is_set != 0); if (__pyx_t_5) { - /* "netfilterqueue.pyx":123 + /* "netfilterqueue.pyx":127 * cpdef get_mark(self): * if self._mark_is_set: * return self._given_mark # <<<<<<<<<<<<<< @@ -2824,13 +2840,13 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_get_mark(struct __pyx_obj_14ne * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_u_int32_t(__pyx_v_self->_given_mark); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_u_int32_t(__pyx_v_self->_given_mark); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "netfilterqueue.pyx":122 + /* "netfilterqueue.pyx":126 * * cpdef get_mark(self): * if self._mark_is_set: # <<<<<<<<<<<<<< @@ -2839,7 +2855,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_get_mark(struct __pyx_obj_14ne */ } - /* "netfilterqueue.pyx":124 + /* "netfilterqueue.pyx":128 * if self._mark_is_set: * return self._given_mark * return self.mark # <<<<<<<<<<<<<< @@ -2847,13 +2863,13 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_get_mark(struct __pyx_obj_14ne * cpdef accept(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_u_int32_t(__pyx_v_self->mark); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 124, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_u_int32_t(__pyx_v_self->mark); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "netfilterqueue.pyx":121 + /* "netfilterqueue.pyx":125 * self._mark_is_set = True * * cpdef get_mark(self): # <<<<<<<<<<<<<< @@ -2894,7 +2910,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_14get_mark(struct __pyx_obj_1 PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("get_mark", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_14netfilterqueue_6Packet_get_mark(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_1 = __pyx_f_14netfilterqueue_6Packet_get_mark(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2911,7 +2927,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_14get_mark(struct __pyx_obj_1 return __pyx_r; } -/* "netfilterqueue.pyx":126 +/* "netfilterqueue.pyx":130 * return self.mark * * cpdef accept(self): # <<<<<<<<<<<<<< @@ -2932,7 +2948,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_accept(struct __pyx_obj_14netf if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_accept); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_accept); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_14netfilterqueue_6Packet_17accept)) { __Pyx_XDECREF(__pyx_r); @@ -2948,10 +2964,10 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_accept(struct __pyx_obj_14netf } } if (__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -2963,7 +2979,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_accept(struct __pyx_obj_14netf __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "netfilterqueue.pyx":128 + /* "netfilterqueue.pyx":132 * cpdef accept(self): * """Accept the packet.""" * self.verdict(NF_ACCEPT) # <<<<<<<<<<<<<< @@ -2972,7 +2988,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_accept(struct __pyx_obj_14netf */ ((struct __pyx_vtabstruct_14netfilterqueue_Packet *)__pyx_v_self->__pyx_vtab)->verdict(__pyx_v_self, __pyx_e_14netfilterqueue_NF_ACCEPT); - /* "netfilterqueue.pyx":126 + /* "netfilterqueue.pyx":130 * return self.mark * * cpdef accept(self): # <<<<<<<<<<<<<< @@ -3016,7 +3032,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_16accept(struct __pyx_obj_14n PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("accept", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_14netfilterqueue_6Packet_accept(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_t_1 = __pyx_f_14netfilterqueue_6Packet_accept(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3033,7 +3049,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_16accept(struct __pyx_obj_14n return __pyx_r; } -/* "netfilterqueue.pyx":130 +/* "netfilterqueue.pyx":134 * self.verdict(NF_ACCEPT) * * cpdef drop(self): # <<<<<<<<<<<<<< @@ -3054,7 +3070,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_drop(struct __pyx_obj_14netfil if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_drop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_drop); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_14netfilterqueue_6Packet_19drop)) { __Pyx_XDECREF(__pyx_r); @@ -3070,10 +3086,10 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_drop(struct __pyx_obj_14netfil } } if (__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -3085,7 +3101,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_drop(struct __pyx_obj_14netfil __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "netfilterqueue.pyx":132 + /* "netfilterqueue.pyx":136 * cpdef drop(self): * """Drop the packet.""" * self.verdict(NF_DROP) # <<<<<<<<<<<<<< @@ -3094,7 +3110,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_drop(struct __pyx_obj_14netfil */ ((struct __pyx_vtabstruct_14netfilterqueue_Packet *)__pyx_v_self->__pyx_vtab)->verdict(__pyx_v_self, __pyx_e_14netfilterqueue_NF_DROP); - /* "netfilterqueue.pyx":130 + /* "netfilterqueue.pyx":134 * self.verdict(NF_ACCEPT) * * cpdef drop(self): # <<<<<<<<<<<<<< @@ -3138,7 +3154,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_18drop(struct __pyx_obj_14net PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("drop", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_14netfilterqueue_6Packet_drop(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_1 = __pyx_f_14netfilterqueue_6Packet_drop(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3155,7 +3171,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_18drop(struct __pyx_obj_14net return __pyx_r; } -/* "netfilterqueue.pyx":134 +/* "netfilterqueue.pyx":138 * self.verdict(NF_DROP) * * cpdef repeat(self): # <<<<<<<<<<<<<< @@ -3176,7 +3192,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_repeat(struct __pyx_obj_14netf if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_repeat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_repeat); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_14netfilterqueue_6Packet_21repeat)) { __Pyx_XDECREF(__pyx_r); @@ -3192,10 +3208,10 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_repeat(struct __pyx_obj_14netf } } if (__pyx_t_4) { - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { - __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -3207,7 +3223,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_repeat(struct __pyx_obj_14netf __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "netfilterqueue.pyx":136 + /* "netfilterqueue.pyx":140 * cpdef repeat(self): * """Repeat the packet.""" * self.verdict(NF_REPEAT) # <<<<<<<<<<<<<< @@ -3216,7 +3232,7 @@ static PyObject *__pyx_f_14netfilterqueue_6Packet_repeat(struct __pyx_obj_14netf */ ((struct __pyx_vtabstruct_14netfilterqueue_Packet *)__pyx_v_self->__pyx_vtab)->verdict(__pyx_v_self, __pyx_e_14netfilterqueue_NF_REPEAT); - /* "netfilterqueue.pyx":134 + /* "netfilterqueue.pyx":138 * self.verdict(NF_DROP) * * cpdef repeat(self): # <<<<<<<<<<<<<< @@ -3260,7 +3276,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_20repeat(struct __pyx_obj_14n PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("repeat", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_14netfilterqueue_6Packet_repeat(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_1 = __pyx_f_14netfilterqueue_6Packet_repeat(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3277,7 +3293,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_20repeat(struct __pyx_obj_14n return __pyx_r; } -/* "netfilterqueue.pxd":164 +/* "netfilterqueue.pxd":177 * * # From NFQ packet header: * cdef readonly u_int32_t id # <<<<<<<<<<<<<< @@ -3304,7 +3320,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_2id___get__(struct __pyx_obj_ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_u_int32_t(__pyx_v_self->id); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 164, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_u_int32_t(__pyx_v_self->id); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 177, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3321,7 +3337,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_2id___get__(struct __pyx_obj_ return __pyx_r; } -/* "netfilterqueue.pxd":165 +/* "netfilterqueue.pxd":178 * # From NFQ packet header: * cdef readonly u_int32_t id * cdef readonly u_int16_t hw_protocol # <<<<<<<<<<<<<< @@ -3348,7 +3364,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_11hw_protocol___get__(struct PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_u_int16_t(__pyx_v_self->hw_protocol); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 165, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_u_int16_t(__pyx_v_self->hw_protocol); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3365,7 +3381,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_11hw_protocol___get__(struct return __pyx_r; } -/* "netfilterqueue.pxd":166 +/* "netfilterqueue.pxd":179 * cdef readonly u_int32_t id * cdef readonly u_int16_t hw_protocol * cdef readonly u_int8_t hook # <<<<<<<<<<<<<< @@ -3392,7 +3408,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_4hook___get__(struct __pyx_ob PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_u_int8_t(__pyx_v_self->hook); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 166, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_u_int8_t(__pyx_v_self->hook); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 179, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3409,7 +3425,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_4hook___get__(struct __pyx_ob return __pyx_r; } -/* "netfilterqueue.pxd":167 +/* "netfilterqueue.pxd":180 * cdef readonly u_int16_t hw_protocol * cdef readonly u_int8_t hook * cdef readonly u_int32_t mark # <<<<<<<<<<<<<< @@ -3436,7 +3452,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_4mark___get__(struct __pyx_ob PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_u_int32_t(__pyx_v_self->mark); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 167, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_u_int32_t(__pyx_v_self->mark); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3453,7 +3469,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_4mark___get__(struct __pyx_ob return __pyx_r; } -/* "netfilterqueue.pxd":171 +/* "netfilterqueue.pxd":184 * # Packet details: * cdef Py_ssize_t payload_len * cdef readonly char *payload # <<<<<<<<<<<<<< @@ -3480,7 +3496,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_7payload___get__(struct __pyx PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->payload); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 171, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->payload); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3497,7 +3513,7 @@ static PyObject *__pyx_pf_14netfilterqueue_6Packet_7payload___get__(struct __pyx return __pyx_r; } -/* "netfilterqueue.pyx":140 +/* "netfilterqueue.pyx":144 * cdef class NetfilterQueue: * """Handle a single numbered queue.""" * def __cinit__(self, *args, **kwargs): # <<<<<<<<<<<<<< @@ -3536,23 +3552,23 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(struct __pyx_obj int __pyx_t_4; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "netfilterqueue.pyx":141 + /* "netfilterqueue.pyx":145 * """Handle a single numbered queue.""" * def __cinit__(self, *args, **kwargs): * self.af = kwargs.get("af", PF_INET) # <<<<<<<<<<<<<< * * self.h = nfq_open() */ - __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_e_14netfilterqueue_PF_INET); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_e_14netfilterqueue_PF_INET); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_s_af, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_GetItemDefault(__pyx_v_kwargs, __pyx_n_s_af, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyInt_As_u_int16_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (u_int16_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_As_u_int16_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (u_int16_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->af = __pyx_t_3; - /* "netfilterqueue.pyx":143 + /* "netfilterqueue.pyx":147 * self.af = kwargs.get("af", PF_INET) * * self.h = nfq_open() # <<<<<<<<<<<<<< @@ -3561,7 +3577,7 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(struct __pyx_obj */ __pyx_v_self->h = nfq_open(); - /* "netfilterqueue.pyx":144 + /* "netfilterqueue.pyx":148 * * self.h = nfq_open() * if self.h == NULL: # <<<<<<<<<<<<<< @@ -3571,20 +3587,20 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(struct __pyx_obj __pyx_t_4 = ((__pyx_v_self->h == NULL) != 0); if (__pyx_t_4) { - /* "netfilterqueue.pyx":145 + /* "netfilterqueue.pyx":149 * self.h = nfq_open() * if self.h == NULL: * raise OSError("Failed to open NFQueue.") # <<<<<<<<<<<<<< * nfq_unbind_pf(self.h, self.af) # This does NOT kick out previous * # running queues */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 145, __pyx_L1_error) + __PYX_ERR(0, 149, __pyx_L1_error) - /* "netfilterqueue.pyx":144 + /* "netfilterqueue.pyx":148 * * self.h = nfq_open() * if self.h == NULL: # <<<<<<<<<<<<<< @@ -3593,7 +3609,7 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(struct __pyx_obj */ } - /* "netfilterqueue.pyx":146 + /* "netfilterqueue.pyx":150 * if self.h == NULL: * raise OSError("Failed to open NFQueue.") * nfq_unbind_pf(self.h, self.af) # This does NOT kick out previous # <<<<<<<<<<<<<< @@ -3602,7 +3618,7 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(struct __pyx_obj */ nfq_unbind_pf(__pyx_v_self->h, __pyx_v_self->af); - /* "netfilterqueue.pyx":148 + /* "netfilterqueue.pyx":152 * nfq_unbind_pf(self.h, self.af) # This does NOT kick out previous * # running queues * if nfq_bind_pf(self.h, self.af) < 0: # <<<<<<<<<<<<<< @@ -3612,31 +3628,31 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(struct __pyx_obj __pyx_t_4 = ((nfq_bind_pf(__pyx_v_self->h, __pyx_v_self->af) < 0) != 0); if (__pyx_t_4) { - /* "netfilterqueue.pyx":149 + /* "netfilterqueue.pyx":153 * # running queues * if nfq_bind_pf(self.h, self.af) < 0: * raise OSError("Failed to bind family %s. Are you root?" % self.af) # <<<<<<<<<<<<<< * * def __dealloc__(self): */ - __pyx_t_2 = __Pyx_PyInt_From_u_int16_t(__pyx_v_self->af); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_u_int16_t(__pyx_v_self->af); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Failed_to_bind_family_s_Are_you, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Failed_to_bind_family_s_Are_you, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 149, __pyx_L1_error) + __PYX_ERR(0, 153, __pyx_L1_error) - /* "netfilterqueue.pyx":148 + /* "netfilterqueue.pyx":152 * nfq_unbind_pf(self.h, self.af) # This does NOT kick out previous * # running queues * if nfq_bind_pf(self.h, self.af) < 0: # <<<<<<<<<<<<<< @@ -3645,7 +3661,7 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(struct __pyx_obj */ } - /* "netfilterqueue.pyx":140 + /* "netfilterqueue.pyx":144 * cdef class NetfilterQueue: * """Handle a single numbered queue.""" * def __cinit__(self, *args, **kwargs): # <<<<<<<<<<<<<< @@ -3666,7 +3682,7 @@ static int __pyx_pf_14netfilterqueue_14NetfilterQueue___cinit__(struct __pyx_obj return __pyx_r; } -/* "netfilterqueue.pyx":151 +/* "netfilterqueue.pyx":155 * raise OSError("Failed to bind family %s. Are you root?" % self.af) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3690,7 +3706,7 @@ static void __pyx_pf_14netfilterqueue_14NetfilterQueue_2__dealloc__(struct __pyx int __pyx_t_1; __Pyx_RefNannySetupContext("__dealloc__", 0); - /* "netfilterqueue.pyx":152 + /* "netfilterqueue.pyx":156 * * def __dealloc__(self): * if self.qh != NULL: # <<<<<<<<<<<<<< @@ -3700,7 +3716,7 @@ static void __pyx_pf_14netfilterqueue_14NetfilterQueue_2__dealloc__(struct __pyx __pyx_t_1 = ((__pyx_v_self->qh != NULL) != 0); if (__pyx_t_1) { - /* "netfilterqueue.pyx":153 + /* "netfilterqueue.pyx":157 * def __dealloc__(self): * if self.qh != NULL: * nfq_destroy_queue(self.qh) # <<<<<<<<<<<<<< @@ -3709,7 +3725,7 @@ static void __pyx_pf_14netfilterqueue_14NetfilterQueue_2__dealloc__(struct __pyx */ nfq_destroy_queue(__pyx_v_self->qh); - /* "netfilterqueue.pyx":152 + /* "netfilterqueue.pyx":156 * * def __dealloc__(self): * if self.qh != NULL: # <<<<<<<<<<<<<< @@ -3718,7 +3734,7 @@ static void __pyx_pf_14netfilterqueue_14NetfilterQueue_2__dealloc__(struct __pyx */ } - /* "netfilterqueue.pyx":156 + /* "netfilterqueue.pyx":160 * # Don't call nfq_unbind_pf unless you want to disconnect any other * # processes using this libnetfilter_queue on this protocol family! * nfq_close(self.h) # <<<<<<<<<<<<<< @@ -3727,7 +3743,7 @@ static void __pyx_pf_14netfilterqueue_14NetfilterQueue_2__dealloc__(struct __pyx */ nfq_close(__pyx_v_self->h); - /* "netfilterqueue.pyx":151 + /* "netfilterqueue.pyx":155 * raise OSError("Failed to bind family %s. Are you root?" % self.af) * * def __dealloc__(self): # <<<<<<<<<<<<<< @@ -3739,7 +3755,7 @@ static void __pyx_pf_14netfilterqueue_14NetfilterQueue_2__dealloc__(struct __pyx __Pyx_RefNannyFinishContext(); } -/* "netfilterqueue.pyx":158 +/* "netfilterqueue.pyx":162 * nfq_close(self.h) * * def bind(self, int queue_num, object user_callback, # <<<<<<<<<<<<<< @@ -3756,16 +3772,18 @@ static PyObject *__pyx_pw_14netfilterqueue_14NetfilterQueue_5bind(PyObject *__py u_int32_t __pyx_v_max_len; u_int8_t __pyx_v_mode; u_int32_t __pyx_v_range; + u_int32_t __pyx_v_sock_len; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("bind (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_queue_num,&__pyx_n_s_user_callback,&__pyx_n_s_max_len,&__pyx_n_s_mode,&__pyx_n_s_range,0}; - PyObject* values[5] = {0,0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_queue_num,&__pyx_n_s_user_callback,&__pyx_n_s_max_len,&__pyx_n_s_mode,&__pyx_n_s_range,&__pyx_n_s_sock_len,0}; + PyObject* values[6] = {0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -3782,7 +3800,7 @@ static PyObject *__pyx_pw_14netfilterqueue_14NetfilterQueue_5bind(PyObject *__py case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_user_callback)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("bind", 0, 2, 5, 1); __PYX_ERR(0, 158, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("bind", 0, 2, 6, 1); __PYX_ERR(0, 162, __pyx_L3_error) } case 2: if (kw_args > 0) { @@ -3799,12 +3817,18 @@ static PyObject *__pyx_pw_14netfilterqueue_14NetfilterQueue_5bind(PyObject *__py PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_range); if (value) { values[4] = value; kw_args--; } } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sock_len); + if (value) { values[5] = value; kw_args--; } + } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bind") < 0)) __PYX_ERR(0, 158, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "bind") < 0)) __PYX_ERR(0, 162, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -3814,50 +3838,57 @@ static PyObject *__pyx_pw_14netfilterqueue_14NetfilterQueue_5bind(PyObject *__py default: goto __pyx_L5_argtuple_error; } } - __pyx_v_queue_num = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_queue_num == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 158, __pyx_L3_error) + __pyx_v_queue_num = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_queue_num == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 162, __pyx_L3_error) __pyx_v_user_callback = values[1]; if (values[2]) { - __pyx_v_max_len = __Pyx_PyInt_As_u_int32_t(values[2]); if (unlikely((__pyx_v_max_len == (u_int32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L3_error) + __pyx_v_max_len = __Pyx_PyInt_As_u_int32_t(values[2]); if (unlikely((__pyx_v_max_len == (u_int32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L3_error) } else { - __pyx_v_max_len = __pyx_k__4; + __pyx_v_max_len = ((u_int32_t)0x400); } if (values[3]) { - __pyx_v_mode = __Pyx_PyInt_As_u_int8_t(values[3]); if (unlikely((__pyx_v_mode == (u_int8_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L3_error) + __pyx_v_mode = __Pyx_PyInt_As_u_int8_t(values[3]); if (unlikely((__pyx_v_mode == (u_int8_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 164, __pyx_L3_error) } else { - __pyx_v_mode = __pyx_k__5; + __pyx_v_mode = __pyx_k__4; } if (values[4]) { - __pyx_v_range = __Pyx_PyInt_As_u_int32_t(values[4]); if (unlikely((__pyx_v_range == (u_int32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L3_error) + __pyx_v_range = __Pyx_PyInt_As_u_int32_t(values[4]); if (unlikely((__pyx_v_range == (u_int32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 165, __pyx_L3_error) } else { __pyx_v_range = ((u_int32_t)0xFFFF); } + if (values[5]) { + __pyx_v_sock_len = __Pyx_PyInt_As_u_int32_t(values[5]); if (unlikely((__pyx_v_sock_len == (u_int32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 166, __pyx_L3_error) + } else { + __pyx_v_sock_len = ((u_int32_t)0x257800); + } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("bind", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 158, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("bind", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 162, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("netfilterqueue.NetfilterQueue.bind", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self), __pyx_v_queue_num, __pyx_v_user_callback, __pyx_v_max_len, __pyx_v_mode, __pyx_v_range); + __pyx_r = __pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(((struct __pyx_obj_14netfilterqueue_NetfilterQueue *)__pyx_v_self), __pyx_v_queue_num, __pyx_v_user_callback, __pyx_v_max_len, __pyx_v_mode, __pyx_v_range, __pyx_v_sock_len); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(struct __pyx_obj_14netfilterqueue_NetfilterQueue *__pyx_v_self, int __pyx_v_queue_num, PyObject *__pyx_v_user_callback, u_int32_t __pyx_v_max_len, u_int8_t __pyx_v_mode, u_int32_t __pyx_v_range) { +static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(struct __pyx_obj_14netfilterqueue_NetfilterQueue *__pyx_v_self, int __pyx_v_queue_num, PyObject *__pyx_v_user_callback, u_int32_t __pyx_v_max_len, u_int8_t __pyx_v_mode, u_int32_t __pyx_v_range, u_int32_t __pyx_v_sock_len) { + unsigned int __pyx_v_newsiz; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("bind", 0); - /* "netfilterqueue.pyx":163 - * u_int32_t range=MaxPacketSize): + /* "netfilterqueue.pyx":169 * """Create and bind to a new queue.""" + * cdef unsigned int newsiz * self.user_callback = user_callback # <<<<<<<<<<<<<< * self.qh = nfq_create_queue(self.h, queue_num, * global_callback, self) @@ -3868,8 +3899,8 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(struct __pyx_o __Pyx_DECREF(__pyx_v_self->user_callback); __pyx_v_self->user_callback = __pyx_v_user_callback; - /* "netfilterqueue.pyx":164 - * """Create and bind to a new queue.""" + /* "netfilterqueue.pyx":170 + * cdef unsigned int newsiz * self.user_callback = user_callback * self.qh = nfq_create_queue(self.h, queue_num, # <<<<<<<<<<<<<< * global_callback, self) @@ -3877,7 +3908,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(struct __pyx_o */ __pyx_v_self->qh = nfq_create_queue(__pyx_v_self->h, __pyx_v_queue_num, ((nfq_callback *)__pyx_f_14netfilterqueue_global_callback), ((void *)__pyx_v_self)); - /* "netfilterqueue.pyx":166 + /* "netfilterqueue.pyx":172 * self.qh = nfq_create_queue(self.h, queue_num, * global_callback, self) * if self.qh == NULL: # <<<<<<<<<<<<<< @@ -3887,31 +3918,31 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(struct __pyx_o __pyx_t_1 = ((__pyx_v_self->qh == NULL) != 0); if (__pyx_t_1) { - /* "netfilterqueue.pyx":167 + /* "netfilterqueue.pyx":173 * global_callback, self) * if self.qh == NULL: * raise OSError("Failed to create queue %s." % queue_num) # <<<<<<<<<<<<<< * * if range > MaxCopySize: */ - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_queue_num); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_queue_num); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Failed_to_create_queue_s, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Failed_to_create_queue_s, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 167, __pyx_L1_error) + __PYX_ERR(0, 173, __pyx_L1_error) - /* "netfilterqueue.pyx":166 + /* "netfilterqueue.pyx":172 * self.qh = nfq_create_queue(self.h, queue_num, * global_callback, self) * if self.qh == NULL: # <<<<<<<<<<<<<< @@ -3920,7 +3951,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(struct __pyx_o */ } - /* "netfilterqueue.pyx":169 + /* "netfilterqueue.pyx":175 * raise OSError("Failed to create queue %s." % queue_num) * * if range > MaxCopySize: # <<<<<<<<<<<<<< @@ -3930,7 +3961,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(struct __pyx_o __pyx_t_1 = ((__pyx_v_range > 0xFB0) != 0); if (__pyx_t_1) { - /* "netfilterqueue.pyx":170 + /* "netfilterqueue.pyx":176 * * if range > MaxCopySize: * range = MaxCopySize # <<<<<<<<<<<<<< @@ -3939,7 +3970,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(struct __pyx_o */ __pyx_v_range = 0xFB0; - /* "netfilterqueue.pyx":169 + /* "netfilterqueue.pyx":175 * raise OSError("Failed to create queue %s." % queue_num) * * if range > MaxCopySize: # <<<<<<<<<<<<<< @@ -3948,7 +3979,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(struct __pyx_o */ } - /* "netfilterqueue.pyx":171 + /* "netfilterqueue.pyx":177 * if range > MaxCopySize: * range = MaxCopySize * if nfq_set_mode(self.qh, mode, range) < 0: # <<<<<<<<<<<<<< @@ -3958,20 +3989,20 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(struct __pyx_o __pyx_t_1 = ((nfq_set_mode(__pyx_v_self->qh, __pyx_v_mode, __pyx_v_range) < 0) != 0); if (__pyx_t_1) { - /* "netfilterqueue.pyx":172 + /* "netfilterqueue.pyx":178 * range = MaxCopySize * if nfq_set_mode(self.qh, mode, range) < 0: * raise OSError("Failed to set packet copy mode.") # <<<<<<<<<<<<<< * * nfq_set_queue_maxlen(self.qh, max_len) */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_OSError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 172, __pyx_L1_error) + __PYX_ERR(0, 178, __pyx_L1_error) - /* "netfilterqueue.pyx":171 + /* "netfilterqueue.pyx":177 * if range > MaxCopySize: * range = MaxCopySize * if nfq_set_mode(self.qh, mode, range) < 0: # <<<<<<<<<<<<<< @@ -3980,16 +4011,78 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(struct __pyx_o */ } - /* "netfilterqueue.pyx":174 + /* "netfilterqueue.pyx":180 * raise OSError("Failed to set packet copy mode.") * * nfq_set_queue_maxlen(self.qh, max_len) # <<<<<<<<<<<<<< * - * def unbind(self): + * newsiz = nfnl_rcvbufsiz(nfq_nfnlh(self.h),sock_len) */ nfq_set_queue_maxlen(__pyx_v_self->qh, __pyx_v_max_len); - /* "netfilterqueue.pyx":158 + /* "netfilterqueue.pyx":182 + * nfq_set_queue_maxlen(self.qh, max_len) + * + * newsiz = nfnl_rcvbufsiz(nfq_nfnlh(self.h),sock_len) # <<<<<<<<<<<<<< + * if newsiz != sock_len*2: + * raise RuntimeWarning("Socket rcvbuf limit is now %d, requested %d." % (newsiz,sock_len)) + */ + __pyx_v_newsiz = nfnl_rcvbufsiz(nfq_nfnlh(__pyx_v_self->h), __pyx_v_sock_len); + + /* "netfilterqueue.pyx":183 + * + * newsiz = nfnl_rcvbufsiz(nfq_nfnlh(self.h),sock_len) + * if newsiz != sock_len*2: # <<<<<<<<<<<<<< + * raise RuntimeWarning("Socket rcvbuf limit is now %d, requested %d." % (newsiz,sock_len)) + * + */ + __pyx_t_1 = ((__pyx_v_newsiz != (__pyx_v_sock_len * 2)) != 0); + if (__pyx_t_1) { + + /* "netfilterqueue.pyx":184 + * newsiz = nfnl_rcvbufsiz(nfq_nfnlh(self.h),sock_len) + * if newsiz != sock_len*2: + * raise RuntimeWarning("Socket rcvbuf limit is now %d, requested %d." % (newsiz,sock_len)) # <<<<<<<<<<<<<< + * + * def unbind(self): + */ + __pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_newsiz); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyInt_From_u_int32_t(__pyx_v_sock_len); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Socket_rcvbuf_limit_is_now_d_req, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeWarning, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 184, __pyx_L1_error) + + /* "netfilterqueue.pyx":183 + * + * newsiz = nfnl_rcvbufsiz(nfq_nfnlh(self.h),sock_len) + * if newsiz != sock_len*2: # <<<<<<<<<<<<<< + * raise RuntimeWarning("Socket rcvbuf limit is now %d, requested %d." % (newsiz,sock_len)) + * + */ + } + + /* "netfilterqueue.pyx":162 * nfq_close(self.h) * * def bind(self, int queue_num, object user_callback, # <<<<<<<<<<<<<< @@ -4003,6 +4096,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(struct __pyx_o __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("netfilterqueue.NetfilterQueue.bind", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -4011,8 +4105,8 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_4bind(struct __pyx_o return __pyx_r; } -/* "netfilterqueue.pyx":176 - * nfq_set_queue_maxlen(self.qh, max_len) +/* "netfilterqueue.pyx":186 + * raise RuntimeWarning("Socket rcvbuf limit is now %d, requested %d." % (newsiz,sock_len)) * * def unbind(self): # <<<<<<<<<<<<<< * """Destroy the queue.""" @@ -4039,7 +4133,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_6unbind(struct __pyx int __pyx_t_1; __Pyx_RefNannySetupContext("unbind", 0); - /* "netfilterqueue.pyx":178 + /* "netfilterqueue.pyx":188 * def unbind(self): * """Destroy the queue.""" * if self.qh != NULL: # <<<<<<<<<<<<<< @@ -4049,7 +4143,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_6unbind(struct __pyx __pyx_t_1 = ((__pyx_v_self->qh != NULL) != 0); if (__pyx_t_1) { - /* "netfilterqueue.pyx":179 + /* "netfilterqueue.pyx":189 * """Destroy the queue.""" * if self.qh != NULL: * nfq_destroy_queue(self.qh) # <<<<<<<<<<<<<< @@ -4058,7 +4152,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_6unbind(struct __pyx */ nfq_destroy_queue(__pyx_v_self->qh); - /* "netfilterqueue.pyx":178 + /* "netfilterqueue.pyx":188 * def unbind(self): * """Destroy the queue.""" * if self.qh != NULL: # <<<<<<<<<<<<<< @@ -4067,7 +4161,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_6unbind(struct __pyx */ } - /* "netfilterqueue.pyx":180 + /* "netfilterqueue.pyx":190 * if self.qh != NULL: * nfq_destroy_queue(self.qh) * self.qh = NULL # <<<<<<<<<<<<<< @@ -4076,8 +4170,8 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_6unbind(struct __pyx */ __pyx_v_self->qh = NULL; - /* "netfilterqueue.pyx":176 - * nfq_set_queue_maxlen(self.qh, max_len) + /* "netfilterqueue.pyx":186 + * raise RuntimeWarning("Socket rcvbuf limit is now %d, requested %d." % (newsiz,sock_len)) * * def unbind(self): # <<<<<<<<<<<<<< * """Destroy the queue.""" @@ -4091,7 +4185,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_6unbind(struct __pyx return __pyx_r; } -/* "netfilterqueue.pyx":183 +/* "netfilterqueue.pyx":193 * # See warning about nfq_unbind_pf in __dealloc__ above. * * def run(self): # <<<<<<<<<<<<<< @@ -4122,7 +4216,7 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_8run(struct __pyx_ob int __pyx_t_1; __Pyx_RefNannySetupContext("run", 0); - /* "netfilterqueue.pyx":185 + /* "netfilterqueue.pyx":195 * def run(self): * """Begin accepting packets.""" * cdef int fd = nfq_fd(self.h) # <<<<<<<<<<<<<< @@ -4131,74 +4225,21 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_8run(struct __pyx_ob */ __pyx_v_fd = nfq_fd(__pyx_v_self->h); - /* "netfilterqueue.pyx":188 + /* "netfilterqueue.pyx":198 * cdef char buf[BufferSize] * cdef int rv - * with nogil: # <<<<<<<<<<<<<< - * rv = recv(fd, buf, sizeof(buf), 0) - * while rv >= 0: - */ - { - #ifdef WITH_THREAD - PyThreadState *_save; - Py_UNBLOCK_THREADS - #endif - /*try:*/ { - - /* "netfilterqueue.pyx":189 - * cdef int rv - * with nogil: - * rv = recv(fd, buf, sizeof(buf), 0) # <<<<<<<<<<<<<< - * while rv >= 0: - * nfq_handle_packet(self.h, buf, rv) - */ - __pyx_v_rv = recv(__pyx_v_fd, __pyx_v_buf, (sizeof(__pyx_v_buf)), 0); - } - - /* "netfilterqueue.pyx":188 - * cdef char buf[BufferSize] - * cdef int rv - * with nogil: # <<<<<<<<<<<<<< - * rv = recv(fd, buf, sizeof(buf), 0) - * while rv >= 0: - */ - /*finally:*/ { - /*normal exit:*/{ - #ifdef WITH_THREAD - Py_BLOCK_THREADS - #endif - goto __pyx_L5; - } - __pyx_L5:; - } - } - - /* "netfilterqueue.pyx":190 - * with nogil: - * rv = recv(fd, buf, sizeof(buf), 0) - * while rv >= 0: # <<<<<<<<<<<<<< - * nfq_handle_packet(self.h, buf, rv) + * while True: # <<<<<<<<<<<<<< * with nogil: + * rv = recv(fd, buf, sizeof(buf), 0) */ while (1) { - __pyx_t_1 = ((__pyx_v_rv >= 0) != 0); - if (!__pyx_t_1) break; - /* "netfilterqueue.pyx":191 - * rv = recv(fd, buf, sizeof(buf), 0) - * while rv >= 0: - * nfq_handle_packet(self.h, buf, rv) # <<<<<<<<<<<<<< - * with nogil: - * rv = recv(fd, buf, sizeof(buf), 0) - */ - nfq_handle_packet(__pyx_v_self->h, __pyx_v_buf, __pyx_v_rv); - - /* "netfilterqueue.pyx":192 - * while rv >= 0: - * nfq_handle_packet(self.h, buf, rv) + /* "netfilterqueue.pyx":199 + * cdef int rv + * while True: * with nogil: # <<<<<<<<<<<<<< * rv = recv(fd, buf, sizeof(buf), 0) - * + * if (rv >= 0): */ { #ifdef WITH_THREAD @@ -4207,36 +4248,97 @@ static PyObject *__pyx_pf_14netfilterqueue_14NetfilterQueue_8run(struct __pyx_ob #endif /*try:*/ { - /* "netfilterqueue.pyx":193 - * nfq_handle_packet(self.h, buf, rv) + /* "netfilterqueue.pyx":200 + * while True: * with nogil: * rv = recv(fd, buf, sizeof(buf), 0) # <<<<<<<<<<<<<< - * - * PROTOCOLS = { + * if (rv >= 0): + * nfq_handle_packet(self.h, buf, rv) */ __pyx_v_rv = recv(__pyx_v_fd, __pyx_v_buf, (sizeof(__pyx_v_buf)), 0); } - /* "netfilterqueue.pyx":192 - * while rv >= 0: - * nfq_handle_packet(self.h, buf, rv) + /* "netfilterqueue.pyx":199 + * cdef int rv + * while True: * with nogil: # <<<<<<<<<<<<<< * rv = recv(fd, buf, sizeof(buf), 0) - * + * if (rv >= 0): */ /*finally:*/ { /*normal exit:*/{ #ifdef WITH_THREAD Py_BLOCK_THREADS #endif - goto __pyx_L12; + goto __pyx_L9; } - __pyx_L12:; + __pyx_L9:; } } - } - /* "netfilterqueue.pyx":183 + /* "netfilterqueue.pyx":201 + * with nogil: + * rv = recv(fd, buf, sizeof(buf), 0) + * if (rv >= 0): # <<<<<<<<<<<<<< + * nfq_handle_packet(self.h, buf, rv) + * else: + */ + __pyx_t_1 = ((__pyx_v_rv >= 0) != 0); + if (__pyx_t_1) { + + /* "netfilterqueue.pyx":202 + * rv = recv(fd, buf, sizeof(buf), 0) + * if (rv >= 0): + * nfq_handle_packet(self.h, buf, rv) # <<<<<<<<<<<<<< + * else: + * if errno != ENOBUFS: + */ + nfq_handle_packet(__pyx_v_self->h, __pyx_v_buf, __pyx_v_rv); + + /* "netfilterqueue.pyx":201 + * with nogil: + * rv = recv(fd, buf, sizeof(buf), 0) + * if (rv >= 0): # <<<<<<<<<<<<<< + * nfq_handle_packet(self.h, buf, rv) + * else: + */ + goto __pyx_L10; + } + + /* "netfilterqueue.pyx":204 + * nfq_handle_packet(self.h, buf, rv) + * else: + * if errno != ENOBUFS: # <<<<<<<<<<<<<< + * break + * + */ + /*else*/ { + __pyx_t_1 = ((errno != __pyx_e_14netfilterqueue_ENOBUFS) != 0); + if (__pyx_t_1) { + + /* "netfilterqueue.pyx":205 + * else: + * if errno != ENOBUFS: + * break # <<<<<<<<<<<<<< + * + * PROTOCOLS = { + */ + goto __pyx_L4_break; + + /* "netfilterqueue.pyx":204 + * nfq_handle_packet(self.h, buf, rv) + * else: + * if errno != ENOBUFS: # <<<<<<<<<<<<<< + * break + * + */ + } + } + __pyx_L10:; + } + __pyx_L4_break:; + + /* "netfilterqueue.pyx":193 * # See warning about nfq_unbind_pf in __dealloc__ above. * * def run(self): # <<<<<<<<<<<<<< @@ -4556,7 +4658,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_DCN_MEAS, __pyx_k_DCN_MEAS, sizeof(__pyx_k_DCN_MEAS), 0, 0, 1, 0}, {&__pyx_n_s_DDP, __pyx_k_DDP, sizeof(__pyx_k_DDP), 0, 0, 1, 1}, {&__pyx_n_s_DDX, __pyx_k_DDX, sizeof(__pyx_k_DDX), 0, 0, 1, 1}, - {&__pyx_n_s_DEFAULT_MAX_QUEUELEN, __pyx_k_DEFAULT_MAX_QUEUELEN, sizeof(__pyx_k_DEFAULT_MAX_QUEUELEN), 0, 0, 1, 1}, {&__pyx_n_s_DGP, __pyx_k_DGP, sizeof(__pyx_k_DGP), 0, 0, 1, 1}, {&__pyx_n_s_DSR, __pyx_k_DSR, sizeof(__pyx_k_DSR), 0, 0, 1, 1}, {&__pyx_n_s_EGP, __pyx_k_EGP, sizeof(__pyx_k_EGP), 0, 0, 1, 1}, @@ -4659,6 +4760,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_SUN_ND, __pyx_k_SUN_ND, sizeof(__pyx_k_SUN_ND), 0, 0, 1, 0}, {&__pyx_n_s_SWIPE, __pyx_k_SWIPE, sizeof(__pyx_k_SWIPE), 0, 0, 1, 1}, {&__pyx_n_s_Shim6, __pyx_k_Shim6, sizeof(__pyx_k_Shim6), 0, 0, 1, 1}, + {&__pyx_kp_s_Socket_rcvbuf_limit_is_now_d_req, __pyx_k_Socket_rcvbuf_limit_is_now_d_req, sizeof(__pyx_k_Socket_rcvbuf_limit_is_now_d_req), 0, 0, 1, 0}, {&__pyx_kp_s_Sprite_RPC, __pyx_k_Sprite_RPC, sizeof(__pyx_k_Sprite_RPC), 0, 0, 1, 0}, {&__pyx_n_s_TCF, __pyx_k_TCF, sizeof(__pyx_k_TCF), 0, 0, 1, 1}, {&__pyx_n_s_TCP, __pyx_k_TCP, sizeof(__pyx_k_TCP), 0, 0, 1, 1}, @@ -4706,13 +4808,14 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_s_packet_s_bytes, __pyx_k_s_packet_s_bytes, sizeof(__pyx_k_s_packet_s_bytes), 0, 0, 1, 0}, {&__pyx_n_s_set_mark, __pyx_k_set_mark, sizeof(__pyx_k_set_mark), 0, 0, 1, 1}, {&__pyx_n_s_set_payload, __pyx_k_set_payload, sizeof(__pyx_k_set_payload), 0, 0, 1, 1}, + {&__pyx_n_s_sock_len, __pyx_k_sock_len, sizeof(__pyx_k_sock_len), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_user_callback, __pyx_k_user_callback, sizeof(__pyx_k_user_callback), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) __PYX_ERR(0, 63, __pyx_L1_error) - __pyx_builtin_RuntimeWarning = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeWarning); if (!__pyx_builtin_RuntimeWarning) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_builtin_RuntimeWarning = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeWarning); if (!__pyx_builtin_RuntimeWarning) __PYX_ERR(0, 75, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -4722,49 +4825,49 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "netfilterqueue.pyx":63 + /* "netfilterqueue.pyx":67 * self.payload_len = nfq_get_payload(self._nfa, &self.payload) * if self.payload_len < 0: * raise OSError("Failed to get payload of packet.") # <<<<<<<<<<<<<< * * nfq_get_timestamp(self._nfa, &self.timestamp) */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Failed_to_get_payload_of_packet); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Failed_to_get_payload_of_packet); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "netfilterqueue.pyx":71 + /* "netfilterqueue.pyx":75 * """Call appropriate set_verdict... function on packet.""" * if self._verdict_is_set: * raise RuntimeWarning("Verdict already given for this packet.") # <<<<<<<<<<<<<< * * cdef u_int32_t modified_payload_len = 0 */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Verdict_already_given_for_this_p); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Verdict_already_given_for_this_p); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "netfilterqueue.pyx":145 + /* "netfilterqueue.pyx":149 * self.h = nfq_open() * if self.h == NULL: * raise OSError("Failed to open NFQueue.") # <<<<<<<<<<<<<< * nfq_unbind_pf(self.h, self.af) # This does NOT kick out previous * # running queues */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_open_NFQueue); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_open_NFQueue); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "netfilterqueue.pyx":172 + /* "netfilterqueue.pyx":178 * range = MaxCopySize * if nfq_set_mode(self.qh, mode, range) < 0: * raise OSError("Failed to set packet copy mode.") # <<<<<<<<<<<<<< * * nfq_set_queue_maxlen(self.qh, max_len) */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_set_packet_copy_mode); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 172, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_set_packet_copy_mode); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); /* "netfilterqueue.pyx":8 * License: MIT; see LICENSE.txt @@ -4773,9 +4876,9 @@ static int __Pyx_InitCachedConstants(void) { * * # Constants for module users */ - __pyx_tuple__7 = PyTuple_Pack(3, __pyx_int_0, __pyx_int_6, __pyx_int_0); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_tuple__6 = PyTuple_Pack(3, __pyx_int_0, __pyx_int_6, __pyx_int_0); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -4927,7 +5030,6 @@ static int __Pyx_InitGlobals(void) { __pyx_int_139 = PyInt_FromLong(139); if (unlikely(!__pyx_int_139)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_140 = PyInt_FromLong(140); if (unlikely(!__pyx_int_140)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_255 = PyInt_FromLong(255); if (unlikely(!__pyx_int_255)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1024 = PyInt_FromLong(1024); if (unlikely(!__pyx_int_1024)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -4942,7 +5044,6 @@ PyMODINIT_FUNC PyInit_netfilterqueue(void) #endif { PyObject *__pyx_t_1 = NULL; - u_int32_t __pyx_t_2; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); @@ -5029,14 +5130,14 @@ PyMODINIT_FUNC PyInit_netfilterqueue(void) __pyx_vtable_14netfilterqueue_Packet.accept = (PyObject *(*)(struct __pyx_obj_14netfilterqueue_Packet *, int __pyx_skip_dispatch))__pyx_f_14netfilterqueue_6Packet_accept; __pyx_vtable_14netfilterqueue_Packet.drop = (PyObject *(*)(struct __pyx_obj_14netfilterqueue_Packet *, int __pyx_skip_dispatch))__pyx_f_14netfilterqueue_6Packet_drop; __pyx_vtable_14netfilterqueue_Packet.repeat = (PyObject *(*)(struct __pyx_obj_14netfilterqueue_Packet *, int __pyx_skip_dispatch))__pyx_f_14netfilterqueue_6Packet_repeat; - if (PyType_Ready(&__pyx_type_14netfilterqueue_Packet) < 0) __PYX_ERR(0, 36, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_14netfilterqueue_Packet) < 0) __PYX_ERR(0, 40, __pyx_L1_error) __pyx_type_14netfilterqueue_Packet.tp_print = 0; - if (__Pyx_SetVtable(__pyx_type_14netfilterqueue_Packet.tp_dict, __pyx_vtabptr_14netfilterqueue_Packet) < 0) __PYX_ERR(0, 36, __pyx_L1_error) - if (PyObject_SetAttrString(__pyx_m, "Packet", (PyObject *)&__pyx_type_14netfilterqueue_Packet) < 0) __PYX_ERR(0, 36, __pyx_L1_error) + if (__Pyx_SetVtable(__pyx_type_14netfilterqueue_Packet.tp_dict, __pyx_vtabptr_14netfilterqueue_Packet) < 0) __PYX_ERR(0, 40, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "Packet", (PyObject *)&__pyx_type_14netfilterqueue_Packet) < 0) __PYX_ERR(0, 40, __pyx_L1_error) __pyx_ptype_14netfilterqueue_Packet = &__pyx_type_14netfilterqueue_Packet; - if (PyType_Ready(&__pyx_type_14netfilterqueue_NetfilterQueue) < 0) __PYX_ERR(0, 138, __pyx_L1_error) + if (PyType_Ready(&__pyx_type_14netfilterqueue_NetfilterQueue) < 0) __PYX_ERR(0, 142, __pyx_L1_error) __pyx_type_14netfilterqueue_NetfilterQueue.tp_print = 0; - if (PyObject_SetAttrString(__pyx_m, "NetfilterQueue", (PyObject *)&__pyx_type_14netfilterqueue_NetfilterQueue) < 0) __PYX_ERR(0, 138, __pyx_L1_error) + if (PyObject_SetAttrString(__pyx_m, "NetfilterQueue", (PyObject *)&__pyx_type_14netfilterqueue_NetfilterQueue) < 0) __PYX_ERR(0, 142, __pyx_L1_error) __pyx_ptype_14netfilterqueue_NetfilterQueue = &__pyx_type_14netfilterqueue_NetfilterQueue; /*--- Type import code ---*/ /*--- Variable import code ---*/ @@ -5053,7 +5154,7 @@ PyMODINIT_FUNC PyInit_netfilterqueue(void) * * # Constants for module users */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION, __pyx_tuple__7) < 0) __PYX_ERR(0, 8, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_VERSION, __pyx_tuple__6) < 0) __PYX_ERR(0, 8, __pyx_L1_error) /* "netfilterqueue.pyx":11 * @@ -5078,193 +5179,171 @@ PyMODINIT_FUNC PyInit_netfilterqueue(void) * COPY_META = 2 * COPY_PACKET = 3 # <<<<<<<<<<<<<< * - * DEFAULT_MAX_QUEUELEN = 1024 + * # Packet copying defaults */ if (PyDict_SetItem(__pyx_d, __pyx_n_s_COPY_PACKET, __pyx_int_3) < 0) __PYX_ERR(0, 13, __pyx_L1_error) - /* "netfilterqueue.pyx":15 - * COPY_PACKET = 3 - * - * DEFAULT_MAX_QUEUELEN = 1024 # <<<<<<<<<<<<<< - * - * # Packet copying defaults - */ - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_MAX_QUEUELEN, __pyx_int_1024) < 0) __PYX_ERR(0, 15, __pyx_L1_error) - - /* "netfilterqueue.pyx":159 - * - * def bind(self, int queue_num, object user_callback, - * u_int32_t max_len=DEFAULT_MAX_QUEUELEN, # <<<<<<<<<<<<<< - * u_int8_t mode=NFQNL_COPY_PACKET, - * u_int32_t range=MaxPacketSize): - */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFAULT_MAX_QUEUELEN); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_As_u_int32_t(__pyx_t_1); if (unlikely((__pyx_t_2 == (u_int32_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_k__4 = __pyx_t_2; - - /* "netfilterqueue.pyx":160 + /* "netfilterqueue.pyx":164 * def bind(self, int queue_num, object user_callback, * u_int32_t max_len=DEFAULT_MAX_QUEUELEN, * u_int8_t mode=NFQNL_COPY_PACKET, # <<<<<<<<<<<<<< - * u_int32_t range=MaxPacketSize): - * """Create and bind to a new queue.""" + * u_int32_t range=MaxPacketSize, + * u_int32_t sock_len=SockRcvSize): */ - __pyx_k__5 = NFQNL_COPY_PACKET; + __pyx_k__4 = NFQNL_COPY_PACKET; - /* "netfilterqueue.pyx":196 + /* "netfilterqueue.pyx":208 * * PROTOCOLS = { * 0: "HOPOPT", # <<<<<<<<<<<<<< * 1: "ICMP", * 2: "IGMP", */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_int_0, __pyx_n_s_HOPOPT) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_1, __pyx_n_s_ICMP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_2, __pyx_n_s_IGMP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_3, __pyx_n_s_GGP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_4, __pyx_n_s_IP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_5, __pyx_n_s_ST) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_6, __pyx_n_s_TCP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_7, __pyx_n_s_CBT) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_8, __pyx_n_s_EGP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_9, __pyx_n_s_IGP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_10, __pyx_kp_s_BBN_RCC_MON) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_11, __pyx_kp_s_NVP_II) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_12, __pyx_n_s_PUP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_13, __pyx_n_s_ARGUS) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_14, __pyx_n_s_EMCON) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_15, __pyx_n_s_XNET) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_16, __pyx_n_s_CHAOS) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_17, __pyx_n_s_UDP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_18, __pyx_n_s_MUX) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_19, __pyx_kp_s_DCN_MEAS) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_20, __pyx_n_s_HMP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_21, __pyx_n_s_PRM) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_22, __pyx_kp_s_XNS_IDP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_23, __pyx_kp_s_TRUNK_1) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_24, __pyx_kp_s_TRUNK_2) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_25, __pyx_kp_s_LEAF_1) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_26, __pyx_kp_s_LEAF_2) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_27, __pyx_n_s_RDP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_28, __pyx_n_s_IRTP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_29, __pyx_kp_s_ISO_TP4) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_30, __pyx_n_s_NETBLT) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_31, __pyx_kp_s_MFE_NSP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_32, __pyx_kp_s_MERIT_INP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_33, __pyx_n_s_DCCP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_34, __pyx_kp_s_3PC) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_35, __pyx_n_s_IDPR) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_36, __pyx_n_s_XTP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_37, __pyx_n_s_DDP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_38, __pyx_kp_s_IDPR_CMTP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_39, __pyx_kp_s_TP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_40, __pyx_n_s_IL) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_41, __pyx_n_s_IPv6) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_42, __pyx_n_s_SDRP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_43, __pyx_kp_s_IPv6_Route) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_44, __pyx_kp_s_IPv6_Frag) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_45, __pyx_n_s_IDRP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_46, __pyx_n_s_RSVP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_47, __pyx_n_s_GRE) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_48, __pyx_n_s_DSR) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_49, __pyx_n_s_BNA) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_50, __pyx_n_s_ESP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_51, __pyx_n_s_AH) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_52, __pyx_kp_s_I_NLSP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_53, __pyx_n_s_SWIPE) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_54, __pyx_n_s_NARP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_55, __pyx_n_s_MOBILE) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_56, __pyx_n_s_TLSP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_57, __pyx_n_s_SKIP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_58, __pyx_kp_s_IPv6_ICMP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_59, __pyx_kp_s_IPv6_NoNxt) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_60, __pyx_kp_s_IPv6_Opts) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_61, __pyx_kp_s_any_host_internal_protocol) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_62, __pyx_n_s_CFTP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_63, __pyx_kp_s_any_local_network) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_64, __pyx_kp_s_SAT_EXPAK) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_65, __pyx_n_s_KRYPTOLAN) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_66, __pyx_n_s_RVD) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_67, __pyx_n_s_IPPC) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_68, __pyx_kp_s_any_distributed_file_system) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_69, __pyx_kp_s_SAT_MON) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_70, __pyx_n_s_VISA) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_71, __pyx_n_s_IPCV) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_72, __pyx_n_s_CPNX) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_73, __pyx_n_s_CPHB) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_74, __pyx_n_s_WSN) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_75, __pyx_n_s_PVP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_76, __pyx_kp_s_BR_SAT_MON) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_77, __pyx_kp_s_SUN_ND) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_78, __pyx_kp_s_WB_MON) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_79, __pyx_kp_s_WB_EXPAK) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_80, __pyx_kp_s_ISO_IP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_81, __pyx_n_s_VMTP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_82, __pyx_kp_s_SECURE_VMTP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_83, __pyx_n_s_VINES) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_84, __pyx_n_s_TTP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_85, __pyx_kp_s_NSFNET_IGP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_86, __pyx_n_s_DGP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_87, __pyx_n_s_TCF) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_88, __pyx_n_s_EIGRP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_89, __pyx_n_s_OSPFIGP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_90, __pyx_kp_s_Sprite_RPC) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_91, __pyx_n_s_LARP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_92, __pyx_n_s_MTP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_93, __pyx_kp_s_AX_25) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_94, __pyx_n_s_IPIP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_95, __pyx_n_s_MICP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_96, __pyx_kp_s_SCC_SP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_97, __pyx_n_s_ETHERIP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_98, __pyx_n_s_ENCAP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_99, __pyx_kp_s_any_private_encryption_scheme) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_100, __pyx_n_s_GMTP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_101, __pyx_n_s_IFMP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_102, __pyx_n_s_PNNI) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_103, __pyx_n_s_PIM) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_104, __pyx_n_s_ARIS) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_105, __pyx_n_s_SCPS) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_106, __pyx_n_s_QNX) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_107, __pyx_kp_s_A_N) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_108, __pyx_n_s_IPComp) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_109, __pyx_n_s_SNP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_110, __pyx_kp_s_Compaq_Peer) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_111, __pyx_kp_s_IPX_in_IP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_112, __pyx_n_s_VRRP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_113, __pyx_n_s_PGM) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_114, __pyx_kp_s_any_0_hop_protocol) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_115, __pyx_n_s_L2TP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_116, __pyx_n_s_DDX) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_117, __pyx_n_s_IATP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_118, __pyx_n_s_STP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_119, __pyx_n_s_SRP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_120, __pyx_n_s_UTI) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_121, __pyx_n_s_SMP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_122, __pyx_n_s_SM) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_123, __pyx_n_s_PTP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_124, __pyx_n_s_ISIS) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_125, __pyx_n_s_FIRE) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_126, __pyx_n_s_CRTP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_127, __pyx_n_s_CRUDP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_128, __pyx_n_s_SSCOPMCE) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_129, __pyx_n_s_IPLT) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_130, __pyx_n_s_SPS) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_131, __pyx_n_s_PIPE) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_132, __pyx_n_s_SCTP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_133, __pyx_n_s_FC) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_134, __pyx_kp_s_RSVP_E2E_IGNORE) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_135, __pyx_n_s_Mobility) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_136, __pyx_n_s_UDPLite) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_137, __pyx_kp_s_MPLS_in_IP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_138, __pyx_n_s_manet) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_139, __pyx_n_s_HIP) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_140, __pyx_n_s_Shim6) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_1, __pyx_int_255, __pyx_n_s_Reserved) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - if (PyDict_SetItem(__pyx_d, __pyx_n_s_PROTOCOLS, __pyx_t_1) < 0) __PYX_ERR(0, 195, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_0, __pyx_n_s_HOPOPT) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_1, __pyx_n_s_ICMP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_2, __pyx_n_s_IGMP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_3, __pyx_n_s_GGP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_4, __pyx_n_s_IP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_5, __pyx_n_s_ST) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_6, __pyx_n_s_TCP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_7, __pyx_n_s_CBT) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_8, __pyx_n_s_EGP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_9, __pyx_n_s_IGP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_10, __pyx_kp_s_BBN_RCC_MON) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_11, __pyx_kp_s_NVP_II) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_12, __pyx_n_s_PUP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_13, __pyx_n_s_ARGUS) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_14, __pyx_n_s_EMCON) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_15, __pyx_n_s_XNET) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_16, __pyx_n_s_CHAOS) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_17, __pyx_n_s_UDP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_18, __pyx_n_s_MUX) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_19, __pyx_kp_s_DCN_MEAS) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_20, __pyx_n_s_HMP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_21, __pyx_n_s_PRM) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_22, __pyx_kp_s_XNS_IDP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_23, __pyx_kp_s_TRUNK_1) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_24, __pyx_kp_s_TRUNK_2) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_25, __pyx_kp_s_LEAF_1) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_26, __pyx_kp_s_LEAF_2) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_27, __pyx_n_s_RDP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_28, __pyx_n_s_IRTP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_29, __pyx_kp_s_ISO_TP4) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_30, __pyx_n_s_NETBLT) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_31, __pyx_kp_s_MFE_NSP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_32, __pyx_kp_s_MERIT_INP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_33, __pyx_n_s_DCCP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_34, __pyx_kp_s_3PC) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_35, __pyx_n_s_IDPR) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_36, __pyx_n_s_XTP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_37, __pyx_n_s_DDP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_38, __pyx_kp_s_IDPR_CMTP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_39, __pyx_kp_s_TP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_40, __pyx_n_s_IL) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_41, __pyx_n_s_IPv6) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_42, __pyx_n_s_SDRP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_43, __pyx_kp_s_IPv6_Route) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_44, __pyx_kp_s_IPv6_Frag) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_45, __pyx_n_s_IDRP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_46, __pyx_n_s_RSVP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_47, __pyx_n_s_GRE) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_48, __pyx_n_s_DSR) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_49, __pyx_n_s_BNA) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_50, __pyx_n_s_ESP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_51, __pyx_n_s_AH) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_52, __pyx_kp_s_I_NLSP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_53, __pyx_n_s_SWIPE) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_54, __pyx_n_s_NARP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_55, __pyx_n_s_MOBILE) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_56, __pyx_n_s_TLSP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_57, __pyx_n_s_SKIP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_58, __pyx_kp_s_IPv6_ICMP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_59, __pyx_kp_s_IPv6_NoNxt) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_60, __pyx_kp_s_IPv6_Opts) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_61, __pyx_kp_s_any_host_internal_protocol) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_62, __pyx_n_s_CFTP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_63, __pyx_kp_s_any_local_network) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_64, __pyx_kp_s_SAT_EXPAK) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_65, __pyx_n_s_KRYPTOLAN) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_66, __pyx_n_s_RVD) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_67, __pyx_n_s_IPPC) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_68, __pyx_kp_s_any_distributed_file_system) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_69, __pyx_kp_s_SAT_MON) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_70, __pyx_n_s_VISA) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_71, __pyx_n_s_IPCV) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_72, __pyx_n_s_CPNX) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_73, __pyx_n_s_CPHB) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_74, __pyx_n_s_WSN) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_75, __pyx_n_s_PVP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_76, __pyx_kp_s_BR_SAT_MON) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_77, __pyx_kp_s_SUN_ND) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_78, __pyx_kp_s_WB_MON) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_79, __pyx_kp_s_WB_EXPAK) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_80, __pyx_kp_s_ISO_IP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_81, __pyx_n_s_VMTP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_82, __pyx_kp_s_SECURE_VMTP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_83, __pyx_n_s_VINES) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_84, __pyx_n_s_TTP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_85, __pyx_kp_s_NSFNET_IGP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_86, __pyx_n_s_DGP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_87, __pyx_n_s_TCF) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_88, __pyx_n_s_EIGRP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_89, __pyx_n_s_OSPFIGP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_90, __pyx_kp_s_Sprite_RPC) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_91, __pyx_n_s_LARP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_92, __pyx_n_s_MTP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_93, __pyx_kp_s_AX_25) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_94, __pyx_n_s_IPIP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_95, __pyx_n_s_MICP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_96, __pyx_kp_s_SCC_SP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_97, __pyx_n_s_ETHERIP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_98, __pyx_n_s_ENCAP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_99, __pyx_kp_s_any_private_encryption_scheme) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_100, __pyx_n_s_GMTP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_101, __pyx_n_s_IFMP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_102, __pyx_n_s_PNNI) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_103, __pyx_n_s_PIM) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_104, __pyx_n_s_ARIS) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_105, __pyx_n_s_SCPS) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_106, __pyx_n_s_QNX) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_107, __pyx_kp_s_A_N) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_108, __pyx_n_s_IPComp) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_109, __pyx_n_s_SNP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_110, __pyx_kp_s_Compaq_Peer) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_111, __pyx_kp_s_IPX_in_IP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_112, __pyx_n_s_VRRP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_113, __pyx_n_s_PGM) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_114, __pyx_kp_s_any_0_hop_protocol) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_115, __pyx_n_s_L2TP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_116, __pyx_n_s_DDX) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_117, __pyx_n_s_IATP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_118, __pyx_n_s_STP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_119, __pyx_n_s_SRP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_120, __pyx_n_s_UTI) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_121, __pyx_n_s_SMP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_122, __pyx_n_s_SM) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_123, __pyx_n_s_PTP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_124, __pyx_n_s_ISIS) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_125, __pyx_n_s_FIRE) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_126, __pyx_n_s_CRTP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_127, __pyx_n_s_CRUDP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_128, __pyx_n_s_SSCOPMCE) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_129, __pyx_n_s_IPLT) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_130, __pyx_n_s_SPS) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_131, __pyx_n_s_PIPE) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_132, __pyx_n_s_SCTP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_133, __pyx_n_s_FC) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_134, __pyx_kp_s_RSVP_E2E_IGNORE) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_135, __pyx_n_s_Mobility) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_136, __pyx_n_s_UDPLite) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_137, __pyx_kp_s_MPLS_in_IP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_138, __pyx_n_s_manet) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_139, __pyx_n_s_HIP) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_140, __pyx_n_s_Shim6) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_int_255, __pyx_n_s_Reserved) < 0) __PYX_ERR(0, 208, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_PROTOCOLS, __pyx_t_1) < 0) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "netfilterqueue.pyx":1 @@ -6215,6 +6294,33 @@ bad: } } +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) { + const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(unsigned int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(unsigned int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); + } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); + } + } else { + if (sizeof(unsigned int) <= sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(unsigned int), + little, !is_unsigned); + } +} + /* CIntFromPy */ static CYTHON_INLINE u_int32_t __Pyx_PyInt_As_u_int32_t(PyObject *x) { const u_int32_t neg_one = (u_int32_t) -1, const_zero = (u_int32_t) 0; diff --git a/netfilterqueue.pxd b/netfilterqueue.pxd index cacd38b..4cd3a47 100644 --- a/netfilterqueue.pxd +++ b/netfilterqueue.pxd @@ -3,6 +3,13 @@ cdef extern from "sys/types.h": ctypedef unsigned short int u_int16_t ctypedef unsigned int u_int32_t +cdef extern from "": + int errno + +# dummy defines from asm-generic/errno.h: +cdef enum: + ENOBUFS = 105 # No buffer space available + cdef extern from "netinet/ip.h": struct iphdr: u_int8_t tos @@ -70,6 +77,11 @@ cdef extern from "libnfnetlink/linux_nfnetlink.h": u_int8_t version u_int16_t res_id +cdef extern from "libnfnetlink/libnfnetlink.h": + struct nfnl_handle: + pass + unsigned int nfnl_rcvbufsiz(nfnl_handle *h, unsigned int size) + cdef extern from "libnetfilter_queue/linux_nfnetlink_queue.h": enum nfqnl_config_mode: NFQNL_COPY_NONE @@ -131,7 +143,8 @@ cdef extern from "libnetfilter_queue/libnetfilter_queue.h": int nfq_get_timestamp(nfq_data *nfad, timeval *tv) nfqnl_msg_packet_hw *nfq_get_packet_hw(nfq_data *nfad) int nfq_get_nfmark (nfq_data *nfad) - + nfnl_handle *nfq_nfnlh(nfq_handle *h) + # Dummy defines from linux/socket.h: cdef enum: # Protocol families, same as address families. PF_INET = 2 diff --git a/netfilterqueue.pyx b/netfilterqueue.pyx index abc2c80..485c507 100644 --- a/netfilterqueue.pyx +++ b/netfilterqueue.pyx @@ -12,13 +12,17 @@ COPY_NONE = 1 COPY_META = 2 COPY_PACKET = 3 -DEFAULT_MAX_QUEUELEN = 1024 - # Packet copying defaults +DEF DEFAULT_MAX_QUEUELEN = 1024 DEF MaxPacketSize = 0xFFFF DEF BufferSize = 4096 DEF MetadataSize = 80 DEF MaxCopySize = BufferSize - MetadataSize +# Experimentally determined overhead +DEF SockOverhead = 760+20 +DEF SockCopySize = MaxCopySize + SockOverhead +# Socket queue should hold max number of packets of copysize bytes +DEF SockRcvSize = DEFAULT_MAX_QUEUELEN * SockCopySize / 2 cimport cpython.version @@ -158,8 +162,10 @@ cdef class NetfilterQueue: def bind(self, int queue_num, object user_callback, u_int32_t max_len=DEFAULT_MAX_QUEUELEN, u_int8_t mode=NFQNL_COPY_PACKET, - u_int32_t range=MaxPacketSize): + u_int32_t range=MaxPacketSize, + u_int32_t sock_len=SockRcvSize): """Create and bind to a new queue.""" + cdef unsigned int newsiz self.user_callback = user_callback self.qh = nfq_create_queue(self.h, queue_num, global_callback, self) @@ -173,6 +179,10 @@ cdef class NetfilterQueue: nfq_set_queue_maxlen(self.qh, max_len) + newsiz = nfnl_rcvbufsiz(nfq_nfnlh(self.h),sock_len) + if newsiz != sock_len*2: + raise RuntimeWarning("Socket rcvbuf limit is now %d, requested %d." % (newsiz,sock_len)) + def unbind(self): """Destroy the queue.""" if self.qh != NULL: @@ -185,12 +195,14 @@ cdef class NetfilterQueue: cdef int fd = nfq_fd(self.h) cdef char buf[BufferSize] cdef int rv - with nogil: - rv = recv(fd, buf, sizeof(buf), 0) - while rv >= 0: - nfq_handle_packet(self.h, buf, rv) + while True: with nogil: rv = recv(fd, buf, sizeof(buf), 0) + if (rv >= 0): + nfq_handle_packet(self.h, buf, rv) + else: + if errno != ENOBUFS: + break PROTOCOLS = { 0: "HOPOPT",