mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-18 22:26:41 +08:00
etharp_query() has error return type now. Matched dhcp.c with this change.
Added debug messages in other places.
This commit is contained in:
@@ -154,19 +154,13 @@ static void dhcp_handle_nak(struct netif *netif) {
|
||||
static void dhcp_check(struct netif *netif)
|
||||
{
|
||||
struct dhcp *dhcp = netif->dhcp;
|
||||
struct pbuf *p;
|
||||
err_t result;
|
||||
u16_t msecs;
|
||||
DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_check()\n"));
|
||||
/* create an ARP query for the offered IP address, expecting that no host
|
||||
responds, as the IP address should not be in use. */
|
||||
p = etharp_query(netif, &dhcp->offered_ip_addr, NULL);
|
||||
if (p != NULL) {
|
||||
DEBUGF(DHCP_DEBUG | DBG_TRACE, ("dhcp_check(): sending ARP request len %u\n", p->tot_len));
|
||||
result = netif->linkoutput(netif, p);
|
||||
pbuf_free(p);
|
||||
p = NULL;
|
||||
} else {
|
||||
result = etharp_query(netif, &dhcp->offered_ip_addr, NULL);
|
||||
if (result != ERR_OK) {
|
||||
DEBUGF(DHCP_DEBUG | DBG_TRACE | 2, ("dhcp_check: could not perform ARP query\n"));
|
||||
}
|
||||
dhcp->tries++;
|
||||
|
||||
@@ -494,7 +494,7 @@ ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
|
||||
#ifdef IP_STATS
|
||||
lwip_stats.ip.xmit++;
|
||||
#endif /* IP_STATS */
|
||||
DEBUGF(IP_DEBUG, ("ip_output_if: %c%c ", netif->name[0], netif->name[1]));
|
||||
DEBUGF(IP_DEBUG, ("ip_output_if: %c%c%u\n", netif->name[0], netif->name[1], netif->num));
|
||||
#if IP_DEBUG
|
||||
ip_debug_print(p);
|
||||
#endif /* IP_DEBUG */
|
||||
|
||||
@@ -176,8 +176,8 @@ void
|
||||
netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
|
||||
{
|
||||
ip_addr_set(&(netif->ip_addr), ipaddr);
|
||||
DEBUGF(NETIF_DEBUG, ("netif: setting IP address of interface %c%c to %d.%d.%d.%d\n",
|
||||
netif->name[0], netif->name[1],
|
||||
DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE, ("netif: setting IP address of interface %c%c%u to %u.%u.%u.%u\n",
|
||||
netif->name[0], netif->name[1], netif->num,
|
||||
(u8_t)(ntohl(ipaddr->addr) >> 24 & 0xff),
|
||||
(u8_t)(ntohl(ipaddr->addr) >> 16 & 0xff),
|
||||
(u8_t)(ntohl(ipaddr->addr) >> 8 & 0xff),
|
||||
@@ -188,12 +188,24 @@ void
|
||||
netif_set_gw(struct netif *netif, struct ip_addr *gw)
|
||||
{
|
||||
ip_addr_set(&(netif->gw), gw);
|
||||
DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE, ("netif: setting GW address of interface %c%c%u to %u.%u.%u.%u\n",
|
||||
netif->name[0], netif->name[1], netif->num,
|
||||
(u8_t)(ntohl(gw->addr) >> 24 & 0xff),
|
||||
(u8_t)(ntohl(gw->addr) >> 16 & 0xff),
|
||||
(u8_t)(ntohl(gw->addr) >> 8 & 0xff),
|
||||
(u8_t)(ntohl(gw->addr) & 0xff)));
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
netif_set_netmask(struct netif *netif, struct ip_addr *netmask)
|
||||
{
|
||||
ip_addr_set(&(netif->netmask), netmask);
|
||||
DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE, ("netif: setting netmask of interface %c%c%u to %u.%u.%u.%u\n",
|
||||
netif->name[0], netif->name[1], netif->num,
|
||||
(u8_t)(ntohl(netmask->addr) >> 24 & 0xff),
|
||||
(u8_t)(ntohl(netmask->addr) >> 16 & 0xff),
|
||||
(u8_t)(ntohl(netmask->addr) >> 8 & 0xff),
|
||||
(u8_t)(ntohl(netmask->addr) & 0xff)));
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
|
||||
@@ -184,7 +184,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
||||
prev = pcb;
|
||||
}
|
||||
|
||||
if(pcb == NULL) {
|
||||
if (pcb == NULL) {
|
||||
/* If it did not go to an active connection, we check the connections
|
||||
in the TIME-WAIT state. */
|
||||
|
||||
|
||||
@@ -410,14 +410,14 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p)
|
||||
/* chksum zero must become 0xffff, as zero means 'no checksum' */
|
||||
if(udphdr->chksum == 0x0000) udphdr->chksum = 0xffff;
|
||||
}
|
||||
DEBUGF(UDP_DEBUG, ("udp_send: UDP checksum %x\n", udphdr->chksum));
|
||||
DEBUGF(UDP_DEBUG, ("udp_send: UDP checksum 0x%04x\n", udphdr->chksum));
|
||||
snmp_inc_udpoutdatagrams();
|
||||
DEBUGF(UDP_DEBUG, ("udp_send: ip_output_if(,,,,IP_PROTO_UDP,)\n"));
|
||||
/* output to IP */
|
||||
err = ip_output_if(q, src_ip, &pcb->remote_ip, UDP_TTL, IP_PROTO_UDP, netif);
|
||||
}
|
||||
|
||||
/* did we chain a header? */
|
||||
/* did we chain a header earlier? */
|
||||
if (q != p) {
|
||||
/* free the header */
|
||||
pbuf_free(q);
|
||||
@@ -504,7 +504,11 @@ udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
|
||||
pcb->next = udp_pcbs;
|
||||
udp_pcbs = pcb;
|
||||
}
|
||||
DEBUGF(UDP_DEBUG, ("udp_bind: bound to port %u\n", port));
|
||||
DEBUGF(UDP_DEBUG | DBG_TRACE | DBG_STATE, ("udp_bind: bound to %u.%u.%u.%u, port %u\n",
|
||||
(u8_t)(ntohl(ipaddr->addr) >> 24 & 0xff),
|
||||
(u8_t)(ntohl(ipaddr->addr) >> 16 & 0xff),
|
||||
(u8_t)(ntohl(ipaddr->addr) >> 8 & 0xff),
|
||||
(u8_t)(ntohl(ipaddr->addr) & 0xff), port));
|
||||
return ERR_OK;
|
||||
}
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user