[gssdp] Fix active discovery



commit 515f00bf78275946eb558abf7ec87031e4a9db00
Author: Jens Georg <mail jensge org>
Date:   Fri Feb 5 21:33:55 2016 +0100

    Fix active discovery
    
    If we got host_ip and device from CM, we would not have the interface index
    and received packets would be thrown away.
    
    Passive discovery still worked.
    
    Signed-off-by: Jens Georg <mail jensge org>

 libgssdp/gssdp-client.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/libgssdp/gssdp-client.c b/libgssdp/gssdp-client.c
index 6478df8..ad46780 100644
--- a/libgssdp/gssdp-client.c
+++ b/libgssdp/gssdp-client.c
@@ -1799,6 +1799,17 @@ init_network_info (GSSDPClient *client, GError **error)
         if (client->priv->device.iface_name == NULL ||
             client->priv->device.host_ip == NULL)
                 get_host_ip (&(client->priv->device));
+        else {
+                /* Ugly. Ideally, get_host_ip needs to be run everytime, but
+                 * it is currently to stupid so just query index here if we
+                 * have a name and an interface already.
+                 *
+                 * query_ifindex will return -1 on platforms that don't
+                 * support this.
+                 */
+                client->priv->device.index =
+                                query_ifindex (client->priv->device.iface_name);
+        }
 
         if (client->priv->device.host_addr == NULL &&
             client->priv->device.host_ip != NULL) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]