From: ron@afsg.apple.com (Ron Flax)
Newsgroups: comp.unix.aux
Subject: Re: SLIP help requested (and fix!)
Date: 18 Dec 92 14:41:09 GMT
Followup-To: comp.unix.aux
Organization: Apple Computer, Inc.

In article <1992Dec15.053648.9062@noao.edu>, tody@noao.edu (Doug Tody)
wrote:
> 
> In article <1992Dec14.182430.26013@tvnews.tv.tek.com>, jasons@snoboy.tv.tek.com (Jason Scheck) writes:
> > I recently purchased a fast modem, and have been using slip under A/UX
> > 3.0 to connect to our network at work.  Everything works fine under
> > native Unix; I can telnet, rcp, ftp, etc.  I don't have an Ethernet card.
> > 
> > However, all MacTCP clients can only connect through the loopback
> > address; I can't get at any other hosts on the network (the clients
> > sit spinning until they eventually time out).  Should I expect this to
> > work?  Does MacTCP need to be configured separately?  The manuals that
> > come with A/UX don't seem to have anything to say about MacTCP.
> > 
> > Jason Scheck
> > jasons@tv.tv.tek.com
> 
> This sounds like a problem I ran into myself a while back.  Networking via
> SLIP would work fine under A/UX but the connects would time out under the
> finder.  The fix turned out to be to bring up "network" in the control
> panel, and select EtherTalk instead of AppleTalk.  Unfortunately, this
> disables the Appletalk network so my laser printer is unusable when I do
> this, but it does enable use of MacTCP.

I'm not sure why this would have any useful effect.  MacTCP, under A/UX, is
really just a passthru to the underlying UNIX TCP/IP mechanism.  You cannot
configure MacTCP independant of the UNIX TCP/IP setup.  In fact, MacTCP
simply inherets the basic characteristics of the UNIX TCP/IP configuration.
 This is where the problems arise with respect to SLIP and MacTCP under
A/UX.  The MacTCP passthru code uses a priority system to determine which
IP interface to use for MacTCP based IP connections.

The code scans all of the IP interfaces that are of type AF_INET and have
the IFF_UP flag bits set, and it caches the IP address, broadcast address
(if one exists since only ethernet devices will have one), and netmask of
each one it finds.  The code then checks through this list in the following
order: 1) is there an interface with a broadcast address set, 2) is there a
point-to-point address set, and 3) is there a loopback address set.  If [1]
is encountered then the code returns that device as the interface to use.
This is why if you have an ethernet card installed and configured, MacTCP
configures itself with the address of that device.. even though you
probably want the address of the SLIP device. 

There is another problem, the devices are searched in the order in which
they occur in the ifreq linked list.  If the loopback device is in the list
before the SLIP interface, then it will be configured instead of the SLIP
device.

There is one other problem... there is a bug in the way the MacTCP code
figures out its own IP address.  *Even* if you were able to have it select
the proper device, it uses a libc routine (get_myaddress) which botches up
the local address since it doesn't compares the ifr_name (or interface name
like: "sl0", or  "ao0") to the one that gets configured in the code
described above.  In fact, most of the time it just uses either the address
of the 1st Ethernet device encountered, or the address of the loopback
device.

Here's what I've done to fix things.  1) I've modified the IP interface
selection code to first try to use a "user specified" device, and 2) if
that fails, use the old method of determining which interface to use. [
This way if the config file is botched or missing things still work as they
did before!!], and 3) I've compiled in my own get_myaddress() code that
does the right thing and compares the ifr_name of the device with the name
we have actually selected for configuration.  The config file is
/etc/mactcp.conf and simply has one line in it which is the name of the
interface you would like MacTCP to use.  

Also of note:  if you have more than one Ethernet device, you can use this
code to pick which one MacTCP uses.

Where can you get this fix, which by the way is completely unsupported!?  [
Although I've been using it for months now without problems... :-) ]

Anonymous FTP to afsg.apple.com (192.1.34.2), look in ~ftp/pub for the
file:
Patches.MacTCP.tar.Z (remember BINARY transfer this file!)

NOTE: Please read the README file which is in the archive, before you
unpack the entire archive.  Otherwise the archive could wipe out the old
versions of your Patch files.

--
Ron Flax
ron@afsg.apple.com
Apple Computer, Inc.
Newsgroups: comp.unix.aux