【发布时间】:2019-07-26 03:09:04
【问题描述】:
来自here的代码sn-p:
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)
我应该如何正确地做呢?
【问题讨论】:
-
如果您在回答问题后对其进行编辑,则答案看起来很荒谬。请不要这样做。问另一个问题。或者更好的是,想想你想问什么,并在第一时间提出正确的问题。
标签: c networking ethernet