mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
tools: Drop support for pre-2.4.0 wireshark
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>
This commit is contained in:
parent
dc93997a83
commit
1620bb0a30
@ -166,11 +166,7 @@
|
|||||||
# Enable wireshark plugins for all distros shipping libvirt 1.2.2 or newer
|
# Enable wireshark plugins for all distros shipping libvirt 1.2.2 or newer
|
||||||
%if 0%{?fedora}
|
%if 0%{?fedora}
|
||||||
%define with_wireshark 0%{!?_without_wireshark:1}
|
%define with_wireshark 0%{!?_without_wireshark:1}
|
||||||
%endif
|
|
||||||
%if 0%{?fedora} || 0%{?rhel} > 7
|
|
||||||
%define wireshark_plugindir %(pkg-config --variable plugindir wireshark)/epan
|
%define wireshark_plugindir %(pkg-config --variable plugindir wireshark)/epan
|
||||||
%else
|
|
||||||
%define wireshark_plugindir %{_libdir}/wireshark/plugins/epan
|
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
# Enable libssh transport for new enough distros
|
# Enable libssh transport for new enough distros
|
||||||
@ -389,7 +385,7 @@ BuildRequires: numad
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if %{with_wireshark}
|
%if %{with_wireshark}
|
||||||
BuildRequires: wireshark-devel >= 2.1.0
|
BuildRequires: wireshark-devel >= 2.4.0
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if %{with_libssh}
|
%if %{with_libssh}
|
||||||
@ -935,7 +931,7 @@ Bash completion script stub.
|
|||||||
%if %{with_wireshark}
|
%if %{with_wireshark}
|
||||||
%package wireshark
|
%package wireshark
|
||||||
Summary: Wireshark dissector plugin for libvirt RPC transactions
|
Summary: Wireshark dissector plugin for libvirt RPC transactions
|
||||||
Requires: wireshark >= 1.12.6-4
|
Requires: wireshark >= 2.4.0
|
||||||
Requires: %{name}-libs = %{version}-%{release}
|
Requires: %{name}-libs = %{version}-%{release}
|
||||||
|
|
||||||
%description wireshark
|
%description wireshark
|
||||||
|
@ -18,14 +18,14 @@ dnl <http://www.gnu.org/licenses/>.
|
|||||||
dnl
|
dnl
|
||||||
|
|
||||||
AC_DEFUN([LIBVIRT_ARG_WIRESHARK],[
|
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],
|
LIBVIRT_ARG_WITH([WS_PLUGINDIR],
|
||||||
[wireshark plugins directory for use when installing
|
[wireshark plugins directory for use when installing
|
||||||
wireshark plugin], [check])
|
wireshark plugin], [check])
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_DEFUN([LIBVIRT_CHECK_WIRESHARK],[
|
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
|
dnl Check for system location of wireshark plugins
|
||||||
if test "x$with_wireshark_dissector" != "xno" ; then
|
if test "x$with_wireshark_dissector" != "xno" ; then
|
||||||
|
@ -42,12 +42,6 @@
|
|||||||
# define dbg(fmt, ...)
|
# define dbg(fmt, ...)
|
||||||
#endif
|
#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 proto_libvirt = -1;
|
||||||
static int hf_libvirt_length = -1;
|
static int hf_libvirt_length = -1;
|
||||||
static int hf_libvirt_program = -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;
|
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);
|
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);
|
payload_data = (caddr_t)tvb_memdup(NULL, payload_tvb, 0, payload_length);
|
||||||
#endif
|
|
||||||
xdrmem_create(&xdrs, payload_data, payload_length, XDR_DECODE);
|
xdrmem_create(&xdrs, payload_data, payload_length, XDR_DECODE);
|
||||||
|
|
||||||
dissect(payload_tvb, tree, &xdrs, -1);
|
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);
|
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
|
static int
|
||||||
dissect_libvirt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
dissect_libvirt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
||||||
void *opaque ATTRIBUTE_UNUSED)
|
void *opaque ATTRIBUTE_UNUSED)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
goffset offset;
|
goffset offset;
|
||||||
guint32 prog, proc, type, serial, status;
|
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);
|
dissect_libvirt_payload(tvb, libvirt_tree, prog, proc, type, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WIRESHARK_VERSION >= 1012000
|
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WIRESHARK_VERSION >= 1099002
|
|
||||||
static guint
|
static guint
|
||||||
get_message_len(packet_info *pinfo ATTRIBUTE_UNUSED, tvbuff_t *tvb, int offset, void *data ATTRIBUTE_UNUSED)
|
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);
|
return tvb_get_ntohl(tvb, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WIRESHARK_VERSION >= 2000001
|
|
||||||
static int
|
static int
|
||||||
dissect_libvirt(tvbuff_t *tvb, packet_info *pinfo,
|
dissect_libvirt(tvbuff_t *tvb, packet_info *pinfo,
|
||||||
proto_tree *tree, void *data ATTRIBUTE_UNUSED)
|
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
|
/* Another magic const - 4; simply, how much bytes
|
||||||
* is needed to tell the length of libvirt packet. */
|
* 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,
|
tcp_dissect_pdus(tvb, pinfo, tree, TRUE, 4,
|
||||||
get_message_len, dissect_libvirt_message, NULL);
|
get_message_len, dissect_libvirt_message, NULL);
|
||||||
#endif
|
|
||||||
|
|
||||||
#if WIRESHARK_VERSION >= 2000001
|
|
||||||
return tvb_captured_length(tvb);
|
return tvb_captured_length(tvb);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -31,29 +31,21 @@
|
|||||||
(VERSION_MICRO))
|
(VERSION_MICRO))
|
||||||
|
|
||||||
#if WIRESHARK_VERSION < 2005000
|
#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_DEF const gchar version[] = VERSION;
|
||||||
WS_DLL_PUBLIC_NOEXTERN const gchar version[] = VERSION;
|
|
||||||
|
|
||||||
/* Start the functions we need for the plugin stuff */
|
/* Start the functions we need for the plugin stuff */
|
||||||
|
|
||||||
WS_DLL_PUBLIC_NOEXTERN void
|
WS_DLL_PUBLIC_DEF void
|
||||||
plugin_register(void)
|
plugin_register(void)
|
||||||
{
|
{
|
||||||
proto_register_libvirt();
|
proto_register_libvirt();
|
||||||
}
|
}
|
||||||
WS_DLL_PUBLIC_NOEXTERN void
|
WS_DLL_PUBLIC_DEF void
|
||||||
plugin_reg_handoff(void)
|
plugin_reg_handoff(void)
|
||||||
{
|
{
|
||||||
proto_reg_handoff_libvirt();
|
proto_reg_handoff_libvirt();
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
|
|
||||||
#elif WIRESHARK_VERSION < 2009000
|
#elif WIRESHARK_VERSION < 2009000
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user