1. 04 May, 2022 2 commits
    • Hans Petter Selasky's avatar
      xhci(4): Only drop BULK and INTERRUPT endpoints to reset data toggle. · 473c925e
      Hans Petter Selasky authored
      Only drop BULK and INTERRUPT endpoints, to reset the data toggle,
      because for other endpoint types this is not critical.
      Tested by:	ehaupt@
      PR:		262882
      Sponsored by:	NVIDIA Networking
      (cherry picked from commit e276d281)
    • Alexander Motin's avatar
      CAM: Keep periph_links when restoring CCB in camperiphdone(). · 8dab6aba
      Alexander Motin authored
      While recovery command executed, some other commands from the periph
      may complete, that may affect periph_links of this CCB.  So restoring
      original CCB we must keep current periph_links as more up to date.
      I've found this triggering assertions with debug kernel and suspect
      some memory corruptions otherwise when spun down disk receives two
      or sometimes more concurrent requests.
      MFC after:	1 week
      Sponsored by:	iXsystems, Inc.
      (cherry picked from commit 404f0011)
  2. 03 May, 2022 3 commits
  3. 02 May, 2022 2 commits
  4. 01 May, 2022 2 commits
    • Ed Maste's avatar
      ssh: use upstream SSH_OPENSSL_VERSION macro · eb845555
      Ed Maste authored
      With the upgrade to OpenSSH 6.7p1 in commit a0ee8cc6 we replaced
      WITH_OPENSSL ifdefs with an OPENSSL_VERSION macro, later changing it
      A few years later OpenSSH made an equivalent change (with a different
      macro name), in commit 4d94b031ff88.  Switch to the macro name they
      MFC after:	1 week
      Sponsored by:	The FreeBSD Foundation
      (cherry picked from commit 6e24fe61)
      (cherry picked from commit 41406f9251c0e186fe820f70e9da0606bff71dae)
    • Greg Foster's avatar
      lacp: short timeout erroneously declares link-flapping · 3cbc8109
      Greg Foster authored
      Panasas was seeing a higher-than-expected number of link-flap events.
      After joint debugging with the switch vendor, we determined there were
      problems on both sides; either of which might cause the occasional
      event, but together caused lots of them.
      On the switch side, an internal queuing issue was causing LACP PDUs --
      which should be sent every second, in short-timeout mode -- to sometimes
      be sent slightly later than they should have been. In some cases, two
      successive PDUs were late, but we never saw three late PDUs in a row.
      On the FreeBSD side, we saw a link-flap event every time there were two
      late PDUs, while the spec says that it takes *three* seconds of downtime
      to trigger that event. It turns out that if a PDU was received shortly
      before the timer code was run, it would decrement less than a full
      second after the PDU arrived. Then two delayed PDUs would cause two
      additional decrements, causing it to reach zero less than three seconds
      after the most-recent on-time PDU.
      The solution is to note the time a PDU arrives, and only decrement if at
      least a full second has elapsed since then.
      Reported by:	Greg Foster <gfoster@panasas.com>
      Reviewed by:	gallatin
      Tested by:	Greg Foster <gfoster@panasas.com>
      MFC after:	3 days
      Sponsored by:	Panasas
      Differential Revision:	https://reviews.freebsd.org/D35070
      (cherry picked from commit 00a80538)
  5. 28 Apr, 2022 1 commit
    • Kyle Evans's avatar
      amd64, i386: remove profile directive from NOTES · 72916c8a
      Kyle Evans authored
      Support for this directive has been removed in config(8) on main,
      which leaves us unable to build LINT with newer config(8).  It's
      believed that mcount-based profiling didn't really work on modern
      systems anyways, so the value of testing this is low.
      We avoid providing limited backwards compatibility here to continue and
      warn folks that may somehow be deploying real-world configs with `profile`
      This is a direct commit to stable/12, but a partial MFC of aa3ea612.
  6. 27 Apr, 2022 8 commits
    • Hans Petter Selasky's avatar
      xhci(4): Ensure the so-called data toggle gets properly reset. · 8a047df9
      Hans Petter Selasky authored
      Use the drop and enable endpoint context commands to force a reset of
      the data toggle for USB 2.0 and USB 3.0 after:
       - clear endpoint halt command (when the driver wishes).
       - set config command (when the kernel or user-space wants).
       - set alternate setting command (only affected endpoints).
      Some XHCI HW implementations may not allow the endpoint reset command when
      the endpoint context is not in the halted state.
      Reported by:		Juniper and Gary Jennejohn
      MFC after:		1 week
      Sponsored by:		NVIDIA Networking
      (cherry picked from commit cda31e73)
    • J.R. Oldroyd's avatar
      e1000: Try auto-negotiation for fixed 100 or 10 configuration · 59fc91f9
      J.R. Oldroyd authored
      Currently if an e1000 interface is set to a fixed media configuration,
      for gigabit, it will participate in auto-negotiation as required by
      IEEE 802.3-2018 Clause 37. However, if set to fixed media configuration
      for 100 or 10, it does NOT participate in auto-negotiation.
      By my reading of Clauses 28 and 37, while auto-negotiation is optional
      for 100 and 10, it is not prohibited and is, in fact, "highly
      This patch enables auto-negotiation for fixed 100 and 10 media
      configuration, in a similar manner to that already performed for 1000.
      I.e., the patch enables advertising of just the manually configured
      settings with the goal of allowing the remote end to match the manually
      configured settings if it has them available.
      To be clear, this patch does NOT allow an em(4) interface that has been
      manually configured with specific media settings to respond to
      auto-negotiation by then configuring different parameters to those that
      were manually configured. The intent of this patch is to fully comply
      with the requirements of Clause 37, but for 100 and 10.
      The need for this has arisen on an em(4) link where the other end is
      under a different administrative control and is set to full
      auto-negotiation. Due to the cable length GigE is not working well. It
      is desired to set the em(4) end to "media 100baseTX mediatype
      full-duplex" which does work when both ends are configured that way.
      Currently, because em(4) does not participate in autoneg for this
      setting, the remote defaults to half-duplex - i.e., there's a duplex
      mismatch and things don't work. With this patch, em(4) would inform the
      remote that it has only 100baseTX full, the remote would match that and
      it will work.
      Approved by:	erj
      Differential Revision:	https://reviews.freebsd.org/D34449
      (cherry picked from commit 9ab4dfce)
    • Kevin Bowling's avatar
      e1000: Update mc filter before RCTL flags · adf0ac34
      Kevin Bowling authored
      Update mc filter array before changing RCTL flags as in 5a3eb620
      Approved by:	grehan
      (cherry picked from commit 07ede751)
    • Kevin Bowling's avatar
      ixgbe: Update mc filter before FCTRL flags · fc3ef237
      Kevin Bowling authored
      Update mc filter array before changing FCTRL flags, similar to 5a3eb620
      Approved by:	grehan
      (cherry picked from commit 395cc55d)
    • Kristof Provost's avatar
      pf: counter argument to pfr_pool_get() may never be NULL · a618bb0f
      Kristof Provost authored
      Coverity points out that if counter was NULL when passed to
      pfr_pool_get() we could potentially end up dereferencing it.
      Happily all users of the function pass a non-NULL pointer. Enforce this
      by assertion and remove the pointless NULL check.
      Reported by:	Coverity (CID 273309)
      MFC after:	1 week
      Sponsored by:	Rubicon Communications, LLC ("Netgate")
      (cherry picked from commit efc64d02)
    • Kristof Provost's avatar
      pfsync: NULL check before dereference · f3b722fe
      Kristof Provost authored
      Move the use of 'sc' to after the NULL check.
      It's very unlikely that we'd actually hit this, but Coverity is correct
      that it's not a good idea to dereference the pointer and only then NULL
      check it.
      Reported by:	Coverity (CID 1398362)
      MFC after:	1 week
      Sponsored by:	Rubicon Communications, LLC ("Netgate")
      (cherry picked from commit 43020350)
    • Kristof Provost's avatar
      pf: remove pointless NULL check · 5bc3ab86
      Kristof Provost authored
      pfi_kkif_attach() always returns non-NULL, and we dereference the
      pointer before we check it, so that's pointless.
      Reported by:	Coverity (CID 1007345)
      MFC after:	1 week
      Sponsored by:	Rubicon Communications, LLC ("Netgate")
      (cherry picked from commit ed6287c1)
    • Kristof Provost's avatar
      callout: fix using shared rmlocks · 8bd26421
      Kristof Provost authored
      15b1eb14 changed the callout code to store the CALLOUT_SHAREDLOCK flag
      in c_iflags (where it used to be c_flags), but failed to update the
      check in softclock_call_cc(). This resulted in the callout code always
      taking the write lock, even if a read lock had been requested (with
      the CALLOUT_SHAREDLOCK flag in callout_init_rm()).
      Reviewed by:	markj
      MFC after:	1 week
      Sponsored by:	Rubicon Communications, LLC ("Netgate")
      Differential Revision:	https://reviews.freebsd.org/D34959
      (cherry picked from commit a879e40c)
  7. 26 Apr, 2022 3 commits
  8. 25 Apr, 2022 4 commits
    • Cy Schubert's avatar
      libexec/rc.d/hostapd: Down/up interface when interface is specified · d818ef7d
      Cy Schubert authored
      When no interface is specified results in a syntax error in the rc
      script. Only execute poststart when an interface has been specified.
      PR:		263358
      Submitted by:	markj
      Reported by:	Joshua Kinard <freebsd@kumba.dev>
      Fixes:		0da2c91e
      (cherry picked from commit 1452bfcd)
    • Ed Maste's avatar
      ssh: apply style(9) to version_addendum · 776b9127
      Ed Maste authored
      Reported by:	allanjude (in review D29953)
      Fixes:		462c32cb ("Upgrade OpenSSH to 6.1p1.")
      MFC after:	1 week
      Sponsored by:	The FreeBSD Foundation
      (cherry picked from commit 613b4b79)
    • Cameron Katri's avatar
      cp: Make -P work without -R as per POSIX · 19413ce6
      Cameron Katri authored
      According to POSIX, cp should allow the `-P` flag to work whether `-R`
      is specified or not.  Currently, the `-P` option only works along with
      PR:		199466
      Reviewed by:	kevans
      (cherry picked from commit 97e13037)
    • Kyle Evans's avatar
      cp: fix -R with links · 1d9f60b0
      Kyle Evans authored
      The traversal was previously not properly honoring -H/-L/-P.  Notably,
      we should not have been resolving symlinks encountered during traversal
      when either -H or -P are specified.
      Sponsored by:	Klara, Inc.
      Reviewed by:	bapt
      (cherry picked from commit 33ad990c)
  9. 24 Apr, 2022 3 commits
    • Kyle Evans's avatar
      stand: zfs: handle holes at the tail end correctly · 9a1efa76
      Kyle Evans authored
      This mirrors dmu_read_impl(), zeroing out the tail end of the buffer and
      clipping the read to what's contained by the block that exists.
      This fixes an issue that arose during the 13.1 release process; in
      13.1-RC1 and later, setting up GELI+ZFS will result in a failure to
      boot.  The culprit is this, which causes us to fail to load geom_eli.ko
      as there's a residual portion after the single datablk that should be
      zeroed out.
      PR:		263407
      Reviewed by:	tsoome
      (cherry picked from commit 914dc91d)
    • Kyle Evans's avatar
      cp: fix -R recursion detection · a605ca25
      Kyle Evans authored
      The correct logic is a lot simpler than the previous iteration.  We
      record the base fts_name to avoid having to worry about whether we
      needed the root symlink name or not (as applicable), then we can simply
      shift all of that logic to after path translation to make it less
      If we're copying to DNE, then we'll have swapped out the NULL root_stat
      pointer and then attempted to recurse on it.  The previously nonexistent
      directory shouldn't exist at all in the new structure, so just back out
      from that tree entirely and move on.
      The tests have been amended to indicate our expectations better with
      subdirectory recursion.  If we copy A to A/B, then we expect to copy
      everything from A/B/* into A/B/A/B, with exception to the A that we
      create in A/B.
      Reviewed by:	bapt
      Sponsored by:	Klara, Inc.
      (cherry picked from commit f00f8b4f)
    • Kyle Evans's avatar
      cp: fix some cases with infinite recursion · b5795471
      Kyle Evans authored
      As noted in the PR, cp -R has some surprising behavior.  Typically, when
      you `cp -R foo bar` where both foo and bar exist, foo is cleanly copied
      to foo/bar.  When you `cp -R foo foo` (where foo clearly exists), cp(1)
      goes a little off the rails as it creates foo/foo, then discovers that
      and creates foo/foo/foo, so on and so forth, until it eventually fails.
      POSIX doesn't seem to disallow this behavior, but it isn't very useful.
      GNU cp(1) will detect the recursion and squash it, but emit a message in
      the process that it has done so.
      This change seemingly follows the GNU behavior, but it currently doesn't
      warn about the situation -- the author feels that the final product is
      about what one might expect from doing this and thus, doesn't need a
      warning.  The author doesn't feel strongly about this.
      PR:		235438
      Reviewed by:	bapt
      Sponsored by:	Klara, Inc.
      (cherry picked from commit 848263aa)
  10. 23 Apr, 2022 4 commits
  11. 22 Apr, 2022 1 commit
  12. 21 Apr, 2022 3 commits
    • Kyle Evans's avatar
      loader: userboot: provide a getsecs() implementation · 53fefea5
      Kyle Evans authored
      We don't need it for userboot, but it avoids issues with BIND_NOW, so
      just provide it.  time(3) isn't defined but ends up being provided by
      libc linked into the host process, which is generally fine.
      PR:	262920
      Reviewed by:	imp, jhb
      (cherry picked from commit 660c1892)
    • Kyle Evans's avatar
      stand: libefi: swap /Pci() printing around · 13cc5276
      Kyle Evans authored
      Printing device followed by interface matches, e.g., edk2.  Note that
      this is only a fallback, many firmware implementations will provide the
      protocol that we'll use to format device paths.
      Reviewed by:	imp, tsoome
      Sponsored by:	Ampere Computing
      Submitted by:	Klara, Inc.
      (cherry picked from commit 454630c7)
    • Gordon Bergling's avatar
      time(3): Refine history in the manual page · cf1c35c9
      Gordon Bergling authored
      The time() system call first appeared in Version 1 AT&T UNIX.  Through
      the Version 3 AT&T UNIX, it returned 60 Hz ticks since an epoch that
      changed occasionally, because it was a 32-bit value that overflowed in a
      little over 2 years.
      In Version 4 AT&T UNIX the granularity of the return value was reduced to
      whole seconds, delaying the aforementioned overflow until 2038.
      Version 7 AT&T UNIX introduced the ftime() system call, which returned
      time at a millisecond level, though retained the gtime() system call
      (exposed as time() in userland).  time() could have been implemented as a
      wrapper around ftime(), but that wasn't done.
      4.1cBSD implemented a higher-precision time function gettimeofday() to
      replace ftime() and reimplemented time() in terms of that.
      Since FreeBSD 9 the implementation of time() uses
      clock_gettime(CLOCK_SECOND) instead of gettimeofday() for performance
      With most valuable input from Warner (imp@).
      Reviewed by:	0mp, jilles, imp
      Differential Revision:	https://reviews.freebsd.org/D34751
      (cherry picked from commit 3e0f3678)
  13. 20 Apr, 2022 2 commits
    • Ed Maste's avatar
      vidcontrol: disable p, P, and H when vt(4) is in use · 1bb77846
      Ed Maste authored
      These options use the CONS_SCRSHOT ioctl to capture the contents of the
      current console, which is not yet supported by vt(4).  Disable the
      options when vt(4) is in use rather than emitting a possibly confusing
      error message.
      This change should be reverted if CONS_SCRSHOT is implemented for vt(4).
      PR:		263099
      MFC after:	1 week
      Sponsored by:	The FreeBSD Foundation
      (cherry picked from commit c71ae91f)
      (cherry picked from commit 1f4442f7)
      (cherry picked from commit 4aa249b5f367c3fe0aec287bbf156131ec75ebd3)
    • Ed Maste's avatar
      ssh-agent: move -x description to correct spot in man page · 60b63dfe
      Ed Maste authored
      MFC after:	3 days
      Sponsored by:	The FreeBSD Foundation
      (cherry picked from commit eb45bc68)
  14. 18 Apr, 2022 2 commits
    • Stefan Eßer's avatar
      bin/df: add back linking with getmntops.c from sbin/mount · 879a6b7b
      Stefan Eßer authored
      A last minute clean-up of the Makefile erroneously removed the
      definitions required to link against sbin/mount/getmntops.c which
      defines the iovec handling functions used for the unmounted device
      case (that has been removed from -CURRENT and 13-STABLE).
      Put back the definitions to make the build with MOUNT_CHAR_DEVS
      defined succeed.
    • Stefan Eßer's avatar
      bin/df: fix build with MOUNT_CHAR_DEVS defined · 7dfb8f15
      Stefan Eßer authored
      When resolving conflicts due to the unmergewd commit that removed the
      code previously made conditional on MOUNT_CHAR_DEVS, I failed to see
      that MOUNT needed to be defined in the Makefile and that the include
      of mntopts.h was still required for that case.
      Fix the build by adding back the missing definitions to the Makefile.