public inbox for linux-msdos@vger.kernel.org
 help / color / mirror / Atom feed
* DOSEMU does not pick up all packets
@ 2002-11-26 19:01 Stian Sletner
  0 siblings, 0 replies; 10+ messages in thread
From: Stian Sletner @ 2002-11-26 19:01 UTC (permalink / raw)
  To: linux-msdos

Hi.

Thanks to Osvaldo Marques Junior and Ross Vandegrift for answering my
previous question.

I'm trying to use an IPX tunnel to connect my network to another over
IP, but I have a problem with that it seems DOSEMU does not pick up
packets that originate on its listening interface.  I.e. the IPX tunnel
runs on the same box and puts its IPX packets out on eth0 and DOSEMU
listens on eth0 but doesn't pick them up.  I assume this is something
that must be changed in the packet driver to allow it to look at packets
that originate on the same interface?  I tried to hack around in
libpacket.c without achieving much success.  Gurus, come forth. :)

-- 
Stian Sletner

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: DOSEMU does not pick up all packets
@ 2002-11-26 20:57 Stas Sergeev
  2002-11-26 22:02 ` Stian Sletner
  2002-11-28  5:26 ` Stian Sletner
  0 siblings, 2 replies; 10+ messages in thread
From: Stas Sergeev @ 2002-11-26 20:57 UTC (permalink / raw)
  To: linux-msdos

Hello.

Stian Sletner wrote:
> I.e. the IPX tunnel
> runs on the same box and puts its IPX packets out on eth0 and DOSEMU
> listens on eth0 but doesn't pick them up.
Ethernet interface is a kind of not a
loop-back, why are you expecting it to
work that way?

> that originate on the same interface?  I tried to hack around in
> libpacket.c without achieving much success.
Using dosnet dsn0 will give you much
more of a success with this I think.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: DOSEMU does not pick up all packets
  2002-11-26 20:57 Stas Sergeev
@ 2002-11-26 22:02 ` Stian Sletner
  2002-11-28  5:26 ` Stian Sletner
  1 sibling, 0 replies; 10+ messages in thread
From: Stian Sletner @ 2002-11-26 22:02 UTC (permalink / raw)
  To: Stas Sergeev; +Cc: linux-msdos

* At 2002-11-26T23:57+0300, Stas Sergeev wrote:
: 
| Ethernet interface is a kind of not a loop-back, why are you expecting
| it to work that way?

Seems logical that, at least, it would be possible, given that it works
the other way around (packets from DOSEMU gets picked up by the IPX
tunnel).

| Using dosnet dsn0 will give you much more of a success with this I
| think.

Ok, I'll try it.

-- 
Stian Sletner

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: DOSEMU does not pick up all packets
  2002-11-26 20:57 Stas Sergeev
  2002-11-26 22:02 ` Stian Sletner
@ 2002-11-28  5:26 ` Stian Sletner
  1 sibling, 0 replies; 10+ messages in thread
From: Stian Sletner @ 2002-11-28  5:26 UTC (permalink / raw)
  To: Stas Sergeev; +Cc: linux-msdos

* At 2002-11-26T23:57+0300, Stas Sergeev wrote:
: 
| >I.e. the IPX tunnel runs on the same box and puts its IPX packets out
| >on eth0 and DOSEMU listens on eth0 but doesn't pick them up.
| 
| Ethernet interface is a kind of not a loop-back, why are you expecting
| it to work that way?

I experimented some more with this, since it seemed to be the right
thing to do, the dosnet stuff is IP oriented after all, and shouldn't be
necessary to achieve this, I would think.  There's no end to what one
can achieve with an all-nighter of source hacking, eh?  After tons of
experimenting and code-writing (and Coke drinking), it boiled down to a
one-line change (of course :) to get it working.  Here's the patch.  I'd
like to know if this could be applied or if that'd break something else?

--- libpacket.orig	2002-11-26 19:47:24.000000000 +0100
+++ libpacket.c	2002-11-28 06:25:17.000000000 +0100
@@ -83,7 +83,7 @@
 	if (!config.secure) enter_priv_on();
 #ifdef AF_PACKET
 	if (running_kversion >= 2001000)
