简体   繁体   中英

Undefined symbol “afinfo” when importing python-iptables package “iptc”

I am trying to utilize the python-iptables package to list iptables rules in a web app. When I add the iptc package to my environment, I get the below error. I used yum 'provides' to find where the libxtables.so.4 file comes from and found that the iptables and iptables-devel packages were the appropriate choice in CentOS 6.4 x64. I upgraded those packages but it did not change the error.

Does anyone have any suggestions about how I can resolve this?


pgrace@ny-misc01:~/repos/python-iptables/libxtwrapper$ python
Python 2.6.6 (r266:84292, Sep 11 2012, 08:34:23)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import iptc
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python2.6/site-packages/iptc/__init__.py", line 10, in 
    from ip4tc import Table, Chain, Rule, Match, Target, Policy, IPTCError
  File "/usr/lib64/python2.6/site-packages/iptc/ip4tc.py", line 11, in 
    from xtables import (XT_INV_PROTO, NFPROTO_IPV4, XTablesError, xtables,
  File "/usr/lib64/python2.6/site-packages/iptc/xtables.py", line 744, in 
    class xtables(object):
  File "/usr/lib64/python2.6/site-packages/iptc/xtables.py", line 757, in xtables
    _xtables_afinfo = ct.c_void_p.in_dll(_lib_xtables, "afinfo")
ValueError: /lib64/libxtables.so.4: undefined symbol: afinfo
>>>

See this: https://github.com/ldx/python-iptables/issues/25

This is a known problem , old versions of libxtables declared afinfo as static, thus it is not accessible for python-iptables. There is a possible workaround, though - please keep an eye on the ticket, it will be updated as soon as there has been progress.

Another solution is to update iptables on your machine.

Disclaimer: I am the maintainer of python-iptables.

Update: this should be fixed now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM