summaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/net/icmp/ipv4.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/net/icmp/ipv4.go')
-rw-r--r--vendor/golang.org/x/net/icmp/ipv4.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/vendor/golang.org/x/net/icmp/ipv4.go b/vendor/golang.org/x/net/icmp/ipv4.go
index 729ddc97c..ffc66ed4d 100644
--- a/vendor/golang.org/x/net/icmp/ipv4.go
+++ b/vendor/golang.org/x/net/icmp/ipv4.go
@@ -9,9 +9,14 @@ import (
"net"
"runtime"
+ "golang.org/x/net/internal/socket"
"golang.org/x/net/ipv4"
)
+// freebsdVersion is set in sys_freebsd.go.
+// See http://www.freebsd.org/doc/en/books/porters-handbook/freebsd-versions.html.
+var freebsdVersion uint32
+
// ParseIPv4Header parses b as an IPv4 header of ICMP error message
// invoking packet, which is contained in ICMP error message.
func ParseIPv4Header(b []byte) (*ipv4.Header, error) {
@@ -36,12 +41,12 @@ func ParseIPv4Header(b []byte) (*ipv4.Header, error) {
}
switch runtime.GOOS {
case "darwin":
- h.TotalLen = int(nativeEndian.Uint16(b[2:4]))
+ h.TotalLen = int(socket.NativeEndian.Uint16(b[2:4]))
case "freebsd":
if freebsdVersion >= 1000000 {
h.TotalLen = int(binary.BigEndian.Uint16(b[2:4]))
} else {
- h.TotalLen = int(nativeEndian.Uint16(b[2:4]))
+ h.TotalLen = int(socket.NativeEndian.Uint16(b[2:4]))
}
default:
h.TotalLen = int(binary.BigEndian.Uint16(b[2:4]))