Renamed lwIP low-level rx/tx functions

This commit is contained in:
Joseph Henry
2017-08-17 14:37:01 -07:00
parent f1381e3cfa
commit 8472a45ce3
3 changed files with 8 additions and 9 deletions

View File

@@ -188,11 +188,11 @@ namespace ZeroTier {
{ {
#if defined(STACK_PICO) #if defined(STACK_PICO)
if(picostack) if(picostack)
picostack->pico_rx(this,from,to,etherType,data,len); picostack->pico_eth_rx(this,from,to,etherType,data,len);
#endif #endif
#if defined(STACK_LWIP) #if defined(STACK_LWIP)
if(lwipstack) if(lwipstack)
lwipstack->lwip_rx(this,from,to,etherType,data,len); lwipstack->lwip_eth_rx(this,from,to,etherType,data,len);
#endif #endif
} }
@@ -421,7 +421,6 @@ namespace ZeroTier {
{ {
// TODO: flags // TODO: flags
int err = 0; int err = 0;
DEBUG_INFO();
#if defined(STACK_PICO) #if defined(STACK_PICO)
if(picostack) { if(picostack) {
err = picostack->pico_Connect(vs, addr, addrlen); // implicit err = picostack->pico_Connect(vs, addr, addrlen); // implicit

View File

@@ -49,7 +49,7 @@ err_t tapif_init(struct netif *netif)
return ERR_OK; return ERR_OK;
} }
err_t low_level_output(struct netif *netif, struct pbuf *p) err_t lwip_eth_tx(struct netif *netif, struct pbuf *p)
{ {
DEBUG_INFO(); DEBUG_INFO();
struct pbuf *q; struct pbuf *q;
@@ -104,7 +104,7 @@ namespace ZeroTier
tap->lwipdev.mtu = tap->_mtu; tap->lwipdev.mtu = tap->_mtu;
tap->lwipdev.name[0] = 'l'; tap->lwipdev.name[0] = 'l';
tap->lwipdev.name[1] = '4'; tap->lwipdev.name[1] = '4';
tap->lwipdev.linkoutput = low_level_output; tap->lwipdev.linkoutput = lwip_eth_tx;
tap->lwipdev.hwaddr_len = 6; tap->lwipdev.hwaddr_len = 6;
tap->lwipdev.flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_IGMP | NETIF_FLAG_LINK_UP | NETIF_FLAG_UP; tap->lwipdev.flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_IGMP | NETIF_FLAG_LINK_UP | NETIF_FLAG_UP;
netif_set_default(&(tap->lwipdev)); netif_set_default(&(tap->lwipdev));
@@ -122,7 +122,7 @@ namespace ZeroTier
tap->lwipdev6.name[0] = 'l'; tap->lwipdev6.name[0] = 'l';
tap->lwipdev6.name[1] = '6'; tap->lwipdev6.name[1] = '6';
tap->lwipdev6.hwaddr_len = 6; tap->lwipdev6.hwaddr_len = 6;
tap->lwipdev6.linkoutput = low_level_output; tap->lwipdev6.linkoutput = lwip_eth_tx;
tap->lwipdev6.ip6_autoconfig_enabled = 1; tap->lwipdev6.ip6_autoconfig_enabled = 1;
tap->_mac.copyTo(tap->lwipdev6.hwaddr, tap->lwipdev6.hwaddr_len); tap->_mac.copyTo(tap->lwipdev6.hwaddr, tap->lwipdev6.hwaddr_len);
netif_create_ip6_linklocal_address(&(tap->lwipdev6), 1); netif_create_ip6_linklocal_address(&(tap->lwipdev6), 1);
@@ -181,7 +181,7 @@ namespace ZeroTier
} }
} }
void lwIP::lwip_rx(VirtualTap *tap, const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len) void lwIP::lwip_eth_rx(VirtualTap *tap, const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len)
{ {
DEBUG_INFO("etherType=%x, len=%d", etherType, len); DEBUG_INFO("etherType=%x, len=%d", etherType, len);
struct pbuf *p,*q; struct pbuf *p,*q;

View File

@@ -124,7 +124,7 @@ extern "C" void netif_set_up(LWIP_NETIF_SET_UP_SIG);
extern "C" void netif_set_default(LWIP_NETIF_SET_DEFAULT_SIG); extern "C" void netif_set_default(LWIP_NETIF_SET_DEFAULT_SIG);
//extern "C" struct netif *netif_add(LWIP_NETIF_ADD_SIG); //extern "C" struct netif *netif_add(LWIP_NETIF_ADD_SIG);
extern "C" err_t tapif_init(struct netif *netif); extern "C" err_t tapif_init(struct netif *netif);
extern "C" err_t low_level_output(struct netif *netif, struct pbuf *p); //extern "C" err_t low_level_output(struct netif *netif, struct pbuf *p);
extern "C" err_t tcp_write(LWIP_TCP_WRITE_SIG); extern "C" err_t tcp_write(LWIP_TCP_WRITE_SIG);
extern "C" void tcp_sent(LWIP_TCP_SENT_SIG); extern "C" void tcp_sent(LWIP_TCP_SENT_SIG);
extern "C" struct tcp_pcb *tcp_new(LWIP_TCP_NEW_SIG); extern "C" struct tcp_pcb *tcp_new(LWIP_TCP_NEW_SIG);
@@ -182,7 +182,7 @@ namespace ZeroTier {
/* /*
* Packets from the ZeroTier virtual wire enter the stack here * Packets from the ZeroTier virtual wire enter the stack here
*/ */
void lwip_rx(VirtualTap *tap, const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len); void lwip_eth_rx(VirtualTap *tap, const MAC &from,const MAC &to,unsigned int etherType,const void *data,unsigned int len);
int lwip_Socket(void **pcb, int socket_family, int socket_type, int protocol); int lwip_Socket(void **pcb, int socket_family, int socket_type, int protocol);
int lwip_Connect(VirtualSocket *vs, const struct sockaddr *addr, socklen_t addrlen); int lwip_Connect(VirtualSocket *vs, const struct sockaddr *addr, socklen_t addrlen);