diff --git a/internal/birdfmt/bgp.go b/internal/birdfmt/bgp.go index 42d3b08..3676973 100644 --- a/internal/birdfmt/bgp.go +++ b/internal/birdfmt/bgp.go @@ -43,6 +43,8 @@ func RenderBGPTemplates(opts BGPTemplatesOptions) (string, error) { b.WriteString(" };\n") b.WriteString(" hold time 90;\n") b.WriteString(" keepalive time 30;\n") + // Жёсткая привязка к source address (см. пир): полезно в Docker / bridge, иначе listen может уйти на 0.0.0.0. + b.WriteString(" strict bind on;\n") b.WriteString("}\n\n") fmt.Fprintf(&b, "template bgp %s {\n", BGPTemplateNameV6) fmt.Fprintf(&b, " local as %d;\n", opts.LocalASN) @@ -54,6 +56,7 @@ func RenderBGPTemplates(opts BGPTemplatesOptions) (string, error) { b.WriteString(" };\n") b.WriteString(" hold time 90;\n") b.WriteString(" keepalive time 30;\n") + b.WriteString(" strict bind on;\n") b.WriteString("}\n") return b.String(), nil } diff --git a/internal/birdfmt/testdata/scenarios/standard_layout/bird.d/evobgp_bgp_template.conf b/internal/birdfmt/testdata/scenarios/standard_layout/bird.d/evobgp_bgp_template.conf index 72f51e9..1ecc5fa 100644 --- a/internal/birdfmt/testdata/scenarios/standard_layout/bird.d/evobgp_bgp_template.conf +++ b/internal/birdfmt/testdata/scenarios/standard_layout/bird.d/evobgp_bgp_template.conf @@ -6,6 +6,7 @@ template bgp bgp_template { }; hold time 90; keepalive time 30; + strict bind on; } template bgp bgp_template_v6 { @@ -16,4 +17,5 @@ template bgp bgp_template_v6 { }; hold time 90; keepalive time 30; + strict bind on; }