Changeset 28482 in vbox for trunk/src/VBox/Devices/Network
- Timestamp:
- Apr 19, 2010 4:44:22 PM (15 years ago)
- Location:
- trunk/src/VBox/Devices/Network/slirp
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/misc.h
r28449 r28482 32 32 #define _MISC_H_ 33 33 34 #define EMU_NONE 0x035 36 /* TCP emulations */37 #define EMU_CTL 0x138 #define EMU_FTP 0x239 #define EMU_KSH 0x340 #define EMU_IRC 0x441 #define EMU_REALAUDIO 0x542 #define EMU_RLOGIN 0x643 #define EMU_IDENT 0x744 #define EMU_RSH 0x845 46 #define EMU_NOCONNECT 0x10 /* Don't connect */47 48 /* UDP emulations */49 #define EMU_TALK 0x150 #define EMU_NTALK 0x251 #define EMU_CUSEEME 0x352 53 struct tos_t54 {55 u_int16_t lport;56 u_int16_t fport;57 u_int8_t tos;58 u_int8_t emu;59 };60 61 struct emu_t62 {63 u_int16_t lport;64 u_int16_t fport;65 u_int8_t tos;66 u_int8_t emu;67 struct emu_t *next;68 };69 70 extern struct emu_t *tcpemu;71 34 72 35 extern int x_port, x_server, x_display; -
trunk/src/VBox/Devices/Network/slirp/socket.h
r28449 r28482 75 75 76 76 u_int8_t so_iptos; /* Type of service */ 77 u_int8_t so_emu; /* Is the socket emulated? */78 77 79 78 u_char so_type; /* Type of socket, UDP or TCP */ -
trunk/src/VBox/Devices/Network/slirp/tcp_input.c
r28480 r28482 530 530 so->so_fport = ti->ti_dport; 531 531 532 if ((so->so_iptos = tcp_tos(so)) == 0) 533 so->so_iptos = ((struct ip *)ti)->ip_tos; 532 so->so_iptos = ((struct ip *)ti)->ip_tos; 534 533 535 534 tp = sototcpcb(so); … … 766 765 * But a bit of spaghetti code never hurt anybody :) 767 766 */ 768 769 if (so->so_emu & EMU_NOCONNECT)770 {771 so->so_emu &= ~EMU_NOCONNECT;772 goto cont_input;773 }774 775 767 if ( (tcp_fconnect(pData, so) == -1) 776 768 && errno != EINPROGRESS … … 1594 1586 case TCPS_SYN_RECEIVED: 1595 1587 case TCPS_ESTABLISHED: 1596 if(so->so_emu == EMU_CTL) /* no shutdown on socket */ 1597 tp->t_state = TCPS_LAST_ACK; 1598 else 1599 tp->t_state = TCPS_CLOSE_WAIT; 1588 tp->t_state = TCPS_CLOSE_WAIT; 1600 1589 break; 1601 1590 -
trunk/src/VBox/Devices/Network/slirp/tcp_subr.c
r28480 r28482 587 587 so->s = s; 588 588 589 so->so_iptos = tcp_tos(so);590 589 tp = sototcpcb(so); 591 590 … … 625 624 return 0; 626 625 } 627 628 /*629 * Set the socket's type of service field630 */631 static const struct tos_t tcptos[] =632 {633 {0, 20, IPTOS_THROUGHPUT, 0}, /* ftp data */634 {21, 21, IPTOS_LOWDELAY, EMU_FTP}, /* ftp control */635 {0, 23, IPTOS_LOWDELAY, 0}, /* telnet */636 {0, 80, IPTOS_THROUGHPUT, 0}, /* WWW */637 {0, 513, IPTOS_LOWDELAY, EMU_RLOGIN|EMU_NOCONNECT}, /* rlogin */638 {0, 514, IPTOS_LOWDELAY, EMU_RSH|EMU_NOCONNECT}, /* shell */639 {0, 544, IPTOS_LOWDELAY, EMU_KSH}, /* kshell */640 {0, 543, IPTOS_LOWDELAY, 0}, /* klogin */641 {0, 6667, IPTOS_THROUGHPUT, EMU_IRC}, /* IRC */642 {0, 6668, IPTOS_THROUGHPUT, EMU_IRC}, /* IRC undernet */643 {0, 7070, IPTOS_LOWDELAY, EMU_REALAUDIO }, /* RealAudio control */644 {0, 113, IPTOS_LOWDELAY, EMU_IDENT }, /* identd protocol */645 {0, 0, 0, 0}646 };647 648 /*649 * Return TOS according to the above table650 */651 u_int8_t652 tcp_tos(struct socket *so)653 {654 return 0;655 } -
trunk/src/VBox/Devices/Network/slirp/udp.c
r28449 r28482 268 268 so->so_lport = uh->uh_sport; 269 269 270 if ((so->so_iptos = udp_tos(so)) == 0) 271 so->so_iptos = ip->ip_tos; 270 so->so_iptos = ip->ip_tos; 272 271 273 272 /* … … 294 293 m->m_len -= iphlen; 295 294 m->m_data += iphlen; 296 297 /*298 * Now we sendto() the packet.299 */300 if (so->so_emu)301 udp_emu(pData, so, m);302 295 303 296 ttl = ip->ip_ttl = save_ip.ip_ttl; … … 491 484 } 492 485 493 static const struct tos_t udptos[] =494 {495 { 0, 53, IPTOS_LOWDELAY, 0 }, /* DNS */496 { 517, 517, IPTOS_LOWDELAY, EMU_TALK }, /* talk */497 { 518, 518, IPTOS_LOWDELAY, EMU_NTALK }, /* ntalk */498 { 0, 7648, IPTOS_LOWDELAY, EMU_CUSEEME }, /* Cu-Seeme */499 { 0, 0, 0, 0 }500 };501 502 u_int8_t503 udp_tos(struct socket *so)504 {505 int i = 0;506 507 while(udptos[i].tos)508 {509 if ( (udptos[i].fport && RT_N2H_U16(so->so_fport) == udptos[i].fport)510 || (udptos[i].lport && RT_N2H_U16(so->so_lport) == udptos[i].lport))511 {512 so->so_emu = udptos[i].emu;513 return udptos[i].tos;514 }515 i++;516 }517 518 return 0;519 }520 521 #ifdef EMULATE_TALK522 #include "talkd.h"523 #endif524 525 /*526 * Here, talk/ytalk/ntalk requests must be emulated527 */528 void529 udp_emu(PNATState pData, struct socket *so, struct mbuf *m)530 {531 so->so_emu = 0;532 }533 534 486 struct socket * 535 487 udp_listen(PNATState pData, u_int32_t bind_addr, u_int port, u_int32_t laddr, u_int lport, int flags)
Note:
See TracChangeset
for help on using the changeset viewer.