*BSD News Article 8469


Return to BSD News archive

Xref: sserve comp.protocols.misc:1980 comp.sys.sun.misc:4862 comp.unix.wizards:27853 comp.unix.bsd:8525
Path: sserve!manuel.anu.edu.au!munnari.oz.au!hp9000.csc.cuhk.hk!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!uwm.edu!news.bbn.com!news.bbn.com!jpeters
From: jpeters@bbn.com (Jim Peters)
Newsgroups: comp.protocols.misc,comp.sys.sun.misc,comp.unix.wizards,comp.unix.bsd
Subject: [SUN OS 4.1.1] CSN slip package problems
Followup-To: comp.unix.bsd
Date: 2 Dec 92 12:25:01
Organization: BBN Communications (SD&S)
Lines: 101
Message-ID: <JPETERS.92Dec2122501@saavik.bbn.com>
Reply-To: jpeters@bbn.com
NNTP-Posting-Host: saavik.bbn.com


I have been trying without success to get the 4.1 SLIP package from uunet
to work on a Sun 3/50 running 4.1.1.  (That might be my problem)

Dialout, the new tip will not synchronize with the modem.  Normal tip will
at least dial the phone.  BTW, my kernel only has the slip-4.1 directory
additions, none of the new device drivers because I couldn't make sense of
whether I needed them or not.

When dialing in, I use the following script in place of a login shell:

#!/bin/sh -x
/bin/mesg n
/bin/stty -tostop -hup -raw
../sliplogin vger.bbn.com saavik.bbn.com

Without my user being root, I get the following messages.  


Dec  1 23:32:03 saavik sliplogin[13596]: attaching slip3596:\
		 local 128.89.1.249 remote 128.89.6.245 mask 255.255.0.0

Dec  1 23:32:03 saavik sliplogin[13596]: ioctl (SIOCSIFNETMASK): \
	 No such device or address

If I have a uid of 0, instead of the above I get:

Nov 18 22:21:06 saavik sliplogin[4565]: ioctl (SIOCSIFDSTADDR): \
	 No such device or address

The pieces of code from the sliplogin in question are:

        syslog(LOG_NOTICE, "attaching %s%d: local %s remote %s mask %s\n",
                SLIPIFNAME, unit, localaddr, dstaddr, netmask);

        /* set the local and remote interface addresses */
        s = socket(AF_INET, SOCK_DGRAM, 0);

        if (getuid() != 0 || argc == 4) {
                bzero((char *)&ifr, sizeof(ifr));
                (void) sprintf(ifr.ifr_name, "%s%d", SLIPIFNAME, unit);
                in_getaddr(netmask, &ifr.ifr_addr);
                if (ioctl(s, SIOCSIFNETMASK, (caddr_t)&ifr) < 0) {
                        syslog(LOG_ERR, "ioctl (SIOCSIFNETMASK): %m");
                        exit(1);
                }
        }

        bzero((char *)&ifr, sizeof(ifr));
        (void) sprintf(ifr.ifr_name, "%s%d", SLIPIFNAME, unit);
        in_getaddr(dstaddr, &ifr.ifr_addr);
        if (ioctl(s, SIOCSIFDSTADDR, (caddr_t)&ifr) < 0) {
                syslog(LOG_ERR, "ioctl (SIOCSIFDSTADDR): %m");
                exit(1);
        }

 
Can some one explain how the "No such device or address" error message
applies in this context?   Oh yes, the code for in_getaddr is:

in_getaddr(s, saddr)
        char *s;
        struct sockaddr *saddr;
{

        register struct sockaddr_in *sin = (struct sockaddr_in *)saddr;
        struct hostent *hp;
        struct netent *np;
        u_long val;
        extern struct in_addr inet_makeaddr();
        extern u_long inet_addr();
 
        bzero((caddr_t)saddr, sizeof *saddr);
        sin->sin_family = AF_INET;
        val = inet_addr(s);
        if (val != (u_long)-1) {
                sin->sin_addr.s_addr = val;
                return;
        }
        hp = gethostbyname(s);
        if (hp) {
                sin->sin_family = hp->h_addrtype;
                bcopy(hp->h_addr, (char *)&sin->sin_addr, hp->h_length);
                return;
        }
        np = getnetbyname(s);
        if (np) {
                sin->sin_family = np->n_addrtype;
                sin->sin_addr = inet_makeaddr((int)np->n_net, (int)INADDR_ANY);
                return;
        }
        (void) fprintf(stderr, "sliplogin: %s: bad value\n", s);
        syslog(LOG_ERR, "%s: bad value\n", s);
        exit(1);
        /* NOTREACHED */
}


Thanks.

					-- Jim.