-		s = socket(AF_PACKET, SOCK_PACKET, proto);
+		s = socket(AF_PACKET, SOCK_PACKET, htons(ETH_P_ALL));
 	else
 		s = socket(AF_INET, SOCK_PACKET, proto);
 #else

-- 
Stian Sletner

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: DOSEMU does not pick up all packets
@ 2002-11-28 21:06 Stas Sergeev
  2002-11-28 21:59 ` Stian Sletner
  0 siblings, 1 reply; 10+ messages in thread
From: Stas Sergeev @ 2002-11-28 21:06 UTC (permalink / raw)
  To: linux-msdos

Hello.

Stian Sletner wrote:
> I experimented some more with this, since it seemed to be the right
> thing to do, the dosnet stuff is IP oriented after all, and shouldn't 
> be necessary to achieve this, I would think.
Dosnet have nothing to do with IP.
It's goal is to emulate an Ethernet
network on a single machine.
This is accomplished by:
1. Assigning an unique MAC address
(fake) to each dosemu session (done
in libpacket.c);
2. Ensuring that each dosemu receives
only the packets directed to it, and
the broadcast ones. (done in dosnet
module). This is achieved by manipulating
the "protocol" field of skb, and your
patch breaks this.

> There's no end to what one
> can achieve with an all-nighter of source hacking, eh?
I think you'd better spent some efforts
to rethink your needs:) as what you are
doing, seems out of curiosity (to me at
least).

> After tons of
> experimenting and code-writing (and Coke drinking), it boiled down to a
> one-line change (of course :) to get it working.
To get working what? If you want to put
the packets to the interface and pick them
back immediately, then why not just use
a loopback lo interface (for example)?

> Here's the patch.  
You could probably achieve the same with
just ETH_P_LOOP instead of ETH_P_ALL.

> I'd like to know if this could be applied or if that'd break something 
> else?
It breaks everything.
It breaks dosnet for already described
reason (all dosemus will receive all the
packets, and not only the ones directed to
them).
It breaks also a packet driver, as the DOS
software will now receive every ethernet
frames, even if it requested a particular
type.

Well, before anything else, please just
explain (to yourself and to me:) what do you
*actually* need?
How something can work correctly, if you
use an interface the way it is not intended
to be used?
What is a dest. address of the frames you
are going to pick up? If the dest. address
doesn't match the addr. of the interface
you are picking it from (and the dest is not
a broadcast), then you are already doing
something wrong.
 From what I have currently, it seems to me
that you have to think again about a dosnet
(reverting your patch at first of course,
otherwise don't think about dosnet anymore:),
because dosnet was specially designed for
the tricks like that and it's functionality
is very close to TAP interface (maybe one
day I'll make dosemu to use TAP so that we
throw dosnet away).

I don't have an internet connection from
my LAN now because the admins changed the
net mask on their routers from 255.255.255.0
to 255.255.0.0 in order to "make all the
subnets visible to each other", but actually
they got a clash of an IP ranges on every
router's interfaces, so whenever my station
sends an ARP request with my IP, the router
answers with it's own MAC, because it thinks
this IP exists in another subnet.
This incident definitely have some similarities
with your patch:)
[OK, gone to duel with admins:) ]


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: DOSEMU does not pick up all packets
  2002-11-28 21:06 DOSEMU does not pick up all packets Stas Sergeev
@ 2002-11-28 21:59 ` Stian Sletner
  0 siblings, 0 replies; 10+ messages in thread
From: Stian Sletner @ 2002-11-28 21:59 UTC (permalink / raw)
  To: Stas Sergeev; +Cc: linux-msdos

* At 2002-11-29T00:06+0300, Stas Sergeev wrote:
| Well, before anything else, please just explain (to yourself and to
| me:) what do you *actually* need?

Stas, thanks for answering, I'm sorry if I sound confused, because I'm
not actually very much so. :)  Let me try to explain in examples.

I have a Linux box and a DOS box on my LAN.  Using DOSEMU's packet
driver I'm able to link them up with IPX in Doom.  That's great.

Now, if I want to link with someone else over the Internet, I can use an
IPX bridge/tunnel to connect to a remote LAN from my Linux box.  Doing
this, I can link my DOS box with the other side in Doom and play over
the net.

