diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index 8cfb3df9..10d5b304 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -845,8 +845,10 @@ err_t tcp_send_empty_ack(struct tcp_pcb *pcb) { struct pbuf *p; - struct tcp_hdr *tcphdr; u8_t optlen = 0; +#if LWIP_TCP_TIMESTAMPS || CHECKSUM_GEN_TCP + struct tcp_hdr *tcphdr; +#endif /* LWIP_TCP_TIMESTAMPS || CHECKSUM_GEN_TCP */ #if LWIP_TCP_TIMESTAMPS if (pcb->flags & TF_TIMESTAMP) { @@ -859,7 +861,9 @@ tcp_send_empty_ack(struct tcp_pcb *pcb) LWIP_DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_output: (ACK) could not allocate pbuf\n")); return ERR_BUF; } +#if LWIP_TCP_TIMESTAMPS || CHECKSUM_GEN_TCP tcphdr = (struct tcp_hdr *)p->payload; +#endif /* LWIP_TCP_TIMESTAMPS || CHECKSUM_GEN_TCP */ LWIP_DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_output: sending ACK for %"U32_F"\n", pcb->rcv_nxt)); /* remove ACK flags from the PCB, as we send an empty ACK now */ diff --git a/src/core/udp.c b/src/core/udp.c index bba4a1ce..ac0e56d1 100644 --- a/src/core/udp.c +++ b/src/core/udp.c @@ -509,7 +509,7 @@ udp_send(struct udp_pcb *pcb, struct pbuf *p) return udp_sendto(pcb, p, ipX_2_ip(&pcb->remote_ip), pcb->remote_port); } -#if LWIP_CHECKSUM_ON_COPY +#if LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP /** Same as udp_send() but with checksum */ err_t @@ -520,7 +520,7 @@ udp_send_chksum(struct udp_pcb *pcb, struct pbuf *p, return udp_sendto_chksum(pcb, p, ipX_2_ip(&pcb->remote_ip), pcb->remote_port, have_chksum, chksum); } -#endif /* LWIP_CHECKSUM_ON_COPY */ +#endif /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */ /** * Send data to a specified address using UDP. @@ -543,7 +543,7 @@ err_t udp_sendto(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip, u16_t dst_port) { -#if LWIP_CHECKSUM_ON_COPY +#if LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP return udp_sendto_chksum(pcb, p, dst_ip, dst_port, 0, 0); } @@ -552,7 +552,7 @@ err_t udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip, u16_t dst_port, u8_t have_chksum, u16_t chksum) { -#endif /* LWIP_CHECKSUM_ON_COPY */ +#endif /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */ struct netif *netif; ipX_addr_t *dst_ip_route = ip_2_ipX(dst_ip); @@ -585,11 +585,11 @@ udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip, UDP_STATS_INC(udp.rterr); return ERR_RTE; } -#if LWIP_CHECKSUM_ON_COPY +#if LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP return udp_sendto_if_chksum(pcb, p, dst_ip, dst_port, netif, have_chksum, chksum); -#else /* LWIP_CHECKSUM_ON_COPY */ +#else /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */ return udp_sendto_if(pcb, p, dst_ip, dst_port, netif); -#endif /* LWIP_CHECKSUM_ON_COPY */ +#endif /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */ } /** @@ -615,7 +615,7 @@ err_t udp_sendto_if(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif) { -#if LWIP_CHECKSUM_ON_COPY +#if LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP return udp_sendto_if_chksum(pcb, p, dst_ip, dst_port, netif, 0, 0); } @@ -625,7 +625,7 @@ udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif, u8_t have_chksum, u16_t chksum) { -#endif /* LWIP_CHECKSUM_ON_COPY */ +#endif /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */ struct udp_hdr *udphdr; ip_addr_t *src_ip; err_t err; diff --git a/src/include/lwip/udp.h b/src/include/lwip/udp.h index aa1ad3fb..14d5c0ae 100644 --- a/src/include/lwip/udp.h +++ b/src/include/lwip/udp.h @@ -160,7 +160,7 @@ err_t udp_sendto (struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip, u16_t dst_port); err_t udp_send (struct udp_pcb *pcb, struct pbuf *p); -#if LWIP_CHECKSUM_ON_COPY +#if LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP err_t udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif, u8_t have_chksum, @@ -170,7 +170,7 @@ err_t udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, u8_t have_chksum, u16_t chksum); err_t udp_send_chksum(struct udp_pcb *pcb, struct pbuf *p, u8_t have_chksum, u16_t chksum); -#endif /* LWIP_CHECKSUM_ON_COPY */ +#endif /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */ #define udp_flags(pcb) ((pcb)->flags) #define udp_setflags(pcb, f) ((pcb)->flags = (f)) @@ -192,12 +192,12 @@ struct udp_pcb * udp_new_ip6(void); udp_sendto(pcb, pbuf, ip6_2_ip(ip6addr), port) #define udp_sendto_if_ip6(pcb, pbuf, ip6addr, port, netif) \ udp_sendto_if(pcb, pbuf, ip6_2_ip(ip6addr), port, netif) -#if LWIP_CHECKSUM_ON_COPY +#if LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP #define udp_sendto_chksum_ip6(pcb, pbuf, ip6addr, port, have_chk, chksum) \ udp_sendto_chksum(pcb, pbuf, ip6_2_ip(ip6addr), port, have_chk, chksum) #define udp_sendto_if_chksum_ip6(pcb, pbuf, ip6addr, port, netif, have_chk, chksum) \ udp_sendto_if_chksum(pcb, pbuf, ip6_2_ip(ip6addr), port, netif, have_chk, chksum) -#endif /*LWIP_CHECKSUM_ON_COPY */ +#endif /*LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */ #endif /* LWIP_IPV6 */ #if UDP_DEBUG