Skip to content

Commit

Permalink
Merge pull request #33 from 3d0c/master
Browse files Browse the repository at this point in the history
Ethernet UnmarshalBinary fix, for issue #32
  • Loading branch information
vtolstov committed Sep 13, 2015
2 parents cd1781e + cc2436b commit e5b3f3c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion protocol/eth/ethernet.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/binary"
"errors"
"net"

"github.com/jonstout/ogo/protocol/arp"
"github.com/jonstout/ogo/protocol/ipv4"
"github.com/jonstout/ogo/protocol/util"
Expand Down Expand Up @@ -90,7 +90,12 @@ func (e *Ethernet) UnmarshalBinary(data []byte) error {
if len(data) < 14 {
return errors.New("The []byte is too short to unmarshal a full Ethernet message.")
}

n := 1

e.HWDst = net.HardwareAddr(make([]byte, 6))
e.HWSrc = net.HardwareAddr(make([]byte, 6))

copy(e.HWDst, data[n:])
n += len(e.HWDst)

Expand Down

0 comments on commit e5b3f3c

Please sign in to comment.