nixpkgs/pkgs/tools/networking/gvpe/default.nix
Rémy Grünblatt c9e3cc43c7
nixos: fix iproute2 invocations (#263976)
When using iproute2's ip binary, you can omit the dev parameter, e.g. ip link set up eth0 instead of ip link set up dev eth0.

This breaks if for some reason your device is named e.g. he, hel, … because it is interpreted as ip link set up help.

I just encountered this bug using networking.bridges trying to create an interface named he.

I used a grep on nixpkgs to try to find iproute2 invocations using variables without the dev keyword, and found a few, and fixed them by providing the dev keyword.

I merely fixed what I found, but the use of abbreviated commands makes it a bit hard to be sure everything has been found (e.g. ip l set … up instead of ip link set … up).
2023-10-29 18:27:16 +01:00

34 lines
959 B
Nix

{ lib, stdenv, fetchurl, openssl, gmp, zlib, iproute2, nettools, pkg-config }:
stdenv.mkDerivation rec {
pname = "gvpe";
version = "3.1";
src = fetchurl {
url = "https://ftp.gnu.org/gnu/gvpe/gvpe-${version}.tar.gz";
sha256 = "sha256-8evVctclu5QOCAdxocEIZ8NQnc2DFvYRSBRQPcux6LM=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl gmp zlib ];
configureFlags = [
"--enable-tcp"
"--enable-http-proxy"
"--enable-dns"
];
postPatch = ''
sed -e 's@"/sbin/ifconfig.*"@"${iproute2}/sbin/ip link set dev $IFNAME address $MAC mtu $MTU"@' -i src/device-linux.C
sed -e 's@/sbin/ifconfig@${nettools}/sbin/ifconfig@g' -i src/device-*.C
'';
meta = with lib; {
description = "A protected multinode virtual network";
homepage = "http://software.schmorp.de/pkg/gvpe.html";
maintainers = [ maintainers.raskin ];
platforms = with platforms; linux ++ freebsd;
license = licenses.gpl2;
};
}