diff --git a/.github/workflows/options.yml b/.github/workflows/options.yml index 7e21218f68..7e8451e1f2 100644 --- a/.github/workflows/options.yml +++ b/.github/workflows/options.yml @@ -28,7 +28,6 @@ jobs: -DENABLE_CHECKHF_CONFLICT=ON -DENABLE_GNUTLS=OFF -DENABLE_KERBEROS=OFF - -DENABLE_LIBXML2=OFF -DENABLE_ILBC=OFF -DENABLE_LUA=OFF -DENABLE_LZ4=OFF diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2db5957f83..90de3cdb46 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -963,7 +963,7 @@ No options: script: | cmake -GNinja -DENABLE_CCACHE=ON \ -DENABLE_BROTLI=OFF -DENABLE_CAP=OFF -DENABLE_CHECKHF_CONFLICT=ON -DENABLE_GNUTLS=OFF \ - -DENABLE_KERBEROS=OFF -DENABLE_LIBXML2=OFF -DENABLE_ILBC=OFF -DENABLE_LUA=OFF -DENABLE_LZ4=OFF \ + -DENABLE_KERBEROS=OFF -DENABLE_ILBC=OFF -DENABLE_LUA=OFF -DENABLE_LZ4=OFF \ -DENABLE_MINIZIP=OFF -DENABLE_NETLINK=OFF -DENABLE_NGHTTP2=OFF -DENABLE_NGHTTP3=OFF \ -DENABLE_BCG729=OFF -DENABLE_OPUS=OFF -DENABLE_PCAP=OFF -DENABLE_PLUGIN_IFDEMO=ON \ -DENABLE_PLUGINS=OFF -DENABLE_SBC=OFF -DENABLE_SMI=OFF -DENABLE_SNAPPY=OFF -DENABLE_SPANDSP=OFF \ diff --git a/CMakeLists.txt b/CMakeLists.txt index 79b725014b..1617203335 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1349,6 +1349,8 @@ endif () find_package(LEX REQUIRED) reset_find_package(PCRE2 PCRE2_DEBUG_LIBRARY) find_package(PCRE2 REQUIRED) +reset_find_package(LibXml2) +find_package(LibXml2 "2.9.7" REQUIRED) if (NOT WIN32) find_package(Gettext) @@ -1568,24 +1570,6 @@ if (BUILD_stratoshark) ws_find_package(Sinsp ENABLE_SINSP HAVE_SINSP "0.17.1") endif() -# CMake 3.9 and below used 'LIBXML2_LIBRARIES' as the name of the cache entry -# storing the find_library result. Transfer it to the new cache variable such -# that reset_find_package can detect and clear outdated cache variables. -if(DEFINED LIBXML2_LIBRARIES AND NOT DEFINED LIBXML2_LIBRARY) - set(LIBXML2_LIBRARY ${LIBXML2_LIBRARIES} CACHE FILEPATH "") -endif() -# Call reset_find_package explicitly since variables are in upper case. -reset_find_package(LIBXML2) -ws_find_package(LibXml2 ENABLE_LIBXML2 HAVE_LIBXML2) -if(NOT LIBXML2_FOUND) - # CMake 3.9 and below used LIBXML2_LIBRARIES as the name of - # the cache entry storing the find_library result. - # Current CMake (3.13) and below sets LIBXML2_LIBRARIES and LIBXML2_INCLUDE_DIRS - # to a non-empty value, be sure to clear it when not found. - set(LIBXML2_LIBRARIES "") - set(LIBXML2_INCLUDE_DIRS "") -endif() - # Capabilities to run dumpcap as non-root user. if(CMAKE_SYSTEM_NAME STREQUAL "Linux") ws_find_package(CAP ENABLE_CAP HAVE_LIBCAP) @@ -2428,14 +2412,12 @@ if(USE_REPOSITORY) if (OPUS_FOUND) list (APPEND THIRD_PARTY_DLLS "${OPUS_DLL_DIR}/${OPUS_DLL}") endif(OPUS_FOUND) - if (LIBXML2_FOUND) - foreach( _dll ${LIBXML2_DLLS} ) - list (APPEND THIRD_PARTY_DLLS "${LIBXML2_DLL_DIR}/${_dll}") - endforeach(_dll) - foreach( _pdb ${LIBXML2_PDBS} ) - list (APPEND THIRD_PARTY_PDBS "${LIBXML2_DLL_DIR}/${_pdb}") - endforeach(_pdb) - endif(LIBXML2_FOUND) + foreach( _dll ${LIBXML2_DLLS} ) + list (APPEND THIRD_PARTY_DLLS "${LIBXML2_DLL_DIR}/${_dll}") + endforeach(_dll) + foreach( _pdb ${LIBXML2_PDBS} ) + list (APPEND THIRD_PARTY_PDBS "${LIBXML2_DLL_DIR}/${_pdb}") + endforeach(_pdb) if (SMI_FOUND) list (APPEND THIRD_PARTY_DLLS "${SMI_DLL_DIR}/${SMI_DLL}") # Wireshark.nsi wants SMI_DIR which is the base SMI directory @@ -3976,9 +3958,6 @@ if(RPMBUILD_EXECUTABLE) if (OPUS_FOUND) list(APPEND _rpmbuild_with_args --with opus) endif() - if (LIBXML2_FOUND) - list(APPEND _rpmbuild_with_args --with libxml2) - endif() if (NGHTTP2_FOUND) list(APPEND _rpmbuild_with_args --with nghttp2) endif() diff --git a/CMakeOptions.txt b/CMakeOptions.txt index 70dc9f9f58..8dae80c254 100644 --- a/CMakeOptions.txt +++ b/CMakeOptions.txt @@ -117,7 +117,6 @@ option(ENABLE_SPANDSP "Build with G.722/G.726 codecs support in RTP Player" O option(ENABLE_BCG729 "Build with G.729 codec support in RTP Player" ON) option(ENABLE_AMRNB "Build with AMRNB codec support in RTP Player" ON) option(ENABLE_ILBC "Build with iLBC codec support in RTP Player" ON) -option(ENABLE_LIBXML2 "Build with libxml2 support" ON) option(ENABLE_OPUS "Build with opus support" ON) option(ENABLE_SINSP "Build with libsinsp+libscap support" ON) diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in index c320970ebe..428c2fd319 100644 --- a/cmakeconfig.h.in +++ b/cmakeconfig.h.in @@ -260,9 +260,6 @@ /* Define to 1 if you have the opus library. */ #cmakedefine HAVE_OPUS 1 -/* Define to 1 if you have the lixbml2 library. */ -#cmakedefine HAVE_LIBXML2 1 - /* Define to 1 if you have the `setresgid' function. */ #cmakedefine HAVE_SETRESGID 1 diff --git a/doc/Wireshark_Release_Notes.adoc b/doc/Wireshark_Release_Notes.adoc index 02c8a63bfa..f7b81be9db 100644 --- a/doc/Wireshark_Release_Notes.adoc +++ b/doc/Wireshark_Release_Notes.adoc @@ -194,6 +194,8 @@ for Arm64 and Intel. wsbuglink:17294[] current OS default on Windows and macOS, if Wireshark is built with Qt 6.8 or later as the official installers do. wsbuglink:19328[] +* LibXml2 is now a required dependency. + === Removed Features and Support Wireshark no longer supports AirPcap and WinPcap. diff --git a/doc/wsdg_src/wsdg_quick_setup.adoc b/doc/wsdg_src/wsdg_quick_setup.adoc index 8cff215b11..d8ecd66ec2 100644 --- a/doc/wsdg_src/wsdg_quick_setup.adoc +++ b/doc/wsdg_src/wsdg_quick_setup.adoc @@ -956,6 +956,7 @@ This guide assumes `paru` is being used. paru -S mingw-w64-cmake paru -S mingw-w64-glib2 paru -S mingw-w64-libgcrypt + paru -S mingw-w64-libxml2 paru -S mingw-w64-c-ares paru -S mingw-w64-speexdsp paru -S mingw-w64-libpcap @@ -971,7 +972,6 @@ This guide assumes `paru` is being used. paru -S mingw-w64-snappy paru -S mingw-w64-opus paru -S mingw-w64-opencore-amr - paru -S mingw-w64-libxml2 paru -S mingw-w64-libnghttp2 paru -S mingw-w64-libssh paru -S mingw-w64-minizip diff --git a/epan/dissectors/packet-epl-profile-parser.c b/epan/dissectors/packet-epl-profile-parser.c index cf264305d2..65b22b450c 100644 --- a/epan/dissectors/packet-epl-profile-parser.c +++ b/epan/dissectors/packet-epl-profile-parser.c @@ -32,7 +32,6 @@ #include #include -#if defined HAVE_LIBXML2 #include #if defined LIBXML_XPATH_ENABLED \ @@ -78,8 +77,6 @@ static struct xpath { #endif /* LIBXML_XPATH_ENABLED && LIBXML_SAX1_ENABLED && LIBXML_TREE_ENABLED */ -#endif /* HAVE_LIBXML2 */ - struct datatype { uint16_t id; const struct epl_datatype *ptr; @@ -568,13 +565,11 @@ populate_object_list(xmlNodeSetPtr nodes, void *_profile) #else /* ! PARSE_XDD */ -#ifdef HAVE_LIBXML2 struct profile * epl_xdd_load(struct profile *profile _U_, const char *xml_file _U_) { return NULL; } -#endif /* HAVE_LIBXML2 */ #endif /* ! PARSE_XDD */ diff --git a/epan/dissectors/packet-epl.c b/epan/dissectors/packet-epl.c index 46bcaa6f28..992c2be496 100644 --- a/epan/dissectors/packet-epl.c +++ b/epan/dissectors/packet-epl.c @@ -76,11 +76,7 @@ #include #include -#ifdef HAVE_LIBXML2 - #define IF_LIBXML(x) x -#else - #define IF_LIBXML(x) -#endif +#define IF_LIBXML(x) x void proto_register_epl(void); void proto_reg_handoff_epl(void); @@ -5238,14 +5234,14 @@ static struct profile *profile_load(wmem_allocator_t *allocator, const char *pat if (!epl_eds_load(profile, path)) profile_del(profile); } -#if HAVE_LIBXML2 + else if (g_str_has_suffix(path, ".xdd") || g_str_has_suffix(path, ".xdc")) { profile = profile_new(allocator); if (!epl_xdd_load(profile, path)) profile_del(profile); } -#endif + if (!profile) report_failure("Profile '%s' couldn't be parsed", path); @@ -6384,10 +6380,8 @@ proto_register_epl(void) prefs_register_bool_preference(epl_module, "use_sdo_mappings", "Use SDO ObjectMappings for PDO dissection", "Partition PDOs according to ObjectMappings sent via SDO", &use_sdo_mappings); -#ifdef HAVE_LIBXML2 prefs_register_bool_preference(epl_module, "use_xdc_mappings", "Use XDC ObjectMappings for PDO dissection", "If you want to parse the defaultValue (XDD) and actualValue (XDC) attributes for ObjectMappings in order to detect default PDO mappings, which may not be sent over SDO ", &use_xdc_mappings); -#endif prefs_register_bool_preference(epl_module, "interpret_untyped_as_le", "Interpret short (<64bit) data as little endian integers", "If a data field has untyped data under 8 byte long, interpret it as unsigned little endian integer and show decimal and hexadecimal representation thereof. Otherwise use stock data dissector", &interpret_untyped_as_le); @@ -6517,13 +6511,8 @@ epl_profile_uat_fld_fileopen_check_cb(void *record _U_, const char *path, unsign if (g_str_has_suffix(path, ".xdd") || g_str_has_suffix(path, ".xdc")) { -#ifdef HAVE_LIBXML2 *err = NULL; return true; -#else - *err = ws_strdup_printf("*.xdd and *.xdc support not compiled in. %s", supported); - return false; -#endif } *err = g_strdup(supported); diff --git a/epan/epan.c b/epan/epan.c index a529e417ec..15a6072682 100644 --- a/epan/epan.c +++ b/epan/epan.c @@ -100,10 +100,8 @@ #include #endif -#ifdef HAVE_LIBXML2 #include #include -#endif #ifndef _WIN32 #include @@ -325,10 +323,9 @@ epan_init(register_cb cb, void *client_data, bool load_plugins) } #endif #endif -#ifdef HAVE_LIBXML2 + xmlInitParser(); LIBXML_TEST_VERSION; -#endif #ifndef _WIN32 // We might receive a SIGPIPE due to maxmind_db. @@ -458,9 +455,9 @@ epan_cleanup(void) #ifdef HAVE_LIBGNUTLS gnutls_global_deinit(); #endif -#ifdef HAVE_LIBXML2 + xmlCleanupParser(); -#endif + except_deinit(); addr_resolv_cleanup(); @@ -917,11 +914,7 @@ epan_gather_compile_info(feature_list l) #endif /* HAVE_SNAPPY */ /* libxml2 */ -#ifdef HAVE_LIBXML2 with_feature(l, "libxml2 %s", LIBXML_DOTTED_VERSION); -#else - without_feature(l, "libxml2"); -#endif /* HAVE_LIBXML2 */ /* libsmi */ #ifdef HAVE_LIBSMI diff --git a/packaging/rpm/wireshark.spec.in b/packaging/rpm/wireshark.spec.in index 47665e0edf..d3d56abb7c 100644 --- a/packaging/rpm/wireshark.spec.in +++ b/packaging/rpm/wireshark.spec.in @@ -24,7 +24,6 @@ %bcond_with spandsp %bcond_with bcg729 %bcond_with amrnb -%bcond_with libxml2 %bcond_with nghttp2 %bcond_with nghttp3 %bcond_with sdjournal @@ -161,9 +160,7 @@ BuildRequires: speexdsp-devel BuildRequires: (lua-devel or lua53-devel or compat-lua-devel or lua52-devel or lua51-devel) %endif -%if %{with libxml2} BuildRequires: libxml2-devel -%endif %if %{with nghttp2} BuildRequires: libnghttp2-devel @@ -427,11 +424,6 @@ This package contains the Stratoshark GUI and desktop integration files. %else -DENABLE_AMRNB=OFF \ %endif -%if %{with libxml2} - -DENABLE_LIBXML2=ON \ -%else - -DENABLE_LIBXML2=OFF \ -%endif %if %{with nghttp2} -DENABLE_NGHTTP2=ON \ %else diff --git a/plugins/epan/profinet/packet-dcerpc-pn-io.c b/plugins/epan/profinet/packet-dcerpc-pn-io.c index 8d53a1a6e9..ae44158623 100644 --- a/plugins/epan/profinet/packet-dcerpc-pn-io.c +++ b/plugins/epan/profinet/packet-dcerpc-pn-io.c @@ -71,13 +71,11 @@ #include #include -#ifdef HAVE_LIBXML2 #include #include #include #include #include -#endif #include "packet-pn.h" @@ -4307,7 +4305,6 @@ pnio_gsd_device_equal(const void *key1, const void *key2) return (a->vendor_id == b->vendor_id) && (a->device_id == b->device_id); } -#ifdef HAVE_LIBXML2 static wmem_map_t * pnio_load_gsd_device_modules(const xmlNodePtr deviceNode, xmlXPathContextPtr xpathCtx) { @@ -4535,7 +4532,6 @@ pnio_load_gsd_device_profile(xmlNodePtr deviceNode, xmlXPathContextPtr xpathCtx, value->modules = pnio_load_gsd_device_modules(deviceNode, xpathCtx); value->submodules = pnio_load_gsd_device_submodules(deviceNode, xpathCtx); } -#endif /* HAVE_LIBXML2 */ static void pnio_load_gsd_files(void) @@ -4547,7 +4543,6 @@ pnio_load_gsd_files(void) wmem_free_all(pnio_pref_scope); } -#ifdef HAVE_LIBXML2 char *diropen = NULL; /* saves the final networkpath to open for GSD-files */ GDir *dir; const char *filename; /* saves the found GSD-file name */ @@ -4611,7 +4606,6 @@ pnio_load_gsd_files(void) g_dir_close(dir); } -#endif /* HAVE_LIBXML2 */ } typedef struct { address* device; @@ -22044,11 +22038,9 @@ proto_register_pn_io (void) "Folder containing GSD files", /* Title */ "Place GSD files in this folder.", /* Description */ &pnio_ps_networkpath); /* Variable in which to save the GSD file folder path */ -#ifndef HAVE_LIBXML2 prefs_register_static_text_preference(pnio_module, "pnio_no_libxml2", "This version of Wireshark was built without support for reading GSDML files.", "This version of Wireshark was built without libxml2 and does not support reading GSDML files."); -#endif prefs_register_filename_preference(pnio_module, "pnio_configpath", "Config file for manual extraction", "Choose a config XML file", diff --git a/plugins/epan/profinet/packet-pn-rtc-one.c b/plugins/epan/profinet/packet-pn-rtc-one.c index 7711b19275..941dfa375e 100644 --- a/plugins/epan/profinet/packet-pn-rtc-one.c +++ b/plugins/epan/profinet/packet-pn-rtc-one.c @@ -457,9 +457,7 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset, proto_item *data_item; proto_item *IODataObject_item; -#ifdef HAVE_LIBXML2 proto_item *IODataObject_item_info; -#endif proto_tree *IODataObject_tree; proto_item *ModuleID_item; proto_item *ModuleDiff_item; @@ -613,8 +611,6 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset, proto_tree_add_string_format_value(data_tree, hf_pn_io_frame_info_nameofstation, tvb, 0, 0, station_info->nameofstation, "\"%s\"", station_info->nameofstation); } - -#ifdef HAVE_LIBXML2 if (station_info->gsdPathLength == true) { /* given path isn't too long for the array */ if (station_info->gsdFound == true) { /* found a GSD-file */ if (station_info->gsdLocation != NULL) { @@ -633,9 +629,6 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset, IODataObject_item_info = proto_tree_add_item(data_tree, hf_pn_io_frame_info_gsd_path, tvb, offset, 0, ENC_NA); proto_item_append_text(IODataObject_item_info, " Please check your GSD-file networkpath. (No Path configured)"); } -#else /* HAVE_LIBXML2 */ - proto_tree_add_none_format(data_tree, hf_pn_io_frame_info_gsd_error, tvb, offset, 0, "This copy of Wireshark was built without support for reading GSDML files."); -#endif /* HAVE_LIBXML2 */ } /* ---- Input IOData-/IOCS-Object Handling ---- */ @@ -827,8 +820,6 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset, proto_tree_add_string_format_value(data_tree, hf_pn_io_frame_info_nameofstation, tvb, 0, 0, station_info->nameofstation, "\"%s\"", station_info->nameofstation); } - -#ifdef HAVE_LIBXML2 if (station_info->gsdPathLength == true) { /* given path isn't too long for the array */ if (station_info->gsdFound == true) { /* found a GSD-file */ if (station_info->gsdLocation != NULL) { @@ -847,9 +838,6 @@ dissect_PNIO_C_SDU_RTC1(tvbuff_t *tvb, int offset, IODataObject_item_info = proto_tree_add_item(data_tree, hf_pn_io_frame_info_gsd_path, tvb, offset, 0, ENC_NA); proto_item_append_text(IODataObject_item_info, " Please check your GSD-file networkpath. (No Path configured)"); } -#else /* HAVE_LIBXML2 */ - proto_tree_add_none_format(data_tree, hf_pn_io_frame_info_gsd_error, tvb, offset, 0, "This copy of Wireshark was built without support for reading GSDML files."); -#endif /* HAVE_LIBXML2 */ } /* ---- Output IOData-/IOCS-Object Handling ---- */ diff --git a/tools/alpine-setup.sh b/tools/alpine-setup.sh index 0cdb779934..e099462160 100755 --- a/tools/alpine-setup.sh +++ b/tools/alpine-setup.sh @@ -57,6 +57,7 @@ BASIC_LIST=" g++ glib-dev libgcrypt-dev + libxml2-dev flex tiff-dev c-ares-dev @@ -78,7 +79,6 @@ ADDITIONAL_LIST=" libcap-dev libcap-setcap libpcap-dev - libxml2-dev libmaxminddb-dev krb5-dev lz4-dev diff --git a/tools/debian-setup.sh b/tools/debian-setup.sh index 344687836a..89cb225793 100755 --- a/tools/debian-setup.sh +++ b/tools/debian-setup.sh @@ -106,6 +106,8 @@ BASIC_LIST=" libpcap-dev libpcre2-dev libspeexdsp-dev + libxml2-dev + libxml2-utils make python3 " @@ -193,7 +195,6 @@ ADDITIONAL_LIST=" libsnappy-dev libspandsp-dev libsystemd-dev - libxml2-dev libzstd-dev ninja-build perl @@ -214,7 +215,6 @@ DEBDEPS_LIST=" dh-python docbook-xml docbook-xsl - libxml2-utils lintian lsb-release po-debconf diff --git a/tools/macos-setup-brew.sh b/tools/macos-setup-brew.sh index 202338e045..51fbf6b97d 100755 --- a/tools/macos-setup-brew.sh +++ b/tools/macos-setup-brew.sh @@ -104,6 +104,7 @@ REQUIRED_LIST=( c-ares glib libgcrypt + libxml2 pcre2 qt6 speexdsp @@ -119,7 +120,6 @@ OPTIONAL_LIST=( libnghttp3 libsmi libssh - libxml2 lua lz4 minizip diff --git a/tools/rpm-setup.sh b/tools/rpm-setup.sh index 6a36d59b00..818104921c 100755 --- a/tools/rpm-setup.sh +++ b/tools/rpm-setup.sh @@ -81,6 +81,7 @@ BASIC_LIST=" glib2-devel libgcrypt-devel libpcap-devel + libxml2-devel pcre2-devel python3 " @@ -89,7 +90,6 @@ ADDITIONAL_LIST=" krb5-devel libcap-devel libssh-devel - libxml2-devel lz4 perl perl-Parse-Yapp diff --git a/wiretap/ttl.c b/wiretap/ttl.c index 94283e2ccc..443b95307f 100644 --- a/wiretap/ttl.c +++ b/wiretap/ttl.c @@ -24,11 +24,9 @@ #include #include #include -#ifdef HAVE_LIBXML2 #include #include #include -#endif #include "file_wrappers.h" #include "wtap-int.h" @@ -2266,7 +2264,6 @@ static ttl_result_t ttl_read_entry(wtap* wth, wtap_rec* rec, int* err, char** er } -#ifdef HAVE_LIBXML2 static bool ttl_xml_node_get_number(xmlNodePtr node, xmlXPathContextPtr ctx, double *ret) { xmlXPathObjectPtr result; @@ -2383,7 +2380,6 @@ ttl_process_xml_config(ttl_t* ttl, const char* text, int size) { xmlFreeDoc(doc); return true; } -#endif /* HAVE_LIBXML2 */ /* Maximum supported line length of preference files */ #define MAX_LINELEN 1024 @@ -2717,7 +2713,6 @@ ttl_open(wtap* wth, int* err, char** err_info) { return WTAP_OPEN_ERROR; } offset += TTL_LOGFILE_INFO_SIZE; -#ifdef HAVE_LIBXML2 unsigned int xml_len = header.header_size - offset; if (xml_len != 0) { unsigned char* xml = g_try_malloc(xml_len); @@ -2738,7 +2733,6 @@ ttl_open(wtap* wth, int* err, char** err_info) { g_free(xml); offset += xml_len; } -#endif /* HAVE_LIBXML2 */ } }