From owner-freebsd-gnome@FreeBSD.ORG Mon Jun 23 05:04:50 2008 Return-Path: Delivered-To: gnome@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73AAE1065672 for ; Mon, 23 Jun 2008 05:04:50 +0000 (UTC) (envelope-from vs@FreeBSD.org) Received: from mail.foldr.org (vs.broker.freenet6.net [IPv6:2001:5c0:8fff:fffe::5e3b]) by mx1.freebsd.org (Postfix) with ESMTP id EB40B8FC22 for ; Mon, 23 Jun 2008 05:04:49 +0000 (UTC) (envelope-from vs@FreeBSD.org) Received: from nb194.iist.unu.edu (z118l194.static.ctm.net [202.175.118.194]) (authenticated bits=0) by mail.foldr.org (8.14.3/8.14.3/Debian-4) with ESMTP id m5N54i4X026270 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Mon, 23 Jun 2008 07:04:47 +0200 Message-Id: <7D63219B-DB97-41D1-B4DE-F191F0F93FD6@FreeBSD.org> From: Volker Stolz To: gnome@FreeBSD.org Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-54--332922810" Mime-Version: 1.0 (Apple Message framework v924) Date: Mon, 23 Jun 2008 13:04:38 +0800 X-Pgp-Agent: GPGMail d51 (Leopard) Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.924) Cc: Subject: Issue with gdmchooser (2.20.6) X-BeenThere: freebsd-gnome@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GNOME for FreeBSD -- porting and maintaining List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jun 2008 05:04:50 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --Apple-Mail-54--332922810 Content-Type: multipart/mixed; boundary=Apple-Mail-53--332922902 --Apple-Mail-53--332922902 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Hi guys, I was playing with XDMCP and the gdmchooser drops the following in syslog when looking for local interfaces to broadcast on: Jun 23 12:32:13 pc139 gdmchooser[37872]: CRITICAL: Could not get SIOCGIFFLAGS for ^\b Jun 23 12:32:13 pc139 gdmchooser[37872]: CRITICAL: Could not get SIOCGIFFLAGS for 8^R^C It looks like there's something going wrong (I'm on 7.0-R with a bge0,plip0,lo0), and we don't have the SIOCGIFNUM ioctl anyway. Is someone interested in getting something like the following patch into the port and/or upstream? [Note that I usually don't program in C ;)] Volker --Apple-Mail-53--332922902 Content-Disposition: attachment; filename=gdmchooser.diff Content-Type: application/octet-stream; x-unix-mode=0700; name="gdmchooser.diff" Content-Transfer-Encoding: 7bit --- gdmchooser.c.orig 2008-06-23 12:20:46.000000000 +0800 +++ gdmchooser.c 2008-06-23 12:50:09.000000000 +0800 @@ -43,6 +43,7 @@ #ifdef HAVE_SYS_SOCKIO_H #include #endif +#include #include #include @@ -688,64 +689,32 @@ static void gdm_chooser_find_bcaddr (void) { - int i = 0, num; - int sock; - struct ifconf ifc; - char *buf; - struct ifreq *ifr; + struct ifaddrs *ifap; + struct ifaddrs *p; - sock = socket (AF_INET, SOCK_DGRAM, 0); -#ifdef SIOCGIFNUM - if (ioctl (sock, SIOCGIFNUM, &num) < 0) { - num = 64; - } -#else - num = 64; -#endif - - ifc.ifc_len = sizeof (struct ifreq) * num; - ifc.ifc_buf = buf = g_malloc0 (ifc.ifc_len); - if (ioctl (sock, SIOCGIFCONF, &ifc) < 0) { - g_free (buf); - gdm_common_error ("Could not get local addresses!"); - close (sock); + if (getifaddrs(&ifap) != 0) { + gdm_common_error ("getifaddr() failed!"); return; } - ifr = ifc.ifc_req; - num = ifc.ifc_len / sizeof (struct ifreq); - for (i = 0 ; i < num ; i++) { - if ( ! ve_string_empty (ifr[i].ifr_name)) { - struct ifreq ifreq; - struct sockaddr_in *ba = NULL; - struct sockaddr_in *sin = NULL; - - memset (&ifreq, 0, sizeof (ifreq)); - - strncpy (ifreq.ifr_name, ifr[i].ifr_name, - sizeof (ifreq.ifr_name)); - /* paranoia */ - ifreq.ifr_name[sizeof (ifreq.ifr_name) - 1] = '\0'; - - if (ioctl (sock, SIOCGIFFLAGS, &ifreq) < 0) - gdm_common_error ("Could not get SIOCGIFFLAGS for %s", ifr[i].ifr_name); - - if ((ifreq.ifr_flags & IFF_UP) == 0 || - (ifreq.ifr_flags & IFF_BROADCAST) == 0 || - ioctl (sock, SIOCGIFBRDADDR, &ifreq) < 0) + for (p = ifap ; p->ifa_next != NULL; p=p->ifa_next) { + struct sockaddr_in *ba = NULL; + struct sockaddr_in *sin = NULL; + + if ((p->ifa_flags & IFF_UP) == 0 || + (p->ifa_flags & IFF_BROADCAST) == 0 || + p->ifa_broadaddr == NULL) continue; - ba = (struct sockaddr_in *) &ifreq.ifr_broadaddr; + ba = (struct sockaddr_in *) &p->ifa_broadaddr; sin = g_new0 (struct sockaddr_in, 1); sin->sin_family = AF_INET; memcpy (&sin->sin_addr, &ba->sin_addr, sizeof (ba->sin_addr)); bcaddr = g_slist_append (bcaddr, sin); - } } - - g_free (buf); + freeifaddrs(ifap); } /* Append multicast address into the list */ --Apple-Mail-53--332922902 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit -- "In Macao ist alles besser!" http://lambda.foldr.org/~vs/ --Apple-Mail-53--332922902-- --Apple-Mail-54--332922810 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (Darwin) iQCVAwUBSF8u5hLpPok/0ba1AQJtvAQAxsg9x6rGUgoAhSXEVbCXr+sdW0UV0hKo eJv2mZDkThzHrsyS+a/R8gLY7xfiFF9b+D7I/q48brzOr86S9Fev6vIINDVangu6 E/xpOgybWBTScj7D/Ji0xosEfsvQPcgha9CHJyiw+b2HgV7Y3KH6qRytA3msiZ7j M4RyN1SX2w8= =sLkL -----END PGP SIGNATURE----- --Apple-Mail-54--332922810--