Changeset 87375 in vbox
- Timestamp:
- Jan 22, 2021 6:26:45 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp
r85121 r87375 425 425 { 426 426 AssertPtrReturnVoid(arg); 427 VBoxNetLwipNAT * pNat= static_cast<VBoxNetLwipNAT *>(arg);427 VBoxNetLwipNAT *self = static_cast<VBoxNetLwipNAT *>(arg); 428 428 429 429 HRESULT hrc = com::Initialize(); … … 438 438 /* lwip thread */ 439 439 RTNETADDRIPV4 network; 440 RTNETADDRIPV4 address = g_pLwipNat->getIpv4Address();441 RTNETADDRIPV4 netmask = g_pLwipNat->getIpv4Netmask();440 RTNETADDRIPV4 address = self->getIpv4Address(); 441 RTNETADDRIPV4 netmask = self->getIpv4Netmask(); 442 442 network.u = address.u & netmask.u; 443 443 … … 448 448 memcpy(&LwipIpNetwork, &network, sizeof(ip_addr)); 449 449 450 netif *pNetif = netif_add(& g_pLwipNat->m_LwipNetIf /* Lwip Interface */,450 netif *pNetif = netif_add(&self->m_LwipNetIf /* Lwip Interface */, 451 451 &LwipIpAddr /* IP address*/, 452 452 &LwipIpNetMask /* Network mask */, 453 453 &LwipIpAddr /* gateway address, @todo: is self IP acceptable? */, 454 g_pLwipNat/* state */,454 self /* state */, 455 455 VBoxNetLwipNAT::netifInit /* netif_init_fn */, 456 456 tcpip_input /* netif_input_fn */); … … 475 475 netif_set_link_up(pNetif); 476 476 477 if ( pNat->m_ProxyOptions.ipv6_enabled) {477 if (self->m_ProxyOptions.ipv6_enabled) { 478 478 /* 479 479 * XXX: lwIP currently only ever calls mld6_joingroup() in … … 508 508 } 509 509 510 proxy_init(& g_pLwipNat->m_LwipNetIf, &g_pLwipNat->m_ProxyOptions);511 512 natServiceProcessRegisteredPf( g_pLwipNat->m_vecPortForwardRule4);513 natServiceProcessRegisteredPf( g_pLwipNat->m_vecPortForwardRule6);510 proxy_init(&self->m_LwipNetIf, &self->m_ProxyOptions); 511 512 natServiceProcessRegisteredPf(self->m_vecPortForwardRule4); 513 natServiceProcessRegisteredPf(self->m_vecPortForwardRule6); 514 514 } 515 515 … … 518 518 { 519 519 AssertPtrReturnVoid(arg); 520 VBoxNetLwipNAT *self = static_cast<VBoxNetLwipNAT *>(arg); 520 521 521 522 /* XXX: proxy finalization */ 522 netif_set_link_down(& g_pLwipNat->m_LwipNetIf);523 netif_set_down(& g_pLwipNat->m_LwipNetIf);524 netif_remove(& g_pLwipNat->m_LwipNetIf);523 netif_set_link_down(&self->m_LwipNetIf); 524 netif_set_down(&self->m_LwipNetIf); 525 netif_remove(&self->m_LwipNetIf); 525 526 526 527 } … … 535 536 AssertPtrReturn(pNetif, ERR_ARG); 536 537 537 VBoxNetLwipNAT * pNat= static_cast<VBoxNetLwipNAT *>(pNetif->state);538 AssertPtrReturn( pNat, ERR_ARG);538 VBoxNetLwipNAT *self = static_cast<VBoxNetLwipNAT *>(pNetif->state); 539 AssertPtrReturn(self, ERR_ARG); 539 540 540 541 LogFlowFunc(("ENTER: pNetif[%c%c%d]\n", pNetif->name[0], pNetif->name[1], pNetif->num)); … … 545 546 546 547 pNetif->hwaddr_len = sizeof(RTMAC); 547 RTMAC mac = g_pLwipNat->getMacAddress();548 RTMAC mac = self->getMacAddress(); 548 549 memcpy(pNetif->hwaddr, &mac, sizeof(RTMAC)); 549 550 550 pNat->m_u16Mtu = 1500; // XXX: FIXME551 pNetif->mtu = pNat->m_u16Mtu;551 self->m_u16Mtu = 1500; // XXX: FIXME 552 pNetif->mtu = self->m_u16Mtu; 552 553 553 554 pNetif->flags = NETIF_FLAG_BROADCAST … … 558 559 pNetif->output = etharp_output; /* ip-pipe */ 559 560 560 if ( pNat->m_ProxyOptions.ipv6_enabled) {561 if (self->m_ProxyOptions.ipv6_enabled) { 561 562 pNetif->output_ip6 = ethip6_output; 562 563 … … 945 946 /* end of COM initialization */ 946 947 947 rc = g_pLwipNat->tryGoOnline();948 rc = tryGoOnline(); 948 949 if (RT_FAILURE(rc)) 949 950 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.