Skip to content

Commit 4efe496

Browse files
committed
lxd: start BGP listener after networks are set up
Signed-off-by: Nikita Mezhenskyi <[email protected]>
1 parent da33f72 commit 4efe496

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

lxd/daemon.go

+13-12
Original file line numberDiff line numberDiff line change
@@ -1708,18 +1708,6 @@ func (d *Daemon) init() error {
17081708

17091709
// Setup BGP listener.
17101710
d.bgp = bgp.NewServer()
1711-
if bgpAddress != "" && bgpASN != 0 && bgpRouterID != "" {
1712-
if bgpASN > math.MaxUint32 {
1713-
return fmt.Errorf("Cannot convert BGP ASN to uint32: Upper bound exceeded")
1714-
}
1715-
1716-
err := d.bgp.Start(bgpAddress, uint32(bgpASN), net.ParseIP(bgpRouterID))
1717-
if err != nil {
1718-
return err
1719-
}
1720-
1721-
logger.Info("Started BGP server")
1722-
}
17231711

17241712
// Setup DNS listener.
17251713
d.dns = dns.NewServer(d.db.Cluster, func(name string, full bool) (*dns.Zone, error) {
@@ -1769,6 +1757,19 @@ func (d *Daemon) init() error {
17691757
}
17701758

17711759
// Setup tertiary listeners that may use managed network addresses and must be started after networks.
1760+
if bgpAddress != "" && bgpASN != 0 && bgpRouterID != "" {
1761+
if bgpASN > math.MaxUint32 {
1762+
return fmt.Errorf("Cannot convert BGP ASN to uint32: Upper bound exceeded")
1763+
}
1764+
1765+
err := d.bgp.Start(bgpAddress, uint32(bgpASN), net.ParseIP(bgpRouterID))
1766+
if err != nil {
1767+
return err
1768+
}
1769+
1770+
logger.Info("Started BGP server")
1771+
}
1772+
17721773
dnsAddress := d.localConfig.DNSAddress()
17731774
if dnsAddress != "" {
17741775
err = d.dns.Start(dnsAddress)

0 commit comments

Comments
 (0)