65
65
#include < netif/etharp.h>
66
66
67
67
#if CHIP_TARGET_STYLE_UNIX
68
-
69
- // TapAddrAutoconf and TapInterface are only needed for LwIP on
70
- // sockets simulation in which a host tap/tun interface is used to
71
- // proxy the LwIP stack onto a host native network interface.
72
-
73
- #include " TapAddrAutoconf.h"
74
- #include " TapInterface.h"
68
+ // NOTE: this used to be supported, so could theoretically be
69
+ // recovered, however the TAP/TUN was never actually used
70
+ // and the underlying files were never compiled in CHIP.
71
+ #error "Testing of LWIP on unix systems via TAP not supported."
75
72
#endif // CHIP_TARGET_STYLE_UNIX
73
+
76
74
#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
77
75
78
76
using namespace chip ;
@@ -110,14 +108,6 @@ static void ReleaseLwIP(void)
110
108
#endif // (LWIP_VERSION_MAJOR == 2) && (LWIP_VERSION_MINOR == 0)
111
109
}
112
110
113
- #if CHIP_TARGET_STYLE_UNIX
114
- // TapAddrAutoconf and TapInterface are only needed for LwIP on
115
- // sockets simulation in which a host tap/tun interface is used to
116
- // proxy the LwIP stack onto a host native network interface.
117
- // CollectTapAddresses() is only available on such targets.
118
- static std::vector<TapInterface> sTapIFs ;
119
- #endif // CHIP_TARGET_STYLE_UNIX
120
-
121
111
static std::vector<struct netif > sNetIFs ; // interface to filter
122
112
123
113
static bool NetworkIsReady ();
@@ -196,28 +186,11 @@ static void PrintNetworkState()
196
186
for (size_t j = 0 ; j < gNetworkOptions .TapDeviceName .size (); j++)
197
187
{
198
188
struct netif * netIF = &(sNetIFs [j]);
199
- #if CHIP_TARGET_STYLE_UNIX
200
- // TapAddrAutoconf and TapInterface are only needed for LwIP on
201
- // sockets simulation in which a host tap/tun interface is used to
202
- // proxy the LwIP stack onto a host native network interface.
203
- // CollectTapAddresses() is only available on such targets.
204
-
205
- TapInterface * tapIF = &(sTapIFs [j]);
206
- #endif // CHIP_TARGET_STYLE_UNIX
207
189
InterfaceId (netIF).GetInterfaceName (intfName, sizeof (intfName));
208
190
209
191
printf (" LwIP interface ready\n " );
210
192
printf (" Interface Name: %s\n " , intfName);
211
193
printf (" Tap Device: %s\n " , gNetworkOptions .TapDeviceName [j]);
212
- #if CHIP_TARGET_STYLE_UNIX
213
- // TapAddrAutoconf and TapInterface are only needed for LwIP on
214
- // sockets simulation in which a host tap/tun interface is used to
215
- // proxy the LwIP stack onto a host native network interface.
216
- // CollectTapAddresses() is only available on such targets.
217
-
218
- printf (" MAC address: %02x:%02x:%02x:%02x:%02x:%02x\n " , tapIF->macAddr [0 ], tapIF->macAddr [1 ], tapIF->macAddr [2 ],
219
- tapIF->macAddr [3 ], tapIF->macAddr [4 ], tapIF->macAddr [5 ]);
220
- #endif // CHIP_TARGET_STYLE_UNIX
221
194
222
195
#if INET_CONFIG_ENABLE_IPV4
223
196
printf (" IPv4 Address: %s\n " , ipaddr_ntoa (&(netIF->ip_addr )));
@@ -253,52 +226,14 @@ void InitNetwork()
253
226
}
254
227
}
255
228
256
- #if CHIP_TARGET_STYLE_UNIX
257
- // TapAddrAutoconf and TapInterface are only needed for LwIP on
258
- // sockets simulation in which a host tap/tun interface is used to
259
- // proxy the LwIP stack onto a host native network interface.
260
- // CollectTapAddresses() is only available on such targets.
261
-
262
- sTapIFs .clear ();
263
- #endif // CHIP_TARGET_STYLE_UNIX
264
229
sNetIFs .clear ();
265
230
266
231
for (size_t j = 0 ; j < gNetworkOptions .TapDeviceName .size (); j++)
267
232
{
268
- #if CHIP_TARGET_STYLE_UNIX
269
- // TapAddrAutoconf and TapInterface are only needed for LwIP on
270
- // sockets simulation in which a host tap/tun interface is used to
271
- // proxy the LwIP stack onto a host native network interface.
272
- // CollectTapAddresses() is only available on such targets.
273
-
274
- TapInterface tapIF;
275
- sTapIFs .push_back (tapIF);
276
- #endif // CHIP_TARGET_STYLE_UNIX
277
233
struct netif netIF;
278
234
sNetIFs .push_back (netIF);
279
235
}
280
236
281
- #if CHIP_TARGET_STYLE_UNIX
282
-
283
- // TapAddrAutoconf and TapInterface are only needed for LwIP on
284
- // sockets simulation in which a host tap/tun interface is used to
285
- // proxy the LwIP stack onto a host native network interface.
286
- // CollectTapAddresses() is only available on such targets.
287
-
288
- err_t lwipErr;
289
-
290
- for (size_t j = 0 ; j < gNetworkOptions .TapDeviceName .size (); j++)
291
- {
292
- lwipErr = TapInterface_Init (&(sTapIFs [j]), gNetworkOptions .TapDeviceName [j], NULL );
293
- if (lwipErr != ERR_OK)
294
- {
295
- printf (" Failed to initialize tap device %s: %s\n " , gNetworkOptions .TapDeviceName [j],
296
- ErrorStr (System::MapErrorLwIP (lwipErr)));
297
- exit (EXIT_FAILURE);
298
- }
299
- }
300
- #endif // CHIP_TARGET_STYLE_UNIX
301
-
302
237
tcpip_init (OnLwIPInitComplete, NULL );
303
238
304
239
// Lock LwIP stack
@@ -310,17 +245,6 @@ void InitNetwork()
310
245
311
246
addrsVec.clear ();
312
247
313
- #if CHIP_TARGET_STYLE_UNIX
314
-
315
- // TapAddrAutoconf and TapInterface are only needed for LwIP on
316
- // sockets simulation in which a host tap/tun interface is used to
317
- // proxy the LwIP stack onto a host native network interface.
318
- // CollectTapAddresses() is only available on such targets.
319
- if (gNetworkOptions .TapUseSystemConfig )
320
- {
321
- CollectTapAddresses (addrsVec, gNetworkOptions .TapDeviceName [j]);
322
- }
323
- #endif // CHIP_TARGET_STYLE_UNIX
324
248
#if INET_CONFIG_ENABLE_IPV4
325
249
326
250
IPAddress ip4Addr = (j < gNetworkOptions .LocalIPv4Addr .size ()) ? gNetworkOptions .LocalIPv4Addr [j] : IPAddress::Any;
@@ -333,25 +257,6 @@ void InitNetwork()
333
257
}
334
258
}
335
259
336
- #if CHIP_TARGET_STYLE_UNIX
337
- // TapAddrAutoconf and TapInterface are only needed for LwIP on
338
- // sockets simulation in which a host tap/tun interface is used to
339
- // proxy the LwIP stack onto a host native network interface.
340
- // CollectTapAddresses() is only available on such targets.
341
-
342
- IPAddress ip4Gateway = (j < gNetworkOptions .IPv4GatewayAddr .size ()) ? gNetworkOptions .IPv4GatewayAddr [j] : IPAddress::Any;
343
-
344
- {
345
- ip4_addr_t ip4AddrLwIP, ip4NetmaskLwIP, ip4GatewayLwIP;
346
-
347
- ip4AddrLwIP = ip4Addr.ToIPv4 ();
348
- IP4_ADDR (&ip4NetmaskLwIP, 255 , 255 , 255 , 0 );
349
- ip4GatewayLwIP = ip4Gateway.ToIPv4 ();
350
- netif_add (&(sNetIFs [j]), &ip4AddrLwIP, &ip4NetmaskLwIP, &ip4GatewayLwIP, &(sTapIFs [j]), TapInterface_SetupNetif,
351
- tcpip_input);
352
- }
353
- #endif // CHIP_TARGET_STYLE_UNIX
354
-
355
260
#endif // INET_CONFIG_ENABLE_IPV4
356
261
357
262
netif_create_ip6_linklocal_address (&(sNetIFs [j]), 1 );
@@ -484,14 +389,6 @@ void ServiceEvents(uint32_t aSleepTimeMilliseconds)
484
389
485
390
gSystemLayer .HandlePlatformTimer ();
486
391
}
487
- #if CHIP_TARGET_STYLE_UNIX
488
- // TapAddrAutoconf and TapInterface are only needed for LwIP on
489
- // sockets simulation in which a host tap/tun interface is used to
490
- // proxy the LwIP stack onto a host native network interface.
491
- // CollectTapAddresses() is only available on such targets.
492
-
493
- TapInterface_Select (&(sTapIFs [0 ]), &(sNetIFs [0 ]), aSleepTime, gNetworkOptions .TapDeviceName .size ());
494
- #endif // CHIP_TARGET_STYLE_UNIX
495
392
#endif // CHIP_SYSTEM_CONFIG_USE_LWIP
496
393
}
497
394
0 commit comments