Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Sep 2023 23:54:33 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 273807] tcpdump is not able to set honor the timezone of the PC as set in /etc/localtime
Message-ID:  <bug-273807-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D273807

            Bug ID: 273807
           Summary: tcpdump is not able to set honor the timezone of the
                    PC as set in /etc/localtime
           Product: Base System
           Version: 14.0-STABLE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: mike@sentex.net

Summary discussion here=20
https://lists.freebsd.org/archives/freebsd-stable/2023-September/001448.html

AMD64 VM of FreeBSD 14 from Sept 1st.  TCPDUMP (in the base and in the port=
s)
will not work properly when the timezone is set to something other than UTC=
.=20

e.g. tcpdump -nei pflog0 will display log entries always in UTC, despite wh=
at
/etc/localtime is set to.=20

des@freebsd.org wrote in the email thread

In stable/13, tcpdump reads /etc/localtime very early, and long before
entering capability mode:

 72111 tcpdump  0.007527 NAMI  "/etc/localtime"
 72111 tcpdump  0.007541 RET   open 3
 72111 tcpdump  0.007549 CALL  read(0x3,0x1a9058bb78c0,0xd6b8)
 72111 tcpdump  0.007627 RET   read 2298/0x8fa
 72111 tcpdump  0.007634 CALL  close(0x3)
 72111 tcpdump  0.007642 RET   close 0
 [...]
 72111 tcpdump  0.024369 CALL  cap_enter
 72111 tcpdump  0.024381 RET   cap_enter 0

In main and stable/14, it enters capability mode immediately before the
first attempt to read /etc/localtime, which fails:

   745 tcpdump  0.069967829 CALL  cap_enter
   745 tcpdump  0.070015646 RET   cap_enter 0
   745 tcpdump  0.070139522 CALL=20
fstatat(AT_FDCWD,0x1c377723d38e,0x1c3773430d00
,0)
   745 tcpdump  0.070196299 NAMI  "/etc/localtime"
   745 tcpdump  0.070240578 RET   fstatat -1 errno 94 Not permitted in
capability mode
   745 tcpdump  0.070487574 CALL=20
fstatat(AT_FDCWD,0x1c377723d38e,0x1c3773430cd0,0)
   745 tcpdump  0.070550458 NAMI  "/etc/localtime"
   745 tcpdump  0.070593003 RET   fstatat -1 errno 94 Not permitted in
capability mode

The simplest workaround is to call tzset(3) before entering capability
mode.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-273807-227>