mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
bug #28659: Missing casts
This commit is contained in:
parent
1811a344f5
commit
e678e1bdcb
@ -349,7 +349,7 @@ netconn_recv(struct netconn *conn, struct netbuf **new_buf)
|
|||||||
#if LWIP_TCP
|
#if LWIP_TCP
|
||||||
/* This is not a listening netconn, since recvmbox is set */
|
/* This is not a listening netconn, since recvmbox is set */
|
||||||
|
|
||||||
buf = memp_malloc(MEMP_NETBUF);
|
buf = (struct netbuf *)memp_malloc(MEMP_NETBUF);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
NETCONN_SET_SAFE_ERR(conn, ERR_MEM);
|
NETCONN_SET_SAFE_ERR(conn, ERR_MEM);
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
|
@ -80,7 +80,7 @@ recv_raw(void *arg, struct raw_pcb *pcb, struct pbuf *p,
|
|||||||
#endif /* LWIP_SO_RCVBUF */
|
#endif /* LWIP_SO_RCVBUF */
|
||||||
|
|
||||||
LWIP_UNUSED_ARG(addr);
|
LWIP_UNUSED_ARG(addr);
|
||||||
conn = arg;
|
conn = (struct netconn *)arg;
|
||||||
|
|
||||||
#if LWIP_SO_RCVBUF
|
#if LWIP_SO_RCVBUF
|
||||||
SYS_ARCH_GET(conn->recv_avail, recv_avail);
|
SYS_ARCH_GET(conn->recv_avail, recv_avail);
|
||||||
@ -99,7 +99,7 @@ recv_raw(void *arg, struct raw_pcb *pcb, struct pbuf *p,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(q != NULL) {
|
if(q != NULL) {
|
||||||
buf = memp_malloc(MEMP_NETBUF);
|
buf = (struct netbuf *)memp_malloc(MEMP_NETBUF);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
pbuf_free(q);
|
pbuf_free(q);
|
||||||
return 0;
|
return 0;
|
||||||
@ -145,7 +145,7 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
|||||||
LWIP_UNUSED_ARG(pcb); /* only used for asserts... */
|
LWIP_UNUSED_ARG(pcb); /* only used for asserts... */
|
||||||
LWIP_ASSERT("recv_udp must have a pcb argument", pcb != NULL);
|
LWIP_ASSERT("recv_udp must have a pcb argument", pcb != NULL);
|
||||||
LWIP_ASSERT("recv_udp must have an argument", arg != NULL);
|
LWIP_ASSERT("recv_udp must have an argument", arg != NULL);
|
||||||
conn = arg;
|
conn = (struct netconn *)arg;
|
||||||
LWIP_ASSERT("recv_udp: recv for wrong pcb!", conn->pcb.udp == pcb);
|
LWIP_ASSERT("recv_udp: recv for wrong pcb!", conn->pcb.udp == pcb);
|
||||||
|
|
||||||
#if LWIP_SO_RCVBUF
|
#if LWIP_SO_RCVBUF
|
||||||
@ -159,7 +159,7 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = memp_malloc(MEMP_NETBUF);
|
buf = (struct netbuf *)memp_malloc(MEMP_NETBUF);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
return;
|
return;
|
||||||
@ -206,7 +206,7 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
|||||||
LWIP_UNUSED_ARG(pcb);
|
LWIP_UNUSED_ARG(pcb);
|
||||||
LWIP_ASSERT("recv_tcp must have a pcb argument", pcb != NULL);
|
LWIP_ASSERT("recv_tcp must have a pcb argument", pcb != NULL);
|
||||||
LWIP_ASSERT("recv_tcp must have an argument", arg != NULL);
|
LWIP_ASSERT("recv_tcp must have an argument", arg != NULL);
|
||||||
conn = arg;
|
conn = (struct netconn *)arg;
|
||||||
LWIP_ASSERT("recv_tcp: recv for wrong pcb!", conn->pcb.tcp == pcb);
|
LWIP_ASSERT("recv_tcp: recv for wrong pcb!", conn->pcb.tcp == pcb);
|
||||||
|
|
||||||
if (conn == NULL) {
|
if (conn == NULL) {
|
||||||
@ -255,7 +255,7 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
|||||||
static err_t
|
static err_t
|
||||||
poll_tcp(void *arg, struct tcp_pcb *pcb)
|
poll_tcp(void *arg, struct tcp_pcb *pcb)
|
||||||
{
|
{
|
||||||
struct netconn *conn = arg;
|
struct netconn *conn = (struct netconn *)arg;
|
||||||
|
|
||||||
LWIP_UNUSED_ARG(pcb);
|
LWIP_UNUSED_ARG(pcb);
|
||||||
LWIP_ASSERT("conn != NULL", (conn != NULL));
|
LWIP_ASSERT("conn != NULL", (conn != NULL));
|
||||||
@ -279,7 +279,7 @@ poll_tcp(void *arg, struct tcp_pcb *pcb)
|
|||||||
static err_t
|
static err_t
|
||||||
sent_tcp(void *arg, struct tcp_pcb *pcb, u16_t len)
|
sent_tcp(void *arg, struct tcp_pcb *pcb, u16_t len)
|
||||||
{
|
{
|
||||||
struct netconn *conn = arg;
|
struct netconn *conn = (struct netconn *)arg;
|
||||||
|
|
||||||
LWIP_UNUSED_ARG(pcb);
|
LWIP_UNUSED_ARG(pcb);
|
||||||
LWIP_ASSERT("conn != NULL", (conn != NULL));
|
LWIP_ASSERT("conn != NULL", (conn != NULL));
|
||||||
@ -314,7 +314,7 @@ err_tcp(void *arg, err_t err)
|
|||||||
enum netconn_state old_state;
|
enum netconn_state old_state;
|
||||||
SYS_ARCH_DECL_PROTECT(lev);
|
SYS_ARCH_DECL_PROTECT(lev);
|
||||||
|
|
||||||
conn = arg;
|
conn = (struct netconn *)arg;
|
||||||
LWIP_ASSERT("conn != NULL", (conn != NULL));
|
LWIP_ASSERT("conn != NULL", (conn != NULL));
|
||||||
|
|
||||||
conn->pcb.tcp = NULL;
|
conn->pcb.tcp = NULL;
|
||||||
@ -524,7 +524,7 @@ netconn_alloc(enum netconn_type t, netconn_callback callback)
|
|||||||
struct netconn *conn;
|
struct netconn *conn;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
conn = memp_malloc(MEMP_NETCONN);
|
conn = (struct netconn *)memp_malloc(MEMP_NETCONN);
|
||||||
if (conn == NULL) {
|
if (conn == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -830,7 +830,7 @@ do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
|
|||||||
|
|
||||||
LWIP_UNUSED_ARG(pcb);
|
LWIP_UNUSED_ARG(pcb);
|
||||||
|
|
||||||
conn = arg;
|
conn = (struct netconn *)arg;
|
||||||
|
|
||||||
if (conn == NULL) {
|
if (conn == NULL) {
|
||||||
return ERR_VAL;
|
return ERR_VAL;
|
||||||
|
@ -57,7 +57,7 @@ netbuf *netbuf_new(void)
|
|||||||
{
|
{
|
||||||
struct netbuf *buf;
|
struct netbuf *buf;
|
||||||
|
|
||||||
buf = memp_malloc(MEMP_NETBUF);
|
buf = (struct netbuf *)memp_malloc(MEMP_NETBUF);
|
||||||
if (buf != NULL) {
|
if (buf != NULL) {
|
||||||
buf->p = NULL;
|
buf->p = NULL;
|
||||||
buf->ptr = NULL;
|
buf->ptr = NULL;
|
||||||
|
@ -149,7 +149,7 @@ tcpip_input(struct pbuf *p, struct netif *inp)
|
|||||||
struct tcpip_msg *msg;
|
struct tcpip_msg *msg;
|
||||||
|
|
||||||
if (mbox != SYS_MBOX_NULL) {
|
if (mbox != SYS_MBOX_NULL) {
|
||||||
msg = memp_malloc(MEMP_TCPIP_MSG_INPKT);
|
msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_INPKT);
|
||||||
if (msg == NULL) {
|
if (msg == NULL) {
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ tcpip_callback_with_block(tcpip_callback_fn function, void *ctx, u8_t block)
|
|||||||
struct tcpip_msg *msg;
|
struct tcpip_msg *msg;
|
||||||
|
|
||||||
if (mbox != SYS_MBOX_NULL) {
|
if (mbox != SYS_MBOX_NULL) {
|
||||||
msg = memp_malloc(MEMP_TCPIP_MSG_API);
|
msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API);
|
||||||
if (msg == NULL) {
|
if (msg == NULL) {
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
@ -218,7 +218,7 @@ tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg)
|
|||||||
struct tcpip_msg *msg;
|
struct tcpip_msg *msg;
|
||||||
|
|
||||||
if (mbox != SYS_MBOX_NULL) {
|
if (mbox != SYS_MBOX_NULL) {
|
||||||
msg = memp_malloc(MEMP_TCPIP_MSG_API);
|
msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API);
|
||||||
if (msg == NULL) {
|
if (msg == NULL) {
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
@ -247,7 +247,7 @@ tcpip_untimeout(sys_timeout_handler h, void *arg)
|
|||||||
struct tcpip_msg *msg;
|
struct tcpip_msg *msg;
|
||||||
|
|
||||||
if (mbox != SYS_MBOX_NULL) {
|
if (mbox != SYS_MBOX_NULL) {
|
||||||
msg = memp_malloc(MEMP_TCPIP_MSG_API);
|
msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API);
|
||||||
if (msg == NULL) {
|
if (msg == NULL) {
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
@ -397,7 +397,7 @@ tcpip_init(tcpip_init_done_fn initfunc, void *arg)
|
|||||||
static void
|
static void
|
||||||
pbuf_free_int(void *p)
|
pbuf_free_int(void *p)
|
||||||
{
|
{
|
||||||
struct pbuf *q = p;
|
struct pbuf *q = (struct pbuf *)p;
|
||||||
pbuf_free(q);
|
pbuf_free(q);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ dhcp_start(struct netif *netif)
|
|||||||
/* no DHCP client attached yet? */
|
/* no DHCP client attached yet? */
|
||||||
if (dhcp == NULL) {
|
if (dhcp == NULL) {
|
||||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_start(): starting new DHCP client\n"));
|
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_start(): starting new DHCP client\n"));
|
||||||
dhcp = mem_malloc(sizeof(struct dhcp));
|
dhcp = (struct dhcp *)mem_malloc(sizeof(struct dhcp));
|
||||||
if (dhcp == NULL) {
|
if (dhcp == NULL) {
|
||||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_start(): could not allocate dhcp\n"));
|
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_start(): could not allocate dhcp\n"));
|
||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
@ -667,7 +667,7 @@ dhcp_inform(struct netif *netif)
|
|||||||
{
|
{
|
||||||
struct dhcp *dhcp, *old_dhcp;
|
struct dhcp *dhcp, *old_dhcp;
|
||||||
err_t result = ERR_OK;
|
err_t result = ERR_OK;
|
||||||
dhcp = mem_malloc(sizeof(struct dhcp));
|
dhcp = (struct dhcp *)mem_malloc(sizeof(struct dhcp));
|
||||||
if (dhcp == NULL) {
|
if (dhcp == NULL) {
|
||||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("dhcp_inform(): could not allocate dhcp\n"));
|
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("dhcp_inform(): could not allocate dhcp\n"));
|
||||||
return;
|
return;
|
||||||
@ -1313,7 +1313,7 @@ dhcp_unfold_reply(struct dhcp *dhcp, struct pbuf *p)
|
|||||||
return ERR_MEM;
|
return ERR_MEM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dhcp->msg_in = mem_malloc(sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN);
|
dhcp->msg_in = (struct dhcp_msg *)mem_malloc(sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN);
|
||||||
if (dhcp->msg_in == NULL) {
|
if (dhcp->msg_in == NULL) {
|
||||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS,
|
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS,
|
||||||
("dhcp_unfold_reply(): could not allocate dhcp->msg_in\n"));
|
("dhcp_unfold_reply(): could not allocate dhcp->msg_in\n"));
|
||||||
|
@ -90,7 +90,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
|||||||
snmp_inc_icmpinmsgs();
|
snmp_inc_icmpinmsgs();
|
||||||
|
|
||||||
|
|
||||||
iphdr = p->payload;
|
iphdr = (struct ip_hdr *)p->payload;
|
||||||
hlen = IPH_HL(iphdr) * 4;
|
hlen = IPH_HL(iphdr) * 4;
|
||||||
if (pbuf_header(p, -hlen) || (p->tot_len < sizeof(u16_t)*2)) {
|
if (pbuf_header(p, -hlen) || (p->tot_len < sizeof(u16_t)*2)) {
|
||||||
LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: short ICMP (%"U16_F" bytes) received\n", p->tot_len));
|
LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: short ICMP (%"U16_F" bytes) received\n", p->tot_len));
|
||||||
@ -163,7 +163,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
|||||||
LWIP_ASSERT("icmp_input: copying to new pbuf failed\n", 0);
|
LWIP_ASSERT("icmp_input: copying to new pbuf failed\n", 0);
|
||||||
goto memerr;
|
goto memerr;
|
||||||
}
|
}
|
||||||
iphdr = r->payload;
|
iphdr = (struct ip_hdr *)r->payload;
|
||||||
/* switch r->payload back to icmp header */
|
/* switch r->payload back to icmp header */
|
||||||
if (pbuf_header(r, -hlen)) {
|
if (pbuf_header(r, -hlen)) {
|
||||||
LWIP_ASSERT("icmp_input: restoring original p->payload failed\n", 0);
|
LWIP_ASSERT("icmp_input: restoring original p->payload failed\n", 0);
|
||||||
@ -184,7 +184,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
|||||||
/* At this point, all checks are OK. */
|
/* At this point, all checks are OK. */
|
||||||
/* We generate an answer by switching the dest and src ip addresses,
|
/* We generate an answer by switching the dest and src ip addresses,
|
||||||
* setting the icmp type to ECHO_RESPONSE and updating the checksum. */
|
* setting the icmp type to ECHO_RESPONSE and updating the checksum. */
|
||||||
iecho = p->payload;
|
iecho = (struct icmp_echo_hdr *)p->payload;
|
||||||
tmpaddr.addr = iphdr->src.addr;
|
tmpaddr.addr = iphdr->src.addr;
|
||||||
iphdr->src.addr = iphdr->dest.addr;
|
iphdr->src.addr = iphdr->dest.addr;
|
||||||
iphdr->dest.addr = tmpaddr.addr;
|
iphdr->dest.addr = tmpaddr.addr;
|
||||||
@ -299,14 +299,14 @@ icmp_send_response(struct pbuf *p, u8_t type, u8_t code)
|
|||||||
LWIP_ASSERT("check that first pbuf can hold icmp message",
|
LWIP_ASSERT("check that first pbuf can hold icmp message",
|
||||||
(q->len >= (sizeof(struct icmp_echo_hdr) + IP_HLEN + ICMP_DEST_UNREACH_DATASIZE)));
|
(q->len >= (sizeof(struct icmp_echo_hdr) + IP_HLEN + ICMP_DEST_UNREACH_DATASIZE)));
|
||||||
|
|
||||||
iphdr = p->payload;
|
iphdr = (struct ip_hdr *)p->payload;
|
||||||
LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded from "));
|
LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded from "));
|
||||||
ip_addr_debug_print(ICMP_DEBUG, &(iphdr->src));
|
ip_addr_debug_print(ICMP_DEBUG, &(iphdr->src));
|
||||||
LWIP_DEBUGF(ICMP_DEBUG, (" to "));
|
LWIP_DEBUGF(ICMP_DEBUG, (" to "));
|
||||||
ip_addr_debug_print(ICMP_DEBUG, &(iphdr->dest));
|
ip_addr_debug_print(ICMP_DEBUG, &(iphdr->dest));
|
||||||
LWIP_DEBUGF(ICMP_DEBUG, ("\n"));
|
LWIP_DEBUGF(ICMP_DEBUG, ("\n"));
|
||||||
|
|
||||||
icmphdr = q->payload;
|
icmphdr = (struct icmp_echo_hdr *)q->payload;
|
||||||
icmphdr->type = type;
|
icmphdr->type = type;
|
||||||
icmphdr->code = code;
|
icmphdr->code = code;
|
||||||
icmphdr->id = 0;
|
icmphdr->id = 0;
|
||||||
|
@ -200,7 +200,7 @@ ip_input(struct pbuf *p, struct netif *inp)
|
|||||||
snmp_inc_ipinreceives();
|
snmp_inc_ipinreceives();
|
||||||
|
|
||||||
/* identify the IP header */
|
/* identify the IP header */
|
||||||
iphdr = p->payload;
|
iphdr = (struct ip_hdr *)p->payload;
|
||||||
if (IPH_V(iphdr) != 4) {
|
if (IPH_V(iphdr) != 4) {
|
||||||
LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_WARNING, ("IP packet dropped due to bad version number %"U16_F"\n", IPH_V(iphdr)));
|
LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_WARNING, ("IP packet dropped due to bad version number %"U16_F"\n", IPH_V(iphdr)));
|
||||||
ip_debug_print(p);
|
ip_debug_print(p);
|
||||||
@ -549,7 +549,7 @@ err_t ip_output_if_opt(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest
|
|||||||
return ERR_BUF;
|
return ERR_BUF;
|
||||||
}
|
}
|
||||||
|
|
||||||
iphdr = p->payload;
|
iphdr = (struct ip_hdr *)p->payload;
|
||||||
LWIP_ASSERT("check that first pbuf can hold struct ip_hdr",
|
LWIP_ASSERT("check that first pbuf can hold struct ip_hdr",
|
||||||
(p->len >= sizeof(struct ip_hdr)));
|
(p->len >= sizeof(struct ip_hdr)));
|
||||||
|
|
||||||
@ -575,7 +575,7 @@ err_t ip_output_if_opt(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest
|
|||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
/* IP header already included in p */
|
/* IP header already included in p */
|
||||||
iphdr = p->payload;
|
iphdr = (struct ip_hdr *)p->payload;
|
||||||
dest = &(iphdr->dest);
|
dest = &(iphdr->dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ mem_init(void)
|
|||||||
(SIZEOF_STRUCT_MEM & (MEM_ALIGNMENT-1)) == 0);
|
(SIZEOF_STRUCT_MEM & (MEM_ALIGNMENT-1)) == 0);
|
||||||
|
|
||||||
/* align the heap */
|
/* align the heap */
|
||||||
ram = LWIP_MEM_ALIGN(LWIP_RAM_HEAP_POINTER);
|
ram = (u8_t *)LWIP_MEM_ALIGN(LWIP_RAM_HEAP_POINTER);
|
||||||
/* initialize the start of the heap */
|
/* initialize the start of the heap */
|
||||||
mem = (struct mem *)ram;
|
mem = (struct mem *)ram;
|
||||||
mem->next = MEM_SIZE_ALIGNED;
|
mem->next = MEM_SIZE_ALIGNED;
|
||||||
|
@ -292,7 +292,7 @@ memp_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !MEMP_SEPARATE_POOLS
|
#if !MEMP_SEPARATE_POOLS
|
||||||
memp = LWIP_MEM_ALIGN(memp_memory);
|
memp = (struct memp *)LWIP_MEM_ALIGN(memp_memory);
|
||||||
#endif /* !MEMP_SEPARATE_POOLS */
|
#endif /* !MEMP_SEPARATE_POOLS */
|
||||||
/* for every pool: */
|
/* for every pool: */
|
||||||
for (i = 0; i < MEMP_MAX; ++i) {
|
for (i = 0; i < MEMP_MAX; ++i) {
|
||||||
|
@ -211,7 +211,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case PBUF_POOL:
|
case PBUF_POOL:
|
||||||
/* allocate head of pbuf chain into p */
|
/* allocate head of pbuf chain into p */
|
||||||
p = memp_malloc(MEMP_PBUF_POOL);
|
p = (struct pbuf *)memp_malloc(MEMP_PBUF_POOL);
|
||||||
LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_alloc: allocated pbuf %p\n", (void *)p));
|
LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_alloc: allocated pbuf %p\n", (void *)p));
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
PBUF_POOL_IS_EMPTY();
|
PBUF_POOL_IS_EMPTY();
|
||||||
@ -244,7 +244,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
|
|||||||
rem_len = length - p->len;
|
rem_len = length - p->len;
|
||||||
/* any remaining pbufs to be allocated? */
|
/* any remaining pbufs to be allocated? */
|
||||||
while (rem_len > 0) {
|
while (rem_len > 0) {
|
||||||
q = memp_malloc(MEMP_PBUF_POOL);
|
q = (struct pbuf *)memp_malloc(MEMP_PBUF_POOL);
|
||||||
if (q == NULL) {
|
if (q == NULL) {
|
||||||
PBUF_POOL_IS_EMPTY();
|
PBUF_POOL_IS_EMPTY();
|
||||||
/* free chain so far allocated */
|
/* free chain so far allocated */
|
||||||
@ -298,7 +298,7 @@ pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type)
|
|||||||
/* pbuf references existing (externally allocated) RAM payload? */
|
/* pbuf references existing (externally allocated) RAM payload? */
|
||||||
case PBUF_REF:
|
case PBUF_REF:
|
||||||
/* only allocate memory for the pbuf structure */
|
/* only allocate memory for the pbuf structure */
|
||||||
p = memp_malloc(MEMP_PBUF);
|
p = (struct pbuf *)memp_malloc(MEMP_PBUF);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_LEVEL_SERIOUS,
|
LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_LEVEL_SERIOUS,
|
||||||
("pbuf_alloc: Could not allocate MEMP_PBUF for PBUF_%s.\n",
|
("pbuf_alloc: Could not allocate MEMP_PBUF for PBUF_%s.\n",
|
||||||
@ -383,7 +383,7 @@ pbuf_realloc(struct pbuf *p, u16_t new_len)
|
|||||||
/* (other types merely adjust their length fields */
|
/* (other types merely adjust their length fields */
|
||||||
if ((q->type == PBUF_RAM) && (rem_len != q->len)) {
|
if ((q->type == PBUF_RAM) && (rem_len != q->len)) {
|
||||||
/* reallocate and adjust the length of the pbuf that will be split */
|
/* reallocate and adjust the length of the pbuf that will be split */
|
||||||
q = mem_realloc(q, (u8_t *)q->payload - (u8_t *)q + rem_len);
|
q = (struct pbuf *)mem_realloc(q, (u8_t *)q->payload - (u8_t *)q + rem_len);
|
||||||
LWIP_ASSERT("mem_realloc give q == NULL", q != NULL);
|
LWIP_ASSERT("mem_realloc give q == NULL", q != NULL);
|
||||||
}
|
}
|
||||||
/* adjust length fields for new last pbuf */
|
/* adjust length fields for new last pbuf */
|
||||||
|
@ -83,7 +83,7 @@ raw_input(struct pbuf *p, struct netif *inp)
|
|||||||
|
|
||||||
LWIP_UNUSED_ARG(inp);
|
LWIP_UNUSED_ARG(inp);
|
||||||
|
|
||||||
iphdr = p->payload;
|
iphdr = (struct ip_hdr *)p->payload;
|
||||||
proto = IPH_PROTO(iphdr);
|
proto = IPH_PROTO(iphdr);
|
||||||
|
|
||||||
prev = NULL;
|
prev = NULL;
|
||||||
@ -336,7 +336,7 @@ raw_new(u8_t proto)
|
|||||||
|
|
||||||
LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_TRACE, ("raw_new\n"));
|
LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_TRACE, ("raw_new\n"));
|
||||||
|
|
||||||
pcb = memp_malloc(MEMP_RAW_PCB);
|
pcb = (struct raw_pcb *)memp_malloc(MEMP_RAW_PCB);
|
||||||
/* could allocate RAW PCB? */
|
/* could allocate RAW PCB? */
|
||||||
if (pcb != NULL) {
|
if (pcb != NULL) {
|
||||||
/* initialize PCB to all zeroes */
|
/* initialize PCB to all zeroes */
|
||||||
|
@ -376,7 +376,7 @@ tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog)
|
|||||||
if (pcb->state == LISTEN) {
|
if (pcb->state == LISTEN) {
|
||||||
return pcb;
|
return pcb;
|
||||||
}
|
}
|
||||||
lpcb = memp_malloc(MEMP_TCP_PCB_LISTEN);
|
lpcb = (struct tcp_pcb_listen *)memp_malloc(MEMP_TCP_PCB_LISTEN);
|
||||||
if (lpcb == NULL) {
|
if (lpcb == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -914,7 +914,7 @@ tcp_seg_copy(struct tcp_seg *seg)
|
|||||||
{
|
{
|
||||||
struct tcp_seg *cseg;
|
struct tcp_seg *cseg;
|
||||||
|
|
||||||
cseg = memp_malloc(MEMP_TCP_SEG);
|
cseg = (struct tcp_seg *)memp_malloc(MEMP_TCP_SEG);
|
||||||
if (cseg == NULL) {
|
if (cseg == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1015,19 +1015,19 @@ tcp_alloc(u8_t prio)
|
|||||||
struct tcp_pcb *pcb;
|
struct tcp_pcb *pcb;
|
||||||
u32_t iss;
|
u32_t iss;
|
||||||
|
|
||||||
pcb = memp_malloc(MEMP_TCP_PCB);
|
pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB);
|
||||||
if (pcb == NULL) {
|
if (pcb == NULL) {
|
||||||
/* Try killing oldest connection in TIME-WAIT. */
|
/* Try killing oldest connection in TIME-WAIT. */
|
||||||
LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing off oldest TIME-WAIT connection\n"));
|
LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing off oldest TIME-WAIT connection\n"));
|
||||||
tcp_kill_timewait();
|
tcp_kill_timewait();
|
||||||
/* Try to allocate a tcp_pcb again. */
|
/* Try to allocate a tcp_pcb again. */
|
||||||
pcb = memp_malloc(MEMP_TCP_PCB);
|
pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB);
|
||||||
if (pcb == NULL) {
|
if (pcb == NULL) {
|
||||||
/* Try killing active connections with lower priority than the new one. */
|
/* Try killing active connections with lower priority than the new one. */
|
||||||
LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing connection with prio lower than %d\n", prio));
|
LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing connection with prio lower than %d\n", prio));
|
||||||
tcp_kill_prio(prio);
|
tcp_kill_prio(prio);
|
||||||
/* Try to allocate a tcp_pcb again. */
|
/* Try to allocate a tcp_pcb again. */
|
||||||
pcb = memp_malloc(MEMP_TCP_PCB);
|
pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB);
|
||||||
if (pcb != NULL) {
|
if (pcb != NULL) {
|
||||||
/* adjust err stats: memp_malloc failed twice before */
|
/* adjust err stats: memp_malloc failed twice before */
|
||||||
MEMP_STATS_DEC(err, MEMP_TCP_PCB);
|
MEMP_STATS_DEC(err, MEMP_TCP_PCB);
|
||||||
|
@ -102,7 +102,7 @@ tcp_input(struct pbuf *p, struct netif *inp)
|
|||||||
TCP_STATS_INC(tcp.recv);
|
TCP_STATS_INC(tcp.recv);
|
||||||
snmp_inc_tcpinsegs();
|
snmp_inc_tcpinsegs();
|
||||||
|
|
||||||
iphdr = p->payload;
|
iphdr = (struct ip_hdr *)p->payload;
|
||||||
tcphdr = (struct tcp_hdr *)((u8_t *)p->payload + IPH_HL(iphdr) * 4);
|
tcphdr = (struct tcp_hdr *)((u8_t *)p->payload + IPH_HL(iphdr) * 4);
|
||||||
|
|
||||||
#if TCP_INPUT_DEBUG
|
#if TCP_INPUT_DEBUG
|
||||||
|
@ -63,7 +63,7 @@ static struct tcp_hdr *
|
|||||||
tcp_output_set_header(struct tcp_pcb *pcb, struct pbuf *p, u16_t optlen,
|
tcp_output_set_header(struct tcp_pcb *pcb, struct pbuf *p, u16_t optlen,
|
||||||
u32_t seqno_be /* already in network byte order */)
|
u32_t seqno_be /* already in network byte order */)
|
||||||
{
|
{
|
||||||
struct tcp_hdr *tcphdr = p->payload;
|
struct tcp_hdr *tcphdr = (struct tcp_hdr *)p->payload;
|
||||||
tcphdr->src = htons(pcb->local_port);
|
tcphdr->src = htons(pcb->local_port);
|
||||||
tcphdr->dest = htons(pcb->remote_port);
|
tcphdr->dest = htons(pcb->remote_port);
|
||||||
tcphdr->seqno = seqno_be;
|
tcphdr->seqno = seqno_be;
|
||||||
@ -218,7 +218,7 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
|||||||
seglen = left > (pcb->mss - optlen) ? (pcb->mss - optlen) : left;
|
seglen = left > (pcb->mss - optlen) ? (pcb->mss - optlen) : left;
|
||||||
|
|
||||||
/* Allocate memory for tcp_seg, and fill in fields. */
|
/* Allocate memory for tcp_seg, and fill in fields. */
|
||||||
seg = memp_malloc(MEMP_TCP_SEG);
|
seg = (struct tcp_seg *)memp_malloc(MEMP_TCP_SEG);
|
||||||
if (seg == NULL) {
|
if (seg == NULL) {
|
||||||
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS,
|
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_LEVEL_SERIOUS,
|
||||||
("tcp_enqueue: could not allocate memory for tcp_seg\n"));
|
("tcp_enqueue: could not allocate memory for tcp_seg\n"));
|
||||||
@ -308,7 +308,7 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
|
|||||||
TCP_STATS_INC(tcp.err);
|
TCP_STATS_INC(tcp.err);
|
||||||
goto memerr;
|
goto memerr;
|
||||||
}
|
}
|
||||||
seg->tcphdr = seg->p->payload;
|
seg->tcphdr = (struct tcp_hdr *)seg->p->payload;
|
||||||
seg->tcphdr->src = htons(pcb->local_port);
|
seg->tcphdr->src = htons(pcb->local_port);
|
||||||
seg->tcphdr->dest = htons(pcb->remote_port);
|
seg->tcphdr->dest = htons(pcb->remote_port);
|
||||||
seg->tcphdr->seqno = htonl(seqno);
|
seg->tcphdr->seqno = htonl(seqno);
|
||||||
@ -781,7 +781,7 @@ tcp_rst(u32_t seqno, u32_t ackno,
|
|||||||
LWIP_ASSERT("check that first pbuf can hold struct tcp_hdr",
|
LWIP_ASSERT("check that first pbuf can hold struct tcp_hdr",
|
||||||
(p->len >= sizeof(struct tcp_hdr)));
|
(p->len >= sizeof(struct tcp_hdr)));
|
||||||
|
|
||||||
tcphdr = p->payload;
|
tcphdr = (struct tcp_hdr *)p->payload;
|
||||||
tcphdr->src = htons(local_port);
|
tcphdr->src = htons(local_port);
|
||||||
tcphdr->dest = htons(remote_port);
|
tcphdr->dest = htons(remote_port);
|
||||||
tcphdr->seqno = htonl(seqno);
|
tcphdr->seqno = htonl(seqno);
|
||||||
|
@ -263,7 +263,7 @@ sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg)
|
|||||||
{
|
{
|
||||||
struct sys_timeo *timeout, *t;
|
struct sys_timeo *timeout, *t;
|
||||||
|
|
||||||
timeout = memp_malloc(MEMP_SYS_TIMEOUT);
|
timeout = (struct sys_timeo *)memp_malloc(MEMP_SYS_TIMEOUT);
|
||||||
if (timeout == NULL) {
|
if (timeout == NULL) {
|
||||||
LWIP_ASSERT("sys_timeout: timeout != NULL, pool MEMP_SYS_TIMEOUT is empty", timeout != NULL);
|
LWIP_ASSERT("sys_timeout: timeout != NULL, pool MEMP_SYS_TIMEOUT is empty", timeout != NULL);
|
||||||
return;
|
return;
|
||||||
|
@ -96,7 +96,7 @@ udp_input(struct pbuf *p, struct netif *inp)
|
|||||||
|
|
||||||
UDP_STATS_INC(udp.recv);
|
UDP_STATS_INC(udp.recv);
|
||||||
|
|
||||||
iphdr = p->payload;
|
iphdr = (struct ip_hdr *)p->payload;
|
||||||
|
|
||||||
/* Check minimum length (IP header + UDP header)
|
/* Check minimum length (IP header + UDP header)
|
||||||
* and move payload pointer to UDP header */
|
* and move payload pointer to UDP header */
|
||||||
@ -450,7 +450,7 @@ udp_sendto_if(struct udp_pcb *pcb, struct pbuf *p,
|
|||||||
LWIP_ASSERT("check that first pbuf can hold struct udp_hdr",
|
LWIP_ASSERT("check that first pbuf can hold struct udp_hdr",
|
||||||
(q->len >= sizeof(struct udp_hdr)));
|
(q->len >= sizeof(struct udp_hdr)));
|
||||||
/* q now represents the packet to be sent */
|
/* q now represents the packet to be sent */
|
||||||
udphdr = q->payload;
|
udphdr = (struct udp_hdr *)q->payload;
|
||||||
udphdr->src = htons(pcb->local_port);
|
udphdr->src = htons(pcb->local_port);
|
||||||
udphdr->dest = htons(dst_port);
|
udphdr->dest = htons(dst_port);
|
||||||
/* in UDP, 0 checksum means 'no checksum' */
|
/* in UDP, 0 checksum means 'no checksum' */
|
||||||
@ -809,7 +809,7 @@ struct udp_pcb *
|
|||||||
udp_new(void)
|
udp_new(void)
|
||||||
{
|
{
|
||||||
struct udp_pcb *pcb;
|
struct udp_pcb *pcb;
|
||||||
pcb = memp_malloc(MEMP_UDP_PCB);
|
pcb = (struct udp_pcb *)memp_malloc(MEMP_UDP_PCB);
|
||||||
/* could allocate UDP PCB? */
|
/* could allocate UDP PCB? */
|
||||||
if (pcb != NULL) {
|
if (pcb != NULL) {
|
||||||
/* UDP Lite: by initializing to all zeroes, chksum_len is set to 0
|
/* UDP Lite: by initializing to all zeroes, chksum_len is set to 0
|
||||||
|
@ -430,7 +430,7 @@ find_entry(struct ip_addr *ipaddr, u8_t flags)
|
|||||||
static err_t
|
static err_t
|
||||||
etharp_send_ip(struct netif *netif, struct pbuf *p, struct eth_addr *src, struct eth_addr *dst)
|
etharp_send_ip(struct netif *netif, struct pbuf *p, struct eth_addr *src, struct eth_addr *dst)
|
||||||
{
|
{
|
||||||
struct eth_hdr *ethhdr = p->payload;
|
struct eth_hdr *ethhdr = (struct eth_hdr *)p->payload;
|
||||||
u8_t k;
|
u8_t k;
|
||||||
|
|
||||||
LWIP_ASSERT("netif->hwaddr_len must be the same as ETHARP_HWADDR_LEN for etharp!",
|
LWIP_ASSERT("netif->hwaddr_len must be the same as ETHARP_HWADDR_LEN for etharp!",
|
||||||
@ -587,7 +587,7 @@ etharp_ip_input(struct netif *netif, struct pbuf *p)
|
|||||||
LWIP_ERROR("netif != NULL", (netif != NULL), return;);
|
LWIP_ERROR("netif != NULL", (netif != NULL), return;);
|
||||||
/* Only insert an entry if the source IP address of the
|
/* Only insert an entry if the source IP address of the
|
||||||
incoming IP packet comes from a host on the local network. */
|
incoming IP packet comes from a host on the local network. */
|
||||||
ethhdr = p->payload;
|
ethhdr = (struct eth_hdr *)p->payload;
|
||||||
iphdr = (struct ip_hdr *)((u8_t*)ethhdr + SIZEOF_ETH_HDR);
|
iphdr = (struct ip_hdr *)((u8_t*)ethhdr + SIZEOF_ETH_HDR);
|
||||||
#if ETHARP_SUPPORT_VLAN
|
#if ETHARP_SUPPORT_VLAN
|
||||||
if (ethhdr->type == ETHTYPE_VLAN) {
|
if (ethhdr->type == ETHTYPE_VLAN) {
|
||||||
@ -651,7 +651,7 @@ etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ethhdr = p->payload;
|
ethhdr = (struct eth_hdr *)p->payload;
|
||||||
hdr = (struct etharp_hdr *)((u8_t*)ethhdr + SIZEOF_ETH_HDR);
|
hdr = (struct etharp_hdr *)((u8_t*)ethhdr + SIZEOF_ETH_HDR);
|
||||||
#if ETHARP_SUPPORT_VLAN
|
#if ETHARP_SUPPORT_VLAN
|
||||||
if (ethhdr->type == ETHTYPE_VLAN) {
|
if (ethhdr->type == ETHTYPE_VLAN) {
|
||||||
@ -988,7 +988,7 @@ etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
|
|||||||
/* queue packet ... */
|
/* queue packet ... */
|
||||||
struct etharp_q_entry *new_entry;
|
struct etharp_q_entry *new_entry;
|
||||||
/* allocate a new arp queue entry */
|
/* allocate a new arp queue entry */
|
||||||
new_entry = memp_malloc(MEMP_ARP_QUEUE);
|
new_entry = (struct etharp_q_entry *)memp_malloc(MEMP_ARP_QUEUE);
|
||||||
if (new_entry != NULL) {
|
if (new_entry != NULL) {
|
||||||
new_entry->next = 0;
|
new_entry->next = 0;
|
||||||
new_entry->p = p;
|
new_entry->p = p;
|
||||||
@ -1073,7 +1073,7 @@ etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr,
|
|||||||
LWIP_ASSERT("check that first pbuf can hold struct etharp_hdr",
|
LWIP_ASSERT("check that first pbuf can hold struct etharp_hdr",
|
||||||
(p->len >= SIZEOF_ETHARP_PACKET));
|
(p->len >= SIZEOF_ETHARP_PACKET));
|
||||||
|
|
||||||
ethhdr = p->payload;
|
ethhdr = (struct eth_hdr *)p->payload;
|
||||||
hdr = (struct etharp_hdr *)((u8_t*)ethhdr + SIZEOF_ETH_HDR);
|
hdr = (struct etharp_hdr *)((u8_t*)ethhdr + SIZEOF_ETH_HDR);
|
||||||
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_raw: sending raw ARP packet.\n"));
|
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_raw: sending raw ARP packet.\n"));
|
||||||
hdr->opcode = htons(opcode);
|
hdr->opcode = htons(opcode);
|
||||||
@ -1154,7 +1154,7 @@ ethernet_input(struct pbuf *p, struct netif *netif)
|
|||||||
u16_t type;
|
u16_t type;
|
||||||
|
|
||||||
/* points to packet payload, which starts with an Ethernet header */
|
/* points to packet payload, which starts with an Ethernet header */
|
||||||
ethhdr = p->payload;
|
ethhdr = (struct eth_hdr *)p->payload;
|
||||||
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE,
|
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE,
|
||||||
("ethernet_input: dest:%02x:%02x:%02x:%02x:%02x:%02x, src:%02x:%02x:%02x:%02x:%02x:%02x, type:%2hx\n",
|
("ethernet_input: dest:%02x:%02x:%02x:%02x:%02x:%02x, src:%02x:%02x:%02x:%02x:%02x:%02x, type:%2hx\n",
|
||||||
(unsigned)ethhdr->dest.addr[0], (unsigned)ethhdr->dest.addr[1], (unsigned)ethhdr->dest.addr[2],
|
(unsigned)ethhdr->dest.addr[0], (unsigned)ethhdr->dest.addr[1], (unsigned)ethhdr->dest.addr[2],
|
||||||
|
Loading…
Reference in New Issue
Block a user