Changeset 68444 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Aug 17, 2017 1:05:10 PM (7 years ago)
- Location:
- trunk/src/VBox/Devices/Network
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/DrvNAT.cpp
r65710 r68444 1656 1656 slirp_set_mtu(pThis->pNATState, MTU); 1657 1657 slirp_set_somaxconn(pThis->pNATState, i32SoMaxConn); 1658 1658 1659 char *pszBindIP = NULL; 1659 1660 GET_STRING_ALLOC(rc, pThis, pCfg, "BindIP", pszBindIP); 1660 rc = slirp_set_binding_address(pThis->pNATState, pszBindIP); 1661 if (rc != 0 && pszBindIP && *pszBindIP) 1662 LogRel(("NAT: Value of BindIP has been ignored\n")); 1663 1664 if(pszBindIP != NULL) 1661 slirp_set_binding_address(pThis->pNATState, pszBindIP); 1662 if (pszBindIP != NULL) 1665 1663 MMR3HeapFree(pszBindIP); 1664 1666 1665 #define SLIRP_SET_TUNING_VALUE(name, setter) \ 1667 1666 do \ -
trunk/src/VBox/Devices/Network/slirp/slirp.c
r65810 r68444 1694 1694 int slirp_set_binding_address(PNATState pData, char *addr) 1695 1695 { 1696 if (addr == NULL || (inet_aton(addr, &pData->bindIP) == 0)) 1697 { 1696 int ok; 1697 1698 pData->bindIP.s_addr = INADDR_ANY; 1699 1700 if (addr == NULL || *addr == '\0') 1701 return VINF_SUCCESS; 1702 1703 ok = inet_aton(addr, &pData->bindIP); 1704 if (!ok) 1705 { 1706 LogRel(("NAT: Unable to parse binding address: %s\n", addr)); 1707 return VERR_INVALID_PARAMETER; 1708 } 1709 1710 if (pData->bindIP.s_addr == INADDR_ANY) 1711 return VINF_SUCCESS; 1712 1713 if ((pData->bindIP.s_addr & RT_N2H_U32_C(0xe0000000)) == RT_N2H_U32_C(0xe0000000)) 1714 { 1715 LogRel(("NAT: Ignoring multicast binding address %RTnaipv4\n", pData->bindIP.s_addr)); 1698 1716 pData->bindIP.s_addr = INADDR_ANY; 1699 return 1; 1700 } 1701 return 0; 1717 return VERR_INVALID_PARAMETER; 1718 } 1719 1720 LogRel(("NAT: Binding address %RTnaipv4\n", pData->bindIP.s_addr)); 1721 return VINF_SUCCESS; 1702 1722 } 1703 1723 -
trunk/src/VBox/Devices/Network/slirp/tcp_subr.c
r63668 r68444 417 417 opt = 1; 418 418 setsockopt(s, SOL_SOCKET, SO_OOBINLINE, (char *)&opt, sizeof(opt)); 419 420 if (pData->bindIP.s_addr != INADDR_ANY) 421 { 422 struct sockaddr_in self; 423 self.sin_family = AF_INET; 424 self.sin_addr = pData->bindIP; 425 self.sin_port = 0; 426 427 ret = bind(s, (struct sockaddr *)&self, sizeof(self)); 428 if (ret != 0) 429 { 430 Log2(("NAT: bind(%RTnaipv4): %s\n", pData->bindIP.s_addr, strerror(errno))); 431 return ret; 432 } 433 } 419 434 420 435 addr.sin_family = AF_INET;
Note:
See TracChangeset
for help on using the changeset viewer.