Skip to content

Commit

Permalink
Merge pull request #252 from zerotier/bugfix/211
Browse files Browse the repository at this point in the history
Fix #211: Use tcpip_input for IPv6 instead of ethernet_input
  • Loading branch information
joseph-henry authored Aug 21, 2023
2 parents af217eb + 8a414d5 commit 1bdced9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/VirtualTap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,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);
Expand Down

0 comments on commit 1bdced9

Please sign in to comment.