However, I can _not_ link my Linux box running DOSEMU to the other side,
as long as the IPX tunnel runs on the same box.  The incoming IPX
packets _are_ to broadcast address, but DOSEMU does not pick them up
because (I assume) they originate from the same interface, eth0.  I
cannot use the loopback interface for this, as that wouldn't enable me
to link to both the DOS box and the other side of the tunnel at once.
Using my hack, DOSEMU picks up the tunneled packets, and is able to link
to both the other side and my local DOS box.

It seems to me that DOSEMU _should_ be able to pick up these packets,
since, again, they're aimed to broadcast (all Doom IPX traffic is,
AFAIK).

Any clearer?

-- 
Stian Sletner

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: DOSEMU does not pick up all packets
@ 2002-11-29  0:40 Stas Sergeev
  2002-11-29 19:26 ` Stian Sletner
  0 siblings, 1 reply; 10+ messages in thread
From: Stas Sergeev @ 2002-11-29  0:40 UTC (permalink / raw)
  To: linux-msdos

Hello.

Stian Sletner wrote:
> The incoming IPX
> packets _are_ to broadcast address, but DOSEMU does not pick them up
> because (I assume) they originate from the same interface, eth0.
Well, all the outgoing packets have
the PACKET_OUTGOING type. They are
not intended to be received on the
same interface.
ETH_P_ALL is a special case, it seem
to allow to break that rule (probably
only for broadcast, I don't know).

> Using my hack, DOSEMU picks up the tunneled packets, and is able to 
> link to both the other side and my local DOS box
Can you, for example, run 2 instances
of dosemu and play a network Doom on a
single machine using your hack?

> It seems to me that DOSEMU _should_ be able to pick up these packets,
> since, again, they're aimed to broadcast
And if they are not?
Anyway, don't try to establish a virtual
network on a single ethernet interface.
There are other possibilities of doing that
without breaking a dosemu functionality.

> (all Doom IPX traffic is,
> AFAIK).
Not true, Doom uses broadcast only when
it searches for another node, and after
that it uses a directded traffic (produce
a +P log and check that out).

> Any clearer?
No, the problem is clear.
Now what I would probably try in that case.
Note that I never actually tried something
like that, so it would be interesting to
hear if it works, or what am I missing.
I think you have to do bridging to your
eth0 device *and* to dsn0 device.
Then your other DOS machine will receive
the traffic via the real Ethernet and also
you can run an arbitrary amount of dosemu
sessions, which will work in their separate
virtual network, to which you also do a
bridging on the same machine.
Does this work?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: DOSEMU does not pick up all packets
  2002-11-29  0:40 Stas Sergeev
@ 2002-11-29 19:26 ` Stian Sletner
  0 siblings, 0 replies; 10+ messages in thread
From: Stian Sletner @ 2002-11-29 19:26 UTC (permalink / raw)
  To: Stas Sergeev; +Cc: linux-msdos

Hi again.

I thought I had a clever idea, ifconfig'd up a virtual interface eth0:0
and set $_netdev = "eth0:0", but that made dosemu crash so it probably
wasn't. ;)

* At 2002-11-29T03:40+0300, Stas Sergeev wrote:
: 
| Note that I never actually tried something like that, so it would be
| interesting to hear if it works, or what am I missing.

I'm having problems compiling the dosnet module in RH8.  Gives all sorts
of parse errors.  I'd paste only I think I fucked with the file already.

| I think you have to do bridging to your eth0 device *and* to dsn0
| device.

I don't know if this is doable.  Would I need some sort of program to
"tee" them together?

-- 
Stian Sletner

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: DOSEMU does not pick up all packets
@ 2002-11-29 20:27 Stas Sergeev
  2002-11-29 20:48 ` Stian Sletner
  0 siblings, 1 reply; 10+ messages in thread
From: Stas Sergeev @ 2002-11-29 20:27 UTC (permalink / raw)
  To: linux-msdos

Hello.

Stian Sletner wrote:
> I thought I had a clever idea, ifconfig'd up a virtual interface eth0:0
> and set $_netdev = "eth0:0", but that made dosemu crash so it probably
How exactly the crash looks like?

> I'm having problems compiling the dosnet module in RH8.
It was already reported that there
are problems compiling dosnet under
RH8. The fix is to get the fresh
kernel sources and make a proper
symlinks for /usr/include/linux and
/usr/include/asm

> I'd paste only I think I fucked with the file 
> already.
Btw, to get the trick working, you'll
(most likely) need the latest dosnet
(ie from dosemu > 1.1.3.4).

> | I think you have to do bridging to your eth0 device *and* to dsn0
> | device.
> I don't know if this is doable.  Would I need some sort of program to
> "tee" them together?
Hmm, but I supposed your bridging
software can do that. Why are you
limited with bridging between only
2 interfaces?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: DOSEMU does not pick up all packets
  2002-11-29 20:27 Stas Sergeev
@ 2002-11-29 20:48 ` Stian Sletner
  0 siblings, 0 replies; 10+ messages in thread
