From c91caa06d3e17fcc7726a0e969c4f7cd0d2df609 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Sat, 30 Jun 2007 11:42:41 +0000 Subject: [PATCH] Set/get ARP hwlen and protolen in one piece. --- src/netif/etharp.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/netif/etharp.c b/src/netif/etharp.c index 12c2d42e..e975d9fc 100644 --- a/src/netif/etharp.c +++ b/src/netif/etharp.c @@ -600,9 +600,8 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p) /* RFC 826 "Packet Reception": */ if ((hdr->hwtype != htons(HWTYPE_ETHERNET)) || - (ARPH_HWLEN(hdr) != ETHARP_HWADDR_LEN) || + (hdr->_hwlen_protolen != htons((ETHARP_HWADDR_LEN << 8) | sizeof(struct ip_addr))) || (hdr->proto != htons(ETHTYPE_IP)) || - (ARPH_PROTOLEN(hdr) != sizeof(struct ip_addr)) || (hdr->ethhdr.type != htons(ETHTYPE_ARP))) { LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE | 1, ("etharp_arp_input: packet dropped, wrong hw type, hwlen, proto, protolen or ethernet type (%"U16_F"/%"U16_F"/%"U16_F"/%"U16_F"/%"U16_F")\n", @@ -1000,10 +999,9 @@ etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr, hdr->dipaddr = *(struct ip_addr2 *)ipdst_addr; hdr->hwtype = htons(HWTYPE_ETHERNET); - ARPH_HWLEN_SET(hdr, ETHARP_HWADDR_LEN); - hdr->proto = htons(ETHTYPE_IP); - ARPH_PROTOLEN_SET(hdr, sizeof(struct ip_addr)); + /* set hwlen and protolen together */ + hdr->_hwlen_protolen = htons((ETHARP_HWADDR_LEN << 8) | sizeof(struct ip_addr)); hdr->ethhdr.type = htons(ETHTYPE_ARP); /* send ARP query */