--- gupnp-0.20.13/libgupnp/gupnp-linux-context-manager.c	2015-01-04 15:58:19.000000000 +0400
+++ gupnp-devel/libgupnp/gupnp-linux-context-manager.c	2015-10-12 19:43:59.108459468 +0400
@@ -175,7 +175,8 @@
 }
 
 static void
-network_device_create_context (NetworkInterface *device, const char *label)
+network_device_create_context (NetworkInterface *device,
+			       const char *label, const char *address)
 {
         guint port;
         GError *error = NULL;
@@ -214,7 +215,15 @@
 
                 return;
         }
-        g_hash_table_insert (device->contexts, g_strdup (label), context);
+
+	if (!address) {
+	    g_warning ("address not set in network_device_create_context");
+	  }
+
+
+        g_hash_table_insert (device->contexts,
+			     g_strconcat (label, ":", address, NULL),
+			     context);
 
         g_signal_emit_by_name (device->manager,
                                "context-available",
@@ -250,7 +259,7 @@
                                       context_signal_up,
                                       device->manager);
         else if (device->flags & NETWORK_INTERFACE_PRECONFIGURED)
-                network_device_create_context (device, device->name);
+	  network_device_create_context (device, device->name, NULL);
 }
 
 static void
@@ -302,9 +311,11 @@
                                      GError                   **error);
 static void create_context (GUPnPLinuxContextManager *self,
                             const char               *label,
+                            const char               *address,
                             struct ifaddrmsg         *ifa);
 static void remove_context (GUPnPLinuxContextManager *self,
                             const char               *label,
+                            const char               *address,
                             struct ifaddrmsg         *ifa);
 
 static gboolean
@@ -325,19 +336,29 @@
         ((l > 0) && RTA_OK (a, l))
 
 static void
-extract_info (struct nlmsghdr *header, char **label)
+extract_info (struct nlmsghdr *header, char **label, char **address)
 {
         int rt_attr_len;
         struct rtattr *rt_attr;
+        static char buf[100];
 
         rt_attr = IFLA_RTA (NLMSG_DATA (header));
         rt_attr_len = IFLA_PAYLOAD (header);
         while (RT_ATTR_OK (rt_attr, rt_attr_len)) {
                 if (rt_attr->rta_type == IFA_LABEL) {
-                        *label = g_strdup ((char *) RTA_DATA (rt_attr));
+		  *label = g_strdup((char *)RTA_DATA (rt_attr));
+                }
+
+                if (rt_attr->rta_type == IFA_LOCAL) {
+		  struct in_addr *rt_addr = (struct in_addr *)RTA_DATA(rt_attr);
+
+		  *address = g_strdup((char *)inet_ntop (AF_INET,
+							 rt_addr,
+							 buf,
+							 sizeof(buf)));
 
-                        break;
                 }
+
                 rt_attr = RTA_NEXT (rt_attr, rt_attr_len);
         }
 }
@@ -363,11 +384,12 @@
 static void
 create_context (GUPnPLinuxContextManager *self,
                 const char               *label,
+                const char               *address,
                 struct ifaddrmsg         *ifa)
 {
         NetworkInterface *device;
 
-        remove_context (self, label, ifa);
+        remove_context (self, label, address, ifa);
 
         device = g_hash_table_lookup (self->priv->interfaces,
                                       GINT_TO_POINTER (ifa->ifa_index));
@@ -384,16 +406,18 @@
         if (device->flags & NETWORK_INTERFACE_IGNORE)
                 return;
 
-        network_device_create_context (device, label);
+        network_device_create_context (device, label, address);
 }
 
 static void
 remove_context (GUPnPLinuxContextManager *self,
                 const char               *label,
+                const char               *address,
                 struct ifaddrmsg         *ifa)
 {
         NetworkInterface *device;
         GUPnPContext *context;
+	char *key;
 
         device = g_hash_table_lookup (self->priv->interfaces,
                                       GINT_TO_POINTER (ifa->ifa_index));
@@ -401,18 +425,24 @@
         if (!device)
                 return;
 
-        context = g_hash_table_lookup (device->contexts, label);
+	key = g_strconcat (label, ":", address, NULL);
+
+        context = g_hash_table_lookup (device->contexts, key);
+
         if (context) {
                 if (device->flags & NETWORK_INTERFACE_UP) {
                         g_signal_emit_by_name (self,
                                                "context-unavailable",
                                                context);
                 }
-                g_hash_table_remove (device->contexts, label);
+                g_hash_table_remove (device->contexts, key);
         }
 
         if (g_hash_table_size (device->contexts) == 0)
                 device->flags &= ~NETWORK_INTERFACE_PRECONFIGURED;
+
+	g_free (key);
+
 }
 
 /* Idle-handler for initial interface and address bootstrapping.
@@ -611,21 +641,25 @@
                         case RTM_NEWADDR:
                             {
                                 char *label = NULL;
+                                char *address = NULL;
 
                                 ifa = NLMSG_DATA (header);
-                                extract_info (header, &label);
-                                create_context (self, label, ifa);
+                                extract_info (header, &label,&address);
+                                create_context (self, label, address, ifa);
                                 g_free (label);
+                                g_free (address);
                             }
                             break;
                         case RTM_DELADDR:
                             {
                                 char *label = NULL;
+                                char *address = NULL;
 
                                 ifa = NLMSG_DATA (header);
-                                extract_info (header, &label);
-                                remove_context (self, label, ifa);
+                                extract_info (header, &label,&address);
+                                remove_context (self, label, address, ifa);
                                 g_free (label);
+                                g_free (address);
                             }
                             break;
                         case RTM_NEWLINK:
