07-27-2023, 09:31 AM
Code snippet from [here][1]:
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
....
But this image doesn't say it's necessarily **14**:
[![alt text][2]][2]
<sub>(source: [lewis at
How should I do it properly?
[1]:
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
....
But this image doesn't say it's necessarily **14**:
[![alt text][2]][2]
<sub>(source: [lewis at
[To see links please register here]
]([To see links please register here]
;How should I do it properly?
[1]:
[To see links please register here]
[2]: