- Timestamp:
- May 22, 2018 11:42:27 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/socket.c
r72283 r72292 184 184 if (addr == INADDR_ANY && port == 0 && so->so_type != IPPROTO_UDP) 185 185 { 186 187 188 189 190 186 /* TCP sockets without constraints don't need to be bound */ 187 Log2(("NAT: sobind: %s guest %RTnaipv4:%d - nothing to do\n", 188 so->so_type == IPPROTO_UDP ? "udp" : "tcp", 189 so->so_laddr.s_addr, ntohs(so->so_lport))); 190 return 0; 191 191 } 192 192 … … 202 202 if (status == 0) 203 203 { 204 205 206 207 204 Log2(("NAT: sobind: %s guest %RTnaipv4:%d to host %RTnaipv4:%d\n", 205 so->so_type == IPPROTO_UDP ? "udp" : "tcp", 206 so->so_laddr.s_addr, ntohs(so->so_lport), addr, ntohs(port))); 207 return 0; 208 208 } 209 209 210 210 Log2(("NAT: sobind: %s guest %RTnaipv4:%d to host %RTnaipv4:%d error %d%s\n", 211 212 213 214 211 so->so_type == IPPROTO_UDP ? "udp" : "tcp", 212 so->so_laddr.s_addr, ntohs(so->so_lport), 213 addr, ntohs(port), 214 errno, port ? " (will retry with random port)" : "")); 215 215 216 216 if (port) /* retry without */ 217 217 status = sobindto(so, addr, 0); 218 218 219 219 if (addr) 220 220 return status; 221 221 else 222 222 return 0; 223 223 } 224 224 … … 241 241 int opt = 1; 242 242 setsockopt(so->s, SOL_SOCKET, SO_REUSEADDR, (char *)&opt, sizeof(opt)); 243 243 port = so->so_lport; 244 244 } 245 245 else 246 246 { 247 247 port = 0; 248 248 } 249 249
Note:
See TracChangeset
for help on using the changeset viewer.