Documentation changes. Added missing trailing newlines to debug messages.

This commit is contained in:
likewise
2003-03-31 10:32:35 +00:00
parent 8636ac26cf
commit 6c147709b6
8 changed files with 202 additions and 186 deletions

View File

@@ -238,12 +238,12 @@ update_arp_entry(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr *e
struct pbuf *p;
struct eth_hdr *ethhdr;
#endif
DEBUGF(ETHARP_DEBUG, ("update_arp_entry()"));
DEBUGF(ETHARP_DEBUG, ("update_arp_entry: %u.%u.%u.%u - %02x:%02x:%02x:%02x:%02x:%02x\n", ip4_addr1(ipaddr), ip4_addr2(ipaddr), ip4_addr3(ipaddr), ip4_addr4(ipaddr),
DEBUGF(ETHARP_DEBUG | DBG_TRACE | 3, ("update_arp_entry()\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: %u.%u.%u.%u - %02x:%02x:%02x:%02x:%02x:%02x\n", ip4_addr1(ipaddr), ip4_addr2(ipaddr), ip4_addr3(ipaddr), ip4_addr4(ipaddr),
ethaddr->addr[0], ethaddr->addr[1], ethaddr->addr[2], ethaddr->addr[3], ethaddr->addr[4], ethaddr->addr[5]));
/* do not update for 0.0.0.0 addresses */
if (ipaddr->addr == 0) {
DEBUGF(ETHARP_DEBUG, ("update_arp_entry: will not add 0.0.0.0 to ARP cache\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: will not add 0.0.0.0 to ARP cache\n"));
return NULL;
}
/* Walk through the ARP mapping table and try to find an entry to
@@ -255,16 +255,16 @@ update_arp_entry(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr *e
if(ip_addr_cmp(ipaddr, &arp_table[i].ipaddr)) {
/* pending entry? */
if(arp_table[i].state == ETHARP_STATE_PENDING) {
DEBUGF(ETHARP_DEBUG, ("update_arp_entry: pending entry %u goes stable\n", i));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: pending entry %u goes stable\n", i));
/* A pending entry was found, mark it stable */
arp_table[i].state = ETHARP_STATE_STABLE;
/* fall-through to next if */
}
/* stable entry? (possible just marked to become stable) */
if(arp_table[i].state == ETHARP_STATE_STABLE) {
DEBUGF(ETHARP_DEBUG, ("update_arp_entry: updating stable entry %u\n", i));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: updating stable entry %u\n", i));
/* An old entry found, update this and return. */
for(k = 0; k < 6; ++k) {
for(k = 0; k < netif->hwaddr_len; ++k) {
arp_table[i].ethaddr.addr[k] = ethaddr->addr[k];
}
/* reset time stamp */
@@ -276,11 +276,11 @@ update_arp_entry(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr *e
arp_table[i].p = NULL;
/* fill-in Ethernet header */
ethhdr = p->payload;
for(k = 0; k < 6; ++k) {
for(k = 0; k < netif->hwaddr_len; ++k) {
ethhdr->dest.addr[k] = ethaddr->addr[k];
}
ethhdr->type = htons(ETHTYPE_IP);
DEBUGF(ETHARP_DEBUG, ("update_arp_entry: sending queued IP packet.\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: sending queued IP packet.\n"));
/* send the queued IP packet */
netif->linkoutput(netif, p);
/* free the queued IP packet */
@@ -295,32 +295,32 @@ update_arp_entry(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr *e
/* no matching ARP entry was found */
LWIP_ASSERT("update_arp_entry: i == ARP_TABLE_SIZE", i == ARP_TABLE_SIZE);
DEBUGF(ETHARP_DEBUG, ("update_arp_entry: IP address not yet in table\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: IP address not yet in table\n"));
/* allowed to insert an entry? */
if ((ETHARP_ALWAYS_INSERT) || (flags & ARP_INSERT_FLAG))
{
DEBUGF(ETHARP_DEBUG, ("update_arp_entry: adding entry to table\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: adding entry to table\n"));
/* find an empty or old entry. */
i = find_arp_entry();
if(i == ARP_TABLE_SIZE) {
DEBUGF(ETHARP_DEBUG, ("update_arp_entry: no available entry found\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: no available entry found\n"));
return NULL;
}
/* see if find_arp_entry() gave us an old stable, or empty entry to re-use */
if (arp_table[i].state == ETHARP_STATE_STABLE) {
DEBUGF(ETHARP_DEBUG, ("update_arp_entry: overwriting old stable entry %u\n", i));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: overwriting old stable entry %u\n", i));
/* stable entries should have no queued packets (TODO: allow later) */
#if ARP_QUEUEING
LWIP_ASSERT("update_arp_entry: arp_table[i].p == NULL", arp_table[i].p == NULL);
#endif
} else {
DEBUGF(ETHARP_DEBUG, ("update_arp_entry: filling empty entry %u with state %u\n", i, arp_table[i].state));
DEBUGF(ETHARP_DEBUG | DBG_TRACE | DBG_STATE, ("update_arp_entry: filling empty entry %u with state %u\n", i, arp_table[i].state));
LWIP_ASSERT("update_arp_entry: arp_table[i].state == ETHARP_STATE_EMPTY", arp_table[i].state == ETHARP_STATE_EMPTY);
}
/* set IP address */
ip_addr_set(&arp_table[i].ipaddr, ipaddr);
/* set Ethernet hardware address */
for(k = 0; k < 6; ++k) {
for(k = 0; k < netif->hwaddr_len; ++k) {
arp_table[i].ethaddr.addr[k] = ethaddr->addr[k];
}
/* reset time-stamp */
@@ -334,7 +334,7 @@ update_arp_entry(struct netif *netif, struct ip_addr *ipaddr, struct eth_addr *e
}
else
{
DEBUGF(ETHARP_DEBUG, ("update_arp_entry: no matching stable entry to update\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("update_arp_entry: no matching stable entry to update\n"));
}
return NULL;
}
@@ -368,7 +368,7 @@ etharp_ip_input(struct netif *netif, struct pbuf *p)
return NULL;
}
DEBUGF(ETHARP_DEBUG, ("etharp_ip_input: updating ETHARP table.\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_ip_input: updating ETHARP table.\n"));
/* update ARP table, ask to insert entry */
update_arp_entry(netif, &(hdr->ip.src), &(hdr->eth.src), ARP_INSERT_FLAG);
return NULL;
@@ -397,7 +397,7 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
/* drop short ARP packets */
if(p->tot_len < sizeof(struct etharp_hdr)) {
DEBUGF(ETHARP_DEBUG, ("etharp_arp_input: packet too short (%d/%d)\n", p->tot_len, sizeof(struct etharp_hdr)));
DEBUGF(ETHARP_DEBUG | DBG_TRACE | 1, ("etharp_arp_input: packet too short (%d/%d)\n", p->tot_len, sizeof(struct etharp_hdr)));
pbuf_free(p);
return NULL;
}
@@ -411,10 +411,10 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
reply. In any case, we time-stamp any existing ARP entry,
and possiby send out an IP packet that was queued on it. */
DEBUGF(ETHARP_DEBUG, ("etharp_arp_input: incoming ARP request\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: incoming ARP request\n"));
/* we are not configured? */
if(netif->ip_addr.addr == 0) {
DEBUGF(ETHARP_DEBUG, ("etharp_arp_input: we are unconfigured, ARP request ignored.\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: we are unconfigured, ARP request ignored.\n"));
pbuf_free(p);
return NULL;
}
@@ -423,14 +423,14 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
/* ARP request for our address? */
if(ip_addr_cmp(&(hdr->dipaddr), &(netif->ip_addr))) {
DEBUGF(ETHARP_DEBUG, ("etharp_arp_input: replying to ARP request for our IP address\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: replying to ARP request for our IP address\n"));
/* re-use pbuf to send ARP reply */
hdr->opcode = htons(ARP_REPLY);
ip_addr_set(&(hdr->dipaddr), &(hdr->sipaddr));
ip_addr_set(&(hdr->sipaddr), &(netif->ip_addr));
for(i = 0; i < 6; ++i) {
for(i = 0; i < netif->hwaddr_len; ++i) {
hdr->dhwaddr.addr[i] = hdr->shwaddr.addr[i];
hdr->shwaddr.addr[i] = ethaddr->addr[i];
hdr->ethhdr.dest.addr[i] = hdr->dhwaddr.addr[i];
@@ -438,7 +438,7 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
}
hdr->hwtype = htons(HWTYPE_ETHERNET);
ARPH_HWLEN_SET(hdr, 6);
ARPH_HWLEN_SET(hdr, netif->hwaddr_len);
hdr->proto = htons(ETHTYPE_IP);
ARPH_PROTOLEN_SET(hdr, sizeof(struct ip_addr));
@@ -447,24 +447,24 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
/* return ARP reply */
netif->linkoutput(netif, p);
} else {
DEBUGF(ETHARP_DEBUG, ("etharp_arp_input: incoming ARP request was not for us.\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: incoming ARP request was not for us.\n"));
}
break;
case ARP_REPLY:
/* ARP reply. We insert or update the ARP table. */
DEBUGF(ETHARP_DEBUG, ("etharp_arp_input: incoming ARP reply\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: incoming ARP reply\n"));
#if (LWIP_DHCP && DHCP_DOES_ARP_CHECK)
/* DHCP needs to know about ARP replies */
dhcp_arp_reply(netif, &hdr->sipaddr);
#endif
/* ARP reply directed to us? */
if(ip_addr_cmp(&(hdr->dipaddr), &(netif->ip_addr))) {
DEBUGF(ETHARP_DEBUG, ("etharp_arp_input: incoming ARP reply is for us\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: incoming ARP reply is for us\n"));
/* update_the ARP cache, ask to insert */
update_arp_entry(netif, &(hdr->sipaddr), &(hdr->shwaddr), ARP_INSERT_FLAG);
/* ARP reply not directed to us */
} else {
DEBUGF(ETHARP_DEBUG, ("etharp_arp_input: incoming ARP reply is not for us\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: incoming ARP reply is not for us\n"));
/* update the destination address pair */
update_arp_entry(netif, &(hdr->sipaddr), &(hdr->shwaddr), 0);
/* update the destination address pair */
@@ -472,7 +472,7 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
}
break;
default:
DEBUGF(ETHARP_DEBUG, ("etharp_arp_input: ARP unknown opcode type %d\n", htons(hdr->opcode)));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_arp_input: ARP unknown opcode type %d\n", htons(hdr->opcode)));
break;
}
/* free ARP packet */
@@ -517,7 +517,7 @@ etharp_output(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
if(pbuf_header(q, sizeof(struct eth_hdr)) != 0) {
/* The pbuf_header() call shouldn't fail, and we'll just bail
out if it does.. */
DEBUGF(ETHARP_DEBUG, ("etharp_output: could not allocate room for header.\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE | 2, ("etharp_output: could not allocate room for header.\n"));
#ifdef LINK_STATS
++lwip_stats.link.lenerr;
#endif /* LINK_STATS */
@@ -600,7 +600,7 @@ etharp_output(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
Ethernet header for the outgoing packet. */
ethhdr = q->payload;
for(i = 0; i < 6; i++) {
for(i = 0; i < netif->hwaddr_len; i++) {
ethhdr->dest.addr[i] = dest->addr[i];
ethhdr->src.addr[i] = srcaddr->addr[i];
}
@@ -672,7 +672,7 @@ struct pbuf *etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pb
DEBUGF(ETHARP_DEBUG | 2, ("etharp_query: no more ARP entries available.\n"));
return NULL;
}
DEBUGF(ETHARP_DEBUG, ("etharp_query: created ARP table entry %u.\n", i));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_query: created ARP table entry %u.\n", i));
/* i is available, create ARP entry */
ip_addr_set(&arp_table[i].ipaddr, ipaddr);
arp_table[i].ctime = 0;
@@ -690,7 +690,7 @@ struct pbuf *etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pb
pbuf_ref_chain(q);
/* remember pbuf to queue, if any */
arp_table[i].p = q;
DEBUGF(ETHARP_DEBUG, ("etharp_query: queued packet %p on ARP entry %u.\n", (void *)q, i));
DEBUGF(ETHARP_DEBUG | DBG_TRACE | DBG_STATE, ("etharp_query: queued packet %p on ARP entry %u.\n", (void *)q, i));
}
#endif
/* allocate a pbuf for the outgoing ARP request packet */
@@ -698,10 +698,10 @@ struct pbuf *etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pb
/* could allocate pbuf? */
if (p != NULL) {
u8_t j;
DEBUGF(ETHARP_DEBUG, ("etharp_query: sending ARP request.\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE, ("etharp_query: sending ARP request.\n"));
hdr = p->payload;
hdr->opcode = htons(ARP_REQUEST);
for(j = 0; j < 6; ++j)
for(j = 0; j < netif->hwaddr_len; ++j)
{
hdr->dhwaddr.addr[j] = 0x00;
hdr->shwaddr.addr[j] = srcaddr->addr[j];
@@ -710,11 +710,11 @@ struct pbuf *etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pb
ip_addr_set(&(hdr->sipaddr), &(netif->ip_addr));
hdr->hwtype = htons(HWTYPE_ETHERNET);
ARPH_HWLEN_SET(hdr, 6);
ARPH_HWLEN_SET(hdr, netif->hwaddr_len);
hdr->proto = htons(ETHTYPE_IP);
ARPH_PROTOLEN_SET(hdr, sizeof(struct ip_addr));
for(j = 0; j < 6; ++j)
for(j = 0; j < netif->hwaddr_len; ++j)
{
hdr->ethhdr.dest.addr[j] = 0xff;
hdr->ethhdr.src.addr[j] = srcaddr->addr[j];
@@ -726,7 +726,7 @@ struct pbuf *etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pb
pbuf_free(p);
p = NULL;
} else {
DEBUGF(ETHARP_DEBUG, ("etharp_query: could not allocate pbuf for ARP request.\n"));
DEBUGF(ETHARP_DEBUG | DBG_TRACE | 2, ("etharp_query: could not allocate pbuf for ARP request.\n"));
}
return NULL;
}