Browse Source

x/net/ipv6: update TODOs

TODOs for stub files are unnecessary because they are stubs.
Also adds TODOs that need to be treated for spurious word
boundary access on some CPU architecture such as ARM, Power.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/174720043
Mikio Hara 11 years ago
parent
commit
5af45f3924

+ 1 - 0
ipv6/control_rfc2292_unix.go

@@ -20,6 +20,7 @@ func marshal2292HopLimit(b []byte, cm *ControlMessage) []byte {
 	m.SetLen(syscall.CmsgLen(4))
 	if cm != nil {
 		data := b[syscall.CmsgLen(0):]
+		// TODO(mikio): fix potential misaligned memory access
 		*(*int32)(unsafe.Pointer(&data[:4][0])) = int32(cm.HopLimit)
 	}
 	return b[syscall.CmsgSpace(4):]

+ 4 - 0
ipv6/control_rfc3542_unix.go

@@ -20,12 +20,14 @@ func marshalTrafficClass(b []byte, cm *ControlMessage) []byte {
 	m.SetLen(syscall.CmsgLen(4))
 	if cm != nil {
 		data := b[syscall.CmsgLen(0):]
+		// TODO(mikio): fix potential misaligned memory access
 		*(*int32)(unsafe.Pointer(&data[:4][0])) = int32(cm.TrafficClass)
 	}
 	return b[syscall.CmsgSpace(4):]
 }
 
 func parseTrafficClass(cm *ControlMessage, b []byte) {
+	// TODO(mikio): fix potential misaligned memory access
 	cm.TrafficClass = int(*(*int32)(unsafe.Pointer(&b[:4][0])))
 }
 
@@ -36,12 +38,14 @@ func marshalHopLimit(b []byte, cm *ControlMessage) []byte {
 	m.SetLen(syscall.CmsgLen(4))
 	if cm != nil {
 		data := b[syscall.CmsgLen(0):]
+		// TODO(mikio): fix potential misaligned memory access
 		*(*int32)(unsafe.Pointer(&data[:4][0])) = int32(cm.HopLimit)
 	}
 	return b[syscall.CmsgSpace(4):]
 }
 
 func parseHopLimit(cm *ControlMessage, b []byte) {
+	// TODO(mikio): fix potential misaligned memory access
 	cm.HopLimit = int(*(*int32)(unsafe.Pointer(&b[:4][0])))
 }
 

+ 0 - 4
ipv6/control_stub.go

@@ -7,21 +7,17 @@
 package ipv6
 
 func setControlMessage(fd int, opt *rawOpt, cf ControlFlags, on bool) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }
 
 func newControlMessage(opt *rawOpt) (oob []byte) {
-	// TODO(mikio): Implement this
 	return nil
 }
 
 func parseControlMessage(b []byte) (*ControlMessage, error) {
-	// TODO(mikio): Implement this
 	return nil, errOpNoSupport
 }
 
 func marshalControlMessage(cm *ControlMessage) (oob []byte) {
-	// TODO(mikio): Implement this
 	return nil
 }

+ 4 - 4
ipv6/control_windows.go

@@ -7,21 +7,21 @@ package ipv6
 import "syscall"
 
 func setControlMessage(fd syscall.Handle, opt *rawOpt, cf ControlFlags, on bool) error {
-	// TODO(mikio): Implement this
+	// TODO(mikio): implement this
 	return syscall.EWINDOWS
 }
 
 func newControlMessage(opt *rawOpt) (oob []byte) {
-	// TODO(mikio): Implement this
+	// TODO(mikio): implement this
 	return nil
 }
 
 func parseControlMessage(b []byte) (*ControlMessage, error) {
-	// TODO(mikio): Implement this
+	// TODO(mikio): implement this
 	return nil, syscall.EWINDOWS
 }
 
 func marshalControlMessage(cm *ControlMessage) (oob []byte) {
-	// TODO(mikio): Implement this
+	// TODO(mikio): implement this
 	return nil
 }

+ 0 - 12
ipv6/dgramopt_stub.go

@@ -11,42 +11,36 @@ import "net"
 // MulticastHopLimit returns the hop limit field value for outgoing
 // multicast packets.
 func (c *dgramOpt) MulticastHopLimit() (int, error) {
-	// TODO(mikio): Implement this
 	return 0, errOpNoSupport
 }
 
 // SetMulticastHopLimit sets the hop limit field value for future
 // outgoing multicast packets.
 func (c *dgramOpt) SetMulticastHopLimit(hoplim int) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }
 
 // MulticastInterface returns the default interface for multicast
 // packet transmissions.
 func (c *dgramOpt) MulticastInterface() (*net.Interface, error) {
-	// TODO(mikio): Implement this
 	return nil, errOpNoSupport
 }
 
 // SetMulticastInterface sets the default interface for future
 // multicast packet transmissions.
 func (c *dgramOpt) SetMulticastInterface(ifi *net.Interface) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }
 
 // MulticastLoopback reports whether transmitted multicast packets
 // should be copied and send back to the originator.
 func (c *dgramOpt) MulticastLoopback() (bool, error) {
-	// TODO(mikio): Implement this
 	return false, errOpNoSupport
 }
 
 // SetMulticastLoopback sets whether transmitted multicast packets
 // should be copied and send back to the originator.
 func (c *dgramOpt) SetMulticastLoopback(on bool) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }
 
