aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/Webserver/Lib/uip/uip_arp.c
diff options
context:
space:
mode:
Diffstat (limited to 'Projects/Webserver/Lib/uip/uip_arp.c')
-rw-r--r--Projects/Webserver/Lib/uip/uip_arp.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/Projects/Webserver/Lib/uip/uip_arp.c b/Projects/Webserver/Lib/uip/uip_arp.c
index b7e3b7342..fcb783b14 100644
--- a/Projects/Webserver/Lib/uip/uip_arp.c
+++ b/Projects/Webserver/Lib/uip/uip_arp.c
@@ -16,7 +16,7 @@
*
* \note This ARP implementation only supports Ethernet.
*/
-
+
/**
* \file
* Implementation of the ARP Address Resolution Protocol.
@@ -150,7 +150,7 @@ void
uip_arp_timer(void)
{
struct arp_entry *tabptr = NULL;
-
+
++arptime;
for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
tabptr = &arp_table[i];
@@ -178,7 +178,7 @@ uip_arp_update(uip_ipaddr_t *ipaddr, struct uip_eth_addr *ethaddr)
/* Check if the source IP address of the incoming packet matches
the IP address in this ARP table entry. */
if(uip_ipaddr_cmp(ipaddr, &tabptr->ipaddr)) {
-
+
/* An old entry found, update this and return. */
memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6);
tabptr->time = arptime;
@@ -240,7 +240,7 @@ void
uip_arp_ipin(void)
{
uip_len -= sizeof(struct uip_eth_hdr);
-
+
/* Only insert/update an entry if the source IP address of the
incoming IP packet comes from a host on the local network. */
if((IPBUF->srcipaddr[0] & uip_netmask[0]) !=
@@ -252,7 +252,7 @@ uip_arp_ipin(void)
return;
}
uip_arp_update(IPBUF->srcipaddr, &(IPBUF->ethhdr.src));
-
+
return;
}
#endif /* 0 */
@@ -287,7 +287,7 @@ uip_arp_arpin(void)
return;
}
uip_len = 0;
-
+
switch(BUF->opcode) {
case HTONS(ARP_REQUEST):
/* ARP request. If it asked for our address, we send out a
@@ -304,14 +304,14 @@ uip_arp_arpin(void)
table, since it is likely that we will do more communication
with this host in the future. */
uip_arp_update(&BUF->sipaddr, &BUF->shwaddr);
-
+
BUF->opcode = HTONS(ARP_REPLY);
memcpy(BUF->dhwaddr.addr, BUF->shwaddr.addr, 6);
memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
memcpy(BUF->ethhdr.dest.addr, BUF->dhwaddr.addr, 6);
-
+
uip_ipaddr_copy(&BUF->dipaddr, &BUF->sipaddr);
uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr);
@@ -362,7 +362,7 @@ void
uip_arp_out(void)
{
struct arp_entry *tabptr = NULL;
-
+
/* Find the destination IP address in the ARP table and construct
the Ethernet header. If the destination IP address isn't on the
local network, we use the default router's IP address instead.
@@ -384,7 +384,7 @@ uip_arp_out(void)
/* Else, we use the destination IP address. */
uip_ipaddr_copy(&ipaddr, &IPBUF->destipaddr);
}
-
+
for(i = 0; i < UIP_ARPTAB_SIZE; ++i) {
tabptr = &arp_table[i];
if(uip_ipaddr_cmp(&ipaddr, &tabptr->ipaddr)) {
@@ -400,7 +400,7 @@ uip_arp_out(void)
memset(BUF->dhwaddr.addr, 0x00, 6);
memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
memcpy(BUF->shwaddr.addr, uip_ethaddr.addr, 6);
-
+
uip_ipaddr_copy(&BUF->dipaddr, &ipaddr);
uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr);
BUF->opcode = HTONS(ARP_REQUEST); /* ARP request. */
@@ -411,7 +411,7 @@ uip_arp_out(void)
BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);
uip_appdata = &uip_buf[UIP_TCPIP_HLEN + UIP_LLH_LEN];
-
+
uip_len = sizeof(struct arp_hdr);
return;
}
@@ -420,7 +420,7 @@ uip_arp_out(void)
memcpy(IPBUF->ethhdr.dest.addr, tabptr->ethaddr.addr, 6);
}
memcpy(IPBUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
-
+
IPBUF->ethhdr.type = HTONS(UIP_ETHTYPE_IP);
uip_len += sizeof(struct uip_eth_hdr);
@@ -429,3 +429,4 @@ uip_arp_out(void)
/** @} */
/** @} */
+