TIPXD - Tom's IPX Tunneling Daemon

VERSION
   Current version is 0.8.1b - 'b' meaning BETA.  I believe all intended features to this point are working.

TODO
   The logfile argument is currently ignored, and I would like to fix that.  Also, I would like to add command line option to run as a daemon.  For the next release (post 1.0, heading towards 2.0), I would like to have better packet routing to cut down unnecessary traffic.  For more information on my plans, read the README.releases file for the release/feature schedule.

DESCRIPTION
  This program tunnels IPX protocol packets between LANs over TCP/IP connections, making the IPX network act as if the local nets were connected directly together.  What does this mean?  Games, glorious games!  I wrote this program for multiplayer games which can be played only over a local net using the IPX protocl, or for internetwork games which can not be played over nets with masqueraded hosts.

ARCHITECTURE
   The program is simple, really.  Trust me, it IS simple.  I divided the program into "tasks", each providing different pieces of output.  Before you think this is really complicated, let me assure you that each "task" is not a thread.  In fact, this program is NOT multi-threaded AT ALL.  Each "task" almost exactly corresponds to a function with the same or similar name.

   tipxd starts as any normal program does, first it checks the command-line arguments[COM-LINE].  It then reads in its configuration file[CONFIG-READ], typically "ipxtunnel.conf" if no other filename is specified.  It then opens an 802.3[IPX-802.3-OPEN] socket on each device and configures each device for PROMISCUOUS mode[CONFIG-INTERFACE], allowing it to see ALL traffic, not just the traffic bound for it.  Follwing the configuration of the ethernet interface, it installs a signal handler for SIGINT[SIGNAL-INSTALL], typically control-C on linux machines.  It then opens the TCP listening socket[OPEN-TCP-LISTENING-SOCKET], and a UDP control socket[OPEN-UDP-CONTROL-SOCKET].  It then starts the main application loop[APP-MAIN-LOOP].
   The main loop of the application is basically a large select( ) call.  It waits for input on one of its many sockets, and then handles the input on each socket that is ready.  From here, we get into peer registration.  Each IPX sender is called a "peer".  Everyone who sends an IPX packet on any of the connected LANS is registered the first time the program sees a packet from it ethernet address.  If we received the packet on one of our local interfaces, we register the address as "PEER_LOCAL".  However, should we receive the packet from one of the TCP sockets, we register the peer as remote and register them to the remote host(router) associated with the socket we received the packet on.  Now, you would think we would just package up the packet and send it down the appropriate socket.  To some degree this is true, but figuring out the appropriate socket works like this.

PACKET RECVD ON   DST PEER REG ON    SRC PEER REG ON   PACKET SENT ON
local             broadcast          local             all TCP
local             broadcast          router X          none
local             broadcast          router Y          none
local             local              local             none
local             local              router X          none
local             local              router Y          none
local             router X           local             router X TCP
local             router X           router X          -- error, drop it --
local             router X           router Y          -- error, drop it --
local             router Y           local             router Y TCP
local             router Y           router X          -- error, drop it --
local             router Y           router Y          -- error, drop it --
router X          broadcast          local             -- error, drop it --
router X          broadcast          router X          all local
router X          broadcast          router Y          -- error, drop it --
router X          local              local             -- error, drop it --
router X          local              router X          all local
router X          local              router Y          all local
router X          router X           local             -- error, drop it --
router X          router X           router X          -- error, drop it --
router X          router X           router Y          -- error, drop it --
router X          router Y           local             -- error, drop it --
router X          router Y           router X          -- error, drop it --
router X          router Y           router Y          -- error, drop it --

  NOTE: there is a difference between "none" and "-- error, drop it--".  Because some of the packets tipxd sends on the local socket, it will receive again.  In order to remove the threat of cycling messages( A->B->A->B... ), we have to register each peer with its specific location.

ACKNOWLEDGEMENTS:
   Though all, and I do mean *ALL*, of the code is original, I would like to acknowlege the work of Andreas Godzina <ag@agsc.han.de> who wrote the 'original' ipxtunneleling program known as 'ipxtunnel'.  I used his code to figure out some of the problems I was having, mostly because SOCK_PACKET sockets are so poorly documented in both the kernel source and the man pages.  I would also like to acknowledge Bruce Calder and Dan Abplanalp for helping me debug, and James Hicks of zorch.org for lending me the CVS space :)
  As for myself, though I have written many pieces of software, this one is the first one I feel is 'worthy-of-note', as in I think other people might use it.  I tried to document the source code as best I can line by line and blockwise.

MAINTAINER AND COPYRIGHT HOLDER:
Tom Hendrick <thendri1@san.rr.com>;<thomash@qualcomm.com>

ACKNOWLEDGEMENTS:
Bruce Calder<bcalder@qualcomm.com>   Debug and Test
Dan Abplanalp<dabplana@qualcomm.com> Debug and Test
James Hicks<jhicks@he.net>           Moral Support and CVS help
Peter Belding<pbelding@cts.com>      Network Design
Matt the Cat                         Running off and hiding

ORIGINAL AUTHOR OF IPXTUNNEL:
Andreas Godzina <ag@agsc.han.de>     Original Author

