浏览代码

go.net/ipv4: 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/171110043
Mikio Hara 11 年之前
父节点
当前提交
63ee83b038
共有 6 个文件被更改,包括 7 次插入24 次删除
  1. 0 4
      ipv4/control_stub.go
  2. 4 4
      ipv4/control_windows.go
  3. 0 8
      ipv4/dgramopt_stub.go
  4. 0 4
      ipv4/genericopt_stub.go
  5. 3 0
      ipv4/header.go
  6. 0 4
      ipv4/helper_stub.go

+ 0 - 4
ipv4/control_stub.go

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

+ 4 - 4
ipv4/control_windows.go

@@ -7,21 +7,21 @@ package ipv4
 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) []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) []byte {
-	// TODO(mikio): Implement this
+	// TODO(mikio): implement this
 	return nil
 }

+ 0 - 8
ipv4/dgramopt_stub.go

@@ -9,41 +9,33 @@ package ipv4
 import "net"
 
 func (c *dgramOpt) MulticastTTL() (int, error) {
-	// TODO(mikio): Implement this
 	return 0, errOpNoSupport
 }
 
 func (c *dgramOpt) SetMulticastTTL(ttl int) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }
 
 func (c *dgramOpt) MulticastInterface() (*net.Interface, error) {
-	// TODO(mikio): Implement this
 	return nil, errOpNoSupport
 }
 
 func (c *dgramOpt) SetMulticastInterface(ifi *net.Interface) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }
 
 func (c *dgramOpt) MulticastLoopback() (bool, error) {
-	// TODO(mikio): Implement this
 	return false, errOpNoSupport
 }
 
 func (c *dgramOpt) SetMulticastLoopback(on bool) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }
 
 func (c *dgramOpt) JoinGroup(ifi *net.Interface, grp net.Addr) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }
 
 func (c *dgramOpt) LeaveGroup(ifi *net.Interface, grp net.Addr) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }

+ 0 - 4
ipv4/genericopt_stub.go

@@ -7,21 +7,17 @@
 package ipv4
 
 func (c *genericOpt) TOS() (int, error) {
-	// TODO(mikio): Implement this
 	return 0, errOpNoSupport
 }
 
 func (c *genericOpt) SetTOS(tos int) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }
 
 func (c *genericOpt) TTL() (int, error) {
-	// TODO(mikio): Implement this
 	return 0, errOpNoSupport
 }
 
 func (c *genericOpt) SetTTL(ttl int) error {
-	// TODO(mikio): Implement this
 	return errOpNoSupport
 }

+ 3 - 0
ipv4/header.go

@@ -100,6 +100,7 @@ func (h *Header) Marshal() ([]byte, error) {
 		b[posTotalLen], b[posTotalLen+1] = byte(h.TotalLen>>8), byte(h.TotalLen)
 		b[posFragOff], b[posFragOff+1] = byte(flagsAndFragOff>>8), byte(flagsAndFragOff)
 	} else {
+		// TODO(mikio): fix spurious word boundary access
 		*(*uint16)(unsafe.Pointer(&b[posTotalLen : posTotalLen+1][0])) = uint16(h.TotalLen)
 		*(*uint16)(unsafe.Pointer(&b[posFragOff : posFragOff+1][0])) = uint16(flagsAndFragOff)
 	}
@@ -141,10 +142,12 @@ func ParseHeader(b []byte) (*Header, error) {
 		h.TotalLen = int(b[posTotalLen])<<8 | int(b[posTotalLen+1])
 		h.FragOff = int(b[posFragOff])<<8 | int(b[posFragOff+1])
 	} else {
+		// TODO(mikio): fix spurious word boundary access
 		h.TotalLen = int(*(*uint16)(unsafe.Pointer(&b[posTotalLen : posTotalLen+1][0])))
 		if runtime.GOOS != "freebsd" || freebsdVersion < 1000000 {
 			h.TotalLen += hdrlen
 		}
+		// TODO(mikio): fix spurious word boundary access
 		h.FragOff = int(*(*uint16)(unsafe.Pointer(&b[posFragOff : posFragOff+1][0])))
 	}
 	h.Flags = HeaderFlags(h.FragOff&0xe000) >> 13

+ 0 - 4
ipv4/helper_stub.go

@@ -7,21 +7,17 @@
 package ipv4
 
 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
 }
 
 func (c *packetHandler) sysfd() (int, error) {
-	// TODO(mikio): Implement this
 	return 0, errOpNoSupport
 }