Skip to content

Commit be67ec6

Browse files
dilyevskyclaude
andcommitted
[tunnel] advertise overlay network prefix to tunnel clients
Always include the /72 network prefix in routes advertised to tunnel agents so they can reach other endpoints in the same overlay network (e.g. backplane services) without requiring egressGateway.enabled=true. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5124f0f commit be67ec6

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

pkg/tunnel/relay.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/apoxy-dev/apoxy/pkg/tunnel/api"
2727
"github.com/apoxy-dev/apoxy/pkg/tunnel/controllers"
2828
"github.com/apoxy-dev/apoxy/pkg/tunnel/hasher"
29+
tunnet "github.com/apoxy-dev/apoxy/pkg/tunnel/net"
2930
"github.com/apoxy-dev/apoxy/pkg/tunnel/router"
3031
)
3132

@@ -299,6 +300,13 @@ func (r *Relay) handleConnect(w http.ResponseWriter, req *http.Request, ps httpr
299300
pfx = netip.PrefixFrom(pfx.Addr(), 128)
300301
}
301302
routes = append(routes, api.Route{Destination: pfx.String()})
303+
// Always include the network prefix so the agent can reach other endpoints
304+
// in the same overlay network (e.g. backplane services).
305+
if pfx.Addr().Is6() {
306+
if ula, err := tunnet.ULAFromPrefix(req.Context(), pfx); err == nil {
307+
routes = append(routes, api.Route{Destination: ula.NetPrefix().String()})
308+
}
309+
}
302310
}
303311
}
304312
if r.egressGateway {

pkg/tunnel/server.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,13 @@ func (t *TunnelServer) setupConn(
698698

699699
log.Info("Client addresses assigned")
700700

701-
// Advertise routes to client - read egress gateway from TunnelNode spec.
701+
// Advertise routes to client.
702702
advRoutes := []netip.Prefix{netip.PrefixFrom(addrv6.Addr(), 128)}
703+
// Always include the network prefix so the agent can reach other endpoints
704+
// in the same overlay network (e.g. backplane services).
705+
if ula, err := tunnet.ULAFromPrefix(ctx, addrv6); err == nil {
706+
advRoutes = append(advRoutes, ula.NetPrefix())
707+
}
703708
if conn.obj.Spec.EgressGateway != nil && conn.obj.Spec.EgressGateway.Enabled {
704709
log.Info("Enabling egress gateway")
705710
advRoutes = append(advRoutes,

0 commit comments

Comments
 (0)