@@ -55,13 +49,11 @@ func (c *dgramOpt) SetMulticastLoopback(on bool) error {
 // although this is not recommended because the assignment depends on
 // platforms and sometimes it might require routing configuration.
 func (c *dgramOpt) JoinGroup(ifi *net.Interface, group net.Addr) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }
 
 // LeaveGroup leaves the group address group on the interface ifi.
 func (c *dgramOpt) LeaveGroup(ifi *net.Interface, group net.Addr) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }
 
@@ -70,7 +62,6 @@ func (c *dgramOpt) LeaveGroup(ifi *net.Interface, group net.Addr) error {
 // returns an offset in bytes into the data of where the checksum
 // field is located.
 func (c *dgramOpt) Checksum() (on bool, offset int, err error) {
-	// TODO(mikio): Implement this
 	return false, 0, errOpNoSupport
 }
 
@@ -78,18 +69,15 @@ func (c *dgramOpt) Checksum() (on bool, offset int, err error) {
 // the offset should be an offset in bytes into the data of where the
 // checksum field is located.
 func (c *dgramOpt) SetChecksum(on bool, offset int) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }
 
 // ICMPFilter returns an ICMP filter.
 func (c *dgramOpt) ICMPFilter() (*ICMPFilter, error) {
-	// TODO(mikio): Implement this
 	return nil, errOpNoSupport
 }
 
 // SetICMPFilter deploys the ICMP filter.
 func (c *dgramOpt) SetICMPFilter(f *ICMPFilter) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }

+ 0 - 4
ipv6/genericopt_stub.go

@@ -9,26 +9,22 @@ package ipv6
 // TrafficClass returns the traffic class field value for outgoing
 // packets.
 func (c *genericOpt) TrafficClass() (int, error) {
-	// TODO(mikio): Implement this
 	return 0, errOpNoSupport
 }
 
 // SetTrafficClass sets the traffic class field value for future
 // outgoing packets.
 func (c *genericOpt) SetTrafficClass(tclass int) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }
 
 // HopLimit returns the hop limit field value for outgoing packets.
 func (c *genericOpt) HopLimit() (int, error) {
-	// TODO(mikio): Implement this
 	return 0, errOpNoSupport
 }
 
 // SetHopLimit sets the hop limit field value for future outgoing
 // packets.
 func (c *genericOpt) SetHopLimit(hoplim int) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }

+ 0 - 3
ipv6/helper_stub.go

@@ -7,16 +7,13 @@
 package ipv6
 
 func (c *genericOpt) sysfd() (int, error) {
-	// TODO(mikio): Implement this
 	return 0, errOpNoSupport
 }
 
 func (c *dgramOpt) sysfd() (int, error) {
-	// TODO(mikio): Implement this
 	return 0, errOpNoSupport
 }
 
 func (c *payloadHandler) sysfd() (int, error) {
-	// TODO(mikio): Implement this
 	return 0, errOpNoSupport
 }

+ 3 - 3
ipv6/icmp_solaris.go

@@ -7,14 +7,14 @@
 package ipv6
 
 func (f *sysICMPv6Filter) set(typ ICMPType, block bool) {
-	// TODO(mikio): Implement this
+	// TODO(mikio): implement this
 }
 
 func (f *sysICMPv6Filter) setAll(block bool) {
-	// TODO(mikio): Implement this
+	// TODO(mikio): implement this
 }
 
 func (f *sysICMPv6Filter) willBlock(typ ICMPType) bool {
-	// TODO(mikio): Implement this
+	// TODO(mikio): implement this
 	return false
 }

+ 0 - 4
ipv6/icmp_stub.go

@@ -7,18 +7,14 @@
 package ipv6
 
 type sysICMPv6Filter struct {
-	// TODO(mikio): Implement this
 }
 
 func (f *sysICMPv6Filter) set(typ ICMPType, block bool) {
-	// TODO(mikio): Implement this
 }
 
 func (f *sysICMPv6Filter) setAll(block bool) {
-	// TODO(mikio): Implement this
 }
 
 func (f *sysICMPv6Filter) willBlock(typ ICMPType) bool {
-	// TODO(mikio): Implement this
 	return false
 }

+ 4 - 4
ipv6/icmp_windows.go

@@ -5,18 +5,18 @@
 package ipv6
 
 type sysICMPv6Filter struct {
-	// TODO(mikio): Implement this
+	// TODO(mikio): implement this
 }
 
 func (f *sysICMPv6Filter) set(typ ICMPType, block bool) {
-	// TODO(mikio): Implement this
+	// TODO(mikio): implement this
 }
 
 func (f *sysICMPv6Filter) setAll(block bool) {
-	// TODO(mikio): Implement this
+	// TODO(mikio): implement this
 }
 
 func (f *sysICMPv6Filter) willBlock(typ ICMPType) bool {
-	// TODO(mikio): Implement this
+	// TODO(mikio): implement this
 	return false
 }