Page MenuHomeFreeBSD

ndp: Prepare for pending tcpdump update
ClosedPublic

Authored by jrm on Jun 7 2023, 2:27 AM.
Tags
None
Referenced Files
F84425698: D40445.id122947.diff
Thu, May 23, 5:37 PM
F84425694: D40445.id122953.diff
Thu, May 23, 5:37 PM
F84425686: D40445.id122949.diff
Thu, May 23, 5:37 PM
Unknown Object (File)
Tue, May 21, 4:38 AM
Unknown Object (File)
Tue, May 21, 4:37 AM
Unknown Object (File)
Sun, May 19, 8:56 PM
Unknown Object (File)
Sun, May 19, 8:35 PM
Unknown Object (File)
Sun, May 19, 7:21 PM
Subscribers

Details

Summary

npd makes use of gmt2local, however that library has been removed from
tcpdump. Add utc_offset() as a substitute.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 51962
Build 48853: arc lint + arc unit

Event Timeline

jrm requested review of this revision.Jun 7 2023, 2:27 AM

Should we be concerned that the long tm->tm_gmtoff will be implicitly cast as int32_t when it's returned?

Make utc_offset() argument match gmt2local() and make it a static function.

This revision is now accepted and ready to land.Jun 7 2023, 4:36 PM

This seems OK as a minimal change.

We may want to follow tcpdump's ts_print() more closely though, in a subsequent change.

Assert that the value stored in tm->tm_gmtoff will fit in a int32_t.

This revision now requires review to proceed.Jun 7 2023, 6:07 PM

Nit: s/npd/ndp/ in commit log

usr.sbin/ndp/ndp.c
187

Given this is only used with a value of 0, I would maybe go ahead and assume that and remove the argument from here entirely, that is, have it start as:

static int32_t
utc_offset(void)
{
    struct tm *tm;
    time t;

    t = time(NULL);
    tm = localtime(&t);
...
197

Revert back to function with no arguments. Fix typo and formatting.

jrm marked 2 inline comments as done.Jun 7 2023, 8:54 PM
This revision was not accepted when it landed; it landed in state Needs Review.Jun 8 2023, 2:00 AM
This revision was automatically updated to reflect the committed changes.