ping: Fix read ipv4 header on darwin
This commit is contained in:
parent
fe4e54bb0d
commit
c089ffbd6c
2 changed files with 25 additions and 0 deletions
|
|
@ -159,6 +159,10 @@ func (c *Conn) ReadIP(buffer *buf.Buffer) error {
|
|||
}
|
||||
if !c.destination.Is6() {
|
||||
ipHdr := header.IPv4(buffer.Bytes())
|
||||
if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
|
||||
ipHdr.SetTotalLength(ipHdr.TotalLengthDarwinRaw())
|
||||
ipHdr.SetFlagsFragmentOffset(ipHdr.FlagsDarwinRaw(), ipHdr.FragmentOffsetDarwinRaw())
|
||||
}
|
||||
if !ipHdr.IsValid(buffer.Len()) {
|
||||
return E.New("invalid IPv4 header received")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue