[comp.unix.ultrix] Ifconfig internals

hascall@cs.iastate.edu (John Hascall) (06/07/90)

Gentle readers,

  I am in the process of writing a bootp-based "ifconfig" for Ultrix and
while I have the bootp part all hammered out (thanks to all who helped!),
I am having a slight problem with the "ifconfig" part in that I seem to
be forgetting to do something that the real ifconfig does.  If I use my
program and then try to use ftp (either to or from the machine in question)
the inital (control) connection works fine but when ftp tries to open the
data connection (say, by doing a "dir") it fails with an EADDRNOTAVAIL
"Can't assign requested address" when it tries to bind to 129.186.1.65,20
(the machine in question, port 20).

  The operations my program does are:

        /* do a: ifconfig se0 a.b.c.d netmask e.f.g.h broadcast i.j.k.l */
        ioctl(SIOCSIFNETMASK)   /* set subnet-mask */
        ioctl(SIOCSIFADDR)      /* set our address */
        ioctl(SIOCSIFBRDADDR)   /* set broadcast address */
	/* do a: route add default m.n.o.p 0 */
        ioctl(SIOCADDRT)        /* add default route */
	/* do a: hostname our.name.here */
	sethostname(ourhostname)

   what am I forgetting???

Many thanks,
John Hascall  /  atanasoff.cs.iastate.edu  /  ISU Comp Ctr; Ames, IA