0
我可以捕捉从eth0接口的数据包,并嗅出IP分组如下如何用libpcap嗅探PPP数据包?
/* IP header */
struct sniff_ip {
u_char ip_vhl; /* version << 4 | header length >> 2 */
u_char ip_tos; /* type of service */
u_short ip_len; /* total length */
u_short ip_id; /* identification */
u_short ip_off; /* fragment offset field */
#define IP_RF 0x8000 /* reserved fragment flag */
#define IP_DF 0x4000 /* dont fragment flag */
#define IP_MF 0x2000 /* more fragments flag */
#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
u_char ip_ttl; /* time to live */
u_char ip_p; /* protocol */
u_short ip_sum; /* checksum */
struct in_addr ip_src,ip_dst; /* source and dest address */
};
所以,如果需要捕捉从PPP接口的数据包,如何定义页眉结构?
我只是注意到,在这种情况下,标头的长度是32字节。
我不认为我知道通过libpcap或tcpdump捕获“按程序”的方法。关心添加更多的信息? – Hasturkun 2010-11-22 14:27:03
对不起!我可以通过ppp – why 2010-11-22 14:27:44
来捕获但我注意到,这个包的目标ip是“0.2.172.16”,很奇怪,认为172.16.0.2是对的。 – why 2010-11-22 14:32:08