36 # FRR's configure.ac gets SNMP options by executing net-snmp-config on the build host
37 # This leads to compilation errors when cross compiling.
38 # E.g. net-snmp-config for x86_64 does not return the ARM64 paths.
40 # SNMP_LIBS="`${NETSNMP_CONFIG} --agent-libs`"
41 # SNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags`"
42 , snmpSupport ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
44 # other general options besides snmp support
47 , watchfrrSupport ? true
48 , cumulusSupport ? false
51 , routeReplacementSupport ? true
54 # routing daemon options
57 , ripngdSupport ? true
59 , ospf6dSupport ? true
62 , eigrpdSupport ? true
63 , babeldSupport ? true
67 , sharpdSupport ? true
68 , fabricdSupport ? true
73 , staticdSupport ? true
84 lib.warnIf (!(stdenv.buildPlatform.canExecute stdenv.hostPlatform))
85 "cannot enable SNMP support due to cross-compilation issues with net-snmp-config"
87 stdenv.mkDerivation (finalAttrs: {
91 src = fetchFromGitHub {
93 repo = finalAttrs.pname;
94 rev = "${finalAttrs.pname}-${finalAttrs.version}";
95 hash = "sha256-pmFdxL8QpyXvpX2YiSOZ+KIoNaj1OOH6/qnVAWZLE9s=";
100 name = "CVE-2024-44070.patch";
101 url = "https://github.com/FRRouting/frr/commit/fea4ed5043b4a523921f970a39a565d2c1ca381f.patch";
102 hash = "sha256-X9FjQeOvo92+mL1z3u5W0LBhhePDAyhFAqh8sAtNNm8=";
106 nativeBuildInputs = [
130 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
132 ] ++ lib.optionals snmpSupport [
134 ] ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform elfutils) [
138 # otherwise in cross-compilation: "configure: error: no working python version found"
140 buildPackages.python3
143 # cross-compiling: clippy is compiled with the build host toolchain, split it out to ease
144 # navigation in dependency hell
145 clippy-helper = buildPackages.callPackage ./clippy-helper.nix { frrVersion = finalAttrs.version; frrSource = finalAttrs.src; };
148 "--disable-silent-rules"
149 "--disable-exampledir"
150 "--enable-configfile-mask=0640"
152 "--enable-logfile-mask=0640"
153 "--enable-multipath=${toString numMultipath}"
155 "--enable-vty-group=frrvty"
156 "--localstatedir=/run/frr"
157 "--sbindir=${placeholder "out"}/libexec/frr"
158 "--sysconfdir=/etc/frr"
159 "--with-clippy=${finalAttrs.clippy-helper}/bin/clippy"
161 (lib.strings.enableFeature snmpSupport "snmp")
162 (lib.strings.enableFeature rpkiSupport "rpki")
163 (lib.strings.enableFeature watchfrrSupport "watchfrr")
164 (lib.strings.enableFeature rtadvSupport "rtadv")
165 (lib.strings.enableFeature irdpSupport "irdp")
166 (lib.strings.enableFeature routeReplacementSupport "rr-semantics")
167 (lib.strings.enableFeature mgmtdSupport "mgmtd")
170 (lib.strings.enableFeature bgpdSupport "bgpd")
171 (lib.strings.enableFeature ripdSupport "ripd")
172 (lib.strings.enableFeature ripngdSupport "ripngd")
173 (lib.strings.enableFeature ospfdSupport "ospfd")
174 (lib.strings.enableFeature ospf6dSupport "ospf6d")
175 (lib.strings.enableFeature ldpdSupport "ldpd")
176 (lib.strings.enableFeature nhrpdSupport "nhrpd")
177 (lib.strings.enableFeature eigrpdSupport "eigrpd")
178 (lib.strings.enableFeature babeldSupport "babeld")
179 (lib.strings.enableFeature isisdSupport "isisd")
180 (lib.strings.enableFeature pimdSupport "pimd")
181 (lib.strings.enableFeature pim6dSupport "pim6d")
182 (lib.strings.enableFeature sharpdSupport "sharpd")
183 (lib.strings.enableFeature fabricdSupport "fabricd")
184 (lib.strings.enableFeature vrrpdSupport "vrrpd")
185 (lib.strings.enableFeature pathdSupport "pathd")
186 (lib.strings.enableFeature bfddSupport "bfdd")
187 (lib.strings.enableFeature pbrdSupport "pbrd")
188 (lib.strings.enableFeature staticdSupport "staticd")
190 (lib.strings.enableFeature bgpAnnounce "bgp-announce")
191 (lib.strings.enableFeature bgpBmp "bgp-bmp")
192 (lib.strings.enableFeature bgpVnc "bgp-vnc")
194 (lib.strings.enableFeature ospfApi "ospfapi")
196 (lib.strings.enableFeature cumulusSupport "cumulus")
200 substituteInPlace tools/frr-reload \
201 --replace-quiet /usr/lib/frr/ $out/libexec/frr/
202 sed -i '/^PATH=/ d' tools/frr.in tools/frrcommon.sh.in
207 nativeCheckInputs = [
212 enableParallelBuilding = true;
215 homepage = "https://frrouting.org/";
216 description = "FRR BGP/OSPF/ISIS/RIP/RIPNG routing daemon suite";
218 FRRouting (FRR) is a free and open source Internet routing protocol suite
219 for Linux and Unix platforms. It implements BGP, OSPF, RIP, IS-IS, PIM,
220 LDP, BFD, Babel, PBR, OpenFabric and VRRP, with alpha support for EIGRP
223 FRR’s seamless integration with native Linux/Unix IP networking stacks
224 makes it a general purpose routing stack applicable to a wide variety of
225 use cases including connecting hosts/VMs/containers to the network,
226 advertising network services, LAN switching and routing, Internet access
227 routers, and Internet peering.
229 FRR has its roots in the Quagga project. In fact, it was started by many
230 long-time Quagga developers who combined their efforts to improve on
231 Quagga’s well-established foundation in order to create the best routing
232 protocol stack available. We invite you to participate in the FRRouting
233 community and help shape the future of networking.
235 Join the ranks of network architects using FRR for ISPs, SaaS
236 infrastructure, web 2.0 businesses, hyperscale services, and Fortune 500
239 license = with licenses; [ gpl2Plus lgpl21Plus ];
240 maintainers = with maintainers; [ woffs thillux ];
241 # adapt to platforms stated in http://docs.frrouting.org/en/latest/overview.html#supported-platforms
242 platforms = (platforms.linux ++ platforms.freebsd ++ platforms.netbsd ++ platforms.openbsd);
245 passthru.tests = { inherit (nixosTests) frr; };