[ros-diffs] [cgutman] 44618: [OSKITTCP] - Fix broken MTU code (MTU was assumed to always be 1500)

cgutman at svn.reactos.org cgutman at svn.reactos.org
Wed Dec 16 03:41:39 CET 2009


Author: cgutman
Date: Wed Dec 16 03:41:39 2009
New Revision: 44618

URL: http://svn.reactos.org/svn/reactos?rev=44618&view=rev
Log:
[OSKITTCP]
 - Fix broken MTU code (MTU was assumed to always be 1500)

Modified:
    branches/aicom-network-branch/lib/drivers/oskittcp/oskittcp/ip_output.c

Modified: branches/aicom-network-branch/lib/drivers/oskittcp/oskittcp/ip_output.c
URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-branch/lib/drivers/oskittcp/oskittcp/ip_output.c?rev=44618&r1=44617&r2=44618&view=diff
==============================================================================
--- branches/aicom-network-branch/lib/drivers/oskittcp/oskittcp/ip_output.c [iso-8859-1] (original)
+++ branches/aicom-network-branch/lib/drivers/oskittcp/oskittcp/ip_output.c [iso-8859-1] Wed Dec 16 03:41:39 2009
@@ -160,6 +160,7 @@
 	 */
 #define ifatoia(ifa)	((struct in_ifaddr *)(ifa))
 #define sintosa(sin)	((struct sockaddr *)(sin))
+#ifndef __REACTOS__
 	if (flags & IP_ROUTETOIF) {
 		if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == 0 &&
 		    (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == 0) {
@@ -167,9 +168,8 @@
 			error = ENETUNREACH;
 			goto bad;
 		}
-#ifndef __REACTOS__
+
 		ifp = ia->ia_ifp;
-#endif
 		ip->ip_ttl = 1;
 	} else {
 		/*
@@ -181,7 +181,7 @@
 		 * the link layer, as this is probably required in all cases
 		 * for correct operation (as it is for ARP).
 		 */
-#ifndef __REACTOS__
+
 		if (ro->ro_rt == 0)
 			rtalloc_ign(ro, RTF_PRCLONING);
 		if (ro->ro_rt == 0) {
@@ -195,8 +195,17 @@
 		ro->ro_rt->rt_use++;
 		if (ro->ro_rt->rt_flags & RTF_GATEWAY)
 			dst = (struct sockaddr_in *)ro->ro_rt->rt_gateway;
-#endif
-	}
+	}
+
+#else
+	if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == 0 &&
+	    (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == 0) {
+		ipstat.ips_noroute++;
+		error = ENETUNREACH;
+		goto bad;
+	}
+#endif
+
 #ifndef __REACTOS__
 	if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) {
 		struct in_multi *inm;
@@ -358,7 +367,9 @@
 	/*
 	 * If small enough for interface, can just send directly.
 	 */
-	if ((u_short)ip->ip_len <= 1400 /* XXX Get MTU from Interface */) {
+
+	/* FIXME: This was ROS-modified code. Where is the original? */
+	if ((u_short)ip->ip_len <= ((struct ifaddr *)ia)->ifa_mtu) {
 	    ip->ip_len = htons((u_short)ip->ip_len);
 	    ip->ip_off = htons((u_short)ip->ip_off);
 	    ip->ip_sum = 0;
@@ -421,8 +432,7 @@
 		goto bad;
 	}
 #else
-	OS_DbgPrint(OSK_MID_TRACE,("Using default mtu of 1500\n"));
-	len = (1500 - hlen) & ~7;
+	len = (((struct ifaddr *)ia)->ifa_mtu - hlen) & ~7;
 #endif
 
     {




More information about the Ros-diffs mailing list