Mikio Hara | cdfc4ce | 2013-06-04 17:42:58 +0900 | [diff] [blame] | 1 | // Copyright 2013 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package ipv6 |
| 6 | |
| 7 | import ( |
| 8 | "os" |
Mikio Hara | b27e68b | 2013-11-06 21:33:49 +0900 | [diff] [blame] | 9 | "unsafe" |
Mikio Hara | cdfc4ce | 2013-06-04 17:42:58 +0900 | [diff] [blame] | 10 | ) |
| 11 | |
| 12 | func setIPv6Checksum(fd int, on bool, offset int) error { |
| 13 | if !on { |
| 14 | offset = -1 |
| 15 | } |
Mikio Hara | b27e68b | 2013-11-06 21:33:49 +0900 | [diff] [blame] | 16 | v := int32(offset) |
| 17 | return os.NewSyscallError("setsockopt", setsockopt(fd, ianaProtocolReserved, sysSockoptChecksum, uintptr(unsafe.Pointer(&v)), 4)) |
Mikio Hara | cdfc4ce | 2013-06-04 17:42:58 +0900 | [diff] [blame] | 18 | } |