summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-01-07 00:34:27 +0000
committergVisor bot <gvisor-bot@google.com>2020-01-07 00:34:27 +0000
commit7b8c645f4f03614a1b9633e289f8488eeef9cea6 (patch)
tree6e81261ae7ad88fb2ebb82ad5f92fc756b087f54 /pkg/tcpip
parent6c6ade5e5db9106d9743ceee1e6ee852432678fc (diff)
parent8dfd92284016f7c719b5766506cf3d6ab9c39c0e (diff)
Merge release-20191213.0-64-g8dfd922 (automated)
Diffstat (limited to 'pkg/tcpip')
-rwxr-xr-xpkg/tcpip/stack/ndp.go2
-rw-r--r--pkg/tcpip/stack/nic.go2
-rw-r--r--pkg/tcpip/stack/stack.go9
3 files changed, 9 insertions, 4 deletions
diff --git a/pkg/tcpip/stack/ndp.go b/pkg/tcpip/stack/ndp.go
index ba6a57e6f..238bc27dc 100755
--- a/pkg/tcpip/stack/ndp.go
+++ b/pkg/tcpip/stack/ndp.go
@@ -1030,7 +1030,7 @@ func (ndp *ndpState) handleAutonomousPrefixInformation(pi header.NDPPrefixInform
addrBytes := []byte(prefix.ID())
if oIID := ndp.nic.stack.opaqueIIDOpts; oIID.NICNameFromID != nil {
- addrBytes = header.AppendOpaqueInterfaceIdentifier(addrBytes[:header.IIDOffsetInIPv6Address], prefix, oIID.NICNameFromID(ndp.nic.ID()), 0 /* dadCounter */, oIID.SecretKey)
+ addrBytes = header.AppendOpaqueInterfaceIdentifier(addrBytes[:header.IIDOffsetInIPv6Address], prefix, oIID.NICNameFromID(ndp.nic.ID(), ndp.nic.name), 0 /* dadCounter */, oIID.SecretKey)
} else {
// Only attempt to generate an interface-specific IID if we have a valid
// link address.
diff --git a/pkg/tcpip/stack/nic.go b/pkg/tcpip/stack/nic.go
index 3bed0af3c..044fe5298 100644
--- a/pkg/tcpip/stack/nic.go
+++ b/pkg/tcpip/stack/nic.go
@@ -180,7 +180,7 @@ func (n *NIC) enable() *tcpip.Error {
var addr tcpip.Address
if oIID := n.stack.opaqueIIDOpts; oIID.NICNameFromID != nil {
- addr = header.LinkLocalAddrWithOpaqueIID(oIID.NICNameFromID(n.ID()), 0, oIID.SecretKey)
+ addr = header.LinkLocalAddrWithOpaqueIID(oIID.NICNameFromID(n.ID(), n.name), 0, oIID.SecretKey)
} else {
l2addr := n.linkEP.LinkAddress()
diff --git a/pkg/tcpip/stack/stack.go b/pkg/tcpip/stack/stack.go
index c6e6becf3..ffb379363 100644
--- a/pkg/tcpip/stack/stack.go
+++ b/pkg/tcpip/stack/stack.go
@@ -353,8 +353,13 @@ func (u *uniqueIDGenerator) UniqueID() uint64 {
}
// NICNameFromID is a function that returns a stable name for the specified NIC,
-// even if the NIC ID changes over time.
-type NICNameFromID func(tcpip.NICID) string
+// even if different NIC IDs are used to refer to the same NIC in different
+// program runs. It is used when generating opaque interface identifiers (IIDs).
+// If the NIC was created with a name, it will be passed to NICNameFromID.
+//
+// NICNameFromID SHOULD return unique NIC names so unique opaque IIDs are
+// generated for the same prefix on differnt NICs.
+type NICNameFromID func(tcpip.NICID, string) string
// OpaqueInterfaceIdentifierOptions holds the options related to the generation
// of opaque interface indentifiers (IIDs) as defined by RFC 7217.