Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wireshark: Add Bluetooth #89461

Merged
merged 1 commit into from Jun 10, 2020
Merged

wireshark: Add Bluetooth #89461

merged 1 commit into from Jun 10, 2020

Conversation

justin-gerhardt
Copy link
Contributor

Motivation for this change

Add support for captuing live data from bluetooth interfaces.
Note: This only works on linux and has been appropriately gated.

It is debatable whether or not libpcap should include bluez support by default on linux.
If it's default enabled then no changes are needed for wireshark (or any other application that want to use it) but iptables must disable it (to avoid a libpcap -> bluez -> dbus -> systemd -> iptables -> libpcap cycle).
If it's default disabled then wireshark needs to enable it but iptables needs no changes.

I've implemented the latter but the change is trivial if prefered.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

Only applies to Linux
@bjornfor bjornfor merged commit 9930b8f into NixOS:master Jun 10, 2020
@Izorkin
Copy link
Contributor

Izorkin commented Aug 30, 2020

How to disable Bluez support for wireshark-cli by default?
The build of the bluez package freezing on my server - #91011

@bjornfor
Copy link
Contributor

@Izorkin: Ideally someone adds a flag to wireshark, but in the meantime you might get away with using .overrideAttrs and pass in your non-bluez pcap first in buildInputs.

@Izorkin
Copy link
Contributor

Izorkin commented Aug 30, 2020

@bjornfor this variant not worked:

{ pkgs, lib, ... }:
{
  nixpkgs.config.packageOverrides = with lib; pkgs: rec {
...
    wireshark-cli = pkgs.wireshark-cli.overrideAttrs (oldAttr: {
      pcap = pkgs.libpcap.override { withBluez = false; };
    });

wireshark-cli building with bluetooth.

@bjornfor
Copy link
Contributor

I was thinking something like

{ pkgs, lib, ... }:
{
  nixpkgs.config.packageOverrides = with lib; pkgs: rec {
...
    wireshark-cli =
      let pcapNoBluetooth = pkgs.libpcap.override { withBluez = false; }; in
      pkgs.wireshark-cli.overrideAttrs (oldAttr: {
        buildInputs = [ pcapNoBluetooth ] ++ oldAttr.buildInputs;  # THIS LINE IS IMPORTANT
      });

(untested)

@Izorkin
Copy link
Contributor

Izorkin commented Aug 31, 2020

This variation works:

diff --git a/pkgs/applications/networking/sniffers/wireshark/default.nix b/pkgs/applications/networking/sniffers/wireshark/default.nix
index 8d4a6d73120..3561c69dd0d 100644
--- a/pkgs/applications/networking/sniffers/wireshark/default.nix
+++ b/pkgs/applications/networking/sniffers/wireshark/default.nix
@@ -12,7 +12,6 @@ with stdenv.lib;
 let
   version = "3.2.5";
   variant = if withQt then "qt" else "cli";
-  pcap = libpcap.override { withBluez = stdenv.isLinux; };

 in stdenv.mkDerivation {
   pname = "wireshark-${variant}";
@@ -39,7 +38,7 @@ in stdenv.mkDerivation {
   ] ++ optional withQt qt5.wrapQtAppsHook;

   buildInputs = [
-    gettext pcre perl pcap lua5 libssh nghttp2 openssl libgcrypt
+    gettext pcre perl libpcap lua5 libssh nghttp2 openssl libgcrypt
     libgpgerror gnutls geoip c-ares python3 glib zlib makeWrapper
   ] ++ optionals withQt  (with qt5; [ qtbase qtmultimedia qtsvg qttools ])
     ++ optionals stdenv.isLinux  [ libcap libnl ]
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 98851c09d43..9455295e9e2 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -20429,12 +20429,16 @@ in

   wireshark = callPackage ../applications/networking/sniffers/wireshark {
     inherit (darwin.apple_sdk.frameworks) ApplicationServices SystemConfiguration;
+    libpcap = libpcap.override { withBluez = stdenv.isLinux; };
   };
   wireshark-qt = wireshark;

   # The GTK UI is deprecated by upstream. You probably want the QT version.
   wireshark-gtk = throw "wireshark-gtk is not supported anymore. Use wireshark-qt or wireshark-cli instead.";
-  wireshark-cli = wireshark.override { withQt = false; };
+  wireshark-cli = wireshark.override {
+    withQt = false;
+    libpcap = libpcap.override { withBluez = false; };
+  };

   sngrep = callPackage ../applications/networking/sniffers/sngrep {};

Create PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants