refactor: remove strict bind configuration from BGP templates and update related logic. Eliminate 'strict bind on' from both IPv4 and IPv6 templates to simplify BGP peer rendering. Adjust OpenAPI documentation and internal handling of BGP source addresses to reflect these changes, enhancing clarity and compatibility.
CI / changes (push) Successful in 7s
CI / openapi (push) Successful in 23s
CI / go (push) Successful in 24s
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, , evobgp-web) (push) Successful in 1m7s
CI / docker-web (deploy/docker/evobgp-web/Dockerfile, evobgp-all, evobgp-web-all) (push) Successful in 1m2s
CI / docker-bird (push) Has been skipped
CI / bird2 (push) Successful in 55s
CI / docker-go (deploy/docker/evobgp-agent/Dockerfile, , evobgp-agent) (push) Successful in 54s
CI / docker-go (evobgp-all, 1, deploy/docker/gobinary/Dockerfile, , evobgp-all) (push) Successful in 2m19s
CI / docker-go (evobgp-api, 1, deploy/docker/gobinary/Dockerfile, , evobgp-api) (push) Successful in 2m27s
CI / docker-go (evobgp-deploy, 0, deploy/docker/gobinary/Dockerfile, , evobgp-deploy) (push) Successful in 1m22s
CI / docker-go (evobgp-ingest, 0, deploy/docker/gobinary/Dockerfile, , evobgp-ingest) (push) Successful in 1m26s
CI / docker-go (evobgp-node, 0, deploy/docker/gobinary/Dockerfile, , evobgp-node) (push) Successful in 1m9s
CI / docker-go (evobgp-render, 0, deploy/docker/gobinary/Dockerfile, , evobgp-render) (push) Successful in 1m19s
CI / docker-go (evobgp-scheduler, 0, deploy/docker/gobinary/Dockerfile, , evobgp-scheduler) (push) Successful in 1m19s

This commit is contained in:
Denozordec
2026-04-06 14:03:25 +07:00
parent dc5e20e9b2
commit 482eeb122d
8 changed files with 29 additions and 72 deletions
+9 -32
View File
@@ -331,9 +331,6 @@ type birdLocals struct {
localV4 string
localV6 string
localASN uint32
// Optional BGP TCP source (BIRD "source address"); empty => use effective local per peer.
sourceV4 string
sourceV6 string
}
func birdLocalsFromStore(st store.Backend, tenantID string) birdLocals {
@@ -361,30 +358,12 @@ func birdLocalsFromStore(st store.Backend, tenantID string) birdLocals {
loc.localASN = n
}
if s := stringFromSettingsMap(settings, "bird_bgp_source_ipv4"); s != "" {
loc.sourceV4 = s
// BIRD router id must be an IPv4 address; align with BGP source when operator sets it.
// BIRD router id must be an IPv4 address; historically aligned with optional BGP source setting.
loc.routerID = strings.TrimSpace(s)
}
if s := stringFromSettingsMap(settings, "bird_bgp_source_ipv6"); s != "" {
loc.sourceV6 = s
}
return loc
}
func bgpPeerSourceIPv4(loc birdLocals, effectiveLocal string) string {
if s := strings.TrimSpace(loc.sourceV4); s != "" {
return s
}
return effectiveLocal
}
func bgpPeerSourceIPv6(loc birdLocals, effectiveLocal string) string {
if s := strings.TrimSpace(loc.sourceV6); s != "" {
return s
}
return effectiveLocal
}
func stringFromSettingsMap(m map[string]any, key string) string {
v, ok := m[key]
if !ok || v == nil {
@@ -474,11 +453,10 @@ func renderPeersBirdFragment(st store.Backend, tenantID string, loc birdLocals)
ra := uint32(p.RemoteASN)
if addr.Is4() {
opts := birdfmt.BGPPeerFromTemplateOptions{
ProtocolName: proto,
TemplateName: birdfmt.BGPTemplateNameV4,
NeighborIP: addr.String(),
NeighborASN: ra,
SourceAddress: bgpPeerSourceIPv4(loc, lv4),
ProtocolName: proto,
TemplateName: birdfmt.BGPTemplateNameV4,
NeighborIP: addr.String(),
NeighborASN: ra,
}
if peerNeedsLocalOverride(loc, lv4, asn, true) {
opts.OverrideLocalIP = lv4
@@ -493,11 +471,10 @@ func renderPeersBirdFragment(st store.Backend, tenantID string, loc birdLocals)
}
if addr.Is6() {
opts := birdfmt.BGPPeerFromTemplateOptions{
ProtocolName: proto,
TemplateName: birdfmt.BGPTemplateNameV6,
NeighborIP: addr.String(),
NeighborASN: ra,
SourceAddress: bgpPeerSourceIPv6(loc, lv6),
ProtocolName: proto,
TemplateName: birdfmt.BGPTemplateNameV6,
NeighborIP: addr.String(),
NeighborASN: ra,
}
if peerNeedsLocalOverride(loc, lv6, asn, false) {
opts.OverrideLocalIP = lv6