1. 23 Jan, 2022 2 commits
    • Cy Schubert's avatar
      rc.d/ntp: Ensure ntpd.leap-seconds.list is readable by ntpd · 28d0a782
      Cy Schubert authored
      When a use sets umask in login.conf(5) to 027 or 077 a subsequently
      fetched /var/db/ntpd.leap-seconds.list will inherit the permissions
      allowed by the umask, resulting in a file that may not be readable
      ntpd running under the ntp account. This patch adds a umask command
      to preempt the umask in login.conf(5) prior to fetching a new copy
      of the leap-seconds file.
      PR:		261298
      Reported by:	Martin Waschbusch <martin@waschbuesch.de>
      (cherry picked from commit c6806434)
    • Alexander Motin's avatar
      Fix inverse sleep logic in buf_daemon(). · c8c305ac
      Alexander Motin authored
      Before commit 3cec5c77 buf_daemon() went to longer 1s sleep if
      numdirtybuffers <= lodirtybuffers.  After that commit new condition
      !BIT_EMPTY(BUF_DOMAINS, &bdlodirty) got opposite -- true when one
      or more more domains is above lodirtybuffers.  As result, on freshly
      booted system with no dirty buffers buf_daemon() wakes up 10 times
      per second and probably only 1 time per second when there is actual
      work to do.
      MFC after:	1 week
      Reviewed by:	kib, markj
      Tested by:	pho
      Differential revision:	https://reviews.freebsd.org/D33890
      (cherry picked from commit e76c0108)
  2. 21 Jan, 2022 3 commits
    • Edward Tomasz Napierala's avatar
      rc: make ctld depend on NETWORKING · e265658e
      Edward Tomasz Napierala authored
      This fixes a problem where ctld(8) would refuse to start on boot
      with a specific IP address to listen on configured in ctl.conf(5).
      It also fixes a problem where ctld(8) would fail to start with
      some network interfaces which require a sysctl.conf(5) tweak
      to configure them, eg to switch them from InfiniBand to IP mode.
      PR:		232397
      Reported By:	Mahmoud Al-Qudsi <mqudsi at neosmart.net>
      Submitted By:	Jeremy Faulkner <gldisater at gmail.com>
      (cherry picked from commit 015351de)
    • Andriy Gapon's avatar
      adaspindown: check disk power mode before sending IDLE command · c902b608
      Andriy Gapon authored
      If a disk is already in STANDBY mode, then setting IDLE mode can
      actually spin it up.
      (cherry picked from commit 15910dc0)
    • Mark Johnston's avatar
      netbsd-tests: Fix the libc stat_socket test · 9f192dd7
      Mark Johnston authored
      The test tries to connect a socket to a closed port at  It
      sets O_NONBLOCK on the socket first and expects to get EINPROGRESS from
      connect(2), but this is not guaranteed, ECONNREFUSED is possible.
      Handle both cases, and re-enable the test.
      PR:		240621
      Sponsored by:	The FreeBSD Foundation
      (cherry picked from commit 95c75073)
  3. 20 Jan, 2022 1 commit
    • Kenneth D. Merry's avatar
      Free UMA zones when a pass(4) instance goes away. · 6d1a5632
      Kenneth D. Merry authored
      If the UMA zones are not freed, we get warnings about re-using the
      sysctl variables associated with the UMA zones, and we're leaking
      the other memory associated with the zone structures.  e.g.:
      sysctl_warn_reuse: can't re-use a leaf (vm.uma.pass44.size)!
      sysctl_warn_reuse: can't re-use a leaf (vm.uma.pass44.flags)!
      sysctl_warn_reuse: can't re-use a leaf (vm.uma.pass44.bucket_size)!
      sysctl_warn_reuse: can't re-use a leaf (vm.uma.pass44.bucket_size_max)!
      sysctl_warn_reuse: can't re-use a leaf (vm.uma.pass44.keg.name)!
      sysctl_warn_reuse: can't re-use a leaf (vm.uma.pass44.keg.rsize)!
      sysctl_warn_reuse: can't re-use a leaf (vm.uma.pass44.keg.ppera)!
      sysctl_warn_reuse: can't re-use a leaf (vm.uma.pass44.keg.ipers)!
      Also, correctly clear the PASS_FLAG_ZONE_INPROG flag in
      passcreatezone().  The way it was previously done, it would have
      had set the flag and cleared all other flags that were set at
      that point.
      Sponsored by:	Spectra Logic
      (cherry picked from commit ca2a7262)
  4. 19 Jan, 2022 7 commits
  5. 18 Jan, 2022 7 commits
    • Joerg Wunsch's avatar
      usbconfig: actually set the exit code in usage() · 1cab5dac
      Joerg Wunsch authored
      Oversight in previous commit: usage() had been turned to accept
      an "exitcode" parameter, but it hasn't been used.
      (cherry picked from commit 1654b514)
    • Joerg Wunsch's avatar
      usbconfig: implement a -v option · bb0b7f40
      Joerg Wunsch authored
      Implement a -v option to usbconfig(8), as a shortcut for the most
      frequently needed commands dump_device_desc, dump_curr_config_desc,
      and show_ifdrv.
      While here, implement a real -h option that has been promised by the
      man page.
      Use <sysexits.h> to declare the utility return codes.
      Reviewed by:	hselasky
      Differential Revision:	https://reviews.freebsd.org/D33586
      (cherry picked from commit d69b9cc2)
    • Joerg Wunsch's avatar
      usbconfig: documentation fixes, mainly for -i option · 940db7ed
      Joerg Wunsch authored
      * in usage(), clearly mark -i interface as optional
      * both, -u busnum and -a devaddr are optional as well
      * various minor man page fixes
      * clearly mark those two commands that actually use -i ifaceidx
      * remove unused bitfield tag got_iface
      * fix indentation level according to review comment
      Differential Revision:	https://reviews.freebsd.org/D33579/
      Reviewed by:	hselasky
      (cherry picked from commit cae1884d)
    • Joerg Wunsch's avatar
      usbconfig: use getopt(3) for option handling · 08185384
      Joerg Wunsch authored
      This makes option handling consistent with other utilities as well as
      Posix rules. By that, it's no longer important whether option name and
      its argument are separated by a space or not, so -d5.3 works the same
      as -d 5.3.
      Also, recognize either /dev/ugen or ugen as prefix to the -d argument.
      Note that this removes the undocumented feature that allowed to
      specify multiple -d n.m options interleaved with commands referring to
      that particular device in a single run.
      (cherry picked from commit ae450e6d)
    • Alan Somers's avatar
      fusefs: in the tests, always assume debug.try_reclaim_vnode is available · 542dbacf
      Alan Somers authored
      In an earlier version of the revision that created that sysctl (D20519)
      the sysctl was gated by INVARIANTS, so the test had to check for it.
      But in the committed version it is always available.
      (cherry picked from commit 19ab3610)
      fusefs: move common code from forget.cc to utils.cc
      (cherry picked from commit 8d99a6b9)
      fusefs: fix .. lookups when the parent has been reclaimed.
      By default, FUSE file systems are assumed not to support lookups for "."
      and "..".  They must opt-in to that.  To cope with this limitation, the
      fusefs kernel module caches every fuse vnode's parent's inode number,
      and uses that during VOP_LOOKUP for "..".  But if the parent's vnode has
      been reclaimed that won't be possible.  Previously we paniced in this
      situation.  Now, we'll return ESTALE instead.  Or, if the file system
      has opted into ".." lookups, we'll just do that instead.
      This commit also fixes VOP_LOOKUP to respect the cache timeout for ".."
      lookups, if the FUSE file system specified a finite timeout.
      PR:		259974
      Reviewed by:	pfg
      Differential Revision: https://reviews.freebsd.org/D33239
      (cherry picked from commit 1613087a)
    • Alan Somers's avatar
      Fix a race in fusefs that can corrupt a file's size. · c85846ea
      Alan Somers authored
      VOPs like VOP_SETATTR can change a file's size, with the vnode
      exclusively locked.  But VOPs like VOP_LOOKUP look up the file size from
      the server without the vnode locked.  So a race is possible.  For
      1) One thread calls VOP_SETATTR to truncate a file.  It locks the vnode
         and sends FUSE_SETATTR to the server.
      2) A second thread calls VOP_LOOKUP and fetches the file's attributes from
         the server.  Then it blocks trying to acquire the vnode lock.
      3) FUSE_SETATTR returns and the first thread releases the vnode lock.
      4) The second thread acquires the vnode lock and caches the file's
         attributes, which are now out-of-date.
      Fix this race by recording a timestamp in the vnode of the last time
      that its filesize was modified.  Check that timestamp during VOP_LOOKUP
      and VFS_VGET.  If it's newer than the time at which FUSE_LOOKUP was
      issued to the server, ignore the attributes returned by FUSE_LOOKUP.
      PR:		259071
      Reported by:	Agata <chogata@moosefs.pro>
      Reviewed by:	pfg
      Differential Revision: https://reviews.freebsd.org/D33158
      (cherry picked from commit 13d593a5)
    • Xin LI's avatar
      file: upgrade to 5.41. · 17886a89
      Xin LI authored
      (cherry picked from commit 43a5ec4e)
  6. 17 Jan, 2022 1 commit
  7. 15 Jan, 2022 2 commits
  8. 14 Jan, 2022 1 commit
  9. 11 Jan, 2022 1 commit
  10. 10 Jan, 2022 3 commits
    • Cy Schubert's avatar
      ipfilter: Add SDT probe frb_natv6in · 486bb274
      Cy Schubert authored
      Like IPv4 NAT frb_natv4in, add a corresponding IPv6 NAT SDT probe called
      (cherry picked from commit 6b54d2f4)
    • Cy Schubert's avatar
      ipfilter: Unconditionally expose SDT probe frb_natv4in · 2c3f2c5d
      Cy Schubert authored
      SDT probe frb_natv4in is only available when an error is encountered.
      Make it also available when no error is encountered, i.e. NATed and
      not translated.
      (cherry picked from commit b6f072f7)
    • Ed Maste's avatar
      Build libclang also if LLDB is enabled · 620d1564
      Ed Maste authored
      LLDB depends on libclang as it uses Clang as the expression parser.
      Previously setting WITHOUT_CLANG but leaving LLDB enabled (as default)
      resulted in a build failure.
      Users who set WITHOUT_CLANG in order to reduce build time or size
      might want to set WITHOUT_LLDB in addition to WITHOUT_CLANG, or use
      WITHOUT_TOOLCHAIN instead.
      PR:		260993
      Reported by:	eugen
      Reviewed by:	dim
      MFC after:	3 days
      Sponsored by:	The FreeBSD Foundation
      (cherry picked from commit adc88b9c)
  11. 09 Jan, 2022 2 commits
  12. 08 Jan, 2022 1 commit
    • Cy Schubert's avatar
      ipfilter: Make LARGE_NAT a tunable. · 07738547
      Cy Schubert authored
      LARGE_NAT is a C macro that increases
      	NAT_SIZE from 127 to 2047,
      	RDR_SIZE from 127 to 2047,
      	HOSTMAP_SIZE from 2047 to 8191,
      	NAT_TABLE_MAX from 30000 to 180000, and
      	NAT_TABLE_SZ from 2047 to 16383.
      These values can be altered at runtime using the ipf -T command however
      some adminstrators of large firewalls rebuild the kernel to enable
      LARGE_NAT at boot. This revision adds the tunable net.inet.ipf.large_nat
      which allows an administrator to set this option at boot instead of build
      time. Setting the LARGE_NAT macro to 1 is unaffected allowing build-time
      users to continue using the old way.
      (cherry picked from commit a805ffbc)
  13. 07 Jan, 2022 1 commit
  14. 06 Jan, 2022 1 commit
    • Vincenzo Maffione's avatar
      net: iflib: sync isc_capenable to if_capenable · 5df59718
      Vincenzo Maffione authored
      On SIOCSIFCAP, some bits in ifp->if_capenable may be toggled.
      When this happens, apply the same change to isc_capenable, which
      is the iflib private copy of if_capenable (for a subset of the
      IFCAP_* bits). In this way the iflib drivers can check the bits
      using isc_capenable rather than if_capenable. This is convenient
      because the latter access requires an additional indirection
      through the ifp, and it is also less likely to be in cache.
      PR:		260068
      Reviewed by:	kbowling, gallatin
      MFC after:	1 week
      Differential Revision:	https://reviews.freebsd.org/D33156
      (cherry picked from commit 4561c4f0)
  15. 05 Jan, 2022 2 commits
    • Ed Maste's avatar
      readelf: add Go Build ID ELF note support · dfe7186f
      Ed Maste authored
      Reviewed by:	markj
      MFC after:	1 week
      Differential Revision:	https://reviews.freebsd.org/D33379
      (cherry picked from commit ca457394)
    • Ed Maste's avatar
      ar: deprecate -T option · df898828
      Ed Maste authored
      Other ar implementations (GNU, LLVM) use -T to mean thin archive
      rather than use only the first fifteen characters of the archive member
      name.  We support both -T and -f for this, with -f documented as an
      alias of -T.
      An exp-run showed that the ports invoking `ar -T` expect thin archives,
      not truncated names.  Switch -f to be the documented flag for this
      behaviour, and emit a warning when -T is used.
      The warning will be changed to an error in the future (in main), once
      ports no longer use -T.
      PR:		260523 [exp-run]
      MFC after:	1 week
      Sponsored by:	The FreeBSD Foundation
      (cherry picked from commit edadbb46)
  16. 04 Jan, 2022 1 commit
  17. 03 Jan, 2022 4 commits
    • Cy Schubert's avatar
      wpa: Import wpa_supplicant/hostapd commit 14ab4a816 · 9a2c888a
      Cy Schubert authored
      This is the November update to vendor/wpa committed upstream 2021-11-26.
      (cherry picked from commit 4b72b91a)
    • Lutz Donnerhacke's avatar
      tests/libalias: Portrange · 8925a302
      Lutz Donnerhacke authored
      Test ranges of allowed ports for aliasing.
       - Explicit default like ipfw(8) is doing
       - Regular range
       - Exhausting a very small range
       - Recovery
      Includes a fix of an utility macro, which was not used before.
      Differential Revision: https://reviews.freebsd.org/D31012
      (cherry picked from commit 2c733b50)
    • Andriy Gapon's avatar
      aw_spi: improve I/O stability · 1e7b0dc0
      Andriy Gapon authored
      This driver does not use DMA at the moment, so some care is needed to
      prevent TX FIFO underruns and RX FIFO overflows.
      Several improvements are done in oder to minimize chances of those.
      First, the interrupt handling is moved to a filter to minimize latency.
      Second, FIFO trigger thresholds are configured for both FIFOs.
      The TX FIFO threshold is set to 3/4-th of its size and the RX FIFO
      threshold is set to 1/4-th of its size.
      The interrupt conditions are changed from the empty FIFO and full FIFO
      for the TX and RX correspondingly to going below and above the thresholds.
      While here I renamed AW_SPI_IER_RF_ERQ to AW_SPI_IER_RF_RDY which is
      closer to what the documentation uses, RF_RDY_INT_EN in the interrupt
      control register and RX_RDY in the interrupt status register.
      (cherry picked from commit 08ff54dc)
    • Alan Somers's avatar
      nfs: don't truncate directory cookies to 32-bits in the NFS server · 374e8226
      Alan Somers authored
      In NFSv2, the directory cookie was 32-bits.  NFSv3 widened it to
      64-bits and SVN r22521 widened the corresponding argument in
      VOP_READDIR, but FreeBSD's NFS server continued to treat the cookies as
      32-bits, and 0-extended to fill the field on the wire.  Nobody ever
      noticed, because every in-tree file system generates cookies that fit
      comfortably within 32-bits.
      Also, have better type safety for txdr_hyper.  Turn it into an inline
      function that type-checks its arguments.  Prevents warnings about
      PR:		260375
      Reviewed by:	rmacklem
      Differential Revision: https://reviews.freebsd.org/D33404
      (cherry picked from commit 32fbc5d8)