Lines Matching refs:ah
276 struct arphdr *ah = (struct arphdr*)buf;
277 unsigned char *p = (unsigned char *)(ah+1);
279 ah->ar_hrd = htons(ME->sll_hatype);
280 if (ah->ar_hrd == htons(ARPHRD_FDDI))
281 ah->ar_hrd = htons(ARPHRD_ETHER);
282 ah->ar_pro = htons(ETH_P_IP);
283 ah->ar_hln = ME->sll_halen;
284 ah->ar_pln = 4;
285 ah->ar_op = advert ? htons(ARPOP_REPLY) : htons(ARPOP_REQUEST);
287 memcpy(p, &ME->sll_addr, ah->ar_hln);
294 memcpy(p, &ME->sll_addr, ah->ar_hln);
296 memcpy(p, &HE->sll_addr, ah->ar_hln);
297 p+=ah->ar_hln;
303 err = sendto(s, buf, p-buf, 0, (struct sockaddr*)HE, SLL_LEN(ah->ar_hln));
379 struct arphdr *ah = (struct arphdr*)buf;
380 unsigned char *p = (unsigned char *)(ah+1);
392 if (ah->ar_op != htons(ARPOP_REQUEST) &&
393 ah->ar_op != htons(ARPOP_REPLY))
397 if (ah->ar_hrd != htons(FROM->sll_hatype) &&
398 (FROM->sll_hatype != ARPHRD_FDDI || ah->ar_hrd != htons(ARPHRD_ETHER)))
402 if (ah->ar_pro != htons(ETH_P_IP))
404 if (ah->ar_pln != 4)
406 if (ah->ar_hln != ((struct sockaddr_ll *)&me)->sll_halen)
408 if (len < sizeof(*ah) + 2*(4 + ah->ar_hln))
410 memcpy(&src_ip, p+ah->ar_hln, 4);
411 memcpy(&dst_ip, p+ah->ar_hln+4+ah->ar_hln, 4);
417 if (memcmp(p+ah->ar_hln+4, ((struct sockaddr_ll *)&me)->sll_addr, ah->ar_hln))
443 printf("%s from ", ah->ar_op == htons(ARPOP_REPLY) ? "reply" : "request");
445 print_hex(p, ah->ar_hln);
451 if (memcmp(p+ah->ar_hln+4, ((struct sockaddr_ll *)&me)->sll_addr, ah->ar_hln)) {
455 print_hex(p+ah->ar_hln+4, ah->ar_hln);
472 if (ah->ar_op == htons(ARPOP_REQUEST))