summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/network/ip
diff options
context:
space:
mode:
authorGhanan Gowripalan <ghanan@google.com>2020-12-09 10:50:42 -0800
committerShentubot <shentubot@google.com>2020-12-09 15:54:18 -0800
commit50189b0d6f2401f842f63ae149de13b89b4c30f9 (patch)
treec5402d8fb9d4589364b3449ed6a027f1b24833e6 /pkg/tcpip/network/ip
parenta855a814d601a4c30f26743ef1bf016df956e042 (diff)
Do not perform IGMP/MLD on loopback interfaces
The loopback interface will never have any neighbouring nodes so advertising its interest in multicast groups is unnecessary. Bug #4682, #4861 Startblock: has LGTM from asfez and then add reviewer tamird PiperOrigin-RevId: 346587604
Diffstat (limited to 'pkg/tcpip/network/ip')
-rw-r--r--pkg/tcpip/network/ip/generic_multicast_protocol.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/pkg/tcpip/network/ip/generic_multicast_protocol.go b/pkg/tcpip/network/ip/generic_multicast_protocol.go
index bc7f7f637..c8c17ab15 100644
--- a/pkg/tcpip/network/ip/generic_multicast_protocol.go
+++ b/pkg/tcpip/network/ip/generic_multicast_protocol.go
@@ -161,7 +161,8 @@ type GenericMulticastProtocolState struct {
// Init initializes the Generic Multicast Protocol state.
//
-// Must only be called once for the lifetime of g.
+// Must only be called once for the lifetime of g; Init will panic if it is
+// called twice.
//
// The GenericMulticastProtocolState will only grab the lock when timers/jobs
// fire.
@@ -170,9 +171,11 @@ func (g *GenericMulticastProtocolState) Init(protocolMU *sync.RWMutex, opts Gene
panic("attempted to initialize generic membership protocol state twice")
}
- g.opts = opts
- g.memberships = make(map[tcpip.Address]multicastGroupState)
- g.protocolMU = protocolMU
+ *g = GenericMulticastProtocolState{
+ opts: opts,
+ memberships: make(map[tcpip.Address]multicastGroupState),
+ protocolMU: protocolMU,
+ }
}
// MakeAllNonMemberLocked transitions all groups to the non-member state.