[gupnp] tests: Do not assume IPv6 exists
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp] tests: Do not assume IPv6 exists
- Date: Wed, 25 May 2022 15:14:38 +0000 (UTC)
commit 49af00d33e127fe119c26d32e9cd21c75617fb1f
Author: Jens Georg <mail jensge org>
Date: Wed May 25 17:12:49 2022 +0200
tests: Do not assume IPv6 exists
tests/test-acl.c | 23 ++++++++++++++++++-----
tests/test-context.c | 25 ++++++++++++++++++++-----
2 files changed, 38 insertions(+), 10 deletions(-)
---
diff --git a/tests/test-acl.c b/tests/test-acl.c
index cc848ca..12bc89c 100644
--- a/tests/test-acl.c
+++ b/tests/test-acl.c
@@ -406,16 +406,13 @@ main (int argc, char *argv[])
GPtrArray *addresses = g_ptr_array_sized_new (2);
g_ptr_array_add (addresses, g_strdup ("127.0.0.1"));
- g_ptr_array_add (addresses, g_strdup ("::1"));
// Detect if there is a special network device with "proper" ip addresses to check also link-local
addresses
GUPnPContext *c = g_initable_new (GUPNP_TYPE_CONTEXT,
NULL,
NULL,
- "interface",
- "gupnp0",
- "address-family",
- G_SOCKET_FAMILY_IPV4,
+ "host-ip",
+ "::1",
NULL);
if (c != NULL) {
@@ -425,6 +422,22 @@ main (int argc, char *argv[])
g_object_unref (c);
}
+ c = g_initable_new (GUPNP_TYPE_CONTEXT,
+ NULL,
+ NULL,
+ "interface",
+ "gupnp0",
+ "address-family",
+ G_SOCKET_FAMILY_IPV4,
+ NULL);
+
+ if (c != NULL) {
+ g_ptr_array_add (
+ addresses,
+ g_strdup (gssdp_client_get_host_ip (GSSDP_CLIENT (c))));
+ g_object_unref (c);
+ }
+
c = g_initable_new (GUPNP_TYPE_CONTEXT,
NULL,
NULL,
diff --git a/tests/test-context.c b/tests/test-context.c
index 044ad82..98ea7d5 100644
--- a/tests/test-context.c
+++ b/tests/test-context.c
@@ -1100,18 +1100,33 @@ main (int argc, char *argv[])
GPtrArray *addresses = g_ptr_array_sized_new (2);
g_ptr_array_add (addresses, g_strdup ("127.0.0.1"));
- g_ptr_array_add (addresses, g_strdup ("::1"));
+
// Detect if there is a special network device with "proper" ip addresses to check also link-local
addresses
GUPnPContext *c = g_initable_new (GUPNP_TYPE_CONTEXT,
NULL,
NULL,
- "interface",
- "gupnp0",
- "address-family",
- G_SOCKET_FAMILY_IPV4,
+ "host-ip",
+ "::1",
NULL);
+ if (c != NULL) {
+ g_ptr_array_add (
+ addresses,
+ g_strdup (gssdp_client_get_host_ip (GSSDP_CLIENT (c))));
+ g_object_unref (c);
+ }
+
+ // Detect if there is a special network device with "proper" ip addresses to check also link-local
addresses
+ c = g_initable_new (GUPNP_TYPE_CONTEXT,
+ NULL,
+ NULL,
+ "interface",
+ "gupnp0",
+ "address-family",
+ G_SOCKET_FAMILY_IPV4,
+ NULL);
+
if (c != NULL) {
g_debug ("Adding address %s from device gupnp0",
gssdp_client_get_host_ip (GSSDP_CLIENT (c)));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]