- Timestamp:
- Mar 26, 2012 1:18:08 AM (13 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/libalias/alias_db.c
r40583 r40621 345 345 */ 346 346 int sockfd; /* socket descriptor */ 347 # else 348 struct socket *pSo; 347 349 # endif 348 350 #endif … … 570 572 static int GetNewPort(struct libalias *, struct alias_link *, int); 571 573 #ifndef NO_USE_SOCKETS 574 # ifdef VBOX 575 static u_short GetSocket(struct libalias *, u_short, struct alias_link*, int); 576 # else 572 577 static u_short GetSocket(struct libalias *, u_short, int *, int); 578 # endif 573 579 #endif 574 580 static void CleanupAliasData(struct libalias *); … … 688 694 if (GetSocket(la, port_net, &lnk->sockfd, lnk->link_type)) { 689 695 #else 690 if (GetSocket(la, port_net, NULL, lnk->link_type)) {696 if (GetSocket(la, port_net, lnk, lnk->link_type)) { 691 697 #endif 692 698 lnk->alias_port = port_net; … … 716 722 #ifndef NO_USE_SOCKETS 717 723 static u_short 724 # ifndef VBOX 718 725 GetSocket(struct libalias *la, u_short port_net, int *sockfd, int link_type) 726 # else 727 GetSocket(struct libalias *la, u_short port_net, struct alias_link *pLnk, int link_type) 728 # endif 719 729 { 720 730 int err; … … 727 737 struct sockaddr sa_addr; 728 738 socklen_t socklen = sizeof(struct sockaddr); 729 NOREF(sockfd);730 739 #endif 731 740 … … 816 825 } 817 826 LogFunc(("bind called for socket: %R[natsock]\n", so)); 827 pLnk->pSo = so; 828 so->so_pvLnk = pLnk; 818 829 #else 819 830 *sockfd = sock; … … 970 981 } 971 982 983 #ifdef VBOX 984 /** 985 * when slirp delete the link we need inform libalias about it. 986 */ 987 void slirpDeleteLinkSocket(void *pvLnk) 988 { 989 struct alias_link *lnk = (struct alias_link *)pvLnk; 990 lnk->pSo = NULL; 991 } 992 #endif /* !VBOX */ 993 972 994 static void 973 995 DeleteLink(struct alias_link *lnk) 974 996 { 975 997 struct libalias *la = lnk->la; 998 LogFlowFunc(("ENTER: lnk->pSo:%R[natsock]\n", lnk->pSo)); 976 999 977 1000 LIBALIAS_LOCK_ASSERT(la); … … 1008 1031 } 1009 1032 # else 1010 /* Slirp will close the socket in its own way */ 1033 if (lnk->pSo) 1034 { 1035 la->sockCount--; 1036 /* should we be more smart, or it's enough to be 1037 * narrow-minded and just do sofree here 1038 */ 1039 sofree(la->pData, lnk->pSo); 1040 lnk->pSo = NULL; 1041 } 1011 1042 # endif 1012 1043 #endif … … 1048 1079 ShowAliasStats(la); 1049 1080 } 1081 LogFlowFuncLeave(); 1050 1082 } 1051 1083 … … 1081 1113 # ifndef VBOX 1082 1114 lnk->sockfd = -1; 1115 # else 1116 lnk->pSo = NULL; 1083 1117 # endif 1084 1118 #endif -
trunk/src/VBox/Devices/Network/slirp/socket.c
r40423 r40621 187 187 else if (so == udp_last_so) 188 188 udp_last_so = &udb; 189 /* libalias notification */ 190 if (so->so_pvLnk) 191 slirpDeleteLinkSocket(so->so_pvLnk); 189 192 190 193 /* check if mbuf haven't been already freed */ … … 1224 1227 sofcantrcvmore(struct socket *so) 1225 1228 { 1229 LogFlowFunc(("ENTER: so:%R[natsock]\n", so)); 1226 1230 if ((so->so_state & SS_NOFDREF) == 0) 1227 1231 { … … 1234 1238 else 1235 1239 so->so_state |= SS_FCANTRCVMORE; 1240 LogFlowFuncLeave(); 1236 1241 } 1237 1242 … … 1239 1244 sofcantsendmore(struct socket *so) 1240 1245 { 1246 LogFlowFunc(("ENTER: so:%R[natsock]\n", so)); 1241 1247 if ((so->so_state & SS_NOFDREF) == 0) 1242 1248 shutdown(so->s, 1); /* send FIN to fhost */ … … 1247 1253 else 1248 1254 so->so_state |= SS_FCANTSENDMORE; 1255 LogFlowFuncLeave(); 1249 1256 } 1250 1257 -
trunk/src/VBox/Devices/Network/slirp/socket.h
r39299 r40621 106 106 /* required for port-forwarding */ 107 107 struct libalias *so_la; 108 /* libalias might attach the socket and we want to notify libalias we're freeing it */ 109 void *so_pvLnk; 108 110 #ifdef VBOX_WITH_NAT_UDP_SOCKET_CLONE 109 111 struct socket *so_cloneOf; /* pointer to master instance */ … … 111 113 #endif 112 114 }; 115 116 /* this function inform libalias about socket close */ 117 void slirpDeleteLinkSocket(void *pvLnk); 113 118 114 119 #ifdef VBOX_WITH_SLIRP_MT -
trunk/src/VBox/Devices/Network/slirp/tcp_subr.c
r40583 r40621 355 355 { 356 356 LogFlowFunc(("ENTER: tp = %R[tcpcb793]\n", tp)); 357 LogFunc(("tp->t_socket:%R[natsock]\n",tp->t_socket)); 357 358 358 359 switch (tp->t_state)
Note:
See TracChangeset
for help on using the changeset viewer.