[pypy-issue] [issue1318] Scapy.sniff returns an error
Amaury Forgeot d Arc
tracker at bugs.pypy.org
Fri Nov 9 17:07:07 CET 2012
Amaury Forgeot d Arc <amauryfa at gmail.com> added the comment:
# XXX. Argl! We need to give the kernel a pointer on the BPF,
# python object header seems to be 20 bytes. 36 bytes for x86 64bits arch.
bpfh = struct.pack("HL", nb, id(bpf)+36)
bpfh = struct.pack("HI", nb, id(bpf)+20)
s.setsockopt(SOL_SOCKET, SO_ATTACH_FILTER, bpfh)
This kind of code won't work at all with PyPy: the object layout is very different, id(bpf) is not
the address of the object, and PyPy moves objects anyway.
I don't know why the code is written like this - setsockopt() accepts a string.
Would the following work?
# (remove all the bpfh stuff)
s.setsockopt(SOL_SOCKET, SO_ATTACH_FILTER, bpf)
status: unread -> chatting
PyPy bug tracker <tracker at bugs.pypy.org>
More information about the pypy-issue