Page MenuHomeFreeBSD

ndp: Prepare for pending tcpdump update
ClosedPublic

Authored by jrm on Jun 7 2023, 2:27 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 14, 5:06 AM
Unknown Object (File)
Mar 21 2024, 7:05 AM
Unknown Object (File)
Mar 16 2024, 4:23 AM
Unknown Object (File)
Mar 16 2024, 4:22 AM
Unknown Object (File)
Mar 16 2024, 4:22 AM
Unknown Object (File)
Mar 16 2024, 4:22 AM
Unknown Object (File)
Mar 16 2024, 4:22 AM
Unknown Object (File)
Mar 12 2024, 10:03 AM
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 Not Applicable
Unit
Tests Not Applicable

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.