STREAMS-based TCP/IP on 386/ix

John Ioannidis ji at cs.columbia.edu
Sat Sep 30 07:48:02 AEST 1989


Where can I find more info than what is (not) in the man pages? This is
what I want to be able to do:

(1) Use the machine as a gateway between two networks 

(2) Interface it to some homebrewed networking hardware

Initially, I want to be able to put two ethernet controllers in the
machine (a Toshiba 5200/100 running 386/ix) and gateway traffic
between the two networks. I have encountered a lot of problems when
trying to do such a trivial thing (well, trivial by my Berkeley Unix
standards. sigh!)


First off, I couldn't convince the kernel that I had two controllers.
I had put two Western Digital WD8003E controllers (configured at
different interrupt levels, I/O addresses and stuff, of course), and
since the idiot-proof sysadm scripts wouldn't let me configure two of
them, I edited some parameters in config.h and added a description for
the controller in /etc/conf/pack.d/wd/space.c. No luck. Eventually I
ended up patching the binary wd/Driver.o and renaming all entry points
from wd* to we* and effectively configured a different device driver
that only happened to talk to identical hardware! So I called my new
device /dev/we, gave it a different major device number (39) and tried
my luck with /etc/netd.cf. Surprisingly enough, I could get the
networking code to talk to either device, but NOT TO BOTH AT ONCE. 

If my interpretation of what /etc/netd does is correct, this is how it
assembles the stream:


      +----------+        +----------+  
      |	/dev/tcp |        | /dev/tcp |
      +----------+        +----------+  
          | nsap=6           | nsap=17
          |                  |
          `-----.     .------'
                |     |
              +----------+
              |  /dev/ip |
              +----------+
                |     |
          .-----'     `------.
          | "wd0"            | "lo0"
      +----------+        +----------+  
      |	/dev/arp |        | /dev/lo  |
      +----------+        +----------+  
       |  |
  lsap=|  |lsap=
  0x800|  |0x806
      +----------+
      | /dev/wd  |
      +----------+


Now, it's not exactly clear to me how things like nsap, lsap, name and
type are passed to the corresponding drivers, but let's not worry about
it for the moment. 

The /etc/netd code appears to be opening /dev/wd twice, once to
associate it with the ARP ethernet service and once to associate it
with the IP ethernet service, so must be doing two opens. Now, since
/dev/wd is a cloneable device, shouldn't that be returning two
separate minor device numbers? That would be OK, provided that the wd
device driver knows how to handle them, but how can the driver get to
a second controller with the same major device numnber? 

At any rate, my workaround (editing the binary) gave me two devices,
one called /dev/wd, with IRQ==7, I/O at 0x280 and Shared Memory at
0xd0000, and one called /dev/we, with IRQ==5, I/O at 0x220 and shared
memory at 0xd8000. By substituting "we" for "wd" everywhere in
/etc/netd.cf, I was able to make it work. Verifying which controller
was actually being used was easy -- just unplug the thinlan connector!!!

So after I did all that, I tried to get it to use both controllers at
once (with different inet addresses, of course!). I tried variations
of in /etc/netd.cf but none worked. The idea is that, since an
interface name ("wd0", in this case) is given to the arp module, one
should be able to open the arp device once again, get a second copy of
the box laveled /dev/arp in the diagram above, then attach to it the
two instances of /dev/we (one for IP, one for ARP) and have an
interface called "we0" running. Now, ideally there should be a way to
just have one device called /dev/wd to access both controllers and have
interfaces "wd0" and "wd1", the way you do it in all BSD-derived
Unixes. SO anyway, I tried that, only to get insulting messages like
DL_ERROR_ACK LLC_error = 0 UNIX_error = 0. This is my impression of
what the stream I was trying to construct looked like:

                  ...  
              +----------+
              |  /dev/ip |
              +----------+
                |      |        
          .-----'      `-------.
          | "wd0"              | "we0"    
      +----------+         +----------+   
      |	/dev/arp |         | /dev/arp |   
      +----------+         +----------+   
       |  |                 |  |          
  lsap=|  |lsap=       lsap=|  |lsap=
  0x800|  |0x806       0x800|  |0x806
      +----------+         +----------+
      | /dev/wd  |         | /dev/we  |
      +----------+         +----------+

Needless to say, it didn't work, (or I wouldn't be sending out this
message!) 

----

Well, this posting turned out to be longer than I had expected...
Every hint, advice etc. will be appreciated. 

advTHANKSance,

/ji

In-Real-Life: John "Heldenprogrammer" Ioannidis
E-Mail-To: ji at cs.columbia.edu
V-Mail-To: +1 212 854 5510 (office) +1 212 666 0140 (fax)



More information about the Comp.unix.i386 mailing list