Lines Matching refs:ah

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