-
Notifications
You must be signed in to change notification settings - Fork 0
/
9010-lwip2.patch
282 lines (259 loc) · 10.4 KB
/
9010-lwip2.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
--- lwip2/makefiles/Makefile.lwip2.orig 2020-06-28 00:58:10.829386795 +0100
+++ lwip2/makefiles/Makefile.lwip2 2020-07-01 23:27:32.579506195 +0100
@@ -3,6 +3,7 @@
OBJ = \
$(patsubst %.c,$(BUILD)/%.o,$(wildcard netif/ethernet.c)) \
+ $(patsubst %.c,$(BUILD)/%.o,$(wildcard netif/ppp/*.c)) \
$(patsubst %.c,$(BUILD)/%.o,$(wildcard core/*.c)) \
$(patsubst %.c,$(BUILD)/%.o,$(wildcard core/ipv4/*.c)) \
$(patsubst %.c,$(BUILD)/%.o,$(wildcard core/ipv6/*.c)) \
--- lwip2/makefiles/Makefile.defs.orig 2020-07-01 23:38:50.530131037 +0100
+++ lwip2/makefiles/Makefile.defs 2020-07-02 22:28:34.984880335 +0100
@@ -22,5 +22,5 @@
OD = $(TOOLS)objdump
BUILD ?= build
-BUILD_FLAGS += -Wall -Wextra -c -O2 -g -Wpointer-arith -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -ffunction-sections -fdata-sections
-BUILD_DEFINES = -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -DLWIP_OPEN_SRC -DLWIP_BUILD -DUSE_OPTIMIZE_PRINTF -DTARGET=$(target) -D$(DEFINE_TARGET)=1 -DTCP_MSS=$(TCP_MSS) -DLWIP_FEATURES=$(LWIP_FEATURES) -DLWIP_IPV6=$(LWIP_IPV6)
+BUILD_FLAGS += -Wall -Wextra -c -Os -g -Wpointer-arith -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -ffunction-sections -fdata-sections
+BUILD_DEFINES = -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -DLWIP_OPEN_SRC -DLWIP_BUILD -DUSE_OPTIMIZE_PRINTF -DTARGET=$(target) -D$(DEFINE_TARGET)=1 -DTCP_MSS=$(TCP_MSS) -DTCP_MSL=5000 -DLWIP_COMPAT_SOCKETS=0 -DLWIP_FEATURES=$(LWIP_FEATURES) -DLWIP_IPV6=$(LWIP_IPV6)
--- lwip2/makefiles/Makefile.build-lwip2.orig 2020-06-28 00:58:10.829386795 +0100
+++ lwip2/makefiles/Makefile.build-lwip2 2020-07-05 00:19:14.257011642 +0100
@@ -24,11 +24,7 @@
all: $(AUTO) $(LWIP_LIB_RELEASE)
glue-lwip/lwip-err-t.h: $(LWIP_ESP)/arch/cc.h
- ( \
- echo "// script-generated, extracted from espressif SDK's lwIP arch/cc.h"; \
- echo "#define LWIP_NO_STDINT_H 1"; \
- grep -e LWIP_ERR_T -e ^typedef $< \
- ) > $@
+ cp ../lwip-err-t.h $@
glue-lwip/lwip-git-hash.h:
makefiles/make-lwip-hash
--- lwip2/makefiles/Makefile.glue.orig 2020-06-28 00:40:00.362781569 +0100
+++ lwip2/makefiles/Makefile.glue 2020-07-05 00:49:05.784590737 +0100
@@ -4,11 +4,11 @@
GLUE_LWIP = lwip-git.c
GLUE_LWIP += esp-dhcpserver.c
GLUE_LWIP += esp-ping.c
-ifneq ($(target),arduino)
-GLUE_LWIP += esp-time.c
-GLUE_LWIP += esp-millis.c
-endif
-GLUE_LWIP += espconn.c espconn_buf.c espconn_tcp.c espconn_udp.c
+#ifneq ($(target),arduino)
+#GLUE_LWIP += esp-time.c
+#GLUE_LWIP += esp-millis.c
+#endif
+#GLUE_LWIP += espconn.c espconn_buf.c espconn_tcp.c espconn_udp.c
OBJ = \
$(patsubst %.c,$(BUILD)/%.o,$(wildcard glue/*.c)) \
--- lwip2/glue-lwip/arch/cc.h.orig 2020-07-07 20:18:32.514092610 +0100
+++ lwip2/glue-lwip/arch/cc.h 2020-07-07 20:40:08.305616288 +0100
@@ -56,7 +56,7 @@
#endif
#endif // defined(LWIP_BUILD)
-#include "mem.h" // useful for os_malloc used in esp-arduino's mDNS
+//#include "mem.h" // useful for os_malloc used in esp-arduino's mDNS
// fixed definitions from esp8266/arduino
// renamed with lwip_ to avoid name collisision
@@ -88,7 +88,7 @@
///////////////////////////////
//// MISSING
-#define sys_now millis // arduino wire millis() definition returns 32 bits like sys_now() does
+//#define sys_now millis // arduino wire millis() definition returns 32 bits like sys_now() does
#define LWIP_RAND r_rand // old lwip uses this useful undocumented function
#define IPSTR "%d.%d.%d.%d"
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
@@ -113,7 +113,8 @@
#define dhcp_cleanup dhcp_cleanup_LWIP2
#define dhcp_release dhcp_release_LWIP2
-#define dhcp_start dhcp_start_LWIP2
+//this conflicts with mos wifi.sta.dhcp_start struct member name.
+//#define dhcp_start dhcp_start_LWIP2
#define dhcp_stop dhcp_stop_LWIP2
#define dhcps_start dhcps_start_LWIP2
//#define dhcps_stop dhcps_stop_LWIP2 // void(void)
@@ -134,10 +135,6 @@
#define pbuf_ref pbuf_ref_LWIP2
//#define sys_check_timeouts sys_check_timeouts_LWIP2 // void(void)
-#if !defined(LWIP_DEBUG) || !SYS_DEBUG
-#define sys_timeout sys_timeout_LWIP2
-#endif
-
#define sys_untimeout sys_untimeout_LWIP2
///////////////////////////////
--- lwip2/lwip2-src/src/include/lwip/dhcp.h.orig 2020-06-28 00:40:04.010749840 +0100
+++ lwip2/lwip2-src/src/include/lwip/dhcp.h 2020-07-05 01:33:30.644451108 +0100
@@ -105,7 +105,7 @@
/** Remove a struct dhcp previously set to the netif using dhcp_set_struct() */
#define dhcp_remove_struct(netif) netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_DHCP, NULL)
void dhcp_cleanup(struct netif *netif);
-err_t dhcp_start(struct netif *netif);
+err_t dhcp_start_LWIP2(struct netif *netif);
err_t dhcp_renew(struct netif *netif);
err_t dhcp_release(struct netif *netif);
void dhcp_stop(struct netif *netif);
--- lwip2/glue-lwip/lwip-git.c.orig 2020-07-05 01:16:08.254212452 +0100
+++ lwip2/glue-lwip/lwip-git.c 2020-07-05 01:35:47.996729226 +0100
@@ -186,7 +186,7 @@
// returning a const pointer once _set_hostname is called?
netif_git[netif_idx].hostname = wifi_station_get_hostname();
- err_t err = dhcp_start(&netif_git[netif_idx]);
+ err_t err = dhcp_start_LWIP2(&netif_git[netif_idx]);
#if LWIP_IPV6 && LWIP_IPV6_DHCP6_STATELESS
if (err == ERR_OK)
err = dhcp6_enable_stateless(&netif_git[netif_idx]);
@@ -310,11 +310,13 @@
valid_address |= ip6_addr_isvalid(netif_ip6_addr_state(netif, addrindex));
}
#endif
+#if 0
if (valid_address) {
// restart sntp
sntp_stop();
sntp_init();
}
+#endif
}
}
@@ -420,7 +422,7 @@
netif_git[i].hwaddr_len = NETIF_MAX_HWADDR_LEN;
memset(netif_git[i].hwaddr, 0, NETIF_MAX_HWADDR_LEN);
}
-
+#if 0
sntp_servermode_dhcp(1); /* get SNTP server via DHCP */
sntp_setoperatingmode(SNTP_OPMODE_POLL);
// start anyway the offline sntp timer
@@ -429,6 +431,7 @@
#else
sntp_set_system_time(0);
#endif
+#endif
}
void esp2glue_espconn_init(void)
--- lwip2/lwip2-src/src/core/ipv4/dhcp.c.orig 2020-07-05 01:40:38.253312028 +0100
+++ lwip2/lwip2-src/src/core/ipv4/dhcp.c 2020-07-05 01:41:09.229373918 +0100
@@ -441,7 +441,7 @@
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_coarse_tmr(): t0 timeout\n"));
/* this clients' lease time has expired */
dhcp_release_and_stop(netif);
- dhcp_start(netif);
+ dhcp_start_LWIP2(netif);
/* timer is active (non zero), and triggers (zeroes) now? */
} else if (dhcp->t2_rebind_time && (dhcp->t2_rebind_time-- == 1)) {
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_coarse_tmr(): t2 timeout\n"));
@@ -513,7 +513,7 @@
} else {
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_timeout(): REQUESTING, releasing, restarting\n"));
dhcp_release_and_stop(netif);
- dhcp_start(netif);
+ dhcp_start_LWIP2(netif);
}
#if DHCP_DOES_ARP_CHECK
/* received no ARP reply for the offered address (which is good) */
@@ -734,7 +734,7 @@
* - ERR_MEM - Out of memory
*/
err_t
-dhcp_start(struct netif *netif)
+dhcp_start_LWIP2(struct netif *netif)
{
struct dhcp *dhcp;
err_t result;
--- lwip2/glue-lwip/open/lwipopts.h.orig 2021-01-25 00:20:22.450699485 +0300
+++ lwip2/glue-lwip/open/lwipopts.h 2021-02-20 17:25:35.347604483 +0300
@@ -993,7 +993,7 @@
* LWIP_AUTOIP==1: Enable AUTOIP module.
*/
#if !defined LWIP_AUTOIP || defined __DOXYGEN__
-#define LWIP_AUTOIP LWIP_FEATURES // 0
+#define LWIP_AUTOIP 0
#endif
#if !LWIP_IPV4
/* disable AUTOIP when IPv4 is disabled */
@@ -1006,7 +1006,7 @@
* the same interface at the same time.
*/
#if !defined LWIP_DHCP_AUTOIP_COOP || defined __DOXYGEN__
-#define LWIP_DHCP_AUTOIP_COOP LWIP_FEATURES // 0
+#define LWIP_DHCP_AUTOIP_COOP 0
#endif
/**
@@ -1250,7 +1250,7 @@
* will be TCP_WND >> TCP_RCV_SCALE
*/
#if !defined TCP_WND || defined __DOXYGEN__
-#define TCP_WND (4 * TCP_MSS)
+#define TCP_WND (2 * TCP_MSS)
#endif
/**
@@ -3641,4 +3641,8 @@
#define MEMP_NUM_TCP_PCB_TIME_WAIT 2
#endif
+#if !defined(LWIP_DEBUG) || !SYS_DEBUG
+#define sys_timeout sys_timeout_LWIP2
+#endif
+
#endif // MYLWIPOPTS_H
--- lwip2/glue-esp/lwip-esp.c.orig 2020-07-06 03:53:48.504984954 +0100
+++ lwip2/glue-esp/lwip-esp.c 2020-07-06 04:16:31.192896467 +0100
@@ -394,7 +394,7 @@
// annoying message to hide:
//STUB(espconn_init);
#if OPENSDK
- esp2glue_espconn_init();
+ // esp2glue_espconn_init();
#endif
}
@@ -596,7 +596,8 @@
// do not let sdk control lwip2's default interface
// (softAP setting it to AP interface breaks routing,
// lwIP knows how to route)
- //no: esp2glue_netif_set_default(netif->num);
+ // rojer: we need this for multicast output in AP mode to work.
+ esp2glue_netif_set_default(netif->num);
}
void netif_set_down (struct netif* netif)
--- lwip2/Makefile.open.orig 2020-07-06 03:53:48.504984954 +0100
+++ lwip2/Makefile.open 2020-07-06 04:19:06.105246317 +0100
@@ -13,9 +13,9 @@
)
%:
- for v6 in 0 1; do \
- for mss in 536 1460; do \
- for feat in 0 1; do \
+ for v6 in 0; do \
+ for mss in 536 1460; do \
+ for feat in 1; do \
test \( $$feat = 0 \) -a \( $$v6 = 1 \) && continue; \
featname= ;\
test $$feat = 1 && featname=-feat ;\
--- lwip2/glue/gluedebug.h.orig 2020-06-28 00:40:00.362781569 +0100
+++ lwip2/glue/gluedebug.h 2020-07-07 20:15:14.602072236 +0100
@@ -18,6 +18,10 @@
#define ULWIPDEBUG 0 // 0 or 1 (trigger lwip debug)
#define ULWIPASSERT 0 // 0 or 1 (trigger lwip self-check, 0 saves flash)
+#ifndef ARDUINO
+#define ARDUINO 0
+#endif
+
#if ARDUINO
#define STRING_IN_FLASH 1 // *print("fmt is stored in flash")
#else
diff --git a/glue/esp-missing.h b/glue/esp-missing.h
index f7167d4..ae1fde6 100644
--- lwip2/glue/esp-missing.h
+++ lwip2/glue/esp-missing.h
@@ -14,11 +14,11 @@ uint32_t r_rand (void);
#if ARDUINO
void* pvPortZalloc (size_t, const char*, int);
-void* pvPortMalloc (size_t xWantedSize, const char* file, int line) __attribute__((malloc, alloc_size(1)));
+void* pvPortMalloc (size_t xWantedSize, const char* file, int line, bool) __attribute__((malloc, alloc_size(1)));
void vPortFree (void *ptr, const char* file, int line);
#else
void *pvPortZalloc (size_t sz, const char *, unsigned);
-void *pvPortMalloc (size_t sz, const char *, unsigned) __attribute__((malloc, alloc_size(1)));
+void *pvPortMalloc (size_t sz, const char *, unsigned, bool) __attribute__((malloc, alloc_size(1)));
void vPortFree (void *p, const char *, unsigned);
#endif