|
最近在移植libpcap的过程中遇到以下问题,希望各位大侠帮忙解惑。
首先按照飞凌手册上的步骤搭建了嵌入式linux开发平台,2.6.28内核加上Cramfs的根系统文件. 然后在主机上下载了libpcap源码进行移植, 移植过程参考:http://blog.sina.com.cn/s/blog_4bec945b010009r2.html 。 移植完写了一个测试小程序如下:
#include
#include
#include
#include
#include
#include
#include
int main(int argc,char *argv[])
{
char *dev;
char *net;
char *mask;
int ret;
char errbuf[PCAP_ERRBUF_SIZE];
bpf_u_int32 netp;
bpf_u_int32 maskp;
struct in_addr addr;
dev = pcap_lookupdev(errbuf);
if(dev ==NULL)
{
printf("%s\n",errbuf);
exit(1);
}
printf("设备名:%s\n",dev);
return 0;
}
在主机上用gcc编译后测试成功,输出 设备名:eth0
使用飞凌提供的linux交叉编译器编译后拷贝到sd卡上使用root运行后则不成功,输出:no suitable device found. 但是通过ifconfig显示能够找到eth0的信息。希望哪位能够给一个解决问题的思路。 |
|
|