Repository navigation
ptp4u: don't apply a denied grant renewal to a running subscription - #595
Support-itecz wants to merge 1 commit into
Conversation
|
Hi @Support-itecz! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Unless you sign CLA we can't review this |
Summary
handleGeneralMessageshandles a REQUEST_UNICAST_TRANSMISSION renewal for a running Announce, Sync or DelayResp subscription by callingSetExpire,SetIntervalandSetGclisafirst, and only then checkingMinSubIntervalandMaxSubDuration. An out-of-limit renewal gets a denial grant (duration 0), but the running subscription already carries the requested interval, expiry and reply address.Signaling is unauthenticated, so any host that can reach port 320 can do this with two packets: a normal grant request, then a renewal with a smaller log interval and a larger duration. With the default limits of 1s and 1h:
time.Duration. On the next tickStartcallsintervalTicker.Reset(0), which panics withnon-positive interval for Ticker.Resetand takes ptp4u down for every client.The fix evaluates the limit check once, before the subscription is touched, and only updates a running subscription when the request is within limits. Out-of-limit requests still get the same zero-duration grant, and new subscriptions behave as before. One behavior change worth knowing: the denial for a running subscription now goes to the address the subscription was granted with, not to the source of the rejected renewal.
Test Plan
Added
TestSignalingDeniedRenewalKeepsSubscriptiontoptp/ptp4u/server/server_test.go. It driveshandleGeneralMessagesover loopback like the existing DelayReq tests. It subscribes to Announce at log interval 0 for 60s, sends a renewal at log interval -7 for 0xFFFFFFFF seconds from a second port, then checks that a denial is sent and the subscription keeps its interval, expiry and address.Without the change to
server.go:With it:
The zero-interval crash, from a scratch test that sends the renewal at log interval -128 against the unpatched tree:
With the fix the same renewal is denied and the subscription stays at 1s.
Also ran on Linux in a golang:1.26 container with libpcap-dev:
go build ./...,go test -race ./...(all packages pass) andgolangci-lint run ./ptp/ptp4u/...(0 issues).