]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tools: Drop support for pre-2.4.0 wireshark
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 8 Feb 2019 11:05:23 +0000 (12:05 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 12 Feb 2019 08:22:59 +0000 (09:22 +0100)
The wireshark-2.4.0 is almost 2 years old now. Assuming anybody
interested in running latest libvirt doesn't run old wireshark,
it is safe to do this. It also simplifies the code.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
libvirt.spec.in
m4/virt-wireshark.m4
tools/wireshark/src/packet-libvirt.c
tools/wireshark/src/plugin.c

index 13f41bb4a5b44777ca2dd90a2099af7c44e4ac73..9beffba203998fbd5121fec0d017ad77e03615bb 100644 (file)
 # Enable wireshark plugins for all distros shipping libvirt 1.2.2 or newer
 %if 0%{?fedora}
     %define with_wireshark 0%{!?_without_wireshark:1}
-%endif
-%if 0%{?fedora} || 0%{?rhel} > 7
     %define wireshark_plugindir %(pkg-config --variable plugindir wireshark)/epan
-%else
-    %define wireshark_plugindir %{_libdir}/wireshark/plugins/epan
 %endif
 
 # Enable libssh transport for new enough distros
@@ -389,7 +385,7 @@ BuildRequires: numad
 %endif
 
 %if %{with_wireshark}
-BuildRequires: wireshark-devel >= 2.1.0
+BuildRequires: wireshark-devel >= 2.4.0
 %endif
 
 %if %{with_libssh}
@@ -935,7 +931,7 @@ Bash completion script stub.
 %if %{with_wireshark}
 %package wireshark
 Summary: Wireshark dissector plugin for libvirt RPC transactions
-Requires: wireshark >= 1.12.6-4
+Requires: wireshark >= 2.4.0
 Requires: %{name}-libs = %{version}-%{release}
 
 %description wireshark
index 1cbe1312eafed0516bcfb4f47de828d83c4ecb5a..2eee8a6ce86d5f8432df3c22e3b8a18ef1a9ed8f 100644 (file)
@@ -18,14 +18,14 @@ dnl <http://www.gnu.org/licenses/>.
 dnl
 
 AC_DEFUN([LIBVIRT_ARG_WIRESHARK],[
-  LIBVIRT_ARG_WITH_FEATURE([WIRESHARK_DISSECTOR], [wireshark], [check], [1.11.3])
+  LIBVIRT_ARG_WITH_FEATURE([WIRESHARK_DISSECTOR], [wireshark], [check], [2.4.0])
   LIBVIRT_ARG_WITH([WS_PLUGINDIR],
                    [wireshark plugins directory for use when installing
                    wireshark plugin], [check])
 ])
 
 AC_DEFUN([LIBVIRT_CHECK_WIRESHARK],[
-  LIBVIRT_CHECK_PKG([WIRESHARK_DISSECTOR], [wireshark], [1.11.3])
+  LIBVIRT_CHECK_PKG([WIRESHARK_DISSECTOR], [wireshark], [2.4.0])
 
   dnl Check for system location of wireshark plugins
   if test "x$with_wireshark_dissector" != "xno" ; then
index e759e81bae26df4fe73816250995ba226090f312..dc3aa410e54a7cc5c54f772f37ad6144ba0999e7 100644 (file)
 # define dbg(fmt, ...)
 #endif
 
-/* Wireshark 1.12 brings API change */
-#define WIRESHARK_VERSION \
-    ((VERSION_MAJOR * 1000 * 1000) + \
-     (VERSION_MINOR * 1000) + \
-     (VERSION_MICRO))
-
 static int proto_libvirt = -1;
 static int hf_libvirt_length = -1;
 static int hf_libvirt_program = -1;
@@ -373,17 +367,8 @@ dissect_libvirt_payload_xdr_data(tvbuff_t *tvb, proto_tree *tree, gint payload_l
         payload_length -= 4;
     }
 
-#if WIRESHARK_VERSION < 200400
-    payload_tvb = tvb_new_subset(tvb, start, -1, payload_length);
-#else
     payload_tvb = tvb_new_subset_remaining(tvb, start);
-#endif
-
-#if WIRESHARK_VERSION < 1012000
-    payload_data = (caddr_t)tvb_memdup(payload_tvb, 0, payload_length);
-#else
     payload_data = (caddr_t)tvb_memdup(NULL, payload_tvb, 0, payload_length);
-#endif
     xdrmem_create(&xdrs, payload_data, payload_length, XDR_DECODE);
 
     dissect(payload_tvb, tree, &xdrs, -1);
@@ -456,14 +441,9 @@ dissect_libvirt_payload(tvbuff_t *tvb, proto_tree *tree,
     proto_tree_add_item(tree, hf_libvirt_unknown, tvb, VIR_HEADER_LEN, -1, ENC_NA);
 }
 
-#if WIRESHARK_VERSION < 1012000
-static void
-dissect_libvirt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-#else
 static int
 dissect_libvirt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
                         void *opaque ATTRIBUTE_UNUSED)
-#endif
 {
     goffset offset;
     guint32 prog, proc, type, serial, status;
@@ -524,44 +504,25 @@ dissect_libvirt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
         dissect_libvirt_payload(tvb, libvirt_tree, prog, proc, type, status);
     }
 
-#if WIRESHARK_VERSION >= 1012000
     return 0;
-#endif
 }
 
-#if WIRESHARK_VERSION >= 1099002
 static guint
 get_message_len(packet_info *pinfo ATTRIBUTE_UNUSED, tvbuff_t *tvb, int offset, void *data ATTRIBUTE_UNUSED)
-#else
-static guint32
-get_message_len(packet_info *pinfo ATTRIBUTE_UNUSED, tvbuff_t *tvb, int offset)
-#endif
 {
     return tvb_get_ntohl(tvb, offset);
 }
 
-#if WIRESHARK_VERSION >= 2000001
 static int
 dissect_libvirt(tvbuff_t *tvb, packet_info *pinfo,
                 proto_tree *tree, void *data ATTRIBUTE_UNUSED)
-#else
-static void
-dissect_libvirt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
-#endif
 {
     /* Another magic const - 4; simply, how much bytes
      * is needed to tell the length of libvirt packet. */
-#if WIRESHARK_VERSION < 1012000
-    tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 4,
-                     get_message_len, dissect_libvirt_message);
-#else
     tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 4,
                      get_message_len, dissect_libvirt_message, NULL);
