- 论坛徽章:
- 0
|
本帖最后由 hl626818 于 2015-08-31 21:29 编辑
系统:
ubuntu 14.04
问题描述:
1)在ubuntu软件中心无脑安装的libnetfilter_queue。
2)直接比照别人的的测试代码:
*******************测试程序:a.c*************************************
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <time.h>
#include <arpa/inet.h>
#include <linux/netfilter.h>
#include <linux/netfilter/nfnetlink.h>
#include <linux/types.h>
#include <linux/netfilter/nfnetlink_queue.h>
#include <libnetfilter_queue/libnetfilter_queue.h>
int main(void)
{
struct nfq_handle *h;
h = nfq_open();
if (!h) {
fprintf(stderr, "error during nfq_open()\n");
exit(1);
}
printf("unbinding existing nf_queue handler for AF_INET (if any)\n");
if (nfq_unbind_pf(h, AF_INET) < 0) {
fprintf(stderr, "error during nfq_unbind_pf()\n");
exit(1);
}
printf("binding nfnetlink_queue as nf_queue handler for AF_INET\n");
if (nfq_bind_pf(h, AF_INET) < 0) {
fprintf(stderr, "error during nfq_bind_pf()\n");
exit(1);
}
printf("close nft queue handle.\n");
if (nfq_close(h) < 0) {
fprintf(stderr, "error during nfq_close()\n");
exit(1);
}
return 0;
}
*********************end******************************************
#gcc -o a a.c -lnetfilter_queue
报错:
无法找到#include <libnetfilter_queue/libnetfilter_queue.h>
将#include <libnetfilter_queue/libnetfilter_queue.h> 注释掉后,再次编译
报错:
无法找到到-lnetfilter_queue库
去掉-lnetfilter_queue,再次编译 #gcc -o a a.c
报错:
nfq_open()..........nfq_xxxx() 以nfq_开头的函数均未定义
请教各位,如何解决? 水平太low。。。。。见笑了~ |
|