Skip to content

Commit 0bf8c0d

Browse files
authored
frr: add optional grpc support via grpcSupport parameter (#373865)
2 parents e08fbb1 + fb5b018 commit 0bf8c0d

File tree

1 file changed

+202
-161
lines changed

1 file changed

+202
-161
lines changed

pkgs/by-name/fr/frr/package.nix

Lines changed: 202 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,83 @@
1-
{ lib
2-
, stdenv
3-
, fetchFromGitHub
4-
5-
# build time
6-
, autoreconfHook
7-
, flex
8-
, bison
9-
, perl
10-
, pkg-config
11-
, texinfo
12-
, buildPackages
13-
14-
# runtime
15-
, c-ares
16-
, json_c
17-
, libcap
18-
, elfutils
19-
, libunwind
20-
, libyang
21-
, net-snmp
22-
, openssl
23-
, pam
24-
, pcre2
25-
, python3
26-
, readline
27-
, rtrlib
28-
, protobufc
29-
, zeromq
30-
31-
# tests
32-
, nettools
33-
, nixosTests
34-
35-
36-
# general options
37-
, snmpSupport ? true
38-
, rpkiSupport ? true
39-
, numMultipath ? 64
40-
, watchfrrSupport ? true
41-
, cumulusSupport ? false
42-
, rtadvSupport ? true
43-
, irdpSupport ? true
44-
, routeReplacementSupport ? true
45-
, mgmtdSupport ? true
46-
47-
# routing daemon options
48-
, bgpdSupport ? true
49-
, ripdSupport ? true
50-
, ripngdSupport ? true
51-
, ospfdSupport ? true
52-
, ospf6dSupport ? true
53-
, ldpdSupport ? true
54-
, nhrpdSupport ? true
55-
, eigrpdSupport ? true
56-
, babeldSupport ? true
57-
, isisdSupport ? true
58-
, pimdSupport ? true
59-
, pim6dSupport ? true
60-
, sharpdSupport ? true
61-
, fabricdSupport ? true
62-
, vrrpdSupport ? true
63-
, pathdSupport ? true
64-
, bfddSupport ? true
65-
, pbrdSupport ? true
66-
, staticdSupport ? true
67-
68-
# BGP options
69-
, bgpAnnounce ? true
70-
, bgpBmp ? true
71-
, bgpVnc ? true
72-
73-
# OSPF options
74-
, ospfApi ? true
1+
{
2+
lib,
3+
stdenv,
4+
fetchFromGitHub,
5+
fetchpatch,
6+
7+
# build time
8+
autoreconfHook,
9+
flex,
10+
bison,
11+
perl,
12+
pkg-config,
13+
texinfo,
14+
buildPackages,
15+
grpc,
16+
protobuf,
17+
which,
18+
19+
# runtime
20+
c-ares,
21+
json_c,
22+
libcap,
23+
elfutils,
24+
libunwind,
25+
libyang,
26+
net-snmp,
27+
openssl,
28+
pam,
29+
pcre2,
30+
python3,
31+
readline,
32+
rtrlib,
33+
protobufc,
34+
zeromq,
35+
36+
# tests
37+
nettools,
38+
nixosTests,
39+
40+
# general options
41+
snmpSupport ? true,
42+
rpkiSupport ? true,
43+
numMultipath ? 64,
44+
watchfrrSupport ? true,
45+
cumulusSupport ? false,
46+
rtadvSupport ? true,
47+
irdpSupport ? true,
48+
routeReplacementSupport ? true,
49+
mgmtdSupport ? true,
50+
# Experimental as of 10.1, reconsider if upstream changes defaults
51+
grpcSupport ? false,
52+
53+
# routing daemon options
54+
bgpdSupport ? true,
55+
ripdSupport ? true,
56+
ripngdSupport ? true,
57+
ospfdSupport ? true,
58+
ospf6dSupport ? true,
59+
ldpdSupport ? true,
60+
nhrpdSupport ? true,
61+
eigrpdSupport ? true,
62+
babeldSupport ? true,
63+
isisdSupport ? true,
64+
pimdSupport ? true,
65+
pim6dSupport ? true,
66+
sharpdSupport ? true,
67+
fabricdSupport ? true,
68+
vrrpdSupport ? true,
69+
pathdSupport ? true,
70+
bfddSupport ? true,
71+
pbrdSupport ? true,
72+
staticdSupport ? true,
73+
74+
# BGP options
75+
bgpAnnounce ? true,
76+
bgpBmp ? true,
77+
bgpVnc ? true,
78+
79+
# OSPF options
80+
ospfApi ? true,
7581
}:
7682

7783
stdenv.mkDerivation (finalAttrs: {
@@ -85,37 +91,60 @@ stdenv.mkDerivation (finalAttrs: {
8591
hash = "sha256-TWqW6kI5dDl6IW2Ql6eeySDSyxp0fPgcJOOX1JxjAxs=";
8692
};
8793

88-
nativeBuildInputs = [
89-
autoreconfHook
90-
bison
91-
flex
92-
perl
93-
pkg-config
94-
python3.pkgs.sphinx
95-
texinfo
96-
protobufc
94+
patches = [
95+
(fetchpatch {
96+
name = "CVE-2024-44070.patch";
97+
url = "https://github.com/FRRouting/frr/commit/fea4ed5043b4a523921f970a39a565d2c1ca381f.patch";
98+
hash = "sha256-X9FjQeOvo92+mL1z3u5W0LBhhePDAyhFAqh8sAtNNm8=";
99+
})
97100
];
98101

99-
buildInputs = [
100-
c-ares
101-
json_c
102-
libunwind
103-
libyang
104-
openssl
105-
pam
106-
pcre2
107-
protobufc
108-
python3
109-
readline
110-
rtrlib
111-
zeromq
112-
] ++ lib.optionals stdenv.hostPlatform.isLinux [
113-
libcap
114-
] ++ lib.optionals snmpSupport [
115-
net-snmp
116-
] ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform elfutils) [
117-
elfutils
118-
];
102+
# Without the std explicitly set, we may run into abseil-cpp
103+
# compilation errors.
104+
CXXFLAGS = "-std=gnu++23";
105+
106+
nativeBuildInputs =
107+
[
108+
autoreconfHook
109+
bison
110+
flex
111+
perl
112+
pkg-config
113+
protobufc
114+
python3.pkgs.sphinx
115+
texinfo
116+
]
117+
++ lib.optionals grpcSupport [
118+
which
119+
];
120+
121+
buildInputs =
122+
[
123+
c-ares
124+
json_c
125+
libunwind
126+
libyang
127+
openssl
128+
pam
129+
pcre2
130+
python3
131+
readline
132+
rtrlib
133+
zeromq
134+
]
135+
++ lib.optionals stdenv.hostPlatform.isLinux [
136+
libcap
137+
]
138+
++ lib.optionals snmpSupport [
139+
net-snmp
140+
]
141+
++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform elfutils) [
142+
elfutils
143+
]
144+
++ lib.optionals grpcSupport [
145+
grpc
146+
protobuf
147+
];
119148

120149
# otherwise in cross-compilation: "configure: error: no working python version found"
121150
depsBuildBuild = [
@@ -124,62 +153,68 @@ stdenv.mkDerivation (finalAttrs: {
124153

125154
# cross-compiling: clippy is compiled with the build host toolchain, split it out to ease
126155
# navigation in dependency hell
127-
clippy-helper = buildPackages.callPackage ./clippy-helper.nix { frrVersion = finalAttrs.version; frrSource = finalAttrs.src; };
128-
129-
configureFlags = [
130-
"--disable-silent-rules"
131-
"--disable-exampledir"
132-
"--enable-configfile-mask=0640"
133-
"--enable-group=frr"
134-
"--enable-logfile-mask=0640"
135-
"--enable-multipath=${toString numMultipath}"
136-
"--enable-user=frr"
137-
"--enable-vty-group=frrvty"
138-
"--localstatedir=/run/frr"
139-
"--sbindir=${placeholder "out"}/libexec/frr"
140-
"--sysconfdir=/etc/frr"
141-
"--with-clippy=${finalAttrs.clippy-helper}/bin/clippy"
142-
# general options
143-
(lib.strings.enableFeature snmpSupport "snmp")
144-
(lib.strings.enableFeature rpkiSupport "rpki")
145-
(lib.strings.enableFeature watchfrrSupport "watchfrr")
146-
(lib.strings.enableFeature rtadvSupport "rtadv")
147-
(lib.strings.enableFeature irdpSupport "irdp")
148-
(lib.strings.enableFeature routeReplacementSupport "rr-semantics")
149-
(lib.strings.enableFeature mgmtdSupport "mgmtd")
150-
151-
# routing protocols
152-
(lib.strings.enableFeature bgpdSupport "bgpd")
153-
(lib.strings.enableFeature ripdSupport "ripd")
154-
(lib.strings.enableFeature ripngdSupport "ripngd")
155-
(lib.strings.enableFeature ospfdSupport "ospfd")
156-
(lib.strings.enableFeature ospf6dSupport "ospf6d")
157-
(lib.strings.enableFeature ldpdSupport "ldpd")
158-
(lib.strings.enableFeature nhrpdSupport "nhrpd")
159-
(lib.strings.enableFeature eigrpdSupport "eigrpd")
160-
(lib.strings.enableFeature babeldSupport "babeld")
161-
(lib.strings.enableFeature isisdSupport "isisd")
162-
(lib.strings.enableFeature pimdSupport "pimd")
163-
(lib.strings.enableFeature pim6dSupport "pim6d")
164-
(lib.strings.enableFeature sharpdSupport "sharpd")
165-
(lib.strings.enableFeature fabricdSupport "fabricd")
166-
(lib.strings.enableFeature vrrpdSupport "vrrpd")
167-
(lib.strings.enableFeature pathdSupport "pathd")
168-
(lib.strings.enableFeature bfddSupport "bfdd")
169-
(lib.strings.enableFeature pbrdSupport "pbrd")
170-
(lib.strings.enableFeature staticdSupport "staticd")
171-
# BGP options
172-
(lib.strings.enableFeature bgpAnnounce "bgp-announce")
173-
(lib.strings.enableFeature bgpBmp "bgp-bmp")
174-
(lib.strings.enableFeature bgpVnc "bgp-vnc")
175-
# OSPF options
176-
(lib.strings.enableFeature ospfApi "ospfapi")
177-
# Cumulus options
178-
(lib.strings.enableFeature cumulusSupport "cumulus")
179-
] ++ lib.optionals snmpSupport [
180-
# Used during build for paths, `dev` has build shebangs so can be run during build.
181-
"NETSNMP_CONFIG=${lib.getDev net-snmp}/bin/net-snmp-config"
182-
];
156+
clippy-helper = buildPackages.callPackage ./clippy-helper.nix {
157+
frrVersion = finalAttrs.version;
158+
frrSource = finalAttrs.src;
159+
};
160+
161+
configureFlags =
162+
[
163+
"--disable-silent-rules"
164+
"--disable-exampledir"
165+
"--enable-configfile-mask=0640"
166+
"--enable-group=frr"
167+
"--enable-logfile-mask=0640"
168+
"--enable-multipath=${toString numMultipath}"
169+
"--enable-user=frr"
170+
"--enable-vty-group=frrvty"
171+
"--localstatedir=/run/frr"
172+
"--sbindir=${placeholder "out"}/libexec/frr"
173+
"--sysconfdir=/etc/frr"
174+
"--with-clippy=${finalAttrs.clippy-helper}/bin/clippy"
175+
# general options
176+
(lib.strings.enableFeature snmpSupport "snmp")
177+
(lib.strings.enableFeature rpkiSupport "rpki")
178+
(lib.strings.enableFeature watchfrrSupport "watchfrr")
179+
(lib.strings.enableFeature rtadvSupport "rtadv")
180+
(lib.strings.enableFeature irdpSupport "irdp")
181+
(lib.strings.enableFeature routeReplacementSupport "rr-semantics")
182+
(lib.strings.enableFeature mgmtdSupport "mgmtd")
183+
(lib.strings.enableFeature grpcSupport "grpc")
184+
185+
# routing protocols
186+
(lib.strings.enableFeature bgpdSupport "bgpd")
187+
(lib.strings.enableFeature ripdSupport "ripd")
188+
(lib.strings.enableFeature ripngdSupport "ripngd")
189+
(lib.strings.enableFeature ospfdSupport "ospfd")
190+
(lib.strings.enableFeature ospf6dSupport "ospf6d")
191+
(lib.strings.enableFeature ldpdSupport "ldpd")
192+
(lib.strings.enableFeature nhrpdSupport "nhrpd")
193+
(lib.strings.enableFeature eigrpdSupport "eigrpd")
194+
(lib.strings.enableFeature babeldSupport "babeld")
195+
(lib.strings.enableFeature isisdSupport "isisd")
196+
(lib.strings.enableFeature pimdSupport "pimd")
197+
(lib.strings.enableFeature pim6dSupport "pim6d")
198+
(lib.strings.enableFeature sharpdSupport "sharpd")
199+
(lib.strings.enableFeature fabricdSupport "fabricd")
200+
(lib.strings.enableFeature vrrpdSupport "vrrpd")
201+
(lib.strings.enableFeature pathdSupport "pathd")
202+
(lib.strings.enableFeature bfddSupport "bfdd")
203+
(lib.strings.enableFeature pbrdSupport "pbrd")
204+
(lib.strings.enableFeature staticdSupport "staticd")
205+
# BGP options
206+
(lib.strings.enableFeature bgpAnnounce "bgp-announce")
207+
(lib.strings.enableFeature bgpBmp "bgp-bmp")
208+
(lib.strings.enableFeature bgpVnc "bgp-vnc")
209+
# OSPF options
210+
(lib.strings.enableFeature ospfApi "ospfapi")
211+
# Cumulus options
212+
(lib.strings.enableFeature cumulusSupport "cumulus")
213+
]
214+
++ lib.optionals snmpSupport [
215+
# Used during build for paths, `dev` has build shebangs so can be run during build.
216+
"NETSNMP_CONFIG=${lib.getDev net-snmp}/bin/net-snmp-config"
217+
];
183218

184219
postPatch = ''
185220
substituteInPlace tools/frr-reload \
@@ -221,8 +256,14 @@ stdenv.mkDerivation (finalAttrs: {
221256
infrastructure, web 2.0 businesses, hyperscale services, and Fortune 500
222257
private clouds.
223258
'';
224-
license = with licenses; [ gpl2Plus lgpl21Plus ];
225-
maintainers = with maintainers; [ woffs thillux ];
259+
license = with licenses; [
260+
gpl2Plus
261+
lgpl21Plus
262+
];
263+
maintainers = with maintainers; [
264+
woffs
265+
thillux
266+
];
226267
# adapt to platforms stated in http://docs.frrouting.org/en/latest/overview.html#supported-platforms
227268
platforms = (platforms.linux ++ platforms.freebsd ++ platforms.netbsd ++ platforms.openbsd);
228269
};

0 commit comments

Comments
 (0)