导入pythoniptables包“iptc”时未定义符号“afinfo”

2024-10-03 06:19:01 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图利用python iptables包在web应用程序中列出iptables规则。当我将iptc包添加到我的环境中时,我得到以下错误。我用yum的'provides'来查找libxtables.so.4文件来自并发现iptables和{}包是CentOS 6.4 x64中的适当选择。我升级了那些包,但它没有改变错误。在

有人对我如何解决这个问题有什么建议吗?在


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
>>>


Tags: inpyimportiptablespackagesusr错误line
1条回答
网友
1楼 · 发布于 2024-10-03 06:19:01

看这个:https://github.com/ldx/python-iptables/issues/25

这是一个已知问题,旧版本的libxtables声明afinfo为静态的,因此python iptables无法访问它。不过,这里有一个可能的解决办法-请密切关注罚单,一旦有进展,它将立即更新。在

另一个解决方案是在您的机器上更新iptables。在

免责声明:我是python iptables的维护者。在

更新:现在应该修复此问题。在

相关问题 更多 >