summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSonia Appasamy <sonia@tailscale.com>2023-11-29 11:17:00 -0500
committerSonia Appasamy <appasamysm@gmail.com>2023-11-29 14:35:30 -0500
commitbc4e303846c3bb15dcb3a545a2cee110361ba028 (patch)
tree218b4d64921e1d7bc6c4e3874234ef509f937ca8
parentac4b416c5b087ae0a3a3909971ae1e20b419ef77 (diff)
downloadtailscale-bc4e303846c3bb15dcb3a545a2cee110361ba028.tar.xz
tailscale-bc4e303846c3bb15dcb3a545a2cee110361ba028.zip
ipn/ipnstate: add AllowedIPs to PeerStatus
Adds AllowedIPs to PeerStatus, allowing for easier lookup of the routes allowed to be routed to a node. Will be using the AllowedIPs of the self node from the web client interface to display approval status of advertised routes. Updates #10261 Signed-off-by: Sonia Appasamy <sonia@tailscale.com>
-rw-r--r--ipn/ipnlocal/local.go4
-rw-r--r--ipn/ipnstate/ipnstate.go5
2 files changed, 9 insertions, 0 deletions
diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go
index a4c8cc414..842e38406 100644
--- a/ipn/ipnlocal/local.go
+++ b/ipn/ipnlocal/local.go
@@ -900,6 +900,10 @@ func peerStatusFromNode(ps *ipnstate.PeerStatus, n tailcfg.NodeView) {
v := n.PrimaryRoutes()
ps.PrimaryRoutes = &v
}
+ if n.AllowedIPs().Len() != 0 {
+ v := n.AllowedIPs()
+ ps.AllowedIPs = &v
+ }
if n.Expired() {
ps.Expired = true
diff --git a/ipn/ipnstate/ipnstate.go b/ipn/ipnstate/ipnstate.go
index 1a58b0170..4a3c80106 100644
--- a/ipn/ipnstate/ipnstate.go
+++ b/ipn/ipnstate/ipnstate.go
@@ -216,6 +216,8 @@ type PeerStatus struct {
// TailscaleIPs are the IP addresses assigned to the node.
TailscaleIPs []netip.Addr
+ // AllowedIPs are IP addresses allowed to route to this node.
+ AllowedIPs *views.Slice[netip.Prefix] `json:",omitempty"`
// Tags are the list of ACL tags applied to this node.
// See tailscale.com/tailcfg#Node.Tags for more information.
@@ -414,6 +416,9 @@ func (sb *StatusBuilder) AddPeer(peer key.NodePublic, st *PeerStatus) {
if v := st.PrimaryRoutes; v != nil && !v.IsNil() {
e.PrimaryRoutes = v
}
+ if v := st.AllowedIPs; v != nil && !v.IsNil() {
+ e.AllowedIPs = v
+ }
if v := st.Tags; v != nil && !v.IsNil() {
e.Tags = v
}