[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fwtk-users
Subject:    x-gw on 4.1.3_U1 running with Solaris (OpenWin)
From:       Sundar Narasimhan <sundar () ascent ! com>
Date:       1995-08-24 13:29:48
[Download RAW message or body]

Hi,

A couple of people have asked me about this so here goes. With Wei's
help, I've finally managed to get x-gw up and running reliably. 

The problem was that from our SunOS firewall machine x-gw would fire
up initially, but freeze the openwindows server when ANY client
attempted to connect up to it.

I made two fixes: one in x-gw/socket.c to replace serv_select's
readable and writable arguments to fd_set *.

The second was to replace the x-gw/fwd.c:query_conn function with the
foll:
--
static pid_t    query_conn( fd,         fwd, 
                            rset,       wset,
                            conn_query_cb, userdata,
                            timemax,    idlemax,
                            dependchild )
int     fd;
struct  sockaddr_in fwd;
fd_set  *rset,   *wset;
int   (*conn_query_cb)();
void   *userdata;
int     timemax, idlemax;
pid_t   dependchild;/* changed int to pid_t */
{
  int                 querysock, outgoing,
  saddrlen=sizeof(struct sockaddr_in);
  pid_t               pid;
  struct sockaddr_in  saddr;

  /* new connection */
  if( (querysock=accept(fd,(struct sockaddr *)&saddr,&saddrlen)) < 0 ) {
    if( errno != EINTR ) pmsg("accept",TRUE);
    return -1;
  }
#ifndef WEI_DBG
  if( (pid=fork())< 0) {
    pmsg("Forking child failed",1);
    return -1;
  } else if( pid ) {
    FD_SET(querysock,rset); FD_SET(querysock,wset);
    close(querysock);
    return pid;
  }
  for(pid=0;pid<3;pid++) {
    if(pid != querysock)
      close(pid);
  }
#endif
  /* ************************************************
   * if conn_query_cb return <0, there is something
   * error and to quit the query_conn
   **************************************************/
  if(conn_query_cb(querysock,outgoing,rset,wset,saddr,userdata)>=0) { 
    time_t              ontime;
    time(&ontime);
    if( (outgoing=conn_sd(fwd))<0 ) 
      goto out;

    FD_SET(outgoing, rset);	FD_SET(outgoing, wset);
    FD_SET(querysock, rset);	FD_SET(querysock, wset);

    pipe2sockets(outgoing,querysock,rset,wset,timemax,idlemax,
		 (dependchild)?getppid():-1); 
    close(outgoing);
    exitmsg( ontime, "child" );
  } 
 out:    close(querysock); 
  exit(1);
}

--
Hope that helps.
Regards.

And thanks Wei.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic