summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrenton Bostick <[email protected]>2023-08-21 17:09:10 -0400
committerBrenton Bostick <[email protected]>2023-08-21 17:09:10 -0400
commit8a414d59eafe1c0eac35d25cc43922e76d2e7a98 (patch)
tree847f416ca34faeecbff7c499efc222db541d3958
parentf800bba4d1692f9219e03f857f0cdeaeba4f11b1 (diff)
Fix #211: Use tcpip_input for IPv6 instead of ethernet_input
-rw-r--r--src/VirtualTap.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/VirtualTap.cpp b/src/VirtualTap.cpp
index a13dcbd..357df5b 100644
--- a/src/VirtualTap.cpp
+++ b/src/VirtualTap.cpp
@@ -572,7 +572,20 @@ void zts_lwip_init_interface(void* tapref, const InetAddress& ip)
LOCK_TCPIP_CORE();
if (isNewNetif) {
vtap->netif6 = (void*)n;
- netif_add(n, NULL, NULL, NULL, (void*)vtap, zts_netif_init6, ethernet_input);
+
+ //
+ // was:
+ // netif_add(n, NULL, NULL, NULL, (void*)vtap, zts_netif_init6, ethernet_input);
+ //
+ // but there is this documentation:
+ // > With NO_SYS=0, this must be set to tcpip_input for all netif types (whether ethernet, PPP, slipif, etc.)
+ // https://lwip.fandom.com/wiki/Writing_a_device_driver
+ //
+ // and also with ethernet_input and lwIP asserts turned on, we get:
+ // Assertion "Function called without core lock" failed at line 236 in /Users/brenton/development/github/libzt/ext/lwip-contrib/ports/unix/port/sys_arch.c
+ //
+ netif_add(n, NULL, NULL, NULL, (void*)vtap, zts_netif_init6, tcpip_input);
+
n->ip6_autoconfig_enabled = 1;
vtap->_mac.copyTo(n->hwaddr, n->hwaddr_len);
netif_create_ip6_linklocal_address(n, 1);