Skip to content

Commit

Permalink
fix sync packet length (#442)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #442

Alternate Port TLV made sync packets non-fixed size.

Reviewed By: leoleovich, vvfedorenko

Differential Revision: D68329227

fbshipit-source-id: fb7726efafb43353cde6c32f497f3e6189aae08a
  • Loading branch information
abulimov authored and facebook-github-bot committed Jan 17, 2025
1 parent 25116f8 commit 5901a66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/ziffy/node/packets.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func formSyncPacket(msgType ptp.MessageType, hop int, routeIndex int) *ptp.SyncD
Header: ptp.Header{
SdoIDAndMsgType: ptp.NewSdoIDAndMsgType(msgType, 0),
Version: ptp.Version,
MessageLength: uint16(binary.Size(ptp.SyncDelayReq{})),
MessageLength: uint16(binary.Size(ptp.Header{}) + binary.Size(ptp.SyncDelayReqBody{})), //#nosec G115
FlagField: ptp.FlagUnicast,
SequenceID: uint16(hop),
SourcePortIdentity: ptp.PortIdentity{
Expand Down
2 changes: 1 addition & 1 deletion ptp/sptp/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func announcePkt(seq int) *ptp.Announce {
}

func syncPkt(seq int) *ptp.SyncDelayReq {
l := binary.Size(ptp.SyncDelayReq{})
l := binary.Size(ptp.Header{}) + binary.Size(ptp.SyncDelayReqBody{}) //#nosec G115
return &ptp.SyncDelayReq{
Header: ptp.Header{
SdoIDAndMsgType: ptp.NewSdoIDAndMsgType(ptp.MessageSync, 0),
Expand Down

0 comments on commit 5901a66

Please sign in to comment.