You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm writing a simple code to capture the packet, and print the packet, just as the example code which you give to us. It works fine as the INPUT chain of iptables, but when I change to capture the output packet with OUTPUT chain of iptables, it crash and show the 'segmentation fault'.
When sending packets, self._hw is NULL so the copy crashes. I have no idea how to fix that in the PYX file (what should be the value of self.hw_addr when self._hw is NULL?), but as a workaround, you can just comment the following lines in netfilterqueue.c and compile/install the module again:
The fix leaves calling and parsing of nfq_get_packet_hw data until the get_hw() call, and just returns None if nfq_get_packet_hw returns NULL. I believe hw_addr was private on Packet, so this should be compatible with 0.8.
I've uploaded 0.8.1 to Pypi but reviews and improvements are welcome. Thanks for reporting this, all.
Activity
dany-fu commentedon Jan 26, 2017
I ran into a similar issue with version 0.8 and 0.6 on Ubuntu 14.04; PREROUTE works fine, POSTROUTE crashes. Seems ok so far on 0.7
Tey commentedon Jan 27, 2017
Problem is at line 65 of netfilterqueue.pyx:
When sending packets,
self._hwisNULLso the copy crashes. I have no idea how to fix that in the PYX file (what should be the value ofself.hw_addrwhenself._hwisNULL?), but as a workaround, you can just comment the following lines in netfilterqueue.c and compile/install the module again:ojalexander commentedon Jan 27, 2017
I ran into the same issue using OUTPUT. Thanks for the workaround.
mattfox commentedon Jan 27, 2017
Thanks for the details. I'll see if I can duplicate and fix within a few days.
To fix #25, only parse self._hw.hw_addr if self._hw is not NULL
mattfox commentedon Jan 31, 2017
The fix leaves calling and parsing of nfq_get_packet_hw data until the
get_hw()call, and just returns None if nfq_get_packet_hw returns NULL. I believehw_addrwas private onPacket, so this should be compatible with 0.8.I've uploaded 0.8.1 to Pypi but reviews and improvements are welcome. Thanks for reporting this, all.
Tey commentedon Feb 6, 2017
Thanks @mattfox I experience no more crash with 0.8.1.