- Timestamp:
- Sep 3, 2013 2:07:03 AM (11 years ago)
- Location:
- trunk/src/VBox/NetworkServices/NAT
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/NAT/VBoxNetLwipNAT.cpp
r47950 r48241 137 137 private: 138 138 struct proxy_options m_ProxyOptions; 139 struct sockaddr_in m_src4; 140 struct sockaddr_in6 m_src6; 141 139 142 uint16_t m_u16Mtu; 140 143 netif m_LwipNetIf; … … 699 702 700 703 m_ProxyOptions.tftp_root = NULL; 704 m_ProxyOptions.src4 = NULL; 705 m_ProxyOptions.src6 = NULL; 706 memset(&m_src4, 0, sizeof(m_src4)); 707 memset(&m_src6, 0, sizeof(m_src6)); 708 m_src4.sin_family = AF_INET; 709 m_src6.sin6_family = AF_INET6; 710 #if HAVE_SA_LEN 711 m_src4.sa_len = sizeof(m_src4); 712 m_src6.sa_len = sizeof(m_src6); 713 #endif 701 714 702 715 m_LwipNetIf.name[0] = 'N'; -
trunk/src/VBox/NetworkServices/NAT/proxytest.c
r48001 r48241 35 35 static SOCKET proxy_create_socket(int, int); 36 36 37 volatile const struct proxy_options *g_proxy_options; 37 38 static sys_thread_t pollmgr_tid; 38 39 … … 48 49 int status; 49 50 51 LWIP_ASSERT1(opts != NULL); 50 52 LWIP_UNUSED_ARG(proxy_netif); 53 54 g_proxy_options = opts; 51 55 52 56 #if 1 … … 58 62 #endif 59 63 60 if (opts != NULL && opts->tftp_root != NULL) {64 if (opts->tftp_root != NULL) { 61 65 tftpd_init(proxy_netif, opts->tftp_root); 62 66 } … … 225 229 socklen_t dst_sa_len; 226 230 void *pdst_addr; 231 const struct sockaddr *psrc_sa; 232 socklen_t src_sa_len; 227 233 int status; 228 234 SOCKET s; … … 278 284 } 279 285 DPRINTF(("socket %d\n", s)); 286 287 /* TODO: needs locking if dynamic modifyvm is allowed */ 288 if (sdom == PF_INET6) { 289 psrc_sa = (const struct sockaddr *)g_proxy_options->src6; 290 src_sa_len = sizeof(struct sockaddr_in6); 291 } 292 else { 293 psrc_sa = (const struct sockaddr *)g_proxy_options->src4; 294 src_sa_len = sizeof(struct sockaddr_in); 295 } 296 if (psrc_sa != NULL) { 297 status = bind(s, psrc_sa, src_sa_len); 298 if (status == SOCKET_ERROR) { 299 DPRINTF(("socket %d: bind: %s\n", s, strerror(errno))); 300 closesocket(s); 301 return INVALID_SOCKET; 302 } 303 } 280 304 281 305 status = connect(s, pdst_sa, dst_sa_len); -
trunk/src/VBox/NetworkServices/NAT/proxytest.h
r48001 r48241 15 15 struct pbuf; 16 16 struct sockaddr; 17 struct sockaddr_in; 18 struct sockaddr_in6; 17 19 18 20 struct proxy_options { 19 21 const char *tftp_root; 22 const struct sockaddr_in *src4; 23 const struct sockaddr_in6 *src6; 20 24 }; 21 25
Note:
See TracChangeset
for help on using the changeset viewer.