c - access ARP header in socket buffer -
embedded system (kernel 2.4.20). in driver need access arp header fields, including mac addresses; unfortunately in include/linux/if_arp.h specific fields commented . i've tried define own 'arp_hdr' structure in code necessary fields:
struct arp_hdr { /* fields taken include/linux/if_arp.h */ /* , additionaly these*/ unsigned char ar_sha[eth_alen]; unsigned char ar_sip[4]; unsigned char ar_tha[eth_alen]; unsigned char ar_tip[4]; } int my_func(struct sk_buff *skb) { struct arp_hdr *arph; arph = (struct arp_hdr *)skb->nh.raw; /* print out contents of arp header, garbage */ }
why garbage , right way want?
thanks in advance!
Comments
Post a Comment