Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
net
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
net
Commits
3329bfea
Commit
3329bfea
authored
Jan 01, 2015
by
Mikio Hara
Committed by
Gerrit Code Review
Jan 01, 2015
Browse files
Options
Browse Files
Download
Plain Diff
Merge "icmp: prevent stripping off ipv4 header twice on darwin"
parents
3053e46b
23996681
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
endpoint.go
icmp/endpoint.go
+10
-0
No files found.
icmp/endpoint.go
View file @
3329bfea
...
@@ -6,6 +6,7 @@ package icmp
...
@@ -6,6 +6,7 @@ package icmp
import
(
import
(
"net"
"net"
"runtime"
"syscall"
"syscall"
"time"
"time"
...
@@ -51,6 +52,15 @@ func (c *PacketConn) ReadFrom(b []byte) (int, net.Addr, error) {
...
@@ -51,6 +52,15 @@ func (c *PacketConn) ReadFrom(b []byte) (int, net.Addr, error) {
if
!
c
.
ok
()
{
if
!
c
.
ok
()
{
return
0
,
nil
,
syscall
.
EINVAL
return
0
,
nil
,
syscall
.
EINVAL
}
}
// Please be informed that ipv4.NewPacketConn enables
// IP_STRIPHDR option by default on Darwin.
// See golang.org/issue/9395 for futher information.
if
runtime
.
GOOS
==
"darwin"
{
if
p
,
_
:=
c
.
ipc
.
(
*
ipv4
.
PacketConn
);
p
!=
nil
{
n
,
_
,
peer
,
err
:=
p
.
ReadFrom
(
b
)
return
n
,
peer
,
err
}
}
return
c
.
c
.
ReadFrom
(
b
)
return
c
.
c
.
ReadFrom
(
b
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment