From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stas Sergeev Subject: Re: Doom in Linux HOWTO Date: Tue, 07 Jan 2003 21:53:19 +0300 Sender: linux-msdos-owner@vger.kernel.org Message-ID: <3E1B221F.1060300@yahoo.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060104010007060106050005" Return-path: List-Id: To: linux-msdos@vger.kernel.org Cc: Stian Sletner This is a multi-part message in MIME format. --------------060104010007060106050005 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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:) --------------060104010007060106050005 Content-Type: text/plain; name="sbr.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sbr.c" #include #include #include #include #include #include #include #include #include #include #include #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); } } } --------------060104010007060106050005--