Roell's X11R4 server & TCP Problem Found/Solved?

Paul Emerson paul at sdgsun.uucp
Thu Dec 6 05:46:36 AEST 1990



  Pim Zandbergen says:

  When I start the server, "Getting interface configuration: invalid argument"
  is displayed, just before it goes to graphics mode.
  This message turns out to come from mit/server/os/4.2bsd/access.c,
  which does an ioctl(SIOCGIFCONF) that fails.

Well I got the same problem.  I am running 386/ix 2.0.2 with TCP 1.2.
I started to look for information on SIOCGIFCONF ioctl in the TCP manual,
but no such luck.  Ok, so I wrote a little quick and dirty program that
that opens a tcp socket at port 6000 (X.server), then tried the ioctl
call.  Well my program failed with the same error as the server was 
giving.  The first thought in my head is, "another fine mess Interactive".
Well I sent this program over to a Sun 3/160 compiled it and it ran
OK.  My second thought was, "Yeah it's Interactive".  BUT then it
compiled it with gcc 1.37.1(no gas) (same as I am using on the 386) on 
the Sun and it doesn't work.  Using cc on the 386, the program work!  
So it seems that gcc is the problem here.  I haven't spent any time 
trying to figure out why.  I hope someone more familar with gcc 
could tell me. 

Here's the quick and dirty test program: (no flames please)
 
---------------------------- Cut Here ---------------------------------
#include <sys/types.h>
#include <sys/stream.h>
#ifndef sun 
#include <sys/sioctl.h>
#endif
#include <errno.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/sockio.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <net/if.h>

main(argc,argv)
int argc;
char *argv[];
{
struct ifconf ifc;
int fd;
char buffer[2048];


	if ((fd = open_tcp_socket()) < 0)
   {
   perror("TCP OPEN FAILS");
   exit(1);
   }
ifc.ifc_ifcu.ifcu_buf=buffer;
ifc.ifc_len = 2048; 

if (ioctl (fd,SIOCGIFCONF, (char *)&ifc) < 0)
   {
   perror("Getting interace configuration");
   close(fd);
   shutdown(fd,0);
   exit(1);
   }
printf("got it ok\n");
close(fd);
shutdown(fd,0);
}

static int
open_tcp_socket()
{
struct sockaddr_in insock;
int request;
int retry;

	if ((request = socket(AF_INET, SOCK_STREAM, 0)) < 0)
	   {
	   perror("Creating TCP socket");
	   return (-1);
	   }
	memset(&insock,'\0',sizeof(insock));
	insock.sin_family = AF_INET;
	insock.sin_port = htons(6000);
	insock.sin_addr.s_addr=htonl(INADDR_ANY);
	retry = 20;
	while (bind(request,  (struct sockaddr *) &insock, sizeof (insock)))
	      {
	      if (--retry == 0)
	         {
	         perror("Binding TCP Socket");	
	         close(request);
	    	 return (-1);
	         }
		  sleep(10); 
	      }

	if (listen (request, 5))
	   {
	   perror("TCP Listening");
	   close(request);
	   return(1);
	   }
return(request);
}
-- 
Paul J. Emerson                           SDG Division of SAIC 
Senior Technical Manager                  450 Lakemont Ave.
UUCP:     uunet|tarpit!sdgsun!paul        Winter Park, FL 32792
Internet: sdgsun!paul at bikini.cis.ufl.edu  (407) 657-1300



More information about the Comp.unix.sysv386 mailing list