Changeset 20379 in vbox
- Timestamp:
- Jun 8, 2009 6:43:48 AM (16 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/slirp.c
r20376 r20379 632 632 pData->pvUser = pvUser; 633 633 pData->netmask = u32Netmask; 634 635 /* sockets & TCP defaults */ 636 pData->socket_rcv = 64 * _1K; 637 pData->socket_snd = 64 * _1K; 638 tcp_sndspace = 64 * _1K; 639 tcp_rcvspace = 64 * _1K; 634 640 635 641 #ifdef RT_OS_WINDOWS … … 1845 1851 } 1846 1852 #endif 1853 1854 #define CHECK_ARG(name, val, lim_min, lim_max) \ 1855 do { \ 1856 if ((val) < (lim_min) || (val) > (lim_max)) \ 1857 { \ 1858 LogRel(("NAT: (" #name ":%d) has been ignored, " \ 1859 "because out of range (%d, %d)\n", (val), (lim_min), (lim_max))); \ 1860 return; \ 1861 } \ 1862 else \ 1863 { \ 1864 LogRel(("NAT: (" #name ":%d)\n", (val))); \ 1865 } \ 1866 } while (0) 1867 1868 /* don't allow user set negative and more than 1M values */ 1869 #define _1M_CHECK_ARG(name, val) CHECK_ARG(name, (val), 0, 1024) 1870 void slirp_set_rcvbuf(PNATState pData, int kilobytes) 1871 { 1872 _1M_CHECK_ARG("SOCKET_RCVBUF", kilobytes); 1873 pData->socket_rcv = kilobytes; 1874 } 1875 void slirp_set_sndbuf(PNATState pData, int kilobytes) 1876 { 1877 _1M_CHECK_ARG("SOCKET_SNDBUF", kilobytes); 1878 pData->socket_snd = kilobytes * _1K; 1879 } 1880 void slirp_set_tcp_rcvspace(PNATState pData, int kilobytes) 1881 { 1882 _1M_CHECK_ARG("TCP_RCVSPACE", kilobytes); 1883 tcp_rcvspace = kilobytes * _1K; 1884 } 1885 void slirp_set_tcp_sndspace(PNATState pData, int kilobytes) 1886 { 1887 _1M_CHECK_ARG("TCP_SNDSPACE", kilobytes); 1888 tcp_sndspace = kilobytes * _1K; 1889 } -
trunk/src/VBox/Devices/Network/slirp/slirp_state.h
r20351 r20379 114 114 struct in_addr alias_addr; 115 115 struct in_addr special_addr; 116 117 int tcp_rcvspace; 118 int tcp_sndspace; 119 int socket_rcv; 120 int socket_snd; 116 121 #ifdef VBOX_WITH_SLIRP_MT 117 122 PRTREQQUEUE pReqQueue; … … 271 276 272 277 /** TCP receive buffer size. */ 273 #define tcp_rcvspace TCP_RCVSPACE278 #define tcp_rcvspace pData->tcp_rcvspace 274 279 275 280 /** TCP receive buffer size. */ 276 #define tcp_sndspace TCP_SNDSPACE281 #define tcp_sndspace pData->tcp_sndspace 277 282 278 283 /* TCP duplicate ACK retransmit threshold. */ -
trunk/src/VBox/Devices/Network/slirp/socket.c
r20378 r20379 825 825 so->so_fport = addr.sin_port; 826 826 /* set socket buffers */ 827 opt = 64 * _1K;827 opt = pData->socket_rcv; 828 828 status = setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&opt, sizeof(int)); 829 829 if (status < 0) … … 832 832 goto no_sockopt; 833 833 } 834 opt = 64 * _1K;834 opt = pData->socket_snd; 835 835 status = setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&opt, sizeof(int)); 836 836 if (status < 0) -
trunk/src/VBox/Devices/Network/slirp/tcp_subr.c
r20244 r20379 519 519 LogRel(("NAT: old socket rcv size: %dKB\n", opt / 1024)); 520 520 /* @todo (r-vvl) make it configurable (via extra data) */ 521 opt = 64 * _1K;521 opt = pData->socket_rcv; 522 522 status = setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&opt, sizeof(int)); 523 523 if (status < 0) … … 535 535 if (cVerbose > 0) 536 536 LogRel(("NAT: old socket snd size: %dKB\n", opt / 1024)); 537 opt = 64 * _1K;537 opt = pData->socket_rcv; 538 538 status = setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&opt, sizeof(int)); 539 539 if (status < 0)
Note:
See TracChangeset
for help on using the changeset viewer.