nixos/bgp: add internal exports

This commit is contained in:
Luke Granger-Brown 2024-04-04 22:51:40 +00:00
parent 761465b393
commit ed0d0fa3c8

View file

@ -266,6 +266,29 @@ in {
}; };
}; };
}; };
internal.export = mkOption {
default = { v4 = []; v6 = []; };
type = submodule {
options = {
v4 = mkOption { # lukegbgp.config.internal.export.v4
type = listOf str;
default = [];
};
v4Extra = mkOption { #lukegbgp.config.internal.export.v4Extra
type = lines;
default = "";
};
v6 = mkOption { # lukegbgp.config.internal.export.v6
type = listOf str;
default = [];
};
v6Extra = mkOption { #lukegbgp.config.internal.export.v6Extra
type = lines;
default = "";
};
};
};
};
bfd = mkOption { # lukegbgp.config.bfd bfd = mkOption { # lukegbgp.config.bfd
type = lines; type = lines;
default = ""; default = "";
@ -380,6 +403,16 @@ in {
${lib.concatMapStrings (ip: "route ${ip} blackhole;") config.services.lukegbgp.config.export.v4} ${lib.concatMapStrings (ip: "route ${ip} blackhole;") config.services.lukegbgp.config.export.v4}
${config.services.lukegbgp.config.export.v4Extra} ${config.services.lukegbgp.config.export.v4Extra}
}; };
protocol static exportinternal4 {
ipv4 {
import filter {
bgp_ext_community.add((ro, 205479, 10)); # internal only
accept;
};
};
${lib.concatMapStrings (ip: "route ${ip} blackhole;") config.services.lukegbgp.config.internal.export.v4}
${config.services.lukegbgp.config.internal.export.v4Extra}
};
protocol static export6 { protocol static export6 {
ipv6 { ipv6 {
import filter { import filter {
@ -414,6 +447,16 @@ in {
${lib.concatMapStrings (ip: "route ${ip} blackhole;") config.services.lukegbgp.config.export.v6} ${lib.concatMapStrings (ip: "route ${ip} blackhole;") config.services.lukegbgp.config.export.v6}
${config.services.lukegbgp.config.export.v6Extra} ${config.services.lukegbgp.config.export.v6Extra}
}; };
protocol static exportinternal6 {
ipv6 {
import filter {
bgp_ext_community.add((ro, 205479, 10)); # internal only
accept;
};
};
${lib.concatMapStrings (ip: "route ${ip} blackhole;") config.services.lukegbgp.config.internal.export.v6}
${config.services.lukegbgp.config.internal.export.v6Extra}
};
protocol bfd { protocol bfd {
${config.services.lukegbgp.config.bfd} ${config.services.lukegbgp.config.bfd}