summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2024-10-16 08:12:28 -0600
committerTom Rini <[email protected]>2024-10-16 11:11:57 -0600
commit608a31bdec6284ad6f821226e4c62c9cd3052874 (patch)
treec43e6664c7530f354f73c05cb817e37d10d93615 /lib
parent1ca0ddb643f3b152439f7bb8f6ee3f5826d7102d (diff)
parent4820cb4b16c44ec332b18dbe7207ddd8c0a1d446 (diff)
Merge patch series "Introduce the lwIP network stack"
Jerome Forissier <[email protected]> says: This is a rework of a patch series by Maxim Uvarov: "net/lwip: add lwip library for the network stack" [1]. The goal is to introduce the lwIP TCP/IP stack [2] [3] as an alternative to the current implementation in net/, selectable with Kconfig, and ultimately keep only lwIP if possible. Some reasons for doing so are: - Make the support of HTTPS in the wget command easier. Javier T. and Raymond M. (CC'd) have some additional lwIP and Mbed TLS patches to do so. With that it becomes possible to fetch and launch a distro installer such as Debian etc. using a secure, authenticated connection directly from the U-Boot shell. Several use cases: * Authentication: prevent MITM attack (third party replacing the binary with a different one) * Confidentiality: prevent third parties from grabbing a copy of the image as it is being downloaded * Allow connection to servers that do not support plain HTTP anymore (this is becoming more and more common on the Internet these days) - Possibly benefit from additional features implemented in lwIP - Less code to maintain in U-Boot Prior to applying this series, the lwIP stack needs to be added as a Git subtree with the following command: $ git subtree add --squash --prefix lib/lwip/lwip \ https://github.com/lwip-tcpip/lwip.git STABLE-2_2_0_RELEASE Notes 1. A number of features are currently incompatible with NET_LWIP: DFU_TFTP, FASTBOOT, SPL_NET, ETH_SANDBOX, ETH_SANDBOX_RAW, DM_ETH. They all make assumptions on how the network stack is implemented and/or pull sybols that are not trivially exported from lwIP. Some interface rework may be needed. 2. Due to the above, and in order to provide some level of testing of the lwIP code in CI even when the legacy NET is the default, a new QEMU configuration is introduced (qemu_arm64_lwip_defconfig) which is based on qemu_arm64_defconfig with NET_LWIP and CMD_*_LWIP enabled. In addition to that, this series has some [TESTING] patches which make NET_LWIP the default. [1] https://lore.kernel.org/all/[email protected]/ [2] https://www.nongnu.org/lwip/ [3] https://en.wikipedia.org/wiki/LwIP Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile2
-rw-r--r--lib/binman.c1
-rw-r--r--lib/lwip/Makefile55
-rw-r--r--lib/lwip/lwip/src/apps/tftp/tftp.c102
-rw-r--r--lib/lwip/lwip/src/include/lwip/apps/tftp_client.h1
-rw-r--r--lib/lwip/u-boot/arch/cc.h45
-rw-r--r--lib/lwip/u-boot/arch/sys_arch.h0
-rw-r--r--lib/lwip/u-boot/limits.h0
-rw-r--r--lib/lwip/u-boot/lwipopts.h157
-rw-r--r--lib/tiny-printf.c3
10 files changed, 355 insertions, 11 deletions
diff --git a/lib/Makefile b/lib/Makefile
index 3fc428cff1d..dbcfa87ebd6 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -99,6 +99,8 @@ obj-$(CONFIG_$(PHASE_)OF_REAL) += fdtdec_common.o fdtdec.o
obj-$(CONFIG_MBEDTLS_LIB) += mbedtls/
+obj-$(CONFIG_NET_LWIP) += lwip/
+
ifdef CONFIG_XPL_BUILD
obj-$(CONFIG_SPL_YMODEM_SUPPORT) += crc16-ccitt.o
obj-$(CONFIG_$(PHASE_)HASH) += crc16-ccitt.o
diff --git a/lib/binman.c b/lib/binman.c
index 9047f5275f3..93d85548116 100644
--- a/lib/binman.c
+++ b/lib/binman.c
@@ -137,6 +137,7 @@ int binman_init(void)
{
int ret;
+ return 0;
binman = malloc(sizeof(struct binman_info));
if (!binman)
return log_msg_ret("space for binman", -ENOMEM);
diff --git a/lib/lwip/Makefile b/lib/lwip/Makefile
new file mode 100644
index 00000000000..dfcd700ca47
--- /dev/null
+++ b/lib/lwip/Makefile
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2024 Linaro Ltd.
+
+obj-y += \
+ lwip/src/api/api_lib.o \
+ lwip/src/api/api_msg.o \
+ lwip/src/api/err.o \
+ lwip/src/api/if_api.o \
+ lwip/src/api/netbuf.o \
+ lwip/src/api/netdb.o \
+ lwip/src/api/netifapi.o \
+ lwip/src/api/sockets.o \
+ lwip/src/api/tcpip.o \
+ lwip/src/apps/http/http_client.o \
+ lwip/src/apps/tftp/tftp.o \
+ lwip/src/core/altcp_alloc.o \
+ lwip/src/core/altcp.o \
+ lwip/src/core/altcp_tcp.o \
+ lwip/src/core/def.o \
+ lwip/src/core/dns.o \
+ lwip/src/core/inet_chksum.o \
+ lwip/src/core/init.o \
+ lwip/src/core/ip.o \
+ lwip/src/core/ipv4/acd.o \
+ lwip/src/core/ipv4/autoip.o \
+ lwip/src/core/ipv4/dhcp.o \
+ lwip/src/core/ipv4/etharp.o \
+ lwip/src/core/ipv4/icmp.o \
+ lwip/src/core/ipv4/igmp.o \
+ lwip/src/core/ipv4/ip4_addr.o \
+ lwip/src/core/ipv4/ip4.o \
+ lwip/src/core/ipv4/ip4_frag.o \
+ lwip/src/core/ipv6/dhcp6.o \
+ lwip/src/core/ipv6/ethip6.o \
+ lwip/src/core/ipv6/icmp6.o \
+ lwip/src/core/ipv6/inet6.o \
+ lwip/src/core/ipv6/ip6_addr.o \
+ lwip/src/core/ipv6/ip6.o \
+ lwip/src/core/ipv6/ip6_frag.o \
+ lwip/src/core/ipv6/mld6.o \
+ lwip/src/core/ipv6/nd6.o \
+ lwip/src/core/mem.o \
+ lwip/src/core/memp.o \
+ lwip/src/core/netif.o \
+ lwip/src/core/pbuf.o \
+ lwip/src/core/raw.o \
+ lwip/src/core/stats.o \
+ lwip/src/core/sys.o \
+ lwip/src/core/tcp.o \
+ lwip/src/core/tcp_in.o \
+ lwip/src/core/tcp_out.o \
+ lwip/src/core/timeouts.o \
+ lwip/src/core/udp.o \
+ lwip/src/netif/ethernet.o
diff --git a/lib/lwip/lwip/src/apps/tftp/tftp.c b/lib/lwip/lwip/src/apps/tftp/tftp.c
index ddfdbfc0c1b..56aeabc4d73 100644
--- a/lib/lwip/lwip/src/apps/tftp/tftp.c
+++ b/lib/lwip/lwip/src/apps/tftp/tftp.c
@@ -57,7 +57,7 @@
#include "lwip/timeouts.h"
#include "lwip/debug.h"
-#define TFTP_MAX_PAYLOAD_SIZE 512
+#define TFTP_DEFAULT_BLOCK_SIZE 512
#define TFTP_HEADER_LENGTH 4
#define TFTP_RRQ 1
@@ -65,6 +65,7 @@
#define TFTP_DATA 3
#define TFTP_ACK 4
#define TFTP_ERROR 5
+#define TFTP_OACK 6
enum tftp_error {
TFTP_ERROR_FILE_NOT_FOUND = 1,
@@ -88,9 +89,11 @@ struct tftp_state {
int timer;
int last_pkt;
u16_t blknum;
+ u16_t blksize;
u8_t retries;
u8_t mode_write;
u8_t tftp_mode;
+ bool wait_oack;
};
static struct tftp_state tftp_state;
@@ -137,10 +140,22 @@ send_request(const ip_addr_t *addr, u16_t port, u16_t opcode, const char* fname,
{
size_t fname_length = strlen(fname)+1;
size_t mode_length = strlen(mode)+1;
- struct pbuf* p = init_packet(opcode, 0, fname_length + mode_length - 2);
+ size_t blksize_length = 0;
+ int blksize = tftp_state.blksize;
+ struct pbuf* p;
char* payload;
err_t ret;
+ if (blksize) {
+ /* 'blksize\0'.\0" with . = 1 digit */
+ blksize_length = strlen("blksize") + 1 + 1 + 1;
+ while (blksize >= 10) {
+ blksize /= 10;
+ blksize_length++;
+ }
+ }
+
+ p = init_packet(opcode, 0, fname_length + mode_length + blksize_length - 2);
if (p == NULL) {
return ERR_MEM;
}
@@ -148,7 +163,10 @@ send_request(const ip_addr_t *addr, u16_t port, u16_t opcode, const char* fname,
payload = (char*) p->payload;
MEMCPY(payload+2, fname, fname_length);
MEMCPY(payload+2+fname_length, mode, mode_length);
+ if (tftp_state.blksize)
+ sprintf(payload+2+fname_length+mode_length, "blksize%c%d%c", 0, tftp_state.blksize, 0);
+ tftp_state.wait_oack = true;
ret = udp_sendto(tftp_state.upcb, p, addr, port);
pbuf_free(p);
return ret;
@@ -221,14 +239,14 @@ send_data(const ip_addr_t *addr, u16_t port)
pbuf_free(tftp_state.last_data);
}
- tftp_state.last_data = init_packet(TFTP_DATA, tftp_state.blknum, TFTP_MAX_PAYLOAD_SIZE);
+ tftp_state.last_data = init_packet(TFTP_DATA, tftp_state.blknum, TFTP_DEFAULT_BLOCK_SIZE);
if (tftp_state.last_data == NULL) {
return;
}
payload = (u16_t *) tftp_state.last_data->payload;
- ret = tftp_state.ctx->read(tftp_state.handle, &payload[2], TFTP_MAX_PAYLOAD_SIZE);
+ ret = tftp_state.ctx->read(tftp_state.handle, &payload[2], TFTP_DEFAULT_BLOCK_SIZE);
if (ret < 0) {
send_error(addr, port, TFTP_ERROR_ACCESS_VIOLATION, "Error occurred while reading the file.");
close_handle();
@@ -239,6 +257,28 @@ send_data(const ip_addr_t *addr, u16_t port)
resend_data(addr, port);
}
+static u16_t payload_size(void)
+{
+ if (tftp_state.blksize)
+ return tftp_state.blksize;
+ return TFTP_DEFAULT_BLOCK_SIZE;
+}
+
+static const char *
+find_option(struct pbuf *p, const char *option)
+{
+ int i;
+ u16_t optlen = strlen(option);
+ const char *b = p->payload;
+
+ for (i = 0; i + optlen + 1 < p->len; i++) {
+ if (lwip_strnstr(b + i, option, optlen))
+ return b + i + optlen + 2;
+ }
+
+ return NULL;
+}
+
static void
tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port)
{
@@ -338,6 +378,15 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr
}
blknum = lwip_ntohs(sbuf[1]);
+ if (tftp_state.blksize && tftp_state.wait_oack) {
+ /*
+ * Data received while we are expecting an OACK for our blksize option.
+ * This means the server doesn't support it, let's switch back to the
+ * default block size.
+ */
+ tftp_state.blksize = 0;
+ tftp_state.wait_oack = false;
+ }
if (blknum == tftp_state.blknum) {
pbuf_remove_header(p, TFTP_HEADER_LENGTH);
@@ -349,7 +398,7 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr
send_ack(addr, port, blknum);
}
- if (p->tot_len < TFTP_MAX_PAYLOAD_SIZE) {
+ if (p->tot_len < payload_size()) {
close_handle();
} else {
tftp_state.blknum++;
@@ -386,7 +435,7 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr
lastpkt = 0;
if (tftp_state.last_data != NULL) {
- lastpkt = tftp_state.last_data->tot_len != (TFTP_MAX_PAYLOAD_SIZE + TFTP_HEADER_LENGTH);
+ lastpkt = tftp_state.last_data->tot_len != (TFTP_DEFAULT_BLOCK_SIZE + TFTP_HEADER_LENGTH);
}
if (!lastpkt) {
@@ -405,6 +454,25 @@ tftp_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr
close_handle();
}
break;
+ case PP_HTONS(TFTP_OACK): {
+ const char *optval = find_option(p, "blksize");
+ u16_t srv_blksize = 0;
+ tftp_state.wait_oack = false;
+ if (optval) {
+ if (!tftp_state.blksize) {
+ /* We did not request this option */
+ send_error(addr, port, TFTP_ERROR_ILLEGAL_OPERATION, "blksize unexpected");
+ }
+ srv_blksize = atoi(optval);
+ if (srv_blksize <= 0 || srv_blksize > tftp_state.blksize) {
+ send_error(addr, port, TFTP_ERROR_ILLEGAL_OPERATION, "Invalid blksize");
+ }
+ LWIP_DEBUGF(TFTP_DEBUG | LWIP_DBG_STATE, ("tftp: accepting blksize=%d\n", srv_blksize));
+ tftp_state.blksize = srv_blksize;
+ }
+ send_ack(addr, port, 0);
+ break;
+ }
default:
send_error(addr, port, TFTP_ERROR_ILLEGAL_OPERATION, "Unknown operation");
break;
@@ -454,10 +522,12 @@ tftp_init_common(u8_t mode, const struct tftp_context *ctx)
return ERR_MEM;
}
- ret = udp_bind(pcb, IP_ANY_TYPE, TFTP_PORT);
- if (ret != ERR_OK) {
- udp_remove(pcb);
- return ret;
+ if (mode == LWIP_TFTP_MODE_SERVER) {
+ ret = udp_bind(pcb, IP_ANY_TYPE, TFTP_PORT);
+ if (ret != ERR_OK) {
+ udp_remove(pcb);
+ return ret;
+ }
}
tftp_state.handle = NULL;
@@ -494,6 +564,18 @@ tftp_init_client(const struct tftp_context *ctx)
}
/** @ingroup tftp
+ * Set the block size to be used by the TFTP client. The server may choose to
+ * accept a lower value.
+ * @param blksize Block size in bytes
+ */
+void
+tftp_client_set_blksize(u16_t blksize)
+{
+ if (blksize != TFTP_DEFAULT_BLOCK_SIZE)
+ tftp_state.blksize = blksize;
+}
+
+/** @ingroup tftp
* Deinitialize ("turn off") TFTP client/server.
*/
void tftp_cleanup(void)
diff --git a/lib/lwip/lwip/src/include/lwip/apps/tftp_client.h b/lib/lwip/lwip/src/include/lwip/apps/tftp_client.h
index 24dbda6a8c9..e1e21d06b67 100644
--- a/lib/lwip/lwip/src/include/lwip/apps/tftp_client.h
+++ b/lib/lwip/lwip/src/include/lwip/apps/tftp_client.h
@@ -44,6 +44,7 @@ enum tftp_transfer_mode {
};
err_t tftp_init_client(const struct tftp_context* ctx);
+void tftp_client_set_blksize(u16_t blksize);
err_t tftp_get(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, enum tftp_transfer_mode mode);
err_t tftp_put(void* handle, const ip_addr_t *addr, u16_t port, const char* fname, enum tftp_transfer_mode mode);
diff --git a/lib/lwip/u-boot/arch/cc.h b/lib/lwip/u-boot/arch/cc.h
new file mode 100644
index 00000000000..563d3bfa98b
--- /dev/null
+++ b/lib/lwip/u-boot/arch/cc.h
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (C) 2023 Linaro Ltd. <[email protected]> */
+
+#ifndef LWIP_ARCH_CC_H
+#define LWIP_ARCH_CC_H
+
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <vsprintf.h>
+#include <rand.h>
+
+#define LWIP_ERRNO_INCLUDE <errno.h>
+
+#define LWIP_ERRNO_STDINCLUDE 1
+#define LWIP_NO_UNISTD_H 1
+#define LWIP_TIMEVAL_PRIVATE 1
+
+#ifdef CONFIG_LIB_RAND
+#define LWIP_RAND() ((u32_t)rand())
+#else
+#define LWIP_DNS_SECURE 0
+#endif
+
+/* different handling for unit test, normally not needed */
+#ifdef LWIP_NOASSERT_ON_ERROR
+#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
+ handler; }} while (0)
+#endif
+
+#define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS
+
+#define LWIP_PLATFORM_ASSERT(x) do {printf("Assertion \"%s\" failed at line %d in %s\n", \
+ x, __LINE__, __FILE__); } while (0)
+
+#define atoi(str) (int)dectoul(str, NULL)
+#define lwip_strnstr(a, b, c) strstr(a, b)
+
+#define LWIP_ERR_T int
+#define LWIP_CONST_CAST(target_type, val) ((target_type)((uintptr_t)val))
+
+#if defined(CONFIG_SYS_BIG_ENDIAN)
+#define BYTE_ORDER BIG_ENDIAN
+#endif
+
+#endif /* LWIP_ARCH_CC_H */
diff --git a/lib/lwip/u-boot/arch/sys_arch.h b/lib/lwip/u-boot/arch/sys_arch.h
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/lib/lwip/u-boot/arch/sys_arch.h
diff --git a/lib/lwip/u-boot/limits.h b/lib/lwip/u-boot/limits.h
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/lib/lwip/u-boot/limits.h
diff --git a/lib/lwip/u-boot/lwipopts.h b/lib/lwip/u-boot/lwipopts.h
new file mode 100644
index 00000000000..9d618625fac
--- /dev/null
+++ b/lib/lwip/u-boot/lwipopts.h
@@ -0,0 +1,157 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+/* Copyright (C) 2023 Linaro Ltd. <[email protected]> */
+
+#ifndef LWIP_UBOOT_LWIPOPTS_H
+#define LWIP_UBOOT_LWIPOPTS_H
+
+#if defined(CONFIG_LWIP_DEBUG)
+#define LWIP_DEBUG 1
+#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL
+#define LWIP_DBG_TYPES_ON LWIP_DBG_ON
+#define ETHARP_DEBUG LWIP_DBG_ON
+#define NETIF_DEBUG LWIP_DBG_ON
+#define PBUF_DEBUG LWIP_DBG_OFF
+#define API_LIB_DEBUG LWIP_DBG_ON
+#define API_MSG_DEBUG LWIP_DBG_OFF
+#define SOCKETS_DEBUG LWIP_DBG_OFF
+#define ICMP_DEBUG LWIP_DBG_OFF
+#define IGMP_DEBUG LWIP_DBG_OFF
+#define INET_DEBUG LWIP_DBG_OFF
+#define IP_DEBUG LWIP_DBG_ON
+#define IP_REASS_DEBUG LWIP_DBG_OFF
+#define RAW_DEBUG LWIP_DBG_OFF
+#define MEM_DEBUG LWIP_DBG_OFF
+#define MEMP_DEBUG LWIP_DBG_OFF
+#define SYS_DEBUG LWIP_DBG_OFF
+#define TIMERS_DEBUG LWIP_DBG_ON
+#define TCP_DEBUG LWIP_DBG_OFF
+#define TCP_INPUT_DEBUG LWIP_DBG_OFF
+#define TCP_FR_DEBUG LWIP_DBG_OFF
+#define TCP_RTO_DEBUG LWIP_DBG_OFF
+#define TCP_CWND_DEBUG LWIP_DBG_OFF
+#define TCP_WND_DEBUG LWIP_DBG_OFF
+#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF
+#define TCP_RST_DEBUG LWIP_DBG_OFF
+#define TCP_QLEN_DEBUG LWIP_DBG_OFF
+#define UDP_DEBUG LWIP_DBG_OFF
+#define TCPIP_DEBUG LWIP_DBG_OFF
+#define SLIP_DEBUG LWIP_DBG_OFF
+#define DHCP_DEBUG LWIP_DBG_ON
+#define AUTOIP_DEBUG LWIP_DBG_ON
+#define DNS_DEBUG LWIP_DBG_ON
+#define IP6_DEBUG LWIP_DBG_OFF
+#define DHCP6_DEBUG LWIP_DBG_OFF
+#endif
+
+#define LWIP_TESTMODE 0
+
+#if !defined(CONFIG_LWIP_ASSERT)
+#define LWIP_NOASSERT 1
+#define LWIP_ASSERT(message, assertion)
+#endif
+
+#include "lwip/debug.h"
+
+#define SYS_LIGHTWEIGHT_PROT 0
+#define NO_SYS 1
+
+#define LWIP_IPV4 1
+#define LWIP_IPV6 0
+
+#define MEM_ALIGNMENT 8
+
+#define MEMP_NUM_TCP_SEG 16
+#define PBUF_POOL_SIZE 8
+
+#define LWIP_ARP 1
+#define ARP_TABLE_SIZE 4
+#define ARP_QUEUEING 1
+
+#define IP_FORWARD 0
+#define IP_OPTIONS_ALLOWED 1
+#define IP_REASSEMBLY 0
+#define IP_FRAG 0
+#define IP_REASS_MAXAGE 3
+#define IP_REASS_MAX_PBUFS 4
+#define IP_FRAG_USES_STATIC_BUF 0
+
+#define IP_DEFAULT_TTL 255
+
+#define LWIP_ICMP 0
+
+#if defined(CONFIG_PROT_RAW_LWIP)
+#define LWIP_RAW 1
+#else
+#define LWIP_RAW 0
+#endif
+
+#if defined(CONFIG_PROT_DHCP_LWIP)
+#define LWIP_DHCP 1
+#define LWIP_DHCP_BOOTP_FILE 1
+#else
+#define LWIP_DHCP 0
+#endif
+
+#define LWIP_DHCP_DOES_ACD_CHECK 0
+
+#define LWIP_AUTOIP 0
+
+#define LWIP_SNMP 0
+
+#define LWIP_IGMP 0
+
+#if defined(CONFIG_PROT_DNS_LWIP)
+#define LWIP_DNS 1
+#define DNS_TABLE_SIZE 1
+#else
+#define LWIP_DNS 0
+#endif
+
+#if defined(CONFIG_PROT_UDP_LWIP)
+#define LWIP_UDP 1
+#else
+#define LWIP_UDP 0
+#endif
+
+#if defined(CONFIG_PROT_TCP_LWIP)
+#define LWIP_TCP 1
+#define TCP_MSS 1460
+#define TCP_WND CONFIG_LWIP_TCP_WND
+#define LWIP_WND_SCALE 1
+#define TCP_RCV_SCALE 0x7
+#define TCP_SND_BUF (2 * TCP_MSS)
+#ifdef CONFIG_PROT_TCP_SACK_LWIP
+#define LWIP_TCP_SACK_OUT 1
+#endif
+#else
+#define LWIP_TCP 0
+#endif
+
+#define LWIP_LISTEN_BACKLOG 0
+
+#define PBUF_LINK_HLEN 14
+#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS + 40 + PBUF_LINK_HLEN)
+
+#define LWIP_HAVE_LOOPIF 0
+
+#define LWIP_NETCONN 0
+#define LWIP_DISABLE_MEMP_SANITY_CHECKS 1
+
+#define LWIP_SOCKET 0
+#define SO_REUSE 0
+
+#define LWIP_STATS 0
+
+#define PPP_SUPPORT 0
+
+#define LWIP_TCPIP_CORE_LOCKING 0
+
+#define LWIP_NETIF_LOOPBACK 0
+
+/* use malloc instead of pool */
+#define MEMP_MEM_MALLOC 1
+#define MEMP_MEM_INIT 1
+#define MEM_LIBC_MALLOC 1
+
+#endif /* LWIP_UBOOT_LWIPOPTS_H */
diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
index 64dee779c4a..cc1dfe61cf7 100644
--- a/lib/tiny-printf.c
+++ b/lib/tiny-printf.c
@@ -269,7 +269,8 @@ static int _vprintf(struct printf_info *info, const char *fmt, va_list va)
}
break;
case 'p':
- if (CONFIG_IS_ENABLED(NET) || _DEBUG) {
+ if (CONFIG_IS_ENABLED(NET) ||
+ CONFIG_IS_ENABLED(NET_LWIP) || _DEBUG) {
pointer(info, fmt, va_arg(va, void *));
/*
* Skip this because it pulls in _ctype which is