I am trying to generate arp requests from within the kernel but I do not understand the difference between the ‘target MAC address’ and the ‘destination MAC address’. The kernel function that I am using is this one:
void arp_send(int type, int ptype, __be32 dest_ip,
struct net_device *dev, __be32 src_ip,
const unsigned char *dest_hw, const unsigned char *src_hw,
const unsigned char *target_hw)
Does anyone know the difference between ‘target_hw’ (the target MAC address) and ‘dst_hw’ (the destination MAC address)? For me they should be the same…
The arp_send function is a generic one, used to send both ARP requests and responses.
In your case (ARP request) the
target_hwis the information you want to learn, so this field can be ignored (set to NULL, see RFC826 example)dest_hwwill also be NULL – which will result in using broadcast address (see arp_create comment)I’m assuming IPv4 over Ethernet here. For other Layer2/3 protocols it might look different.