Changeset 49042 in vbox
- Timestamp:
- Oct 11, 2013 12:39:51 AM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 89825
- Location:
- trunk/src/VBox/NetworkServices/NAT
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp
r49016 r49042 355 355 { 356 356 AssertPtrReturnVoid(arg); 357 VBoxNetLwipNAT *p This = (VBoxNetLwipNAT *)arg;357 VBoxNetLwipNAT *pNat = static_cast<VBoxNetLwipNAT *>(arg); 358 358 359 359 HRESULT hrc = com::Initialize(); … … 389 389 netif_set_link_up(pNetif); 390 390 391 /* 392 * XXX: lwIP currently only ever calls mld6_joingroup() in 393 * nd6_tmr() for fresh tentative addresses, which is a wrong place 394 * to do it - but I'm not keen on fixing this properly for now 395 * (with correct handling of interface up and down transitions, 396 * etc). So stick it here as a kludge. 397 */ 398 for (int i = 0; i <= 1; ++i) { 399 ip6_addr_t *paddr = netif_ip6_addr(pNetif, i); 400 401 ip6_addr_t solicited_node_multicast_address; 402 ip6_addr_set_solicitednode(&solicited_node_multicast_address, 403 paddr->addr[3]); 404 mld6_joingroup(paddr, &solicited_node_multicast_address); 405 } 406 407 /* 408 * XXX: We must join the solicited-node multicast for the 409 * addresses we do IPv6 NA-proxy for. We map IPv6 loopback to 410 * proxy address + 1. We only need the low 24 bits, and those are 411 * fixed. 412 */ 413 { 414 ip6_addr_t solicited_node_multicast_address; 415 416 ip6_addr_set_solicitednode(&solicited_node_multicast_address, 417 /* last 24 bits of the address */ 418 PP_HTONL(0x00000002)); 419 mld6_netif_joingroup(pNetif, &solicited_node_multicast_address); 391 if (pNat->m_ProxyOptions.ipv6_enabled) { 392 /* 393 * XXX: lwIP currently only ever calls mld6_joingroup() in 394 * nd6_tmr() for fresh tentative addresses, which is a wrong place 395 * to do it - but I'm not keen on fixing this properly for now 396 * (with correct handling of interface up and down transitions, 397 * etc). So stick it here as a kludge. 398 */ 399 for (int i = 0; i <= 1; ++i) { 400 ip6_addr_t *paddr = netif_ip6_addr(pNetif, i); 401 402 ip6_addr_t solicited_node_multicast_address; 403 ip6_addr_set_solicitednode(&solicited_node_multicast_address, 404 paddr->addr[3]); 405 mld6_joingroup(paddr, &solicited_node_multicast_address); 406 } 407 408 /* 409 * XXX: We must join the solicited-node multicast for the 410 * addresses we do IPv6 NA-proxy for. We map IPv6 loopback to 411 * proxy address + 1. We only need the low 24 bits, and those are 412 * fixed. 413 */ 414 { 415 ip6_addr_t solicited_node_multicast_address; 416 417 ip6_addr_set_solicitednode(&solicited_node_multicast_address, 418 /* last 24 bits of the address */ 419 PP_HTONL(0x00000002)); 420 mld6_netif_joingroup(pNetif, &solicited_node_multicast_address); 421 } 420 422 } 421 423 … … 424 426 natServiceProcessRegisteredPf(g_pLwipNat->m_vecPortForwardRule4); 425 427 natServiceProcessRegisteredPf(g_pLwipNat->m_vecPortForwardRule6); 426 427 428 } 428 429 … … 470 471 pNetif->linkoutput = netifLinkoutput; /* ether-level-pipe */ 471 472 pNetif->output = lwip_etharp_output; /* ip-pipe */ 472 pNetif->output_ip6 = ethip6_output; 473 474 /* IPv6 link-local address in slot 0 */ 475 netif_create_ip6_linklocal_address(pNetif, /* :from_mac_48bit */ 1); 476 netif_ip6_addr_set_state(pNetif, 0, IP6_ADDR_PREFERRED); // skip DAD 477 478 /* 479 * RFC 4193 Locally Assigned Global ID (ULA) in slot 1 480 * [fd17:625c:f037:XXXX::1] where XXXX, 16 bit Subnet ID, are two 481 * bytes from the middle of the IPv4 address, e.g. :dead: for 482 * 10.222.173.1 483 */ 484 u8_t nethi = ip4_addr2(&pNetif->ip_addr); 485 u8_t netlo = ip4_addr3(&pNetif->ip_addr); 486 487 ip6_addr_t *paddr = netif_ip6_addr(pNetif, 1); 488 IP6_ADDR(paddr, 0, 0xFD, 0x17, 0x62, 0x5C); 489 IP6_ADDR(paddr, 1, 0xF0, 0x37, nethi, netlo); 490 IP6_ADDR(paddr, 2, 0x00, 0x00, 0x00, 0x00); 491 IP6_ADDR(paddr, 3, 0x00, 0x00, 0x00, 0x01); 492 netif_ip6_addr_set_state(pNetif, 1, IP6_ADDR_PREFERRED); 473 474 if (pNat->m_ProxyOptions.ipv6_enabled) { 475 pNetif->output_ip6 = ethip6_output; 476 477 /* IPv6 link-local address in slot 0 */ 478 netif_create_ip6_linklocal_address(pNetif, /* :from_mac_48bit */ 1); 479 netif_ip6_addr_set_state(pNetif, 0, IP6_ADDR_PREFERRED); // skip DAD 480 481 /* 482 * RFC 4193 Locally Assigned Global ID (ULA) in slot 1 483 * [fd17:625c:f037:XXXX::1] where XXXX, 16 bit Subnet ID, are two 484 * bytes from the middle of the IPv4 address, e.g. :dead: for 485 * 10.222.173.1 486 */ 487 u8_t nethi = ip4_addr2(&pNetif->ip_addr); 488 u8_t netlo = ip4_addr3(&pNetif->ip_addr); 489 490 ip6_addr_t *paddr = netif_ip6_addr(pNetif, 1); 491 IP6_ADDR(paddr, 0, 0xFD, 0x17, 0x62, 0x5C); 492 IP6_ADDR(paddr, 1, 0xF0, 0x37, nethi, netlo); 493 IP6_ADDR(paddr, 2, 0x00, 0x00, 0x00, 0x00); 494 IP6_ADDR(paddr, 3, 0x00, 0x00, 0x00, 0x01); 495 netif_ip6_addr_set_state(pNetif, 1, IP6_ADDR_PREFERRED); 493 496 494 497 #if LWIP_IPV6_SEND_ROUTER_SOLICIT 495 pNetif->rs_count = 0;498 pNetif->rs_count = 0; 496 499 #endif 500 } 497 501 498 502 LogFlowFunc(("LEAVE: %d\n", rcLwip)); … … 718 722 LogFlowFuncEnter(); 719 723 724 m_ProxyOptions.ipv6_enabled = 0; 725 m_ProxyOptions.ipv6_defroute = 0; 720 726 m_ProxyOptions.tftp_root = NULL; 721 727 m_ProxyOptions.src4 = NULL; … … 847 853 net.asOutParam()); 848 854 AssertComRCReturn(hrc, VERR_NOT_FOUND); 855 856 BOOL fIPv6Enabled = FALSE; 857 hrc = net->COMGETTER(IPv6Enabled)(&fIPv6Enabled); 858 AssertComRCReturn(hrc, VERR_NOT_FOUND); 859 860 BOOL fIPv6DefaultRoute = FALSE; 861 if (fIPv6Enabled) 862 { 863 hrc = net->COMGETTER(AdvertiseDefaultIPv6RouteEnabled)(&fIPv6DefaultRoute); 864 AssertComRCReturn(hrc, VERR_NOT_FOUND); 865 } 866 867 m_ProxyOptions.ipv6_enabled = fIPv6Enabled; 868 m_ProxyOptions.ipv6_defroute = fIPv6DefaultRoute; 869 849 870 #if !defined(RT_OS_WINDOWS) 850 871 /* XXX: Temporaly disabled this code on Windows for further debugging */ -
trunk/src/VBox/NetworkServices/NAT/proxy.h
r49016 r49042 31 31 32 32 struct proxy_options { 33 int ipv6_enabled; 34 int ipv6_defroute; 33 35 const char *tftp_root; 34 36 const struct sockaddr_in *src4;
Note:
See TracChangeset
for help on using the changeset viewer.