nixpkgs/pkgs/os-specific/linux/iptables/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

69 lines
2.2 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl
, autoreconfHook, pkg-config, pruneLibtoolFiles, flex, bison
, libmnl, libnetfilter_conntrack, libnfnetlink, libnftnl, libpcap
, nftablesCompat ? true
2022-05-15 08:51:48 +00:00
, fetchpatch
}:
stdenv.mkDerivation rec {
2023-04-01 10:17:23 +00:00
version = "1.8.9";
pname = "iptables";
src = fetchurl {
2023-04-01 10:17:23 +00:00
url = "https://www.netfilter.org/projects/${pname}/files/${pname}-${version}.tar.xz";
sha256 = "72Y5pDvoMlpPjqaBI/+sI2y2lujHhQG2ToEGr7AIyH8=";
};
2022-05-15 08:51:48 +00:00
patches = [
(fetchpatch {
2023-04-01 10:17:23 +00:00
name = "format-security.patch";
url = "https://git.netfilter.org/iptables/patch/?id=ed4082a7405a5838c205a34c1559e289949200cc";
sha256 = "OdytFmHk+3Awu+sDQpGTl5/qip4doRblmW2vQzfNZiU=";
})
(fetchurl {
name = "static.patch";
url = "https://lore.kernel.org/netfilter-devel/20230402232939.1060151-1-hi@alyssa.is/raw";
sha256 = "PkH+1HbJjBb3//ffBe0XUQok1lBwgj/STL8Ppu/28f4=";
})
2022-05-15 08:51:48 +00:00
];
outputs = [ "out" "dev" "man" ];
nativeBuildInputs = [
autoreconfHook pkg-config pruneLibtoolFiles flex bison
];
2016-01-01 01:54:56 +00:00
buildInputs = [ libmnl libnetfilter_conntrack libnfnetlink libnftnl libpcap ];
2016-01-01 01:54:56 +00:00
preConfigure = ''
export NIX_LDFLAGS="$NIX_LDFLAGS -lmnl -lnftnl"
'';
configureFlags = [
"--enable-bpf-compiler"
"--enable-devel"
"--enable-libipq"
"--enable-nfsynproxy"
"--enable-shared"
2022-05-15 08:51:48 +00:00
] ++ lib.optional (!nftablesCompat) "--disable-nftables";
2017-01-22 01:20:00 +00:00
2022-05-15 08:51:48 +00:00
postInstall = lib.optionalString nftablesCompat ''
rm $out/sbin/{iptables,iptables-restore,iptables-save,ip6tables,ip6tables-restore,ip6tables-save}
ln -sv xtables-nft-multi $out/bin/iptables
ln -sv xtables-nft-multi $out/bin/iptables-restore
ln -sv xtables-nft-multi $out/bin/iptables-save
ln -sv xtables-nft-multi $out/bin/ip6tables
ln -sv xtables-nft-multi $out/bin/ip6tables-restore
ln -sv xtables-nft-multi $out/bin/ip6tables-save
'';
2022-05-15 08:51:48 +00:00
meta = with lib; {
description = "A program to configure the Linux IP packet filtering ruleset";
homepage = "https://www.netfilter.org/projects/iptables/index.html";
2017-01-22 01:20:00 +00:00
platforms = platforms.linux;
maintainers = with maintainers; [ fpletz ];
2018-08-29 22:34:22 +00:00
license = licenses.gpl2;
downloadPage = "https://www.netfilter.org/projects/iptables/files/";
};
}