/[lwip]/lwip/src/netif/etharp.c
ViewVC logotype

Diff of /lwip/src/netif/etharp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.29 by jani, Mon Feb 24 10:49:05 2003 UTC revision 1.30 by likewise, Sun Mar 16 22:44:05 2003 UTC
# Line 3  Line 3 
3   * Address Resolution Protocol module for IP over Ethernet   * Address Resolution Protocol module for IP over Ethernet
4   *   *
5   * $Log$   * $Log$
6     * Revision 1.30  2003/03/16 22:44:05  likewise
7     * Fixed bug #2841 (etharp.c packet queueing always picks table entry 6).
8     *
9   * Revision 1.29  2003/02/24 10:49:05  jani   * Revision 1.29  2003/02/24 10:49:05  jani
10   * cleaned up opt.h a bit, added more option defaults ad changed SYS_LIGHTWEIGHT_PROT to be a 0/1 define.The same for COMPAT_SOCKET   * cleaned up opt.h a bit, added more option defaults ad changed SYS_LIGHTWEIGHT_PROT to be a 0/1 define.The same for COMPAT_SOCKET
11   *   *
# Line 737  struct pbuf *etharp_query(struct netif * Line 740  struct pbuf *etharp_query(struct netif *
740    u8_t i;    u8_t i;
741    
742    srcaddr = (struct eth_addr *)netif->hwaddr;    srcaddr = (struct eth_addr *)netif->hwaddr;
743      i = 0;
744    /* bail out if this IP address is pending */    /* bail out if this IP address is pending */
745    for(i = 0; i < ARP_TABLE_SIZE; ++i) {    for(i; i < ARP_TABLE_SIZE; ++i) {
746      if(ip_addr_cmp(ipaddr, &arp_table[i].ipaddr)) {      if(ip_addr_cmp(ipaddr, &arp_table[i].ipaddr)) {
747        if (arp_table[i].state == ETHARP_STATE_PENDING) {        if (arp_table[i].state == ETHARP_STATE_PENDING) {
748          DEBUGF(ETHARP_DEBUG, ("etharp_query: requested IP already pending\n"));          DEBUGF(ETHARP_DEBUG, ("etharp_query: requested IP already pending\n"));
# Line 776  struct pbuf *etharp_query(struct netif * Line 780  struct pbuf *etharp_query(struct netif *
780    p = pbuf_alloc(PBUF_LINK, sizeof(struct etharp_hdr), PBUF_RAM);    p = pbuf_alloc(PBUF_LINK, sizeof(struct etharp_hdr), PBUF_RAM);
781    /* could allocate pbuf? */    /* could allocate pbuf? */
782    if (p != NULL) {    if (p != NULL) {
783        u8_t j;
784      DEBUGF(ETHARP_DEBUG, ("etharp_query: sending ARP request.\n"));      DEBUGF(ETHARP_DEBUG, ("etharp_query: sending ARP request.\n"));
785      hdr = p->payload;      hdr = p->payload;
786      hdr->opcode = htons(ARP_REQUEST);      hdr->opcode = htons(ARP_REQUEST);
787      for(i = 0; i < 6; ++i)      for(j = 0; j < 6; ++j)
788      {      {
789        hdr->dhwaddr.addr[i] = 0x00;        hdr->dhwaddr.addr[j] = 0x00;
790        hdr->shwaddr.addr[i] = srcaddr->addr[i];        hdr->shwaddr.addr[j] = srcaddr->addr[j];
791      }      }
792      ip_addr_set(&(hdr->dipaddr), ipaddr);      ip_addr_set(&(hdr->dipaddr), ipaddr);
793      ip_addr_set(&(hdr->sipaddr), &(netif->ip_addr));      ip_addr_set(&(hdr->sipaddr), &(netif->ip_addr));
# Line 792  struct pbuf *etharp_query(struct netif * Line 797  struct pbuf *etharp_query(struct netif *
797    
798      hdr->proto = htons(ETHTYPE_IP);      hdr->proto = htons(ETHTYPE_IP);
799      ARPH_PROTOLEN_SET(hdr, sizeof(struct ip_addr));      ARPH_PROTOLEN_SET(hdr, sizeof(struct ip_addr));
800      for(i = 0; i < 6; ++i)      for(j = 0; j < 6; ++j)
801      {      {
802        hdr->ethhdr.dest.addr[i] = 0xff;        hdr->ethhdr.dest.addr[j] = 0xff;
803        hdr->ethhdr.src.addr[i] = srcaddr->addr[i];        hdr->ethhdr.src.addr[j] = srcaddr->addr[j];
804      }      }
805      hdr->ethhdr.type = htons(ETHTYPE_ARP);            hdr->ethhdr.type = htons(ETHTYPE_ARP);      
806      /* send ARP query */      /* send ARP query */

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26