Hi,
Fairly new to python, messing with some socket and pcap sniffing and
have come across the following issue while trying to do a pcap_loop
(via pcapy http://oss.coresecurity.com/projects/pcapy.html). I believe
i recall seeing similar stuff using other pcap libs with python in the
past (such as pylibpcap)
in a nutshell, blocking on a read using socket.recvfrom(buf), which
strace shows me is sitting in recvfrom(2) allows ctrl-c to be raised
as keyboardInt, which i can catch with try/except or just let it go
all the way up and kill the script.
But calling pcapy.loop(5,cbk) which also, via strace, is sitting in
recvfrom(2) - via libpcap itself - cannot be interrupted with sigint,
strace shows the signal, but nothing raises.
Here are some snippets that show the issue and code
pcapy_hangs -- http://rafb.net/p/369n4I81.html
socket_no_hang -- http://rafb.net/p/DCa4cV71.html
Any light that someone can shed on this would be greatly appreciated,
or what is a usual workaround (is this a symptom of calling recvfrom
via a compiled lib like pcapy somehow set SIG_IGN on SIGINT ?)
tia,
-jeff