summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/stack/addressable_endpoint_state.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tcpip/stack/addressable_endpoint_state.go')
-rw-r--r--pkg/tcpip/stack/addressable_endpoint_state.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg/tcpip/stack/addressable_endpoint_state.go b/pkg/tcpip/stack/addressable_endpoint_state.go
index adeebfe37..6e855d815 100644
--- a/pkg/tcpip/stack/addressable_endpoint_state.go
+++ b/pkg/tcpip/stack/addressable_endpoint_state.go
@@ -625,6 +625,17 @@ func (a *AddressableEndpointState) IsInGroup(group tcpip.Address) bool {
return ok
}
+// JoinedGroups returns a list of groups the endpoint is a member of.
+func (a *AddressableEndpointState) JoinedGroups() []tcpip.Address {
+ a.mu.RLock()
+ defer a.mu.RUnlock()
+ groups := make([]tcpip.Address, 0, len(a.mu.groups))
+ for g := range a.mu.groups {
+ groups = append(groups, g)
+ }
+ return groups
+}
+
// Cleanup forcefully leaves all groups and removes all permanent addresses.
func (a *AddressableEndpointState) Cleanup() {
a.mu.Lock()