]> git.sur5r.net Git - freertos/blobdiff - Demo/Common/ethernet/FreeRTOS-uIP/uip_arp.c
Add faster version code.
[freertos] / Demo / Common / ethernet / FreeRTOS-uIP / uip_arp.c
index 44c7975fceb65dc369147cd45ed23cd341c5ca0e..d105226618bd3e4477ea5aff6a6715dcae0eddb6 100644 (file)
  * $Id: uip_arp.c,v 1.8 2006/06/02 23:36:21 adam Exp $\r
  *\r
  */\r
-\r
-\r
 #include "uip_arp.h"\r
 \r
 #include <string.h>\r
 \r
 #ifdef __ICCARM__\r
-       #pragma pack(1)\r
+       #pragma pack( 1 )\r
 #endif\r
-\r
-struct arp_hdr {\r
-  struct uip_eth_hdr ethhdr;\r
-  u16_t hwtype;\r
-  u16_t protocol;\r
-  u8_t hwlen;\r
-  u8_t protolen;\r
-  u16_t opcode;\r
-  struct uip_eth_addr shwaddr;\r
-  u16_t sipaddr[2];\r
-  struct uip_eth_addr dhwaddr;\r
-  u16_t dipaddr[2];\r
+struct arp_hdr\r
+{\r
+       struct uip_eth_hdr      ethhdr;\r
+       u16_t                           hwtype;\r
+       u16_t                           protocol;\r
+       u8_t                            hwlen;\r
+       u8_t                            protolen;\r
+       u16_t                           opcode;\r
+       struct uip_eth_addr shwaddr;\r
+       u16_t                           sipaddr[2];\r
+       struct uip_eth_addr dhwaddr;\r
+       u16_t                           dipaddr[2];\r
 } PACK_STRUCT_END;\r
 \r
 #ifdef __ICCARM__\r
        #pragma pack()\r
 #endif\r
-\r
 #ifdef __ICCARM__\r
-       #pragma pack(1)\r
+       #pragma pack( 1 )\r
 #endif\r
+struct ethip_hdr\r
+{\r
+       struct uip_eth_hdr      ethhdr;\r
 \r
-struct ethip_hdr {\r
-  struct uip_eth_hdr ethhdr;\r
-  /* IP header. */\r
-  u8_t vhl,\r
-    tos,\r
-    len[2],\r
-    ipid[2],\r
-    ipoffset[2],\r
-    ttl,\r
-    proto;\r
-  u16_t ipchksum;\r
-  u16_t srcipaddr[2],\r
-    destipaddr[2];\r
+       /* IP header. */\r
+       u8_t                            vhl, tos, len[2], ipid[2], ipoffset[2], ttl, proto;\r
+       u16_t                           ipchksum;\r
+       u16_t                           srcipaddr[2], destipaddr[2];\r
 } PACK_STRUCT_END;\r
 \r
 #ifdef __ICCARM__\r
        #pragma pack()\r
 #endif\r
+#define ARP_REQUEST            1\r
+#define ARP_REPLY              2\r
 \r
-#define ARP_REQUEST 1\r
-#define ARP_REPLY   2\r
-\r
-#define ARP_HWTYPE_ETH 1\r
+#define ARP_HWTYPE_ETH 1\r
 \r
-struct arp_entry {\r
-  u16_t ipaddr[2];\r
-  struct uip_eth_addr ethaddr;\r
-  u8_t time;\r
+struct arp_entry\r
+{\r
+       u16_t                           ipaddr[2];\r
+       struct uip_eth_addr ethaddr;\r
+       u8_t                            time;\r
 };\r
 \r
-static const struct uip_eth_addr broadcast_ethaddr =\r
-  {{0xff,0xff,0xff,0xff,0xff,0xff}};\r
-static const u16_t broadcast_ipaddr[2] = {0xffff,0xffff};\r
+static const struct uip_eth_addr       broadcast_ethaddr = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };\r
+static const u16_t                                     broadcast_ipaddr[2] = { 0xffff, 0xffff };\r
+\r
+static struct arp_entry                                arp_table[UIP_ARPTAB_SIZE];\r
+static u16_t                                           ipaddr[2];\r
+static u8_t                                                    i, c;\r
 \r
-static struct arp_entry arp_table[UIP_ARPTAB_SIZE];\r
-static u16_t ipaddr[2];\r
-static u8_t i, c;\r
+static u8_t                                                    arptime;\r
+static u8_t                                                    tmpage;\r
 \r
-static u8_t arptime;\r
-static u8_t tmpage;\r
+#define BUF            ( ( struct arp_hdr * ) &uip_buf[0] )\r
+#define IPBUF  ( ( struct ethip_hdr * ) &uip_buf[0] )\r
 \r
-#define BUF   ((struct arp_hdr *)&uip_buf[0])\r
-#define IPBUF ((struct ethip_hdr *)&uip_buf[0])\r
 /*-----------------------------------------------------------------------------------*/\r
+\r
 /**\r
  * Initialize the ARP module.\r
  *\r
  */\r
+\r
 /*-----------------------------------------------------------------------------------*/\r
-void\r
-uip_arp_init(void)\r
+void uip_arp_init( void )\r
 {\r
-  for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {\r
-    memset(arp_table[i].ipaddr, 0, 4);\r
-  }\r
+       for( i = 0; i < UIP_ARPTAB_SIZE; ++i )\r
+       {\r
+               memset( arp_table[i].ipaddr, 0, 4 );\r
+       }\r
 }\r
+\r
 /*-----------------------------------------------------------------------------------*/\r
+\r
 /**\r
  * Periodic ARP processing function.\r
  *\r
@@ -153,86 +148,93 @@ uip_arp_init(void)
  * is 10 seconds between the calls.\r
  *\r
  */\r
+\r
 /*-----------------------------------------------------------------------------------*/\r
-void\r
-uip_arp_timer(void)\r
+void uip_arp_timer( void )\r
 {\r
-  struct arp_entry *tabptr;\r
-\r
-  ++arptime;\r
-  for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {\r
-    tabptr = &arp_table[i];\r
-    if((tabptr->ipaddr[0] | tabptr->ipaddr[1]) != 0 &&\r
-       arptime - tabptr->time >= UIP_ARP_MAXAGE) {\r
-      memset(tabptr->ipaddr, 0, 4);\r
-    }\r
-  }\r
-\r
+       struct arp_entry        *tabptr;\r
+\r
+       ++arptime;\r
+       for( i = 0; i < UIP_ARPTAB_SIZE; ++i )\r
+       {\r
+               tabptr = &arp_table[i];\r
+               if( (tabptr->ipaddr[0] | tabptr->ipaddr[1]) != 0 && arptime - tabptr->time >= UIP_ARP_MAXAGE )\r
+               {\r
+                       memset( tabptr->ipaddr, 0, 4 );\r
+               }\r
+       }\r
 }\r
+\r
 /*-----------------------------------------------------------------------------------*/\r
-static void\r
-uip_arp_update(u16_t *ipaddr, struct uip_eth_addr *ethaddr)\r
+static void uip_arp_update( u16_t *ipaddr, struct uip_eth_addr *ethaddr )\r
 {\r
-  register struct arp_entry *tabptr;\r
-  /* Walk through the ARP mapping table and try to find an entry to\r
+       register struct arp_entry       *tabptr;\r
+\r
+       /* Walk through the ARP mapping table and try to find an entry to\r
      update. If none is found, the IP -> MAC address mapping is\r
      inserted in the ARP table. */\r
-  for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {\r
-\r
-    tabptr = &arp_table[i];\r
-    /* Only check those entries that are actually in use. */\r
-    if(tabptr->ipaddr[0] != 0 &&\r
-       tabptr->ipaddr[1] != 0) {\r
-\r
-      /* Check if the source IP address of the incoming packet matches\r
+       for( i = 0; i < UIP_ARPTAB_SIZE; ++i )\r
+       {\r
+               tabptr = &arp_table[i];\r
+\r
+               /* Only check those entries that are actually in use. */\r
+               if( tabptr->ipaddr[0] != 0 && tabptr->ipaddr[1] != 0 )\r
+               {\r
+                       /* Check if the source IP address of the incoming packet matches\r
          the IP address in this ARP table entry. */\r
-      if(ipaddr[0] == tabptr->ipaddr[0] &&\r
-        ipaddr[1] == tabptr->ipaddr[1]) {\r
-       \r
-       /* An old entry found, update this and return. */\r
-       memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6);\r
-       tabptr->time = arptime;\r
-\r
-       return;\r
-      }\r
-    }\r
-  }\r
-\r
-  /* If we get here, no existing ARP table entry was found, so we\r
+                       if( ipaddr[0] == tabptr->ipaddr[0] && ipaddr[1] == tabptr->ipaddr[1] )\r
+                       {\r
+                               /* An old entry found, update this and return. */\r
+                               memcpy( tabptr->ethaddr.addr, ethaddr->addr, 6 );\r
+                               tabptr->time = arptime;\r
+\r
+                               return;\r
+                       }\r
+               }\r
+       }\r
+\r
+       /* If we get here, no existing ARP table entry was found, so we\r
      create one. */\r
 \r
