After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 638723 - Fix for "getnameinfo failed" in gst_rtsp_client_accept
Fix for "getnameinfo failed" in gst_rtsp_client_accept
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-rtsp-server
git master
Other All
: Normal normal
: 0.10.8
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-01-05 09:00 UTC by Jonas Larsson
Modified: 2011-01-05 10:31 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jonas Larsson 2011-01-05 09:00:15 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, ...
Comment 1 Wim Taymans 2011-01-05 10:31:40 UTC
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