From: Stas Sergeev <stssppnn@yahoo.com>
To: linux-msdos@vger.kernel.org
Cc: Stian Sletner <stian@sletner.com>
Subject: Re: Doom in Linux HOWTO
Date: Tue, 07 Jan 2003 21:53:19 +0300 [thread overview]
Message-ID: <3E1B221F.1060300@yahoo.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1688 bytes --]
Hello.
Stian Sletner wrote:
> | And I also think that tunelling to dsn will work. I tried 2 dosemu
> | sessions: first with $_vnet=(on) and the second with $_vnet=(off) (as
> | acting from outside) and the dooms see each other.
> Mm, I still have some testing to do...
OK, given that SIB doesn't support more
than 2 interfaces and that dosnet doesn't
support a kernel bridging (bridging to it
from user-space is OK however), the things
are difficult...
But I've found a solution for you:)
At first, compile and start the simple
bridge I've just made by copy/pasting some
examples supplied with TUN/TAP driver.
The code is attached.
If it printed something like:
Allocated devices: tap0 and tap1
then everything goes fine.
The second, as dosnet doesn't support the
kernel bridging, apply the TUN/TAP patch
from my page, do the necessary change in
dosemu.conf and start dosemu. It will
allocate tap2 (now as the tap0 and tap1
are busy already).
Now do this:
ifconfig tap0 up
ifconfig tap1 up
ifconfig tap2 up
brctl addbr br0
brctl addif br0 tap1
brctl addif br0 tap2
brctl addif br0 eth0
ifconfig br0 up
If there were no errors, you are doing good:)
Now configure your SIB to communicate to tap0
(note that tap0 was not added to br0 bridge as
it is intended to be used by SIB).
That should do it. If I haven't forgot something,
now you have 3 dosemu sessions working together:
on the other end of SIB; on tap2 on the same
machine; somewhere on the net to which the eth0
is connected.
Well, this may be too complicated at a first
glance (3 different bridging software working
between different virtual interfaces etc), but
that would definitely be a lot of fun for you
to play with:)
[-- Attachment #2: sbr.c --]
[-- Type: text/plain, Size: 1771 bytes --]
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/types.h>
#include <netinet/if_ether.h>
#include <linux/if.h>
#include <linux/if_tun.h>
#define max(a,b) ((a)>(b) ? (a):(b))
int tun_alloc(char *dev)
{
struct ifreq ifr;
int fd, err;
if( (fd = open("/dev/net/tun", O_RDWR)) < 0 )
return -1;
memset(&ifr, 0, sizeof(ifr));
/* Flags: IFF_TUN - TUN device (no Ethernet headers)
* IFF_TAP - TAP device
*
* IFF_NO_PI - Do not provide packet information
*/
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
if( *dev )
strncpy(ifr.ifr_name, dev, IFNAMSIZ);
if( (err = ioctl(fd, TUNSETIFF, (void *) &ifr)) < 0 ){
close(fd);
return err;
}
strcpy(dev, ifr.ifr_name);
return fd;
}
int main(int argc, char *argv[])
{
char dev1[7], dev2[7], buf[1600];
int f1,f2,l,fm;
fd_set fds;
strcpy(dev1,"tap%d");
strcpy(dev2,"tap%d");
if (((f1 = tun_alloc(dev1)) < 0) || ((f2 = tun_alloc(dev2)) < 0)) {
printf("Cannot allocate TAP device\n");
exit(1);
}
printf("Allocated devices: %s and %s\n", dev1, dev2);
fm = max(f1, f2) + 1;
/*
ioctl(f1, TUNSETNOCSUM, 1);
ioctl(f2, TUNSETNOCSUM, 1);
*/
while(1){
FD_ZERO(&fds);
FD_SET(f1, &fds);
FD_SET(f2, &fds);
select(fm, &fds, NULL, NULL, NULL);
if( FD_ISSET(f1, &fds) ) {
l = read(f1,buf,sizeof(buf));
printf("Got %i bytes from %s\n", l, dev1);
write(f2,buf,l);
}
if( FD_ISSET(f2, &fds) ) {
l = read(f2,buf,sizeof(buf));
printf("Got %i bytes from %s\n", l, dev2);
write(f1,buf,l);
}
}
}
next reply other threads:[~2003-01-07 18:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-07 18:53 Stas Sergeev [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-12-08 20:10 Doom in Linux HOWTO Stas Sergeev
2002-12-08 14:35 Stas Sergeev
2002-12-08 16:55 ` Stian Sletner
2002-12-08 19:36 ` phrostie
2002-12-08 18:12 ` Peter Jay Salzman
2002-12-08 3:38 Stian Sletner
2002-12-08 4:47 ` Bart Oldeman
2002-12-08 4:58 ` Stian Sletner
[not found] ` <20021208043551.GA23189@dirac.org>
[not found] ` <20021208045400.GD15769@sletner.com>
[not found] ` <20021208061926.GA26833@dirac.org>
[not found] ` <20021208063342.GF15769@sletner.com>
[not found] ` <20021208064541.GA27112@dirac.org>
[not found] ` <20021208065503.GA25194@sletner.com>
2002-12-08 19:19 ` Peter Jay Salzman
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=3E1B221F.1060300@yahoo.com \
--to=stssppnn@yahoo.com \
--cc=linux-msdos@vger.kernel.org \
--cc=stian@sletner.com \
/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