From: Stian Sletner @ 2002-11-29 20:48 UTC (permalink / raw)
  To: Stas Sergeev; +Cc: linux-msdos

* At 2002-11-29T23:27+0300, Stas Sergeev wrote:
: 
| >I thought I had a clever idea, ifconfig'd up a virtual interface eth0:0
| >and set $_netdev = "eth0:0", but that made dosemu crash so it probably
| How exactly the crash looks like?

stian:~$ nice -20 dos -D+P -o dos.debug >dos.out 2>&1

dos.debug:

debug flags: -a
debug flags: +P
========Sending packet======
packet to send: :
 Dest.=ff:ff:ff:ff:ff:ff: Source=0:40:95:0:3c:31: Type= 3781 
PD ERR:  AX=0481 BX=03bc CX=003c DX=0c08 FLAGS=00033017
      SI=163c DI=164a BP=ff7c SP=ff6e CS=f000 DS=0f90 ES=0f90 SS=17f1
SIGILL while in vm86()
ERROR: unexpected CPU exception 0x06 err=0x00000000 cr2=00000000 while in vm86 (DOS)


leavedos(4|0x4) called - shutting down

dos.out:

Linux kernel 2.4.18; CPU speed is 300676000 Hz
Dosemu-1.1.3.7 Running on CPU=586, FPU=1
^[[?25h^[[0m^[[H^[[2JERROR: unexpected CPU exception 0x06 err=0x00000000 cr2=00000000 while in vm86 (DOS)
Program=sigsegv.c, Line=162
EIP: 8b2e:00003669 ESP: 17f1:0000ff70  VFLAGS(b): 00000 00110000 00000110
EAX: 00007ff9 EBX: 0000000e ECX: 0000003d EDX: 00000733 VFLAGS(h): 00003006
ESI: 0000163c EDI: 0000164a EBP: 0000ff7c DS: 0f90 ES: 0f90 FS: 0000 GS: 0000
FLAGS: PF IF RF VM  IOPL: 3
STACK: 35 02 e6 19 00 b8 92 ff 15 07 -> 13 00 27 13 08 16 90 0f 82 03 
OPS  : 00 00 00 00 00 40 6a 13 33 01 -> ff ff ff ff ff ff 02 00 00 00 
	ffff                8b2e:3669 ???     di

| >I'm having problems compiling the dosnet module in RH8.
| It was already reported that there
| are problems compiling dosnet under
| RH8. The fix is to get the fresh
| kernel sources and make a proper
| symlinks for /usr/include/linux and
| /usr/include/asm

Ah.

| Why are you limited with bridging between only 2 interfaces?

Well, it only listens on one interface, and packs up the packets in IP
and sends them off in UDP through normal networking means.  And listens
for UDP (IPADDR_ANY) and unpacks and puts them out on the interface.

What I'm currently using is "SIB", btw.  (It's on freshmeat somewhere if
you want to look.)

-- 
Stian Sletner

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-11-29 20:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-28 21:06 DOSEMU does not pick up all packets Stas Sergeev
2002-11-28 21:59 ` Stian Sletner
  -- strict thread matches above, loose matches on Subject: below --
2002-11-29 20:27 Stas Sergeev
2002-11-29 20:48 ` Stian Sletner
2002-11-29  0:40 Stas Sergeev
2002-11-29 19:26 ` Stian Sletner
2002-11-26 20:57 Stas Sergeev
2002-11-26 22:02 ` Stian Sletner
2002-11-28  5:26 ` Stian Sletner
2002-11-26 19:01 Stian Sletner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox