Applied patch #1596 fixing wrongly cast LWIP_DEBUGF arguments.

(printf expects integers on the var args stack)
This commit is contained in:
likewise
2003-06-11 22:11:42 +00:00
parent af384440f8
commit ba786dc49b
9 changed files with 202 additions and 201 deletions

View File

@@ -1119,8 +1119,8 @@ static void dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_
u8_t msg_type;
u8_t i;
LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE | 3, ("dhcp_recv(pbuf = %p) from DHCP server %u.%u.%u.%u port %u\n", p,
(u8_t)(ntohl(addr->addr) >> 24 & 0xff), (u8_t)(ntohl(addr->addr) >> 16 & 0xff),
(u8_t)(ntohl(addr->addr) >> 8 & 0xff), (u8_t)(ntohl(addr->addr) & 0xff), port));
(unsigned int)(ntohl(addr->addr) >> 24 & 0xff), (unsigned int)(ntohl(addr->addr) >> 16 & 0xff),
(unsigned int)(ntohl(addr->addr) >> 8 & 0xff), (unsigned int)(ntohl(addr->addr) & 0xff), port));
LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("pbuf->len = %u\n", p->len));
LWIP_DEBUGF(DHCP_DEBUG | DBG_TRACE, ("pbuf->tot_len = %u\n", p->tot_len));
/* prevent warnings about unused arguments */

View File

@@ -1,8 +1,8 @@
/*
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
@@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
*
* Author: Adam Dunkels <adam@sics.se>
*
*/
@@ -53,13 +53,13 @@ icmp_input(struct pbuf *p, struct netif *inp)
struct ip_hdr *iphdr;
struct ip_addr tmpaddr;
u16_t hlen;
#ifdef ICMP_STATS
++lwip_stats.icmp.recv;
#endif /* ICMP_STATS */
snmp_inc_icmpinmsgs();
iphdr = p->payload;
hlen = IPH_HL(iphdr) * 4;
if (pbuf_header(p, -((s16_t)hlen)) || (p->tot_len < sizeof(u16_t)*2)) {
@@ -69,7 +69,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
++lwip_stats.icmp.lenerr;
#endif /* ICMP_STATS */
snmp_inc_icmpinerrors();
return;
return;
}
type = *((u8_t *)p->payload);
@@ -95,9 +95,9 @@ icmp_input(struct pbuf *p, struct netif *inp)
#endif /* ICMP_STATS */
snmp_inc_icmpinerrors();
return;
return;
}
iecho = p->payload;
iecho = p->payload;
if (inet_chksum_pbuf(p) != 0) {
LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo\n"));
pbuf_free(p);
@@ -128,7 +128,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
pbuf_header(p, hlen);
ip_output_if (p, &(iphdr->src), IP_HDRINCL,
IPH_TTL(iphdr), IP_PROTO_ICMP, inp);
break;
break;
default:
LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ICMP type %d code %d not supported.\n", (int)type, (int)code));
#ifdef ICMP_STATS
@@ -145,18 +145,18 @@ icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t)
struct pbuf *q;
struct ip_hdr *iphdr;
struct icmp_dur_hdr *idur;
q = pbuf_alloc(PBUF_IP, 8 + IP_HLEN + 8, PBUF_RAM);
/* ICMP header + IP header + 8 bytes of data */
iphdr = p->payload;
idur = q->payload;
ICMPH_TYPE_SET(idur, ICMP_DUR);
ICMPH_CODE_SET(idur, t);
memcpy((char *)q->payload + 8, p->payload, IP_HLEN + 8);
/* calculate checksum */
idur->chksum = 0;
idur->chksum = inet_chksum(idur, q->len);
@@ -186,9 +186,9 @@ icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
iphdr = p->payload;
#if ICMP_DEBUG
LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded from "));
ip_addr_debug_print(&(iphdr->src));
ip_addr_debug_print(ICMP_DEBUG, &(iphdr->src));
LWIP_DEBUGF(ICMP_DEBUG, (" to "));
ip_addr_debug_print(&(iphdr->dest));
ip_addr_debug_print(ICMP_DEBUG, &(iphdr->dest));
LWIP_DEBUGF(ICMP_DEBUG, ("\n"));
#endif /* ICMP_DEBNUG */
@@ -198,7 +198,7 @@ icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t)
/* copy fields from original packet */
memcpy((char *)q->payload + 8, (char *)p->payload, IP_HLEN + 8);
/* calculate checksum */
tehdr->chksum = 0;
tehdr->chksum = inet_chksum(tehdr, q->len);

View File

@@ -1,8 +1,8 @@
/*
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
@@ -11,21 +11,21 @@
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
*
* Author: Adam Dunkels <adam@sics.se>
*
*/
@@ -36,7 +36,7 @@
*
* This is the code for the IP layer for IPv6.
*
*/
*/
/*-----------------------------------------------------------------------------------*/
#include "lwip/opt.h"
@@ -75,7 +75,7 @@ struct netif *
ip_route(struct ip_addr *dest)
{
struct netif *netif;
for(netif = netif_list; netif != NULL; netif = netif->next) {
if (ip_addr_maskcmp(dest, &(netif->ip_addr), &(netif->netmask))) {
return netif;
@@ -96,14 +96,14 @@ static void
ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
{
struct netif *netif;
PERF_START;
if ((netif = ip_route((struct ip_addr *)&(iphdr->dest))) == NULL) {
LWIP_DEBUGF(IP_DEBUG, ("ip_input: no forwarding route found for "));
#if IP_DEBUG
ip_addr_debug_print(&(iphdr->dest));
ip_addr_debug_print(IP_DEBUG, &(iphdr->dest));
#endif /* IP_DEBUG */
LWIP_DEBUGF(IP_DEBUG, ("\n"));
pbuf_free(p);
@@ -116,20 +116,20 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
icmp_time_exceeded(p, ICMP_TE_TTL);
}
pbuf_free(p);
return;
return;
}
/* Incremental update of the IP checksum. */
/* if (iphdr->chksum >= htons(0xffff - 0x100)) {
iphdr->chksum += htons(0x100) + 1;
} else {
iphdr->chksum += htons(0x100);
}*/
LWIP_DEBUGF(IP_DEBUG, ("ip_forward: forwarding packet to "));
#if IP_DEBUG
ip_addr_debug_print(&(iphdr->dest));
ip_addr_debug_print(IP_DEBUG, &(iphdr->dest));
#endif /* IP_DEBUG */
LWIP_DEBUGF(IP_DEBUG, ("\n"));
@@ -139,7 +139,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr)
#endif /* IP_STATS */
PERF_STOP("ip_forward");
netif->output(netif, p, (struct ip_addr *)&(iphdr->dest));
}
/*-----------------------------------------------------------------------------------*/
@@ -158,22 +158,22 @@ ip_input(struct pbuf *p, struct netif *inp) {
struct ip_hdr *iphdr;
struct netif *netif;
PERF_START;
#if IP_DEBUG
ip_debug_print(p);
#endif /* IP_DEBUG */
#ifdef IP_STATS
++lwip_stats.ip.recv;
#endif /* IP_STATS */
/* identify the IP header */
iphdr = p->payload;
if (iphdr->v != 6) {
LWIP_DEBUGF(IP_DEBUG, ("IP packet dropped due to bad version number\n"));
#if IP_DEBUG
@@ -186,14 +186,14 @@ ip_input(struct pbuf *p, struct netif *inp) {
#endif /* IP_STATS */
return;
}
/* is this packet for us? */
for(netif = netif_list; netif != NULL; netif = netif->next) {
#if IP_DEBUG
LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest "));
ip_addr_debug_print(&(iphdr->dest));
ip_addr_debug_print(IP_DEBUG, &(iphdr->dest));
LWIP_DEBUGF(IP_DEBUG, ("netif->ip_addr "));
ip_addr_debug_print(&(netif->ip_addr));
ip_addr_debug_print(IP_DEBUG, &(netif->ip_addr));
LWIP_DEBUGF(IP_DEBUG, ("\n"));
#endif /* IP_DEBUG */
if (ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr))) {
@@ -201,7 +201,7 @@ ip_input(struct pbuf *p, struct netif *inp) {
}
}
if (netif == NULL) {
/* packet not for us, route or discard */
#ifdef IP_FORWARD
@@ -212,14 +212,14 @@ ip_input(struct pbuf *p, struct netif *inp) {
}
pbuf_realloc(p, IP_HLEN + ntohs(iphdr->len));
/* send to upper layers */
#if IP_DEBUG
/* LWIP_DEBUGF("ip_input: \n");
ip_debug_print(p);
LWIP_DEBUGF("ip_input: p->len %u p->tot_len %u\n", p->len, p->tot_len);*/
#endif /* IP_DEBUG */
pbuf_header(p, -IP_HLEN);
@@ -276,9 +276,9 @@ ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
return ERR_BUF;
}
printf("len %u tot_len %u\n", p->len, p->tot_len);
iphdr = p->payload;
if (dest != IP_HDRINCL) {
printf("!IP_HDRLINCL\n");
@@ -294,7 +294,7 @@ ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
} else {
ip_addr_set(&(iphdr->src), src);
}
} else {
dest = &(iphdr->dest);
}
@@ -309,7 +309,7 @@ ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
#endif /* IP_DEBUG */
PERF_STOP("ip_output_if");
return netif->output(netif, p, dest);
return netif->output(netif, p, dest);
}
/*-----------------------------------------------------------------------------------*/
/* ip_output:
@@ -342,7 +342,7 @@ ip_debug_print(struct pbuf *p)
char *payload;
payload = (char *)iphdr + IP_HLEN;
LWIP_DEBUGF(IP_DEBUG, ("IP header:\n"));
LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n"));
LWIP_DEBUGF(IP_DEBUG, ("|%2d | %x%x | %x%x | (v, traffic class, flow label)\n",

View File

@@ -100,11 +100,11 @@ netif_add(struct ip_addr *ipaddr, struct ip_addr *netmask,
#if NETIF_DEBUG
LWIP_DEBUGF(NETIF_DEBUG, ("netif: added interface %c%c IP addr ",
netif->name[0], netif->name[1]));
ip_addr_debug_print(ipaddr);
ip_addr_debug_print(NETIF_DEBUG, ipaddr);
LWIP_DEBUGF(NETIF_DEBUG, (" netmask "));
ip_addr_debug_print(netmask);
LWIP_DEBUGF(NETIF_DEBUG, (" gw "));
ip_addr_debug_print(gw);
ip_addr_debug_print(NETIF_DEBUG, netmask);
LWIP_DEBUGF(NETIF_DEBUG, (" gw "));
ip_addr_debug_print(NETIF_DEBUG, gw);
LWIP_DEBUGF(NETIF_DEBUG, ("\n"));
#endif /* NETIF_DEBUG */
return netif;
@@ -211,11 +211,11 @@ netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
#endif
ip_addr_set(&(netif->ip_addr), ipaddr);
LWIP_DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE | 3, ("netif: IP address of interface %c%c set to %u.%u.%u.%u\n",
netif->name[0], netif->name[1],
(u8_t)(ntohl(netif->ip_addr.addr) >> 24 & 0xff),
(u8_t)(ntohl(netif->ip_addr.addr) >> 16 & 0xff),
(u8_t)(ntohl(netif->ip_addr.addr) >> 8 & 0xff),
(u8_t)(ntohl(netif->ip_addr.addr) & 0xff)));
netif->name[0], netif->name[1],
(unsigned int)(ntohl(netif->ip_addr.addr) >> 24 & 0xff),
(unsigned int)(ntohl(netif->ip_addr.addr) >> 16 & 0xff),
(unsigned int)(ntohl(netif->ip_addr.addr) >> 8 & 0xff),
(unsigned int)(ntohl(netif->ip_addr.addr) & 0xff)));
}
/*-----------------------------------------------------------------------------------*/
void
@@ -224,10 +224,10 @@ netif_set_gw(struct netif *netif, struct ip_addr *gw)
ip_addr_set(&(netif->gw), gw);
LWIP_DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE | 3, ("netif: GW address of interface %c%c set to %u.%u.%u.%u\n",
netif->name[0], netif->name[1],
(u8_t)(ntohl(netif->gw.addr) >> 24 & 0xff),
(u8_t)(ntohl(netif->gw.addr) >> 16 & 0xff),
(u8_t)(ntohl(netif->gw.addr) >> 8 & 0xff),
(u8_t)(ntohl(netif->gw.addr) & 0xff)));
(unsigned int)(ntohl(netif->gw.addr) >> 24 & 0xff),
(unsigned int)(ntohl(netif->gw.addr) >> 16 & 0xff),
(unsigned int)(ntohl(netif->gw.addr) >> 8 & 0xff),
(unsigned int)(ntohl(netif->gw.addr) & 0xff)));
}
/*-----------------------------------------------------------------------------------*/
void
@@ -236,10 +236,10 @@ netif_set_netmask(struct netif *netif, struct ip_addr *netmask)
ip_addr_set(&(netif->netmask), netmask);
LWIP_DEBUGF(NETIF_DEBUG | DBG_TRACE | DBG_STATE | 3, ("netif: netmask of interface %c%c set to %u.%u.%u.%u\n",
netif->name[0], netif->name[1],
(u8_t)(ntohl(netif->netmask.addr) >> 24 & 0xff),
(u8_t)(ntohl(netif->netmask.addr) >> 16 & 0xff),
(u8_t)(ntohl(netif->netmask.addr) >> 8 & 0xff),
(u8_t)(ntohl(netif->netmask.addr) & 0xff)));
(unsigned int)(ntohl(netif->netmask.addr) >> 24 & 0xff),
(unsigned int)(ntohl(netif->netmask.addr) >> 16 & 0xff),
(unsigned int)(ntohl(netif->netmask.addr) >> 8 & 0xff),
(unsigned int)(ntohl(netif->netmask.addr) & 0xff)));
}
/*-----------------------------------------------------------------------------------*/
void

View File

@@ -291,7 +291,10 @@ tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
static err_t
tcp_accept_null(void *arg, struct tcp_pcb *pcb, err_t err)
{
if (arg || pcb || err);
(void)arg;
(void)pcb;
(void)err;
return ERR_ABRT;
}
#endif /* LWIP_CALLBACK_API */

View File

@@ -516,10 +516,10 @@ udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
udp_pcbs = pcb;
}
LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | DBG_STATE, ("udp_bind: bound to %u.%u.%u.%u, port %u\n",
(u8_t)(ntohl(pcb->local_ip.addr) >> 24 & 0xff),
(u8_t)(ntohl(pcb->local_ip.addr) >> 16 & 0xff),
(u8_t)(ntohl(pcb->local_ip.addr) >> 8 & 0xff),
(u8_t)(ntohl(pcb->local_ip.addr) & 0xff), pcb->local_port));
(unsigned int)(ntohl(pcb->local_ip.addr) >> 24 & 0xff),
(unsigned int)(ntohl(pcb->local_ip.addr) >> 16 & 0xff),
(unsigned int)(ntohl(pcb->local_ip.addr) >> 8 & 0xff),
(unsigned int)(ntohl(pcb->local_ip.addr) & 0xff), pcb->local_port));
return ERR_OK;
}
/**
@@ -571,10 +571,10 @@ udp_connect(struct udp_pcb *pcb, struct ip_addr *ipaddr, u16_t port)
}
#endif
LWIP_DEBUGF(UDP_DEBUG | DBG_TRACE | DBG_STATE, ("udp_connect: connected to %u.%u.%u.%u, port %u\n",
(u8_t)(ntohl(pcb->remote_ip.addr) >> 24 & 0xff),
(u8_t)(ntohl(pcb->remote_ip.addr) >> 16 & 0xff),
(u8_t)(ntohl(pcb->remote_ip.addr) >> 8 & 0xff),
(u8_t)(ntohl(pcb->remote_ip.addr) & 0xff), pcb->remote_port));
(unsigned int)(ntohl(pcb->remote_ip.addr) >> 24 & 0xff),
(unsigned int)(ntohl(pcb->remote_ip.addr) >> 16 & 0xff),
(unsigned int)(ntohl(pcb->remote_ip.addr) >> 8 & 0xff),
(unsigned int)(ntohl(pcb->remote_ip.addr) & 0xff), pcb->remote_port));
/* Insert UDP PCB into the list of active UDP PCBs. */
for(ipcb = udp_pcbs; ipcb != NULL; ipcb = ipcb->next) {