feature/conn25: call AuthReconfigAsync after address assignment
When the client of a connector assigns transit IP addresses for a connector we need to let wireguard know that packets for the transit IPs should be sent to the connector node. We do this by: * keeping a map of node -> transit IPs we've assigned for it * setting a callback hook within wireguard reconfig to ask us for these extra allowed IPs. * forcing wireguard to do a reconfig after we have assigned new transit IPs. And this commit is the last part: forcing the wireguard reconfig after a new address assignment. Fixes tailscale/corp#38124 Signed-off-by: Fran Bull <fran@tailscale.com>
This commit is contained in:
@@ -603,13 +603,22 @@ func (e *extension) sendLoop(ctx context.Context) {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case as := <-e.conn25.client.addrsCh:
|
||||
if err := e.sendAddressAssignment(ctx, as); err != nil {
|
||||
e.conn25.client.logf("error sending transit IP assignment (app: %s, mip: %v, src: %v): %v", as.app, as.magic, as.dst, err)
|
||||
if err := e.handleAddressAssignment(ctx, as); err != nil {
|
||||
e.conn25.client.logf("error handling transit IP assignment (app: %s, mip: %v, src: %v): %v", as.app, as.magic, as.dst, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (e *extension) handleAddressAssignment(ctx context.Context, as addrs) error {
|
||||
if err := e.sendAddressAssignment(ctx, as); err != nil {
|
||||
return err
|
||||
}
|
||||
// TODO(fran) assign the connector publickey -> transit ip addresses
|
||||
e.host.AuthReconfigAsync()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) enqueueAddressAssignment(addrs addrs) error {
|
||||
select {
|
||||
// TODO(fran) investigate the value of waiting for multiple addresses and sending them
|
||||
|
||||
Reference in New Issue
Block a user