-  /* First, we try to find an unused entry in the ARP table. */\r
-  for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {\r
-    tabptr = &arp_table[i];\r
-    if(tabptr->ipaddr[0] == 0 &&\r
-       tabptr->ipaddr[1] == 0) {\r
-      break;\r
-    }\r
-  }\r
-\r
-  /* If no unused entry is found, we try to find the oldest entry and\r
+       /* First, we try to find an unused entry in the ARP table. */\r
+       for( i = 0; i < UIP_ARPTAB_SIZE; ++i )\r
+       {\r
+               tabptr = &arp_table[i];\r
+               if( tabptr->ipaddr[0] == 0 && tabptr->ipaddr[1] == 0 )\r
+               {\r
+                       break;\r
+               }\r
+       }\r
+\r
+       /* If no unused entry is found, we try to find the oldest entry and\r
      throw it away. */\r
-  if(i == UIP_ARPTAB_SIZE) {\r
-    tmpage = 0;\r
-    c = 0;\r
-    for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {\r
-      tabptr = &arp_table[i];\r
-      if(arptime - tabptr->time > tmpage) {\r
-       tmpage = arptime - tabptr->time;\r
-       c = i;\r
-      }\r
-    }\r
-    i = c;\r
-    tabptr = &arp_table[i];\r
-  }\r
-\r
-  /* Now, i is the ARP table entry which we will fill with the new\r
+       if( i == UIP_ARPTAB_SIZE )\r
+       {\r
+               tmpage = 0;\r
+               c = 0;\r
+               for( i = 0; i < UIP_ARPTAB_SIZE; ++i )\r
+               {\r
+                       tabptr = &arp_table[i];\r
+                       if( arptime - tabptr->time > tmpage )\r
+                       {\r
+                               tmpage = arptime - tabptr->time;\r
+                               c = i;\r
+                       }\r
+               }\r
+\r
+               i = c;\r
+               tabptr = &arp_table[i];\r
+       }\r
+\r
+       /* Now, i is the ARP table entry which we will fill with the new\r
      information. */\r
-  memcpy(tabptr->ipaddr, ipaddr, 4);\r
-  memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6);\r
-  tabptr->time = arptime;\r
+       memcpy( tabptr->ipaddr, ipaddr, 4 );\r
+       memcpy( tabptr->ethaddr.addr, ethaddr->addr, 6 );\r
+       tabptr->time = arptime;\r
 }\r
+\r
 /*-----------------------------------------------------------------------------------*/\r
+\r
 /**\r
  * ARP processing for incoming IP packets\r
  *\r
@@ -245,29 +247,34 @@ uip_arp_update(u16_t *ipaddr, struct uip_eth_addr *ethaddr)
  * in the uip_buf[] buffer, and the length of the packet in the global\r
  * variable uip_len.\r
  */\r
+\r
 /*-----------------------------------------------------------------------------------*/\r
 #if 1\r
-void\r
-uip_arp_ipin(void)\r
+void uip_arp_ipin( void )\r
 {\r
-  uip_len -= sizeof(struct uip_eth_hdr);\r
-       \r
-  /* Only insert/update an entry if the source IP address of the\r
+       uip_len -= sizeof( struct uip_eth_hdr );\r
+\r
+       /* Only insert/update an entry if the source IP address of the\r
      incoming IP packet comes from a host on the local network. */\r
-  if((IPBUF->srcipaddr[0] & uip_netmask[0]) !=\r
-     (uip_hostaddr[0] & uip_netmask[0])) {\r
-    return;\r
-  }\r
-  if((IPBUF->srcipaddr[1] & uip_netmask[1]) !=\r
-     (uip_hostaddr[1] & uip_netmask[1])) {\r
-    return;\r
-  }\r
-  uip_arp_update(IPBUF->srcipaddr, &(IPBUF->ethhdr.src));\r
-\r
-  return;\r
+       if( (IPBUF->srcipaddr[0] & uip_netmask[0]) != (uip_hostaddr[0] & uip_netmask[0]) )\r
+       {\r
+               return;\r
+       }\r
+\r
+       if( (IPBUF->srcipaddr[1] & uip_netmask[1]) != (uip_hostaddr[1] & uip_netmask[1]) )\r
+       {\r
+               return;\r
+       }\r
+\r
+       uip_arp_update( IPBUF->srcipaddr, &(IPBUF->ethhdr.src) );\r
+\r
+       return;\r
 }\r
+\r
 #endif /* 0 */\r
+\r
 /*-----------------------------------------------------------------------------------*/\r
+\r
 /**\r
  * ARP processing for incoming ARP packets.\r
  *\r
@@ -289,56 +296,65 @@ uip_arp_ipin(void)
  * header in the uip_buf[] buffer, and the length of the packet in the\r
  * global variable uip_len.\r
  */\r
+\r
 /*-----------------------------------------------------------------------------------*/\r
-void\r
-uip_arp_arpin(void)\r
+void uip_arp_arpin( void )\r
 {\r
-\r
-  if(uip_len < sizeof(struct arp_hdr)) {\r
-    uip_len = 0;\r
-    return;\r
-  }\r
-  uip_len = 0;\r
-\r
-  switch(BUF->opcode) {\r
-  case HTONS(ARP_REQUEST):\r
-    /* ARP request. If it asked for our address, we send out a\r
+       if( uip_len < sizeof(struct arp_hdr) )\r
+       {\r
+               uip_len = 0;\r
+               return;\r
+       }\r
+\r
+       uip_len = 0;\r
+\r
+       switch( BUF->opcode )\r
+       {\r
+               case HTONS( ARP_REQUEST ):\r
+                       /* ARP request. If it asked for our address, we send out a\r
        reply. */\r
-    if(uip_ipaddr_cmp(BUF->dipaddr, uip_hostaddr)) {\r
-      /* First, we register the one who made the request in our ARP\r
+                       if( uip_ipaddr_cmp(BUF->dipaddr, uip_hostaddr) )\r
+                       {\r
+                               /* First, we register the one who made the request in our ARP\r
         table, since it is likely that we will do more communication\r
         with this host in the future. */\r
-      uip_arp_update(BUF->sipaddr, &BUF->shwaddr);\r
-\r
-      /* The reply opcode is 2. */\r
-      BUF->opcode = HTONS(2);\r
-\r
-      memcpy(BUF->dhwaddr.addr, BUF->shwaddr.addr, 6);\r
-      memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);\r
-      memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);\r
-      memcpy(BUF->ethhdr.dest.addr, BUF->dhwaddr.addr, 6);\r
-\r
-      BUF->dipaddr[0] = BUF->sipaddr[0];\r
-      BUF->dipaddr[1] = BUF->sipaddr[1];\r
-      BUF->sipaddr[0] = uip_hostaddr[0];\r
-      BUF->sipaddr[1] = uip_hostaddr[1];\r
-\r
-      BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);\r
-      uip_len = sizeof(struct arp_hdr);\r
-    }\r
-    break;\r
-  case HTONS(ARP_REPLY):\r
-    /* ARP reply. We insert or update the ARP table if it was meant\r
+                               uip_arp_update( BUF->sipaddr, &BUF->shwaddr );\r
+\r
+                               /* The reply opcode is 2. */\r
+                               BUF->opcode = HTONS( 2 );\r
+\r
+                               memcpy( BUF->dhwaddr.addr, BUF->shwaddr.addr, 6 );\r
+                               memcpy( BUF->shwaddr.addr, uip_ethaddr.addr, 6 );\r
+                               memcpy( BUF->ethhdr.src.addr, uip_ethaddr.addr, 6 );\r
+                               memcpy( BUF->ethhdr.dest.addr, BUF->dhwaddr.addr, 6 );\r
+\r
+                               BUF->dipaddr[0] = BUF->sipaddr[0];\r
+                               BUF->dipaddr[1] = BUF->sipaddr[1];\r
+                               BUF->sipaddr[0] = uip_hostaddr[0];\r
+                               BUF->sipaddr[1] = uip_hostaddr[1];\r
+\r
+                               BUF->ethhdr.type = HTONS( UIP_ETHTYPE_ARP );\r
+                               uip_len = sizeof( struct arp_hdr );\r
+                       }\r
+\r
+                       break;\r
+\r
+               case HTONS( ARP_REPLY ):\r
+                       /* ARP reply. We insert or update the ARP table if it was meant\r
        for us. */\r
-    if(uip_ipaddr_cmp(BUF->dipaddr, uip_hostaddr)) {\r
-      uip_arp_update(BUF->sipaddr, &BUF->shwaddr);\r
-    }\r
-    break;\r
-  }\r
+                       if( uip_ipaddr_cmp(BUF->dipaddr, uip_hostaddr) )\r
+                       {\r
+                               uip_arp_update( BUF->sipaddr, &BUF->shwaddr );\r
+                       }\r
+\r
+                       break;\r
+       }\r
 \r
-  return;\r
+       return;\r
 }\r
+\r
 /*-----------------------------------------------------------------------------------*/\r
+\r
 /**\r
  * Prepend Ethernet header to an outbound IP packet and see if we need\r
  * to send out an ARP request.\r
@@ -365,75 +381,86 @@ uip_arp_arpin(void)
  * buffer, and the length of the packet is in the global variable\r
  * uip_len.\r
  */\r
+\r
 /*-----------------------------------------------------------------------------------*/\r
-void\r
-uip_arp_out(void)\r
+void uip_arp_out( void )\r
 {\r
-  struct arp_entry *tabptr;\r
+       struct arp_entry        *tabptr;\r
 \r
-  /* Find the destination IP address in the ARP table and construct\r
+       /* Find the destination IP address in the ARP table and construct\r
      the Ethernet header. If the destination IP addres isn't on the\r
      local network, we use the default router's IP address instead.\r
 \r
      If not ARP table entry is found, we overwrite the original IP\r
      packet with an ARP request for the IP address. */\r
 \r
-  /* First check if destination is a local broadcast. */\r
-  if(uip_ipaddr_cmp(IPBUF->destipaddr, broadcast_ipaddr)) {\r
-    memcpy(IPBUF->ethhdr.dest.addr, broadcast_ethaddr.addr, 6);\r
-  } else {\r
-    /* Check if the destination address is on the local network. */\r
-    if(!uip_ipaddr_maskcmp(IPBUF->destipaddr, uip_hostaddr, uip_netmask)) {\r
-      /* Destination address was not on the local network, so we need to\r
+       /* First check if destination is a local broadcast. */\r
+       if( uip_ipaddr_cmp(IPBUF->destipaddr, broadcast_ipaddr) )\r
+       {\r
+               memcpy( IPBUF->ethhdr.dest.addr, broadcast_ethaddr.addr, 6 );\r
+       }\r
+       else\r
+       {\r
+               /* Check if the destination address is on the local network. */\r
+               if( !uip_ipaddr_maskcmp(IPBUF->destipaddr, uip_hostaddr, uip_netmask) )\r
+               {\r
+                       /* Destination address was not on the local network, so we need to\r
         use the default router's IP address instead of the destination\r
         address when determining the MAC address. */\r
-      uip_ipaddr_copy(ipaddr, uip_draddr);\r
-    } else {\r
-      /* Else, we use the destination IP address. */\r
-      uip_ipaddr_copy(ipaddr, IPBUF->destipaddr);\r
-    }\r
-\r
-    for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {\r
-      tabptr = &arp_table[i];\r
-      if(uip_ipaddr_cmp(ipaddr, tabptr->ipaddr)) {\r
-       break;\r
-      }\r
-    }\r
-\r
-    if(i == UIP_ARPTAB_SIZE) {\r
-      /* The destination address was not in our ARP table, so we\r
+                       uip_ipaddr_copy( ipaddr, uip_draddr );\r
+               }\r
+               else\r
+               {\r
+                       /* Else, we use the destination IP address. */\r
+                       uip_ipaddr_copy( ipaddr, IPBUF->destipaddr );\r
+               }\r
+\r
+               for( i = 0; i < UIP_ARPTAB_SIZE; ++i )\r
+               {\r
+                       tabptr = &arp_table[i];\r
+                       if( uip_ipaddr_cmp(ipaddr, tabptr->ipaddr) )\r
+                       {\r
+                               break;\r
+                       }\r
+               }\r
+\r
+               if( i == UIP_ARPTAB_SIZE )\r
+               {\r
+                       /* The destination address was not in our ARP table, so we\r
         overwrite the IP packet with an ARP request. */\r
+                       memset( BUF->ethhdr.dest.addr, 0xff, 6 );\r
+                       memset( BUF->dhwaddr.addr, 0x00, 6 );\r
+                       memcpy( BUF->ethhdr.src.addr, uip_ethaddr.addr, 6 );\r
+                       memcpy( BUF->shwaddr.addr, uip_ethaddr.addr, 6 );\r
 \r
-      memset(BUF->ethhdr.dest.addr, 0xff, 6);\r
-      memset(BUF->dhwaddr.addr, 0x00, 6);\r
-      memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);\r
-      memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);\r
+                       uip_ipaddr_copy( BUF->dipaddr, ipaddr );\r
+                       uip_ipaddr_copy( BUF->sipaddr, uip_hostaddr );\r
+                       BUF->opcode = HTONS( ARP_REQUEST ); /* ARP request. */\r
+                       BUF->hwtype = HTONS( ARP_HWTYPE_ETH );\r
+                       BUF->protocol = HTONS( UIP_ETHTYPE_IP );\r
+                       BUF->hwlen = 6;\r
+                       BUF->protolen = 4;\r
+                       BUF->ethhdr.type = HTONS( UIP_ETHTYPE_ARP );\r
 \r
-      uip_ipaddr_copy(BUF->dipaddr, ipaddr);\r
-      uip_ipaddr_copy(BUF->sipaddr, uip_hostaddr);\r
-      BUF->opcode = HTONS(ARP_REQUEST); /* ARP request. */\r
-      BUF->hwtype = HTONS(ARP_HWTYPE_ETH);\r
-      BUF->protocol = HTONS(UIP_ETHTYPE_IP);\r
-      BUF->hwlen = 6;\r
-      BUF->protolen = 4;\r
-      BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);\r
+                       uip_appdata = &uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN];\r
 \r
-      uip_appdata = &uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN];\r
+                       uip_len = sizeof( struct arp_hdr );\r
+                       return;\r
+               }\r
 \r
-      uip_len = sizeof(struct arp_hdr);\r
-      return;\r
-    }\r
+               /* Build an ethernet header. */\r
+               memcpy( IPBUF->ethhdr.dest.addr, tabptr->ethaddr.addr, 6 );\r
+       }\r
 \r
-    /* Build an ethernet header. */\r
-    memcpy(IPBUF->ethhdr.dest.addr, tabptr->ethaddr.addr, 6);\r
-  }\r
-  memcpy(IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6);\r
+       memcpy( IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6 );\r
 \r
-  IPBUF->ethhdr.type = HTONS(UIP_ETHTYPE_IP);\r
+       IPBUF->ethhdr.type = HTONS( UIP_ETHTYPE_IP );\r
 \r
-  uip_len += sizeof(struct uip_eth_hdr);\r
+       uip_len += sizeof( struct uip_eth_hdr );\r
 }\r
+\r
 /*-----------------------------------------------------------------------------------*/\r
 \r
 /** @} */\r
+\r
 /** @} */\r