-#endif
 
-#if WIRESHARK_VERSION >= 2000001
     return tvb_captured_length(tvb);
-#endif
 }
 
 void
index 3741334e8588744299bc966f8910d44397bf6a90..504e4383a7b7c2686601bb8e246d233d1577fc9f 100644 (file)
      (VERSION_MICRO))
 
 #if WIRESHARK_VERSION < 2005000
-/* In 1.12 wireshark WS_DLL_PUBLIC_NOEXTERN was substitued with
- * WS_DLL_PUBLIC_DEF. See wireshark's commit
- * 5d87a8c46171f572568db5a47c093423482e342f for more info. */
-# ifndef WS_DLL_PUBLIC_NOEXTERN
-#  define WS_DLL_PUBLIC_NOEXTERN WS_DLL_PUBLIC_DEF
-# endif
 
-# ifndef ENABLE_STATIC
-WS_DLL_PUBLIC_NOEXTERN const gchar version[] = VERSION;
+WS_DLL_PUBLIC_DEF const gchar version[] = VERSION;
 
 /* Start the functions we need for the plugin stuff */
 
-WS_DLL_PUBLIC_NOEXTERN void
+WS_DLL_PUBLIC_DEF void
 plugin_register(void)
 {
   proto_register_libvirt();
 }
-WS_DLL_PUBLIC_NOEXTERN void
+WS_DLL_PUBLIC_DEF void
 plugin_reg_handoff(void)
 {
   proto_reg_handoff_libvirt();
 }
-# endif
 
 #elif WIRESHARK_VERSION < 2009000