lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Re: [lwip] ARP requests from LwIP side


From: Rajaraman Krishnan
Subject: [lwip-users] Re: [lwip] ARP requests from LwIP side
Date: Wed, 08 Jan 2003 22:38:33 -0000

Hi Leon,

Thanks for the tip. Looks like in your arp.h you have changed the eth_addr
to an array of 6 u8_t. In the arp.h in the 0.5.0 version of LwIP it is still
u16_t. But your pointer helped me fix it.

Rajaram


----- Original Message -----
From: <address@hidden>
To: <address@hidden>
Sent: Monday, February 11, 2002 3:11 PM
Subject: Re: [lwip] ARP requests from LwIP side


>
> Hello,
>
> I'm not sure what lwIP release your are using, but I've recently
> submitted 2 bugfixes for both arp.c from lwIP 0.5.0. Search for
> the "LW" here:
>
> #define ARPH_HWLEN_SET(hdr, len) (hdr)->_hwlen_protolen =
> HTONS(ARPH_PROTOLEN(hdr) | ((len) << 8))
> file://#define ARPH_PROTOLEN_SET(hdr, len) (hdr)->_hwlen_protolen =
HTONS((len)
> | (ARPH_PROTOLEN(hdr) << 8)) // LW: bug
> #define ARPH_PROTOLEN_SET(hdr, len) (hdr)->_hwlen_protolen = HTONS((len) |
> (ARPH_HWLEN(hdr) << 8))
>
>
> struct pbuf *
> arp_query(struct netif *netif, struct eth_addr *ethaddr, struct ip_addr
> *ipaddr)
> {
>   struct arp_hdr *hdr;
>   struct pbuf *p;
>   u8_t i;
>
>   p = pbuf_alloc(PBUF_LINK, sizeof(struct arp_hdr), PBUF_RAM);
>   if(p == NULL) {
>     return NULL;
>   }
>
>   hdr = p->payload;
>
>   hdr->opcode = htons(ARP_REQUEST);
>
>   for(i = 0; i < 6; ++i) {
>     hdr->dhwaddr.addr[i] = 0x00; // LW: bug in lwIP, uses u16_t, but also
> 0xff instead of 0xffff
>     hdr->shwaddr.addr[i] = ethaddr->addr[i];
>   }
>
>   ip_addr_set(&(hdr->dipaddr), ipaddr);
>   ip_addr_set(&(hdr->sipaddr), &(netif->ip_addr));
>
>   hdr->hwtype = htons(HWTYPE_ETHERNET);
>   ARPH_HWLEN_SET(hdr, 6);
>
>   hdr->proto = htons(ETHTYPE_IP);
>   ARPH_PROTOLEN_SET(hdr, sizeof(struct ip_addr));
>
>   for(i = 0; i < 6; ++i) {
>     hdr->ethhdr.dest.addr[i] = 0xff;
>     hdr->ethhdr.src.addr[i] = ethaddr->addr[i];
>   }
>
>   hdr->ethhdr.type = htons(ETHTYPE_ARP);
>
>   return p;
> }
>
> [This message was sent through the lwip discussion list.]
>

[This message was sent through the lwip discussion list.]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]