Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion pkg/tcpip/transport/internal/network/endpoint_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,17 @@ func (e *Endpoint) Resume(s *stack.Stack) {
e.stack = s

for m := range e.multicastMemberships {
if err := e.stack.JoinGroup(e.netProto, m.nicID, m.multicastAddr); err != nil {
// The NICID can change during restore, find the possible new NICID for the
// multicast address and then join the group.
var nicID tcpip.NICID
if r, err := e.stack.FindRoute(0, tcpip.Address{}, m.multicastAddr, e.netProto, false /* multicastLoop */); err == nil {
nicID = r.NICID()
r.Release()
}
if nicID == 0 {
panic(fmt.Sprintf("could not find a NIC for multicast address %s during restore", m.multicastAddr))
}
if err := e.stack.JoinGroup(e.netProto, nicID, m.multicastAddr); err != nil {
panic(fmt.Sprintf("e.stack.JoinGroup(%d, %d, %s): %s", e.netProto, m.nicID, m.multicastAddr, err))
}
}
Expand Down