Author: cgutman
Date: Fri Aug 27 04:46:04 2010
New Revision: 48628
URL:
http://svn.reactos.org/svn/reactos?rev=48628&view=rev
Log:
[OSKITTCP]
- Only tell the caller how much we sent/received if it completed successfully
- Set SO_DONTROUTE on accepted sockets too
- Disable the core routing code
- Make our MSS calculation much better by sharing the existing code
Modified:
trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c
trunk/reactos/lib/drivers/oskittcp/oskittcp/route.c
trunk/reactos/lib/drivers/oskittcp/oskittcp/tcp_input.c
Modified: trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/oskittcp/oskit…
==============================================================================
--- trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c [iso-8859-1] Fri Aug 27
04:46:04 2010
@@ -114,6 +114,12 @@
DbgPrint ( line );
}
+void InitializeSocketFlags(struct socket *so)
+{
+ so->so_state |= SS_NBIO;
+ so->so_options |= SO_DONTROUTE;
+}
+
/* From uipc_syscalls.c */
int OskitTCPSocket( void *context,
@@ -128,8 +134,7 @@
int error = socreate(domain, &so, type, proto);
if( !error ) {
so->so_connection = context;
- so->so_state |= SS_NBIO;
- so->so_options |= SO_DONTROUTE;
+ InitializeSocketFlags(so);
*aso = so;
}
OSKUnlock();
@@ -171,7 +176,7 @@
&tcp_flags );
OSKUnlock();
- *OutLen = Len - uio.uio_resid;
+ if (error == 0) *OutLen = Len - uio.uio_resid;
return error;
}
@@ -318,7 +323,7 @@
error = sosend( socket, NULL, &uio, NULL, NULL, 0 );
OSKUnlock();
- *OutLen = Len - uio.uio_resid;
+ if (error == 0) *OutLen = Len - uio.uio_resid;
return error;
}
@@ -400,7 +405,8 @@
if (error)
goto out;
- so->so_state |= SS_NBIO | SS_ISCONNECTED;
+ InitializeSocketFlags(so);
+ so->so_state |= SS_ISCONNECTED;
so->so_q = so->so_q0 = NULL;
so->so_qlen = so->so_q0len = 0;
so->so_head = 0;
Modified: trunk/reactos/lib/drivers/oskittcp/oskittcp/route.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/oskittcp/oskit…
==============================================================================
--- trunk/reactos/lib/drivers/oskittcp/oskittcp/route.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/oskittcp/oskittcp/route.c [iso-8859-1] Fri Aug 27 04:46:04
2010
@@ -106,6 +106,7 @@
int report;
u_long ignflags;
{
+#ifndef __REACTOS__
register struct radix_node_head *rnh = rt_tables[dst->sa_family];
register struct rtentry *rt;
register struct radix_node *rn;
@@ -142,6 +143,9 @@
}
splx(s);
return (newrt);
+#else
+ return NULL;
+#endif
}
void
Modified: trunk/reactos/lib/drivers/oskittcp/oskittcp/tcp_input.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/oskittcp/oskit…
==============================================================================
--- trunk/reactos/lib/drivers/oskittcp/oskittcp/tcp_input.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/oskittcp/oskittcp/tcp_input.c [iso-8859-1] Fri Aug 27
04:46:04 2010
@@ -1973,31 +1973,26 @@
struct tcpcb *tp;
int offer;
{
+#ifndef __REACTOS__
register struct rtentry *rt;
struct ifnet *ifp = NULL;
- register int rtt, mss;
+ struct rmxp_tao *taop;
+ register int rtt;
+#endif
+ register int mss;
u_long bufsize;
struct inpcb *inp;
struct socket *so;
- struct rmxp_tao *taop;
int origoffer = offer;
inp = tp->t_inpcb;
+ so = inp->inp_socket;
+#ifndef __REACTOS__
if ((rt = tcp_rtlookup(inp)) == NULL) {
-#ifndef __REACTOS__
tp->t_maxopd = tp->t_maxseg = tcp_mssdflt;
-#else
- if (offer < tcp_mssdflt)
- tp->t_maxopd = tp->t_maxseg = tcp_mssdflt;
- else
- tp->t_maxopd = tp->t_maxseg = min(offer, tcp_mssopt(tp));
-#endif
return;
}
-#ifndef __REACTOS__
ifp = rt->rt_ifp;
-#endif
- so = inp->inp_socket;
taop = rmx_taop(rt->rt_rmx);
/*
@@ -2006,6 +2001,7 @@
*/
if (offer == -1)
offer = taop->tao_mssopt;
+#endif
/*
* Offer == 0 means that there was no MSS on the SYN segment,
* in this case we use tcp_mssdflt.
@@ -2020,6 +2016,7 @@
* funny things may happen in tcp_output.
*/
offer = max(offer, 64);
+#ifndef __REACTOS__
taop->tao_mssopt = offer;
/*
@@ -2060,6 +2057,10 @@
if (!in_localaddr(inp->inp_faddr))
mss = min(mss, tcp_mssdflt);
}
+#else
+ mss = tcp_mssopt(tp);
+ mss = min(mss, tcp_mssdflt);
+#endif
mss = min(mss, offer);
/*
* maxopd stores the maximum length of data AND options
@@ -2097,7 +2098,7 @@
* number of mss units; if the mss is larger than
* the socket buffer, decrease the mss.
*/
-#ifdef RTV_SPIPE
+#if defined(RTV_SPIPE) && !defined(__REACTOS__)
if ((bufsize = rt->rt_rmx.rmx_sendpipe) == 0)
#endif
bufsize = so->so_snd.sb_hiwat;
@@ -2111,7 +2112,7 @@
}
tp->t_maxseg = mss;
-#ifdef RTV_RPIPE
+#if defined(RTV_RPIPE) && !defined(__REACTOS__)
if ((bufsize = rt->rt_rmx.rmx_recvpipe) == 0)
#endif
bufsize = so->so_rcv.sb_hiwat;
@@ -2121,12 +2122,15 @@
bufsize = sb_max;
(void)sbreserve(&so->so_rcv, bufsize);
}
+#ifndef __REACTOS__
/*
* Don't force slow-start on local network.
*/
if (!in_localaddr(inp->inp_faddr))
+#endif
tp->snd_cwnd = mss;
+#ifndef __REACTOS__
if (rt->rt_rmx.rmx_ssthresh) {
/*
* There's some sort of gateway or interface
@@ -2137,6 +2141,7 @@
tp->snd_ssthresh = max(2 * mss, rt->rt_rmx.rmx_ssthresh);
tcpstat.tcps_usedssthresh++;
}
+#endif
}
/*