在nfq_create_queue()期间发生Python和nfqueue error错误

2024-06-28 19:27:44 发布

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

我正在尝试运行以下代码。在

def main():

    global action, inputprotocol, actiontype, inputportnum, inputipaddr

    actiontype = "ipaddress"
    action = "accept"
    inputportnum = ""

    q = nfqueue.queue()
    q.open()
    q.bind(socket.AF_INET)
    q.set_callback(cb)
    q.create_queue(0)

    try:
        q.try_run()
    except KeyboardInterrupt, e:
        print ("Interrupted")

    print ("unbind")
    q.unbind(AF_INET)
    print ("close")
    q.close()

main()

每次尝试运行此程序时,都会收到RuntimeError:error during nfq_create_queue()。 我尝试在sudo下运行它,还检查了同一个脚本是否已经在运行,但没有得到任何输出。 我该怎么办?在


Tags: 代码closequeuemaindefcreateactionglobal