Lines Matching defs:arp
44 struct arpMsg arp;
60 /* send arp request */
61 memset(&arp, 0, sizeof(arp));
62 memset(arp.h_dest, 0xff, 6); /* MAC DA */
63 memcpy(arp.h_source, from_mac, 6); /* MAC SA */
64 arp.h_proto = htons(ETH_P_ARP); /* protocol type (Ethernet) */
65 arp.htype = htons(ARPHRD_ETHER); /* hardware type */
66 arp.ptype = htons(ETH_P_IP); /* protocol type (ARP message) */
67 arp.hlen = 6; /* hardware address length */
68 arp.plen = 4; /* protocol address length */
69 arp.operation = htons(ARPOP_REQUEST); /* ARP op code */
70 memcpy(arp.sHaddr, from_mac, 6); /* source hardware address */
71 memcpy(arp.sInaddr, &from_ip, sizeof(from_ip)); /* source IP address */
73 memcpy(arp.tInaddr, &test_ip, sizeof(test_ip)); /* target IP address */
77 if (sendto(s, &arp, sizeof(arp), 0, &addr, sizeof(addr)) < 0)
80 /* wait for arp reply, and check it */
94 if (recv(s, &arp, sizeof(arp), 0) < 0)
96 if (arp.operation == htons(ARPOP_REPLY)
97 && memcmp(arp.tHaddr, from_mac, 6) == 0
98 && *((uint32_t *) arp.sInaddr) == test_ip