239.1. wireshark-4.7.3
Network protocol analyser — the Qt window, tshark and dumpcap
| Version | 4.7.3, release 1 |
| Shelf | net-diag — Network diagnostics, capture, measurement and low-level socket tools |
| Phase | 43_toolkits (Toolkits), 238 of 344 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://www.wireshark.org/ |
| Build time | 33.7 SBU |
| Installed size | 121.8 MiB in 449 files |
| Recipe | ports/core/net-diag/wireshark/kpkgbuild |
About
Wireshark is the network protocol analyser: it captures traffic and dissects it, protocol by protocol, into fields. The package holds the Qt window wireshark, the command-line analyser tshark, the capture program dumpcap, the file tools (editcap, mergecap, capinfos, text2pcap and the rest), and the extcap helpers that capture from somewhere other than a local interface. termshark drives tshark and dissects nothing itself.
dumpcap is installed with no setuid bit and no file capability, so only root can capture; the window started from the menu opens a saved capture but lists no interfaces (see setuid binaries).
Why it is in KDOS
The comment above it in script/phases/43_toolkits/packages.d/net-diag.txt:
tcpdump prints packets; tshark understands about three thousand protocols, which is the difference between seeing a TLS handshake and reading why it failed. The Qt window and the command line are one package. ~250 MB installed, almost all of it dissectors, and that is the price.
Sources
wireshark-4.7.3.tar.xz(56.3 MiB)
sha2567267c20b15ffb42111f8d0d073f93af8a2973d3c9263c49ea7fe85be0d2e8457
upstream: https://www.wireshark.org/download/src/wireshark-4.7.3.tar.xz
archive copy: sources-3/net-diag--wireshark-4.7.3.tar.xz
Dependencies
Depends on: cmake, ninja, pkgconf, python3, flex, bison, glib, libpcap, zlib, zstd, lz4, c-ares, gnutls, libgcrypt, libxml2, pcre2, libcap, libnl, xxhash, speexdsp, asciidoctor, lua, krb5, nghttp2, nghttp3, brotli, p11-kit, minizip, sbc, opus, libssh, libmaxminddb, libsmi, snappy, qt6-qtbase, qt6-qtsvg, qt6-qttools, qt6-qtmultimedia.
Required by (1): termshark.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/43_toolkits/phase.env && kpkg install wireshark'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/net-diag/wireshark.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/net-diag/wireshark
echo '7267c20b15ffb42111f8d0d073f93af8a2973d3c9263c49ea7fe85be0d2e8457 wireshark-4.7.3.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/wireshark
SRC=$SRC_ROOT/wireshark-4.7.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf wireshark-4.7.3.tar.xz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
mkdir -p build && cd build
cmake .. -G Ninja \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_wireshark=ON \
-DBUILD_androiddump=OFF \
-DBUILD_sshdump=ON \
-DBUILD_ciscodump=ON \
-DBUILD_wifidump=ON \
-DBUILD_sdjournal=OFF \
-DBUILD_mmdbresolve=ON \
-DENABLE_PCAP=ON \
-DENABLE_LUA=ON \
-DENABLE_KERBEROS=ON \
-DENABLE_GNUTLS=ON \
-DENABLE_PKCS11=ON \
-DENABLE_NGHTTP2=ON \
-DENABLE_NGHTTP3=ON \
-DENABLE_BROTLI=ON \
-DENABLE_ZLIB=ON \
-DENABLE_ZSTD=ON \
-DENABLE_LZ4=ON \
-DENABLE_XXHASH=ON \
-DENABLE_NETLINK=ON \
-DENABLE_CAP=ON \
-DENABLE_SMI=ON \
-DENABLE_ZLIBNG=OFF \
-DENABLE_MINIZIP=ON \
-DENABLE_MINIZIPNG=OFF \
-DENABLE_SNAPPY=ON \
-DENABLE_CPUINFO=OFF \
-DENABLE_ILBC=OFF \
-DENABLE_SBC=ON \
-DENABLE_SPANDSP=OFF \
-DENABLE_BCG729=OFF \
-DENABLE_AMRNB=OFF \
-DENABLE_AMRWB=OFF \
-DENABLE_OPUS=ON \
-DENABLE_PLUGINS=ON \
-DENABLE_WERROR=OFF
for have in HAVE_LIBPCAP HAVE_LUA HAVE_KERBEROS HAVE_LIBGNUTLS \
HAVE_GNUTLS_PKCS11 HAVE_NGHTTP2 HAVE_NGHTTP3 HAVE_BROTLI HAVE_ZLIB \
HAVE_ZSTD HAVE_LZ4 HAVE_XXHASH HAVE_LIBNL HAVE_LIBCAP HAVE_MINIZIP \
HAVE_SBC HAVE_OPUS HAVE_LIBSSH HAVE_MAXMINDDB HAVE_LIBSMI HAVE_SNAPPY; do
grep -q "^#define $have 1" config.h || {
echo "wireshark: $have not found at configure" >&2
exit 1
}
done
grep -q '^Qt6Multimedia_DIR:PATH=/' CMakeCache.txt || {
echo "wireshark: Qt Multimedia not found at configure" >&2
exit 1
}
ninja
ninja docs
DESTDIR=$PKG ninja install
rm -f "$PKG/usr/share/doc/wireshark/Stratoshark Release Notes.html"
for page in "$PKG"/usr/share/man/man1/*.1; do
prog=$(basename "$page" .1)
if ! find "$PKG" -path "$PKG/usr/share" -prune -o -type f -name "$prog" -print | grep -q .; then
rm -f "$page" "$PKG/usr/share/doc/wireshark/$prog.html"
fi
done
cat > "$PKG/usr/share/applications/org.wireshark.Wireshark.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Wireshark
GenericName=Network Analyzer
Comment=Capture network traffic and dissect every protocol in it
Exec=wireshark %f
TryExec=wireshark
Icon=org.wireshark.Wireshark
Terminal=false
StartupWMClass=org.wireshark.Wireshark
MimeType=application/vnd.tcpdump.pcap;application/x-pcapng;application/x-snoop;application/x-iptrace;application/x-lanalyzer;application/x-nettl;application/x-radcom;application/x-etherpeek;application/x-visualnetworks;application/x-netinstobserver;application/x-5view;application/x-tektronix-rf5;application/x-micropross-mplog;application/x-apple-packetlogger;application/x-endace-erf;application/ipfix;application/x-ixia-vwr;
Categories=Qt;Network;Monitor;
Keywords=packet;capture;pcap;sniffer;protocol;tshark;
DESKTOP
chmod 644 "$PKG/usr/share/applications/org.wireshark.Wireshark.desktop"
The switches, and why each is set:
-DBUILD_wireshark=ON— build the Qt window alongside the command-line tools. Upstream’s default, named: the window andtsharkare one package.-DBUILD_androiddump=OFF— leave outandroiddump, the extcap that captures an Android device’s logcat and interfaces throughadb. Upstream’s default is on.-DBUILD_sshdump=ON— with-DBUILD_ciscodump=ONand-DBUILD_wifidump=ON: the extcaps that capture on a remote host over SSH, through libssh: withtcpdumpthere, through the Embedded Packet Capture of a Cisco IOS, IOS-XE or ASA device, and Wi-Fi frames in monitor mode. Upstream’s defaults, named.-DBUILD_sdjournal=OFF— leave outsdjournal, the extcap that reads the systemd journal. KDOS has no systemd (see No systemd); upstream’s default on Linux is on, and builds the extcap whenever it finds libsystemd.-DBUILD_mmdbresolve=ON—mmdbresolve, the helper that looks addresses up in a MaxMind GeoIP database through libmaxminddb. Upstream’s default, named.-DENABLE_ZLIBNG=OFF— link zlib only, not zlib-ng’s native API. Upstream looks for zlib-ng as well as zlib and uses it wherever it is found, and zlib-ng is installed in an earlier phase without being independs, so left on, the package would link a library it does not declare.-DENABLE_MINIZIPNG=OFF— the same for ZIP support: upstream tries minizip-ng first and falls back to minizip only when it is not found. Off,-DENABLE_MINIZIP=ONlinks the minizip port, which is independs; minizip-ng is installed in an earlier phase without being in it.-DENABLE_CPUINFO=OFF— no CPU detection through the cpuinfo library, which is not a port.-DENABLE_ILBC=OFF— with-DENABLE_SPANDSP=OFF,-DENABLE_BCG729=OFF,-DENABLE_AMRNB=OFFand-DENABLE_AMRWB=OFF: no iLBC, G.722/G.726, G.729, AMR-NB or AMR-WB decoding in the RTP player. Their libraries, libilbc, spandsp, bcg729 and opencore-amr, are not ports (see Features whose library has no port).-DENABLE_SBC=ONand-DENABLE_OPUS=ONkeep the Bluetooth SBC and Opus decoders, through sbc and opus.-DENABLE_PCAP=ON— and the remainingENABLE_switches set on (LUA,KERBEROS,GNUTLS,PKCS11,NGHTTP2,NGHTTP3,BROTLI,ZLIB,ZSTD,LZ4,XXHASH,NETLINK,CAP,SMI,MINIZIP,SNAPPY,PLUGINS): capture through libpcap, Lua dissectors, Kerberos and TLS decryption, PKCS#11 keys, HTTP/2 and HTTP/3 header decompression, the compressed payload and file formats, libnl for Wi-Fi monitor mode, POSIX capabilities indumpcap, SNMP MIBs through libsmi, and the bundled plugins. Each is upstream’s default; upstream turns one off without an error when its library is missing, which is whybuild.shchecks the result (see Notes).-DENABLE_WERROR=OFF— do not turn compiler warnings into errors. Upstream’s default is on, and a newer compiler’s new warnings would then fail the build. On, it also passes asciidoctor--failure-level WARN, so one documentation warning would failninja docs.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/wireshark, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf wireshark-4.7.3-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/wireshark, and runs the triggers its paths call for.
Contents
Installed programs: capinfos, captype, dumpcap, editcap, mergecap, mmdbresolve, randpkt, rawshark, reordercap, sharkd, text2pcap, tshark, wireshark.
Installed libraries: libuiqt_plugin.so, libwireshark.so, libwiretap.so, libwsutil.so.
Installed directories: /usr/lib/wireshark, /usr/libexec/wireshark, /usr/share/doc/wireshark, /usr/share/licenses/wireshark, /usr/share/wireshark.
Short descriptions
capinfos |
Prints information about capture files |
captype |
Prints the types of capture files |
dumpcap |
Dump network traffic |
editcap |
Edit and/or translate the format of capture files |
mergecap |
Merges two or more capture files into one |
mmdbresolve |
Read IPv4 and IPv6 addresses and print their IP geolocation information. |
randpkt |
Random packet generator |
rawshark |
Dump and analyze raw pcap data |
reordercap |
Reorder input file by timestamp into output file |
sharkd |
Interactively dump and analyze network traffic using JSON-RPC. |
text2pcap |
Generate a capture file from an ASCII hex dump of packets |
tshark |
Dump and analyze network traffic |
wireshark |
Interactively dump and analyze network traffic |
Notes
Every optional library in Wireshark’s configuration is found or skipped quietly. After cmake, build.sh greps config.h for the HAVE_ macro of each optional library the port depends on, from HAVE_LIBPCAP to HAVE_SNAPPY, and greps CMakeCache.txt for Qt6Multimedia_DIR, which the RTP player’s audio output needs; a library that was not found stops the build with its name, rather than shipping a package without the feature.
ninja docs must run before ninja install: with asciidoctor present, the install rule names every manual page in roff and HTML and stops on the first one missing. The HTML pages ship, because the window’s Help > Manual Pages opens them (see Manual pages).
After the install, build.sh removes the Stratoshark release notes, and every section 1 manual page, roff and HTML, whose program is not in the package; upstream installs the pages of programs this build leaves out, such as androiddump and stratoshark.
build.sh writes its own org.wireshark.Wireshark.desktop over upstream’s. It keeps upstream’s Exec, TryExec, Icon and the MimeType list of capture formats, drops upstream’s translated names and comments, writes its own Comment, and adds StartupWMClass and search keywords.