public inbox for linux-msdos@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Flores <almauri@cs.com.uy>
To: linux-msdos@vger.kernel.org
Subject: Running PC/TCP inside DosEmu
Date: Tue, 29 Jul 2008 23:21:26 -0300	[thread overview]
Message-ID: <1217384487.7585.55.camel@voyagerNG> (raw)

[-- Attachment #1: Type: text/plain, Size: 2183 bytes --]

Hi, 
I've been traying to run a DOS application inside DosEmu 1.4.0. That
application uses the PC/TCP drivers to implement a TCP/IP stack and
network comunications.
I could make the application work with no problem using the "direct"
mode, but because we need to contact applications inside the same linux
machine that was running the DosEmu box we have to move to the "tap"
virtual network option. From that moment we couldn't stablish any
connection from inside the DosEmu box. 
I start to debug the DosEmu code and found out that the packages that
come from the TAP driver were pased to the DOS application without
problems, but the connections from inside the DOS application could not
be stablished. I also analyze the TAP code to see if I could found the
problem (I also get in touch with the TUN/TAP mantainer) but I didn't
found any problem there.
So, after some research I reach to the conclution that, for some rason
the PC/TCP driver was dropping tha packets that arrive to the DosEmu
Box. After digging more on the network traffic I could found the
problem.
The problem is that in the Ethernet specification says that no ethernet
frame can be shorter than 60 bytes. The TAP driver relays on the
internal kernel functions to build the frames, and the internal kernel
functions relays on the network card driver to fix the ethernet size
before putting it on the cable... so, because the TAP doesn't have any
"card driver" the TAP can generate packets shorter than 60 bytes and the
PC/TCP driver (and I think that many more DOS native TCP/IP
implementations) droppes them. An example of a packet that is shorter
than 60 bytes is the ARP replay... so you start with the wrong foot.
Any case, I write a few code lines inside the DosEmu packet driver code
to fix this.
I'm attaching that code in the mail in case you wan't to include them
for the nex release or whatever. 
I'm also in contact with the TUN/TAP team (I also write a fix for the
TUN/TAP) to see if they want to fix this on the TAP driver, but I don't
think they will include it there.

So, this are my 2 cents, hope that this may help some one. Please let me
know your thoughts about this.

regards, Mauro Flores

[-- Attachment #2: fix.patch --]
[-- Type: text/x-patch, Size: 695 bytes --]

--- dosemu-1.4.0_fix/src/dosext/net/net/pktnew.c	2008-07-29 23:08:59.000000000 -0300
+++ dosemu-1.4.0/src/dosext/net/net/pktnew.c	2007-05-04 02:59:48.000000000 -0300
@@ -709,17 +709,6 @@
 		*--p = (char)(ETH_P_IPX >> 8);
 	    }
 #endif
-
-		/* The TAP driver can send ethernet frames shorter than 60 bytes that may be dropped for the DOS
-		 * stack implementation. This will fix the packet size adding a trailer at the end. by almauri@cs.com.uy 
-		 */
-
-		if( size < ETH_ZLEN ) { 
-	    	pd_printf("Fixing packet padding. Actual length: %d\n", size);
-			memset( pkt_buf+size, '0', ETH_ZLEN-size );
-			size = ETH_ZLEN;
-		}
-
 	    p_stats->packets_in++;
 	    p_stats->bytes_in += size;
 

                 reply	other threads:[~2008-07-30  2:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1217384487.7585.55.camel@voyagerNG \
    --to=almauri@cs.com.uy \
    --cc=linux-msdos@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox