[Bug 795917] "multicast-iface" parameter for "udpsink" and "udpsrc" under Windows is ignored

GStreamer (GNOME Bugzilla) bugzilla at gnome.org
Wed May 9 07:31:15 UTC 2018


https://bugzilla.gnome.org/show_bug.cgi?id=795917

--- Comment #6 from Sebastian Dröge (slomo) <slomo at coaxion.net> ---
You have to use a name that if_nametoindex() can take, see
https://msdn.microsoft.com/en-us/library/windows/desktop/bb408409(v=vs.85).aspx

IIRC those looked like UNIX interface names. A compatible implementation of
if_nametoindex() is the following, that should help to find the correct name.


static guint
if_nametoindex (const gchar *iface)
{
  PIP_ADAPTER_ADDRESSES addresses = NULL, p;
  gulong addresses_len = 0;
  guint idx = 0;
  DWORD res;

  if (ws2funcs.pIfNameToIndex != NULL)
    return ws2funcs.pIfNameToIndex (iface);

  res = GetAdaptersAddresses (AF_UNSPEC, 0, NULL, NULL, &addresses_len);
  if (res != NO_ERROR && res != ERROR_BUFFER_OVERFLOW)
    {
      if (res == ERROR_NO_DATA)
        errno = ENXIO;
      else
        errno = EINVAL;
      return 0;
    }

  addresses = g_malloc (addresses_len);
  res = GetAdaptersAddresses (AF_UNSPEC, 0, NULL, addresses, &addresses_len);

  if (res != NO_ERROR)
    {
      g_free (addresses);
      if (res == ERROR_NO_DATA)
        errno = ENXIO;
      else
        errno = EINVAL;
      return 0;
    }

  p = addresses;
  while (p)
    {
      if (strcmp (p->AdapterName, iface) == 0)
        {
          idx = p->IfIndex;
          break;
        }
      p = p->Next;
    }

  if (p == NULL)
    errno = ENXIO;

  g_free (addresses);

  return idx;
}

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list