On 2016 Oct 30 (Sun) at 15:17:34 +0100 (+0100), Jeremie Courreges-Anglas wrote: :Peter Hessler <phess...@openbsd.org> writes: : :> I would like to use pcapy in a python3 module, so we need to update it. :> :> However, when I run the test program, I get the following error: :> :> python2.7:/usr/local/lib/python2.7/site-packages/pcapy.so: undefined :> symbol '_Z10bpf_filterPK8bpf_insnPKhjj' :> Traceback (most recent call last): :> File "/usr/local/tests/pcapytests.py", line 8, in <module> :> import pcapy :> ImportError: Cannot load specified object :> :> Based on what I can tell, pcapy.so is linked against libpcap, which :> should provide those symbols. :> :> $ ldd /usr/local/lib/python2.7/site-packages/pcapy.so :> /usr/local/lib/python2.7/site-packages/pcapy.so: :> Start End Type Open Ref GrpRef Name :> 000010ffb9019000 000010ffb921f000 dlib 2 0 0 /usr/local/lib/python2.7/site-packages/pcapy.so :> 000010ff88f9c000 000010ff891c1000 rlib 0 1 0 /usr/lib/libpcap.so.8.1 :> 000010ff5d7d6000 000010ff5daed000 rlib 0 1 0 /usr/lib/libstdc++.so.57.0 :> 000010ff9925f000 000010ff99636000 rlib 0 1 0 /usr/local/lib/libpython2.7.so.0.0 :> 000010fee0ee9000 000010fee1110000 rlib 0 3 0 /usr/lib/libm.so.10.0 :> 000010ff63fa3000 000010ff641b2000 rlib 0 1 0 /usr/lib/libpthread.so.23.0 :> 000010fef2919000 000010fef2b26000 rlib 0 1 0 /usr/lib/libutil.so.12.1 :> :> Ideas? : :C++ name mangling is affecting the functions declared in net/bpf.h. :Probably a __BEGIN_DECLS / __END_DECLS pair missing. : :-- :jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE :
Yup, that was it. How risky is that? Should this be tested in a bulk? (moved to tech@) OK? Index: sys/net/bpf.h =================================================================== RCS file: /cvs/openbsd/src/sys/net/bpf.h,v retrieving revision 1.58 diff -u -p -u -p -r1.58 bpf.h --- sys/net/bpf.h 12 Sep 2016 16:24:37 -0000 1.58 +++ sys/net/bpf.h 30 Oct 2016 16:21:32 -0000 @@ -276,11 +276,13 @@ struct bpf_ops { #define BPF_STMT(code, k) { (u_int16_t)(code), 0, 0, k } #define BPF_JUMP(code, k, jt, jf) { (u_int16_t)(code), jt, jf, k } +__BEGIN_DECLS u_int bpf_filter(const struct bpf_insn *, const u_char *, u_int, u_int) __bounded((__buffer__, 2, 4)); u_int _bpf_filter(const struct bpf_insn *, const struct bpf_ops *, const void *, u_int); +__END_DECLS #ifdef _KERNEL struct ifnet; -- Every program has two purposes -- one for which it was written and another for which it wasn't.