diff options
author | Tamir Duberstein <tamird@google.com> | 2018-09-26 09:48:29 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-09-26 09:49:52 -0700 |
commit | bee264f0c5b41dde1f51c5a65e84dfab2ac4d40b (patch) | |
tree | e66c23b41ff09f2b9cd150267d3885100c548491 /pkg/tcpip/network/ipv6/icmp.go | |
parent | d489336784f12e1b6f92d65f53679c1226b58668 (diff) |
Export ipv6 address helpers
This is useful for Fuchsia.
PiperOrigin-RevId: 214619681
Change-Id: If5a60dd82365c2eae51a12bbc819e5aae8c76ee9
Diffstat (limited to 'pkg/tcpip/network/ipv6/icmp.go')
-rw-r--r-- | pkg/tcpip/network/ipv6/icmp.go | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/pkg/tcpip/network/ipv6/icmp.go b/pkg/tcpip/network/ipv6/icmp.go index 468201d77..9b5fa3f6e 100644 --- a/pkg/tcpip/network/ipv6/icmp.go +++ b/pkg/tcpip/network/ipv6/icmp.go @@ -153,13 +153,6 @@ const ( icmpV6LengthOffset = 25 ) -// solicitedNodeAddr computes the solicited-node multicast address. -// This is used for NDP. Described in RFC 4291. -func solicitedNodeAddr(addr tcpip.Address) tcpip.Address { - const solicitedNodeMulticastPrefix = "\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\xff" - return solicitedNodeMulticastPrefix + addr[len(addr)-3:] -} - var broadcastMAC = tcpip.LinkAddress([]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}) var _ stack.LinkAddressResolver = (*protocol)(nil) @@ -171,7 +164,7 @@ func (*protocol) LinkAddressProtocol() tcpip.NetworkProtocolNumber { // LinkAddressRequest implements stack.LinkAddressResolver. func (*protocol) LinkAddressRequest(addr, localAddr tcpip.Address, linkEP stack.LinkEndpoint) *tcpip.Error { - snaddr := solicitedNodeAddr(addr) + snaddr := header.SolicitedNodeAddr(addr) r := &stack.Route{ LocalAddress: localAddr, RemoteAddress: snaddr, |