[gssdp] sniffer: Add option for IP protocol version



commit 96a8c3a26ea25cc89658fd63ad96bb2c91b3e11b
Author: Jens Georg <mail jensge org>
Date:   Thu Nov 1 12:14:20 2018 +0100

    sniffer: Add option for IP protocol version
    
    Implementation is slightly hackish, we are setting an unsupported IPv6
    address (any) and forcing the client to use the family from that for the
    auto-detection. Needs a bit more work in the client to make that nicely

 tools/gssdp-device-sniffer.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/tools/gssdp-device-sniffer.c b/tools/gssdp-device-sniffer.c
index 626117f..daf82c0 100644
--- a/tools/gssdp-device-sniffer.c
+++ b/tools/gssdp-device-sniffer.c
@@ -35,10 +35,13 @@ GSSDPResourceBrowser *resource_browser;
 GSSDPClient *client;
 char *ip_filter = NULL;
 gboolean capture_packets = TRUE;
+gboolean prefer_v6 = FALSE;
 
 GOptionEntry entries[] =
 {
         {"interface", 'i', 0, G_OPTION_ARG_STRING, &interface, "Network interface to listen on", NULL },
+        { "prefer-v6", '6', 0, G_OPTION_ARG_NONE, &prefer_v6, "Prefer IPv6 for the client", NULL },
+        { "prefer-v4", '4', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &prefer_v6, "Prefer IPv4 for the 
client", NULL },
         { NULL }
 };
 
@@ -744,6 +747,7 @@ init_upnp (void)
         client = g_initable_new (GSSDP_TYPE_CLIENT,
                                  NULL,
                                  &error,
+                                 "host-ip", prefer_v6 ? "::" : NULL,
                                  "interface", interface,
                                  NULL);
         if (error) {


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