Skip to content

Commit 5901a66

Browse files
abulimovfacebook-github-bot
authored andcommitted
fix sync packet length (#442)
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
1 parent 25116f8 commit 5901a66

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

cmd/ziffy/node/packets.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func formSyncPacket(msgType ptp.MessageType, hop int, routeIndex int) *ptp.SyncD
6666
Header: ptp.Header{
6767
SdoIDAndMsgType: ptp.NewSdoIDAndMsgType(msgType, 0),
6868
Version: ptp.Version,
69-
MessageLength: uint16(binary.Size(ptp.SyncDelayReq{})),
69+
MessageLength: uint16(binary.Size(ptp.Header{}) + binary.Size(ptp.SyncDelayReqBody{})), //#nosec G115
7070
FlagField: ptp.FlagUnicast,
7171
SequenceID: uint16(hop),
7272
SourcePortIdentity: ptp.PortIdentity{

ptp/sptp/client/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func announcePkt(seq int) *ptp.Announce {
4949
}
5050

5151
func syncPkt(seq int) *ptp.SyncDelayReq {
52-
l := binary.Size(ptp.SyncDelayReq{})
52+
l := binary.Size(ptp.Header{}) + binary.Size(ptp.SyncDelayReqBody{}) //#nosec G115
5353
return &ptp.SyncDelayReq{
5454
Header: ptp.Header{
5555
SdoIDAndMsgType: ptp.NewSdoIDAndMsgType(ptp.MessageSync, 0),

0 commit comments

Comments
 (0)