rexxar: set a kt_prefsrc

This commit is contained in:
Luke Granger-Brown 2024-03-28 00:45:06 +00:00
parent 55597a6eb7
commit fae628f0b2
2 changed files with 12 additions and 2 deletions

View file

@ -15,7 +15,6 @@ let
if ! (avoid_martians4()) then reject; if ! (avoid_martians4()) then reject;
${if ix.remote.must_be_next_hop then "if (bgp_path.first != ${toString ix.remote.asn}) then reject;" else "# no next-hop requirement"} ${if ix.remote.must_be_next_hop then "if (bgp_path.first != ${toString ix.remote.asn}) then reject;" else "# no next-hop requirement"}
${lib.concatMapStringsSep "\n" (asn: "if (bgp_path ~ [= * ${toString asn} * =]) then reject;") ix.remote.drop_asns} ${lib.concatMapStringsSep "\n" (asn: "if (bgp_path ~ [= * ${toString asn} * =]) then reject;") ix.remote.drop_asns}
if (bgp_path ~ [= * 16276 * =] && gw = 195.66.225.6) then gw = 195.66.224.220; # OVH must go via router 1; router 2 is bork.
${lib.optionalString (ixName == "quadv") '' ${lib.optionalString (ixName == "quadv") ''
bgp_ext_community.add((ro, 205479, 1000)); bgp_ext_community.add((ro, 205479, 1000));
bgp_ext_community.add((ro, 205479, 4000)); # etheroute bgp_ext_community.add((ro, 205479, 4000)); # etheroute
@ -26,6 +25,7 @@ let
bgp_community.add((64600, 3356)); # no Lumen bgp_community.add((64600, 3356)); # no Lumen
bgp_community.add((64600, 5459)); # no LINX peers (inc. RS) bgp_community.add((64600, 5459)); # no LINX peers (inc. RS)
''} ''}
${if ix.remote.pref_src.v4 != null then "krt_prefsrc = ${ix.remote.pref_src.v4};" else "# no krt_prefsrc"}
bgp_local_pref = ${toString ix.remote.bgp_local_pref}; bgp_local_pref = ${toString ix.remote.bgp_local_pref};
accept; accept;
} }
@ -52,7 +52,7 @@ let
if ! (avoid_martians6()) then reject; if ! (avoid_martians6()) then reject;
${if ix.remote.must_be_next_hop then "if (bgp_path.first != ${toString ix.remote.asn}) then reject;" else "# no next-hop requirement"} ${if ix.remote.must_be_next_hop then "if (bgp_path.first != ${toString ix.remote.asn}) then reject;" else "# no next-hop requirement"}
${lib.concatMapStringsSep "\n" (asn: "if (bgp_path ~ [= * ${toString asn} * =]) then reject;") ix.remote.drop_asns} ${lib.concatMapStringsSep "\n" (asn: "if (bgp_path ~ [= * ${toString asn} * =]) then reject;") ix.remote.drop_asns}
if (bgp_path ~ [= * 16276 * =] && gw = 2001:7f8:4::3f94:2) then gw = 2001:7f8:4::3f94:1; # OVH must go via router 1; router 2 is bork. ${if ix.remote.pref_src.v6 != null then "krt_prefsrc = ${ix.remote.pref_src.v6};" else "# no krt_prefsrc"}
bgp_local_pref = ${toString ix.remote.bgp_local_pref}; bgp_local_pref = ${toString ix.remote.bgp_local_pref};
accept; accept;
} }
@ -189,6 +189,14 @@ in {
type = nullOr int; type = nullOr int;
default = null; default = null;
}; };
pref_src.v4 = mkOption { # lukegbgp.config.peering.<foo>.pref_src.v4
type = nullOr str;
default = null;
};
pref_src.v6 = mkOption { # lukegbgp.config.peering.<foo>.pref_src.v6
type = nullOr str;
default = null;
};
must_be_next_hop = mkOption { # lukegbgp.config.peering.<foo>.remote.must_be_next_hop must_be_next_hop = mkOption { # lukegbgp.config.peering.<foo>.remote.must_be_next_hop
type = bool; type = bool;
default = true; default = true;

View file

@ -34,6 +34,8 @@
link.linx = base ++ [{ link.linx = base ++ [{
local.v4 = "195.66.224.58"; local.v4 = "195.66.224.58";
local.v6 = "2001:7f8:4::3:22a7:1"; local.v6 = "2001:7f8:4::3:22a7:1";
remote.pref_src.v4 = "195.74.55.21";
remote.pref_src.v6 = "2a03:ee40:8080:9:1::2";
}]; }];
peer.velox.remote = { peer.velox.remote = {
asn = 3170; asn = 3170;