Ensure iface is up and with overlay ip assigned to get a valid UDP port

This commit is contained in:
riccardom
2026-07-24 18:28:43 +02:00
parent 8157b6d78f
commit 4e7cbe2ef8

View File

@@ -574,13 +574,6 @@ func (e *Engine) Start(netbirdConfig *mgmProto.NetbirdConfig, mgmtURL *url.URL)
return fmt.Errorf("run rosenpass manager: %w", err)
}
}
if pqkem.Enabled() {
log.Infof("ML-KEM post-quantum exchange enabled")
// TODO(NET-1406): replace noopPQTransport with the real dedicated UDP transport
// bound on the WG overlay IPv4.
e.pqkemManager = pqkem.NewManager(publicKey.String(), noopPQTransport{}, pqCallbackHandler{wg: e.wgInterface}, nil)
}
e.stateManager.Start()
initialRoutes, dnsConfig, dnsFeatureFlag, err := e.readInitialSettings()
@@ -662,6 +655,14 @@ func (e *Engine) Start(netbirdConfig *mgmProto.NetbirdConfig, mgmtURL *url.URL)
e.rpManager.SetInterface(e.wgInterface)
}
// Start the ML-KEM PQ manager after the interface is up so its (dedicated UDP)
// transport can bind on the WG overlay IP. TODO(NET-1406): replace noopPQTransport
// with the real transport bound on e.config.WgAddr.IP.
if pqkem.Enabled() {
log.Infof("ML-KEM post-quantum exchange enabled")
e.pqkemManager = pqkem.NewManager(publicKey.String(), noopPQTransport{}, pqCallbackHandler{wg: e.wgInterface}, nil)
}
// if inbound conns are blocked there is no need to create the ACL manager
if e.firewall != nil && !e.config.BlockInbound {
e.acl = acl.NewDefaultManager(e.firewall)
@@ -2911,6 +2912,7 @@ func convertToOfferAnswer(msg *sProto.Message) (*peer.OfferAnswer, error) {
RosenpassPubKey: rosenpassPubKey,
RosenpassAddr: rosenpassAddr,
MlkemPayload: msg.GetBody().GetMlkemPayload(),
MlkemPort: int(msg.GetBody().GetMlkemPort()),
RelaySrvAddress: msg.GetBody().GetRelayServerAddress(),
RelaySrvIP: relayIP,
SessionID: sessionID,