John-Mark Gurney wrote: > Roman Bogorodskiy wrote this message on Thu, Jun 19, 2025 at 18:50 +0200: > > Hi, > > > > Is there a way to check if the given bhyve binary supports tcp console, > > such as "... -l com1,tcp=<tcpconf>"? > > > > I've been using various workarounds to detect bhyve features for quite > > some time, including parsing of the "bhyve -h" output or running "bhyve > > -s 0,<dev>" and see if reports unknown device etc, but apparently none > > of that works for the tcp console. > > > > Am I missing something or is it really not possible? > > Likely the current best way is to use `uname -U`, and have a table to > check which version the feature was added. Less than ideal, in that > you'll have to dig that info up, but not entirely terribly hard to do. > > Use git blame to figure out commit hash when a feature was added, then > use: > git show <rev>:sys/sys/param.h | grep __FreeBSD_version > > to fetch it. Annoyingly, this will may need to be done for each stable > branch as features are backported. > > This obviously doesn't solve the problem where someone in place upgraded > bhyve, but that shouldn't be common, and if they did that, they should > know that they might break things.
It's not terribly hard to do, but cumbersome enough not to do it. Also, it's not quite accurate, obviously, because there's no direct mapping of __FreeBSD_version bumps to bhyve features. Not sure how uncommon is the inplace upgrade usecase, but I use it from time to time to test patches that are not committed yet, and approach like that complicates things. I would not say that the inplace upgrade "breaks things" in this specific case, it's just that approach is not accurate enough. Quite some time ago I've proposed a different approach which I think is more accurate: https://reviews.freebsd.org/D15992. Sadly, it didn't move anywhere, though I was able to work around the lack of feature detection by various hacks like analyzing error message outputs (which is already not super reliable though). TCP console is, unfortunately, the first feature that I wasn't able to find detection workaround for. Roman