Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!amdcad!rpw3 From: rpw3@amdcad.AMD.COM (Rob Warnock) Newsgroups: comp.mail.uucp Subject: Re: FTP or UUCP for PC Message-ID: <25388@amdcad.AMD.COM> Date: 25 Apr 89 00:17:43 GMT References: <294@dekalb.UUCP> <42300011@uicsrd.csrd.uiuc.edu> <25311@amdcad.AMD.COM> <100285@sun.Eng.Sun.COM> Reply-To: rpw3@amdcad.UUCP (Rob Warnock) Organization: [Consultant] San Mateo, CA Lines: 81 In article <100285@sun.Eng.Sun.COM> plocher@sun.COM (John Plocher) writes: +--------------- | >SLIP (Serial Line IP), you can dial it up and "become" a net node yourself. | For those who have done it: ... The question is: "How do you set it all up?" | ...Most people I've talked to (who have not DONE it) say that it is simple - | just set up a SLIP connection and have fun. The people I know who have | tried it all tell me that they didn't get it working and that it | definitely is NOT simple. Thanks, -John Plocher | plocher@sun.com +--------------- I have done it [the line you quoted was mine]. There was indeed a little bit of hacking involved, but more-or-less straightforward (*if* you are already a kernel/network hacker). It wasn't particularly clean, and I can't really ship code at present, but can talk about it a little. Let's see, what was done...? 0. Environment: Main host is a VAX-11/780 running a (nearly) "stock" 4.3bsd. Remote host is an IBM PC running Phil Karn's "KA9Q" software. Both sides have Telebit modems with interfaces locked to 9600 baud [*don't* ask!]. 1. Small change to the 4.3 SLIP driver "if_sl.c" (and to the TTY line discipline switch table "linesw") to add modem control (basically paralleling that in normal TTY driver), as the original SLIP driver had none. Now, when a SLIP'd line drops, the SLIP controller program [see below] gets a SIGHUP. 2. Similar small change to "if_sl.c" to allow user program to "poll" the state of carrier [not really needed, but was a nice safety net]. 3. Wrote a new user program which parallels the function of "slattach", to solve a race condition, and some other stuff. The race condition was in the previous method of setting up a SLIP line: a. Do a "netstat" to see what SLIP ports are in use. b. Do an "ifconfig" on the lowest unused SLIP port, with the desired IP address. c. Do an "slattach" to cause the chosen TTY port to get that SLIP port, and hence, that IP address. The race should be obvious: What happens if *two* people do this at once? Solution: New program "duslip", which *first* does the (equivalent of) "slattach", which gets a SLIP port number for the TTY, *then* does the "ifconfig" knowing for sure what SLIP port it got. "Duslip" then hangs on the TTY line waiting for carrier to drop, whereupon it un-SLIPs the line and hangs it up (sending a SIGHUP to its parent *if* it's not "init"). 4. Since "duslip" has to be setuid root (to do the "ifconfig"), it checks for the user running it to be in group "slip", and to have an entry in a protected configuration file containing the range of allowed IP addresses for that user. 5. "Duslip" also creates a lock file [really an "in use" file] for the SLIP port, owned by the *user*, which if deleted causes "duslip" to un-SLIP the line. This lets you drop back to a normal shell, if you like. So what happens is that a user dials in, logs in as usual (note: this is the main security provided), runs "duslip" with either no args (accepting the default remote IP address) or an IP address arg (which must be in the allowable range), and *boom* is on the net. BUG: I still haven't fixed the bug in 4.3 "routed" that causes it to fail to see newly enabled point-to-point links (even if GATEWAY is defined), so sometimes a manual "route add" is needed to get other hosts on the net to see you. Now with standard KA9Q, I found the easiest way to get dialed in was to run Kermit on the PC and use it to dial the net host and log in as a notmal user. Then after running "duslip", execute KA9Q from beneath Kermit with a "!" command. That way, if you want (for any reason) to drop out of your SLIP session, you delete the lock file created by "duslip", exit from KA9Q, and there you are back in Kermit talking to a normal shell on the other end. Like I said, not at all clean, and certainly not as "automatic" as some people would like it, but it works. Rob Warnock Systems Architecture Consultant UUCP: {amdcad,fortune,sun}!redwood!rpw3 DDD: (415)572-2607 USPS: 627 26th Ave, San Mateo, CA 94403