Page MenuHomeFreeBSD

bsnmpd: Return the correct uptime.
ClosedPublic

Authored by imp on May 5 2021, 12:24 AM.
Tags
None
Referenced Files
F149553983: D30114.diff
Wed, Mar 25, 5:42 AM
Unknown Object (File)
Mon, Mar 23, 11:39 PM
Unknown Object (File)
Sun, Mar 22, 12:30 AM
Unknown Object (File)
Thu, Mar 19, 12:18 AM
Unknown Object (File)
Tue, Mar 17, 1:17 PM
Unknown Object (File)
Tue, Mar 17, 11:52 AM
Unknown Object (File)
Tue, Mar 17, 5:31 AM
Unknown Object (File)
Mon, Mar 16, 6:09 PM
Subscribers
None

Details

Summary

Do not assume that the kernel boot time is invariant. It is not. FreeBSD
uses the formula:
wall_time = boot_time + uptime
where uptime is monotinically increasing and boot_time is adjusted to
get the proper time of day. FreeBSD offers a way to retrieve the uptime
directly, so use that instead of trying to compute it by subtracting
boot_time from wall_time.

Sponsored by: Netflix

Test Plan

To test, one can step the time after starting bsnmpd. Since boot time changes but the new value isn't re-fetched, the uptime will step when it shouldn't.
With the fixed code, this doesn't happen.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

imp requested review of this revision.May 5 2021, 12:24 AM
imp created this revision.
imp edited the test plan for this revision. (Show Details)
imp retitled this revision from bsndmp: Return the correct uptime. to bsnmpd: Return the correct uptime..May 5 2021, 4:02 AM

This is certainly an improvement over the original.

However tabs have been replaced by spaces (0x20). Is this intentional?

This revision is now accepted and ready to land.May 5 2021, 4:40 AM
In D30114#676001, @cy wrote:

This is certainly an improvement over the original.

However tabs have been replaced by spaces (0x20). Is this intentional?

Nope... not sure how that happened.

This revision now requires review to proceed.May 5 2021, 5:47 AM
This revision is now accepted and ready to land.May 5 2021, 2:55 PM
This revision was automatically updated to reflect the committed changes.