Hi!

-broadcast does not send XDMCP requests to a broadcast address

I have traced this one a little bit further. I wrote a small test program:


#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <net/if.h>

int fd;
struct ifreq req;

int main(int argc, char *argv[])
{
  fd=socket(SOCK_STREAM, PF_INET, 0);
  if (fd<0)
    {
      perror("socket");
      exit(-1);
    }

strcpy(req.ifr_name,"en1");
((struct sockaddr_in *) &req.ifr_addr)->sin_addr.s_addr=htonl(0x12345678);
printf("prior to ioctl(): %s, %s\n", req.ifr_name,
inet_ntoa(((struct sockaddr_in *) &req.ifr_addr)->sin_addr));
if (ioctl(fd, SIOCGIFBRDADDR, &req)<0)
{
perror("ioctl");
exit(-1);
}
printf("after ioctl(): %s, %s\n", req.ifr_name,
inet_ntoa(((struct sockaddr_in *) &req.ifr_addr)->sin_addr));
}


it does create a socket and then tries to determine the broadcast address. I initialize ifr_addr with some predefined nonsense and then I found, that this nonsense is not overwritten by the ioctl() nor is any error code returned. :-( On my linux box, an invalid argument error is returned.

To use SIOCGIFBRDADDR, fd must be the fd of a datagram socket, on MacOSX as well as on Linux. So the code in xc/programs/Xserver/os/access.c near line 868, that does not work on MacOSX, will not work on linux, too. At least it will not register the wrong address, since linux correctly returns an error code.

73, Mario
--
Mario Klebsch                                      [EMAIL PROTECTED]
PGP-Key available at http://www.klebsch.de/public.key
Fingerprint DSS: EE7C DBCC D9C8 5DC1 D4DB  1483 30CE 9FB2 A047 9CE0
 Diffie-Hellman: D447 4ED6 8A10 2C65 C5E5  8B98 9464 53FF 9382 F518

_______________________________________________
Devel mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/devel

Reply via email to