来自 here 的代码片段:
void packet_handler(u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data)
{
....
/* retireve the position of the ip header */
ih = (ip_header *) (pkt_data +
14); //length of ethernet header
....
但是这张图片并没有说它一定是14:
(来源:lewis at www.dcs.gla.ac.uk)
我应该如何正确操作?
最佳答案
在 802.3 中,源地址和目的地址都是 48 位的 MAC 地址。 6+6+2=14
关于c - 以太网头的长度一定是 14 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2796944/