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

This commit is contained in:
riccardom
2026-07-27 17:09:36 +02:00
parent 8157b6d78f
commit 4e7cbe2ef8
+9 -7
View File
@@ -574,13 +574,6 @@ func (e *Engine) Start(netbirdConfig *mgmProto.NetbirdConfig, mgmtURL *url.URL)
return fmt.Errorf("run rosenpass manager: %w", err) 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() e.stateManager.Start()
initialRoutes, dnsConfig, dnsFeatureFlag, err := e.readInitialSettings() 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) 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 inbound conns are blocked there is no need to create the ACL manager
if e.firewall != nil && !e.config.BlockInbound { if e.firewall != nil && !e.config.BlockInbound {
e.acl = acl.NewDefaultManager(e.firewall) e.acl = acl.NewDefaultManager(e.firewall)
@@ -2911,6 +2912,7 @@ func convertToOfferAnswer(msg *sProto.Message) (*peer.OfferAnswer, error) {
RosenpassPubKey: rosenpassPubKey, RosenpassPubKey: rosenpassPubKey,
RosenpassAddr: rosenpassAddr, RosenpassAddr: rosenpassAddr,
MlkemPayload: msg.GetBody().GetMlkemPayload(), MlkemPayload: msg.GetBody().GetMlkemPayload(),
MlkemPort: int(msg.GetBody().GetMlkemPort()),
RelaySrvAddress: msg.GetBody().GetRelayServerAddress(), RelaySrvAddress: msg.GetBody().GetRelayServerAddress(),
RelaySrvIP: relayIP, RelaySrvIP: relayIP,
SessionID: sessionID, SessionID: sessionID,