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