Lines Matching defs:arp
27 * mac - our arp address
42 struct arpMsg arp;
59 /* send arp request */
60 memset(&arp, 0, sizeof(arp));
61 memcpy(arp.ethhdr.h_dest, MAC_BCAST_ADDR, 6); /* MAC DA */
62 memcpy(arp.ethhdr.h_source, mac, 6); /* MAC SA */
63 arp.ethhdr.h_proto = htons(ETH_P_ARP); /* protocol type (Ethernet) */
64 arp.htype = htons(ARPHRD_ETHER); /* hardware type */
65 arp.ptype = htons(ETH_P_IP); /* protocol type (ARP message) */
66 arp.hlen = 6; /* hardware address length */
67 arp.plen = 4; /* protocol address length */
68 arp.operation = htons(ARPOP_REQUEST); /* ARP op code */
69 *((u_int *) arp.sInaddr) = ip; /* source IP address */
70 memcpy(arp.sHaddr, mac, 6); /* source hardware address */
72 /* *((u_int *) arp.tInaddr) = yiaddr;*/ /* target IP address */
73 memcpy(arp.tInaddr, (char *)&yiaddr, 4);
78 if (sendto(s, &arp, sizeof(arp), 0, &addr, sizeof(addr)) < 0)
81 /* wait arp reply, and check it */
94 if (recv(s, &arp, sizeof(arp), 0) < 0 ) rv = 0;
95 if (arp.operation == htons(ARPOP_REPLY) &&
96 bcmp(arp.tHaddr, mac, 6) == 0 &&
97 *((u_int *) arp.sInaddr) == yiaddr) {
98 DEBUG(LOG_INFO, "Valid arp reply receved for this address");
108 DEBUG(LOG_INFO, "%salid arp replies for this address", rv ? "No v" : "V");