Skip to content

Commit

Permalink
use ALTERNATE_RESPONSE_PORT TLV in sptp
Browse files Browse the repository at this point in the history
Summary: Set sptp to send 0 for now

Differential Revision: D67040867
  • Loading branch information
leoleovich authored and facebook-github-bot committed Dec 11, 2024
1 parent f155c98 commit c89c3f0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ptp/sptp/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,19 @@ func ReqDelay(clockID ptp.ClockIdentity, portID uint16) *ptp.SyncDelayReq {
Header: ptp.Header{
SdoIDAndMsgType: ptp.NewSdoIDAndMsgType(ptp.MessageDelayReq, 0),
Version: ptp.Version,
SequenceID: 0, // will be populated on sending
MessageLength: uint16(binary.Size(ptp.Header{}) + binary.Size(ptp.SyncDelayReqBody{})), //#nosec G115
SequenceID: 0, // will be populated on sending
MessageLength: uint16(binary.Size(ptp.Header{}) + binary.Size(ptp.SyncDelayReqBody{}) + binary.Size(ptp.AlternateResponsePortTLV{})), //#nosec G115
FlagField: ptp.FlagUnicast | ptp.FlagProfileSpecific1,
SourcePortIdentity: ptp.PortIdentity{
PortNumber: portID,
ClockIdentity: clockID,
},
LogMessageInterval: 0x7f,
},
TLVs: []ptp.TLV{&ptp.AlternateResponsePortTLV{
TLVHead: ptp.TLVHead{TLVType: ptp.TLVAlternateResponsePort, LengthField: uint16(binary.Size(ptp.AlternateResponsePortTLV{}) - binary.Size(ptp.TLVHead{}))}, //#nosec G115
Offset: uint16(0),
}},
}
}

Expand Down Expand Up @@ -163,7 +167,7 @@ func NewClient(target netip.Addr, targetPort int, clockID ptp.ClockIdentity, eve
sequenceIDMask: sequenceIDMask,
sequenceIDValue: sequenceIDMaskedValue,
delayRequest: ReqDelay(clockID, 1),
delayReqBytes: make([]byte, binary.Size(ptp.Header{})+binary.Size(ptp.SyncDelayReqBody{})+ptp.TrailingBytes),
delayReqBytes: make([]byte, binary.Size(ptp.Header{})+binary.Size(ptp.SyncDelayReqBody{})+binary.Size(ptp.AlternateResponsePortTLV{})+ptp.TrailingBytes),
eventConn: eventConn,
eventAddr: eventAddr,
inChan: make(chan bool, 100),
Expand Down

0 comments on commit c89c3f0

Please sign in to comment.