1 From 3ec7c31a2e5fba79936ca97de3e527f851e34c6b Mon Sep 17 00:00:00 2001
2 From: David van Moolenbroek <david@minix3.org>
3 Date: Thu, 2 Feb 2017 18:58:11 +0000
4 Subject: [PATCH 4/4] MINIX 3 only: avoid large contiguous allocations
6 On MINIX 3, we implement our own pool-based memory management. The
7 maximum buffer size of any one of those pool elements is small: 512
8 bytes, currently. That means that any allocation for larger
9 contiguous sizes will never succeed. This patch deals with one known
10 practical case where this is a problem, namely duplication of incoming
11 UDP packets that should be delivered to more than one UDP PCB. This
12 case can be resolved by using our own pbuf chain allocator.
14 The only remaining currently known case where lwIP performs large
15 contiguous allocations, is in allocating the reply buffer for ICMP
16 ping requests. The result is that our implementation will never
17 respond to ping requests that exceed 512 bytes, which is just fine.
19 src/core/udp.c | 4 ++++
20 1 file changed, 4 insertions(+)
22 diff --git a/src/core/udp.c b/src/core/udp.c
23 index ec4b25f..f53fb66 100644
26 @@ -368,7 +368,11 @@ udp_input(struct pbuf *p, struct netif *inp)
27 pbuf_header_force(p, hdrs_len);
31 + q = pchain_alloc(PBUF_RAW, p->tot_len);
32 +#else /* !defined(__minix) */
33 q = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM);
34 +#endif /* !defined(__minix) */
36 err_t err = pbuf_copy(q, p);