Skip to content

Commit 5af45f3

Browse files
committed
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
1 parent 4b6fc9e commit 5af45f3

10 files changed

+16
-38
lines changed

ipv6/control_rfc2292_unix.go

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ func marshal2292HopLimit(b []byte, cm *ControlMessage) []byte {
2020
m.SetLen(syscall.CmsgLen(4))
2121
if cm != nil {
2222
data := b[syscall.CmsgLen(0):]
23+
// TODO(mikio): fix potential misaligned memory access
2324
*(*int32)(unsafe.Pointer(&data[:4][0])) = int32(cm.HopLimit)
2425
}
2526
return b[syscall.CmsgSpace(4):]

ipv6/control_rfc3542_unix.go

+4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@ func marshalTrafficClass(b []byte, cm *ControlMessage) []byte {
2020
m.SetLen(syscall.CmsgLen(4))
2121
if cm != nil {
2222
data := b[syscall.CmsgLen(0):]
23+
// TODO(mikio): fix potential misaligned memory access
2324
*(*int32)(unsafe.Pointer(&data[:4][0])) = int32(cm.TrafficClass)
2425
}
2526
return b[syscall.CmsgSpace(4):]
2627
}
2728

2829
func parseTrafficClass(cm *ControlMessage, b []byte) {
30+
// TODO(mikio): fix potential misaligned memory access
2931
cm.TrafficClass = int(*(*int32)(unsafe.Pointer(&b[:4][0])))
3032
}
3133

@@ -36,12 +38,14 @@ func marshalHopLimit(b []byte, cm *ControlMessage) []byte {
3638
m.SetLen(syscall.CmsgLen(4))
3739
if cm != nil {
3840
data := b[syscall.CmsgLen(0):]
41+
// TODO(mikio): fix potential misaligned memory access
3942
*(*int32)(unsafe.Pointer(&data[:4][0])) = int32(cm.HopLimit)
4043
}
4144
return b[syscall.CmsgSpace(4):]
4245
}
4346

4447
func parseHopLimit(cm *ControlMessage, b []byte) {
48+
// TODO(mikio): fix potential misaligned memory access
4549
cm.HopLimit = int(*(*int32)(unsafe.Pointer(&b[:4][0])))
4650
}
4751

ipv6/control_stub.go

-4
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,17 @@
77
package ipv6
88

99
func setControlMessage(fd int, opt *rawOpt, cf ControlFlags, on bool) error {
10-
// TODO(mikio): Implement this
1110
return errOpNoSupport
1211
}
1312

1413
func newControlMessage(opt *rawOpt) (oob []byte) {
15-
// TODO(mikio): Implement this
1614
return nil
1715
}
1816

1917
func parseControlMessage(b []byte) (*ControlMessage, error) {
20-
// TODO(mikio): Implement this
2118
return nil, errOpNoSupport
2219
}
2320

2421
func marshalControlMessage(cm *ControlMessage) (oob []byte) {
25-
// TODO(mikio): Implement this
2622
return nil
2723
}

ipv6/control_windows.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ package ipv6
77
import "syscall"
88

99
func setControlMessage(fd syscall.Handle, opt *rawOpt, cf ControlFlags, on bool) error {
10-
// TODO(mikio): Implement this
10+
// TODO(mikio): implement this
1111
return syscall.EWINDOWS
1212
}
1313

1414
func newControlMessage(opt *rawOpt) (oob []byte) {
15-
// TODO(mikio): Implement this
15+
// TODO(mikio): implement this
1616
return nil
1717
}
1818

1919
func parseControlMessage(b []byte) (*ControlMessage, error) {
20-
// TODO(mikio): Implement this
20+
// TODO(mikio): implement this
2121
return nil, syscall.EWINDOWS
2222
}
2323

2424
func marshalControlMessage(cm *ControlMessage) (oob []byte) {
25-
// TODO(mikio): Implement this
25+
// TODO(mikio): implement this
2626
return nil
2727
}

ipv6/dgramopt_stub.go

-12
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,36 @@ import "net"
1111
// MulticastHopLimit returns the hop limit field value for outgoing
1212
// multicast packets.
1313
func (c *dgramOpt) MulticastHopLimit() (int, error) {
14-
// TODO(mikio): Implement this
1514
return 0, errOpNoSupport
1615
}
1716

1817
// SetMulticastHopLimit sets the hop limit field value for future
1918
// outgoing multicast packets.
2019
func (c *dgramOpt) SetMulticastHopLimit(hoplim int) error {
21-
// TODO(mikio): Implement this
2220
return errOpNoSupport
2321
}
2422

2523
// MulticastInterface returns the default interface for multicast
2624
// packet transmissions.
2725
func (c *dgramOpt) MulticastInterface() (*net.Interface, error) {
28-
// TODO(mikio): Implement this
2926
return nil, errOpNoSupport
3027
}
3128

3229
// SetMulticastInterface sets the default interface for future
3330
// multicast packet transmissions.
3431
func (c *dgramOpt) SetMulticastInterface(ifi *net.Interface) error {
35-
// TODO(mikio): Implement this
3632
return errOpNoSupport
3733
}
3834

3935
// MulticastLoopback reports whether transmitted multicast packets
4036
// should be copied and send back to the originator.
4137
func (c *dgramOpt) MulticastLoopback() (bool, error) {
42-
// TODO(mikio): Implement this
4338
return false, errOpNoSupport
4439
}
4540

4641
// SetMulticastLoopback sets whether transmitted multicast packets
4742
// should be copied and send back to the originator.
4843
func (c *dgramOpt) SetMulticastLoopback(on bool) error {
49-
// TODO(mikio): Implement this
5044
return errOpNoSupport
5145
}
5246

@@ -55,13 +49,11 @@ func (c *dgramOpt) SetMulticastLoopback(on bool) error {
5549
// although this is not recommended because the assignment depends on
5650
// platforms and sometimes it might require routing configuration.
5751
func (c *dgramOpt) JoinGroup(ifi *net.Interface, group net.Addr) error {
58-
// TODO(mikio): Implement this
5952
return errOpNoSupport
6053
}
6154

6255
// LeaveGroup leaves the group address group on the interface ifi.
6356
func (c *dgramOpt) LeaveGroup(ifi *net.Interface, group net.Addr) error {
64-
// TODO(mikio): Implement this
6557
return errOpNoSupport
6658
}
6759

@@ -70,26 +62,22 @@ func (c *dgramOpt) LeaveGroup(ifi *net.Interface, group net.Addr) error {
7062
// returns an offset in bytes into the data of where the checksum
7163
// field is located.
7264
func (c *dgramOpt) Checksum() (on bool, offset int, err error) {
73-
// TODO(mikio): Implement this
7465
return false, 0, errOpNoSupport
7566
}
7667

7768
// SetChecksum enables the kernel checksum processing. If on is ture,
7869
// the offset should be an offset in bytes into the data of where the
7970
// checksum field is located.
8071
func (c *dgramOpt) SetChecksum(on bool, offset int) error {
81-
// TODO(mikio): Implement this
8272
return errOpNoSupport
8373
}
8474

8575
// ICMPFilter returns an ICMP filter.
8676
func (c *dgramOpt) ICMPFilter() (*ICMPFilter, error) {
87-
// TODO(mikio): Implement this
8877
return nil, errOpNoSupport
8978
}
9079

9180
// SetICMPFilter deploys the ICMP filter.
9281
func (c *dgramOpt) SetICMPFilter(f *ICMPFilter) error {
93-
// TODO(mikio): Implement this
9482
return errOpNoSupport
9583
}

ipv6/genericopt_stub.go

-4
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,22 @@ package ipv6
99
// TrafficClass returns the traffic class field value for outgoing
1010
// packets.
1111
func (c *genericOpt) TrafficClass() (int, error) {
12-
// TODO(mikio): Implement this
1312
return 0, errOpNoSupport
1413
}
1514

1615
// SetTrafficClass sets the traffic class field value for future
1716
// outgoing packets.
1817
func (c *genericOpt) SetTrafficClass(tclass int) error {
19-
// TODO(mikio): Implement this
2018
return errOpNoSupport
2119
}
2220

2321
// HopLimit returns the hop limit field value for outgoing packets.
2422
func (c *genericOpt) HopLimit() (int, error) {
25-
// TODO(mikio): Implement this
2623
return 0, errOpNoSupport
2724
}
2825

2926
// SetHopLimit sets the hop limit field value for future outgoing
3027
// packets.
3128
func (c *genericOpt) SetHopLimit(hoplim int) error {
32-
// TODO(mikio): Implement this
3329
return errOpNoSupport
3430
}

ipv6/helper_stub.go

-3
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,13 @@
77
package ipv6
88

99
func (c *genericOpt) sysfd() (int, error) {
10-
// TODO(mikio): Implement this
1110
return 0, errOpNoSupport
1211
}
1312

1413
func (c *dgramOpt) sysfd() (int, error) {
15-
// TODO(mikio): Implement this
1614
return 0, errOpNoSupport
1715
}
1816

1917
func (c *payloadHandler) sysfd() (int, error) {
20-
// TODO(mikio): Implement this
2118
return 0, errOpNoSupport
2219
}

ipv6/icmp_solaris.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
package ipv6
88

99
func (f *sysICMPv6Filter) set(typ ICMPType, block bool) {
10-
// TODO(mikio): Implement this
10+
// TODO(mikio): implement this
1111
}
1212

1313
func (f *sysICMPv6Filter) setAll(block bool) {
14-
// TODO(mikio): Implement this
14+
// TODO(mikio): implement this
1515
}
1616

1717
func (f *sysICMPv6Filter) willBlock(typ ICMPType) bool {
18-
// TODO(mikio): Implement this
18+
// TODO(mikio): implement this
1919
return false
2020
}

ipv6/icmp_stub.go

-4
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,14 @@
77
package ipv6
88

99
type sysICMPv6Filter struct {
10-
// TODO(mikio): Implement this
1110
}
1211

1312
func (f *sysICMPv6Filter) set(typ ICMPType, block bool) {
14-
// TODO(mikio): Implement this
1513
}
1614

1715
func (f *sysICMPv6Filter) setAll(block bool) {
18-
// TODO(mikio): Implement this
1916
}
2017

2118
func (f *sysICMPv6Filter) willBlock(typ ICMPType) bool {
22-
// TODO(mikio): Implement this
2319
return false
2420
}

ipv6/icmp_windows.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
package ipv6
66

77
type sysICMPv6Filter struct {
8-
// TODO(mikio): Implement this
8+
// TODO(mikio): implement this
99
}
1010

1111
func (f *sysICMPv6Filter) set(typ ICMPType, block bool) {
12-
// TODO(mikio): Implement this
12+
// TODO(mikio): implement this
1313
}
1414

1515
func (f *sysICMPv6Filter) setAll(block bool) {
16-
// TODO(mikio): Implement this
16+
// TODO(mikio): implement this
1717
}
1818

1919
func (f *sysICMPv6Filter) willBlock(typ ICMPType) bool {
20-
// TODO(mikio): Implement this
20+
// TODO(mikio): implement this
2121
return false
2222
}

0 commit comments

Comments
 (0)