Subject: Re: xdmcp for X server fixed
To: Daniel Hagerty <hag@gnu.ai.mit.edu>
From: Mark Davies <mark@Comp.VUW.AC.NZ>
List: port-hp300
Date: 01/11/1996 21:41:17
	From:  Daniel Hagerty <hag@gnu.ai.mit.edu>
	Date:  Thu, 11 Jan 1996 02:29:44 -0500

> 	I tracked the problem down in the xdmcp code for the X
> server. The server builds up a list of supported interfaces to send in
> the xdmcp manage packet, but the code for dealing with SIOCGIFCONF was
> totally botched; it would never have worked on a 4.4 based system (and
> I don't think it would really do the completely right thing on *any*
> system, if I understand how SIOCGIFCONF works).

Will someone (Dave?) point me at the current NetBSD version of the server source
so I can see how it differs from what I've got.  That particular bug has been
fixed for atleast 2 years in the 4.4 version.  I haven't touched that file since
93 and here is the patch I used:

diff -cr X11R5/mit/server/os/access.c R5.hpbsd/mit/server/os/access.c
*** X11R5/mit/server/os/access.c	Fri May 28 20:01:57 1993
--- R5.hpbsd/mit/server/os/access.c	Wed Sep 29 21:24:04 1993
***************
*** 187,193 ****
  DefineSelf (fd)
      int fd;
  {
!     char		buf[2048];
      struct ifconf	ifc;
      register int	n;
      int 		len;
--- 187,193 ----
  DefineSelf (fd)
      int fd;
  {
!     char		buf[2048], *cp, *cplim;
      struct ifconf	ifc;
      register int	n;
      int 		len;
***************
*** 229,237 ****
      ifc.ifc_buf = buf;
      if (ioctl (fd, (int) SIOCGIFCONF, (pointer) &ifc) < 0)
          Error ("Getting interface configuration");
!     for (ifr = ifc.ifc_req, n = ifc.ifc_len / sizeof (struct ifreq); --n >= 0;
!      ifr++)
      {
  	len = sizeof(ifr->ifr_addr);
  #ifdef DNETCONN
  	/*
--- 229,245 ----
      ifc.ifc_buf = buf;
      if (ioctl (fd, (int) SIOCGIFCONF, (pointer) &ifc) < 0)
          Error ("Getting interface configuration");
! #if defined(AF_LINK)
! #define size(p) ((p).sa_len > sizeof(p) ? (p).sa_len : sizeof(p))
! #else
! #define size(p) (sizeof (p))
! #endif
!     cplim = (char *)ifc.ifc_req + ifc.ifc_len; /*skip over if's with big ifr_addr's */
!     for (cp = (char *)ifc.ifc_req; cp < cplim;
! 	 cp += sizeof (ifr->ifr_name) + size(ifr->ifr_addr))
      {
+ #undef size
+         ifr = (struct ifreq *)cp;
  	len = sizeof(ifr->ifr_addr);
  #ifdef DNETCONN
  	/*



> 	I also found a bug of some sort relating to server resets; the
> server would get a bus error in topcat.c:topcatScreenInit(). I just
> randomly discovered that inserting a usleep(500) at the appropriate
> point made the problem go away. It's hardware; well beyond me right
> now (if someone has any idea why this problem existed and why my
> kludge made it go away, I'd love to hear about it).

I've never seen it happen myself.

cheers
mark