[@bx_10_70 /opt/linuxshare/]# ngrep port 80 -W byline
interface: eth0 (10.16.10.0/255.255.255.0)
ngrep: symbol lookup error: ngrep: undefined symbol: pcap_restart
[@bx_10_70 /opt/linuxshare/]# ldd /usr/sbin/ngrep
linux-vdso.so.1 => (0x00007ffe91864000)
libpcap.so.1 => /usr/local/lib/libpcap.so.1 (0x00007f2d2c9de000)
libpcre.so.0 => /lib64/libpcre.so.0 (0x000000325fe00000)
libc.so.6 => /lib64/libc.so.6 (0x00000031b6c00000)
/lib64/ld-linux-x86-64.so.2 (0x00000031b6400000)
根据提示,怀疑是libpcap库的问题,于是查找所有libpcap库文件
[@bx_10_70 /opt/linuxshare/]# find / -name "*libpcap.so*"
/usr/local/lib/libpcap.so.1.6.2
/usr/local/lib/libpcap.so
/usr/local/lib/libpcap.so.1
/usr/lib64/libpcap.so.1.4.0
/usr/lib64/libpcap.so.1
/opt/linuxshare/software/libpcap-1.6.2/libpcap.so.1.6.2
这里有两个libpcap.so.1(都是软链接),分别指向/usr/lib64/libpcap.so.1.4.0和/usr/local/lib/libpcap.so.1.6.2,因为不确定用的哪一个版本,所以删除掉/usr/local/lib/目录下的libpcap.so.1,保留/usr/lib64/下的libpcap.so.1,在运行ngrep,OK.
ngrep undefined symbol: pcap_restart 错误处理
原文地址:http://1038741.blog.51cto.com/1028741/1751762