- Timestamp:
- Feb 24, 2009 12:06:19 PM (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
r17043 r17056 1119 1119 int inq, outq; 1120 1120 int status; 1121 socklen_t optlen = sizeof(int); 1121 1122 inq = outq = 0; 1122 socklen_t optlen = sizeof(int);1123 1123 status = getsockopt(so->s, SOL_SOCKET, SO_ERROR, &err, &optlen); 1124 1124 if (status != 0) … … 1558 1558 } 1559 1559 #endif 1560 1561 uint16_t slirp_get_service(int proto, uint16_t dport, uint16_t sport) 1562 { 1563 uint16_t hdport, hsport, service; 1564 hdport = ntohs(dport); 1565 hsport = ntohs(sport); 1566 Log2(("proto: %d, dport: %d sport: %d\n", proto, hdport, hsport)); 1567 service = 0; 1568 switch (hdport) 1569 { 1570 case 500: 1571 if (hsport == 500) service = 500; 1572 break; 1573 } 1574 Log2(("service : %d\n", service)); 1575 return htons(service); 1576 } -
trunk/src/VBox/Devices/Network/slirp/slirp.h
r16226 r17056 321 321 struct tcpcb *tcp_drop(PNATState, struct tcpcb *tp, int err); 322 322 323 uint16_t slirp_get_service(int proto, uint16_t dport, uint16_t sport); 324 323 325 #define MIN_MRU 128 324 326 #define MAX_MRU 16384 -
trunk/src/VBox/Devices/Network/slirp/udp.c
r16946 r17056 202 202 if ((so = socreate()) == NULL) 203 203 goto bad; 204 if (udp_attach(pData, so ) == -1)204 if (udp_attach(pData, so, slirp_get_service(IPPROTO_UDP, uh->uh_dport, uh->uh_sport)) == -1) 205 205 { 206 206 DEBUG_MISC((dfd," udp_attach errno = %d-%s\n", … … 349 349 350 350 int 351 udp_attach(PNATState pData, struct socket *so )351 udp_attach(PNATState pData, struct socket *so, int service_port) 352 352 { 353 353 struct sockaddr_in addr; … … 364 364 */ 365 365 addr.sin_family = AF_INET; 366 addr.sin_port = 0;366 addr.sin_port = service_port; 367 367 addr.sin_addr.s_addr = INADDR_ANY; 368 368 fd_nonblock(so->s); -
trunk/src/VBox/Devices/Network/slirp/udp.h
r16946 r17056 105 105 void udp_input _P((PNATState, register struct mbuf *, int)); 106 106 int udp_output _P((PNATState, struct socket *, struct mbuf *, struct sockaddr_in *)); 107 int udp_attach _P((PNATState, struct socket * ));107 int udp_attach _P((PNATState, struct socket *, int service_port)); 108 108 void udp_detach _P((PNATState, struct socket *)); 109 109 u_int8_t udp_tos _P((struct socket *));
Note:
See TracChangeset
for help on using the changeset viewer.