feat(network): add *BSD support via an ifconfig fallback - #408
Open
eric-eisenhart wants to merge 1 commit into
Open
feat(network): add *BSD support via an ifconfig fallback#408eric-eisenhart wants to merge 1 commit into
eric-eisenhart wants to merge 1 commit into
Conversation
Network.scan() read interface facts exclusively from Linux sysfs (/sys/class/net), so it could not run on *BSD. Abstract the OS-specific bits behind small helpers that use sysfs when present and fall back to parsing `ifconfig -a` otherwise: - Add netbox_agent/ifconfig.py: parse `ifconfig -a` for per-interface MAC and MTU (the facts scan() reads from /sys on Linux). - scan() enumerates interfaces and reads MAC/MTU/bonding/virtual via _use_sysfs()-guarded helpers; the Linux path is behaviorally unchanged. - ethtool is already skipped when the binary is absent, so *BSD NICs get ethtool=None (interface type falls back to Other), which downstream already handles. - Guard the MTU update so a missing (None) MTU never clears a known one. - Add a fixture + test parsing real FreeBSD `ifconfig` output. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
eric-eisenhart
force-pushed
the
feat/freebsd-support
branch
from
August 4, 2026 18:39
9d5294c to
b31bbd8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We've been running a variant of this code (copied out of netbox-agent several years ago) locally in order to get stuff working on FreeBSD, and I figured would be potentially useful to others and we should submit it upstream.
I used Claude to pull what we'd done on to the latest branch and otherwise clean it up to be good for a PR, but the original core code here was written by me and has been in-use for years on a variety of FreeBSD physical and virtual servers.
Network.scan() read interface facts exclusively from Linux sysfs (/sys/class/net), so it could not run on *BSD. Abstract the OS-specific bits behind small helpers that use sysfs when present and fall back to parsing
ifconfig -aotherwise:ifconfig -afor per-interface MAC and MTU (the facts scan() reads from /sys on Linux).ifconfigoutput.