GNOME Bugzilla – Bug 638723
Fix for "getnameinfo failed" in gst_rtsp_client_accept
Last modified: 2011-01-05 10:31:40 UTC
While embedding the rtsp server in my Android app (long story...) I had an issue when clients (only local) connected. The log message was "getnameinfo failed: Unknown error (0)". I traced the issue to gst_rtsp_client_accept in rtsp-client.c First getsockname is called, which sets the addr struct and addrlen. addrlen now correctly describes addr. Then addrlen is reset to sizeof (addr) and getnameinfo is called. Since addrlen is wrong the call fails. Simply commenting out "addrlen = sizeof (addr);" before the call to getnameinfo solves the problem. The size of the struct is platform specific and I think it's wrong to always set it to sizeof (addr). Here is a snippet with my changes (just added two slashes on 1743) gboolean gst_rtsp_client_accept (GstRTSPClient * client, GIOChannel * channel) 1737 addrlen = sizeof (addr); 1738 if (getsockname (fd, (struct sockaddr *) &addr, &addrlen) < 0) 1739 goto getpeername_failed; 1740 1741 client->is_ipv6 = addr.ss_family == AF_INET6; 1742 1743 //addrlen = sizeof (addr); 1744 if (getnameinfo ((struct sockaddr *) &addr, addrlen, ...
commit b5a1719e89576098809aea59f1a8ddd3cc0a09e8 Author: Jonas Larsson <jonas at hallerud dot se> Date: Wed Jan 5 11:26:30 2011 +0100 client: use the socket length from getsockname Use the length returned by getsockname to perform the getnameinfo call because the size can depend on the socket type and platform. Fixes #638723