feat: FreeBSD and OpenBSD drivers, read side
CI / test (3.10) (push) Successful in 42s
CI / test (3.11) (push) Successful in 37s
CI / test (3.12) (push) Successful in 29s

FreeBSDDriver (`freebsd`) and OpenBSDDriver (`openbsd`) on a shared
BsdDriver, for the BSD VMs netOrk provisions and BSD hosts added by hand
(NetOrk/netork#798).

- SSH over exec channels (napalm-device-types' run_on_transport): no PTY,
  stdout and stderr apart, real exit codes; run_command()/open_stream()
  are public. Root through `sudo -S` with the password on stdin, or
  `sudo -n` without one.
- Facts: hostname, release and running kernel (freebsd-version / uname),
  hardware from SMBIOS (kenv) or hw.* sysctls, uptime from kern.boottime.
- Interfaces and addresses (ifconfig -a: ether/lladdr, hex netmasks,
  scoped IPv6), routes (netstat -rn, OpenBSD's abbreviated networks
  written out, host/broadcast/loopback entries left out), ARP (FreeBSD's
  sentences, OpenBSD's table), users and groups, processes (lstart read as
  one five-word field), cron jobs (system crontab and the login user's).
- Parsers are pure functions, tested on output recorded from FreeBSD 15.1
  (hand-installed and cloud image) and OpenBSD 7.9 (NetOrk/netork#793),
  with internal addresses replaced by documentation ranges.
This commit is contained in:
2026-10-08 09:12:53 +02:00
commit 14afd33798
104 changed files with 3973 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
uname -a
freebsd-version -kru
cat /etc/os-release
sysctl -n kern.hostname kern.ostype kern.osrelease kern.version
sysctl -n hw.model hw.ncpu hw.physmem hw.machine_arch
sysctl -n kern.boottime
sysctl -n kern.smp.cpus vm.stats.vm.v_page_count vm.stats.vm.v_free_count vm.stats.vm.v_page_size
kenv -q smbios.system.product smbios.system.serial smbios.system.maker smbios.bios.vendor
uptime
ifconfig -a
netstat -rn
netstat -rnW -f inet
netstat -rnW -f inet6
arp -an
ndp -an
sockstat -l -4 -6
sockstat -l -4 -6 -P tcp,udp -q
netstat -an -f inet
pkg -N
pkg info
pkg query '%n\t%v\t%o\t%c'
pkg version -vRL=
service -e
sysrc -a
cat /etc/passwd
ps -axww -o user,pid,ppid,%cpu,%mem,vsz,rss,stat,lstart,command
crontab -l
cat /etc/crontab
df -k
swapinfo -k
kldstat
which sudo doas python3 bash snmpd bsnmpd
ls /usr/local/etc/rc.d /etc/rc.d
cat /etc/rc.conf
id
cat /etc/group
+3
View File
@@ -0,0 +1,3 @@
? (192.0.2.254) at bc:24:11:3c:e2:d0 on em0 expires in 1176 seconds [ethernet]
? (192.0.2.1) at bc:24:11:90:8b:c0 on em0 expires in 1137 seconds [ethernet]
? (192.0.2.104) at bc:24:11:20:b0:20 on em0 permanent [ethernet]
+22
View File
@@ -0,0 +1,22 @@
# /etc/crontab - system crontab for FreeBSD
#
#
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
#
#minute hour mday month wday who command
#
# Save some entropy so that /dev/random can re-seed on boot.
*/11 * * * * operator /usr/libexec/save-entropy
#
# Rotate log files every hour, if necessary.
0 * * * * root newsyslog
#
# Perform daily/weekly/monthly maintenance.
1 3 * * * root periodic daily
15 4 * * 6 root periodic weekly
30 5 1 * * root periodic monthly
#
# Adjust the time zone if the CMOS clock keeps local time, as opposed to
# UTC time. See adjkerntz(8) for details.
1,31 0-5 * * * root adjkerntz -a
+39
View File
@@ -0,0 +1,39 @@
wheel:*:0:root
daemon:*:1:
kmem:*:2:
sys:*:3:
tty:*:4:
operator:*:5:root
mail:*:6:
bin:*:7:
news:*:8:
man:*:9:
games:*:13:
ftp:*:14:
staff:*:20:
sshd:*:22:
smmsp:*:25:
mailnull:*:26:
guest:*:31:
video:*:44:
realtime:*:47:
idletime:*:48:
bind:*:53:
unbound:*:59:
proxy:*:62:
authpf:*:63:
_pflogd:*:64:
_dhcp:*:65:
uucp:*:66:
dialer:*:68:
network:*:69:
audit:*:77:
www:*:80:
u2f:*:116:
ntpd:*:123:
_ypldap:*:160:
hast:*:845:
tests:*:977:
nogroup:*:65533:
nobody:*:65534:
netork:*:1001:
+9
View File
@@ -0,0 +1,9 @@
NAME=FreeBSD
VERSION="15.1-RELEASE"
VERSION_ID="15.1"
ID=freebsd
ANSI_COLOR="0;31"
PRETTY_NAME="FreeBSD 15.1-RELEASE"
CPE_NAME="cpe:/o:freebsd:freebsd:15.1"
HOME_URL="https://FreeBSD.org/"
BUG_REPORT_URL="https://bugs.FreeBSD.org/"
+28
View File
@@ -0,0 +1,28 @@
root:*:0:0:Charlie &:/root:/bin/sh
toor:*:0:0:Bourne-again Superuser:/root:
daemon:*:1:1:Owner of many system processes:/root:/usr/sbin/nologin
operator:*:2:5:System &:/:/usr/sbin/nologin
bin:*:3:7:Binaries Commands and Source:/:/usr/sbin/nologin
tty:*:4:65533:Tty Sandbox:/:/usr/sbin/nologin
kmem:*:5:65533:KMem Sandbox:/:/usr/sbin/nologin
games:*:7:13:Games pseudo-user:/:/usr/sbin/nologin
news:*:8:8:News Subsystem:/:/usr/sbin/nologin
man:*:9:9:Mister Man Pages:/usr/share/man:/usr/sbin/nologin
sshd:*:22:22:Secure Shell Daemon:/var/empty:/usr/sbin/nologin
smmsp:*:25:25:Sendmail Submission User:/var/spool/clientmqueue:/usr/sbin/nologin
mailnull:*:26:26:Sendmail Default User:/var/spool/mqueue:/usr/sbin/nologin
bind:*:53:53:Bind Sandbox:/:/usr/sbin/nologin
unbound:*:59:59:Unbound DNS Resolver:/var/unbound:/usr/sbin/nologin
proxy:*:62:62:Packet Filter pseudo-user:/nonexistent:/usr/sbin/nologin
_pflogd:*:64:64:pflogd privsep user:/var/empty:/usr/sbin/nologin
_dhcp:*:65:65:dhcp programs:/var/empty:/usr/sbin/nologin
uucp:*:66:66:UUCP pseudo-user:/var/spool/uucppublic:/usr/local/libexec/uucp/uucico
pop:*:68:6:Post Office Owner:/nonexistent:/usr/sbin/nologin
auditdistd:*:78:77:Auditdistd unprivileged user:/var/empty:/usr/sbin/nologin
www:*:80:80:World Wide Web Owner:/nonexistent:/usr/sbin/nologin
ntpd:*:123:123:NTP Daemon:/var/db/ntp:/usr/sbin/nologin
_ypldap:*:160:160:YP LDAP unprivileged user:/var/empty:/usr/sbin/nologin
hast:*:845:845:HAST unprivileged user:/var/empty:/usr/sbin/nologin
tests:*:977:977:Unprivileged user for tests:/nonexistent:/usr/sbin/nologin
nobody:*:65534:65534:Unprivileged user:/nonexistent:/usr/sbin/nologin
netork:*:1001:1001:netOrk:/home/netork:/bin/sh
+7
View File
@@ -0,0 +1,7 @@
hostname="bsd=01"
ifconfig_em0="DHCP"
ifconfig_em0_ipv6="inet6 accept_rtadv"
sshd_enable="YES"
moused_nondefault_enable="NO"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
+3
View File
@@ -0,0 +1,3 @@
Filesystem 1024-blocks Used Avail Capacity Mounted on
/dev/ada0p2 30451868 1897372 26118348 7% /
devfs 1 0 1 0% /dev
+3
View File
@@ -0,0 +1,3 @@
15.1-RELEASE
15.1-RELEASE
15.1-RELEASE
+1
View File
@@ -0,0 +1 @@
uid=1001(netork) gid=1001(netork) groups=1001(netork)
+15
View File
@@ -0,0 +1,15 @@
em0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
options=48525bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,LRO,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO,HWSTATS,MEXTPG>
ether bc:24:11:20:b0:20
inet 192.0.2.104 netmask 0xffffff00 broadcast 192.0.2.255
inet6 fe80::be24:11ff:fe20:b020%em0 prefixlen 64 scopeid 0x1
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384
options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
groups: lo
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
+7
View File
@@ -0,0 +1,7 @@
Id Refs Address Size Name
1 19 0xffffffff80200000 2351bd0 kernel
2 1 0xffffffff82c18000 21e8 hms.ko
3 1 0xffffffff82c1b000 30a8 hidmap.ko
4 1 0xffffffff82c1f000 4250 ichsmb.ko
5 1 0xffffffff82c24000 2178 smbus.ko
6 1 0xffffffff82c27000 430c virtio_console.ko
@@ -0,0 +1,172 @@
/etc/rc.d:
DAEMON
FILESYSTEMS
LOGIN
NETWORKING
SERVERS
accounting
adjkerntz
apm
auditd
auditdistd
automount
automountd
autounmountd
bgfsck
blacklistd
blocklistd
bluetooth
bootparams
bridge
bsnmpd
bthidd
ccd
cfumass
cleanvar
cleartmp
cron
ctld
ddb
defaultroute
devd
devfs
devmatch
dhclient
dmesg
dnctl
dumpon
fsck
ftp-proxy
geli
geli2
ggated
gptboot
growfs
growfs_fstab
gssd
hastd
hcsecd
hostapd
hostid
hostid_save
hostname
inetd
iovctl
ip6addrctl
ipfilter
ipfs
ipfw
ipfw_netflow
ipmon
ipnat
ippool
ipsec
iscsictl
iscsid
jail
kadmind
kdc
kld
kldxref
ldconfig
linux
local
local_unbound
localpkg
lockd
lpd
mdconfig
mdconfig2
mixer
motd
mountcritlocal
mountcritremote
mountd
mountlate
moused
msconvd
msgs
natd
netif
netoptions
netwait
newsyslog
nfscbd
nfsclient
nfsd
nfsuserd
nisdomain
noshutdown
nscd
ntpd
ntpdate
nuageinit
nuageinit_post_net
nuageinit_user_data_script
os-release
pf
pflog
pfsync
power_profile
powerd
ppp
pppoed
pwcheck
quota
random
rarpd
rctl
resolv
rfcomm_pppd_server
root
route6d
routed
routing
rpcbind
rtadvd
rtsold
rwho
savecore
sdpd
securelevel
sendmail
serial
sshd
statd
static_arp
static_ndp
stf
swap
swaplate
syscons
sysctl
sysctl_lastload
syslogd
sysvipc
tlsclntd
tlsservd
tmp
ubthidhci
ugidfw
utx
var
var_run
virecover
virtual_oss
watchdogd
wpa_supplicant
ypbind
ypldap
yppasswdd
ypserv
ypset
ypupdated
ypxfrd
zfs
zfsbe
zfsd
zfskeys
zpool
zpoolreguid
zpoolupgrade
zvol
+2
View File
@@ -0,0 +1,2 @@
Neighbor Linklayer Address Netif Expire S Flags
fe80::be24:11ff:fe20:b020%em0 bc:24:11:20:b0:20 em0 permanent R
+5
View File
@@ -0,0 +1,5 @@
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address Foreign Address (state)
tcp4 0 0 192.0.2.104.22 198.51.100.114.41590 ESTABLISHED
tcp4 0 0 *.22 *.* LISTEN
udp4 0 0 *.514 *.*
+20
View File
@@ -0,0 +1,20 @@
Routing tables
Internet:
Destination Gateway Flags Netif Expire
default 192.0.2.1 UGS em0
127.0.0.1 link#2 UH lo0
192.0.2.0/24 link#1 U em0
192.0.2.104 link#2 UHS lo0
Internet6:
Destination Gateway Flags Netif Expire
::/96 link#2 URS lo0
::1 link#2 UHS lo0
::ffff:0.0.0.0/96 link#2 URS lo0
fe80::%lo0/10 link#2 URS lo0
fe80::%em0/64 link#1 U em0
fe80::be24:11ff:fe20:b020%lo0 link#2 UHS lo0
fe80::%lo0/64 link#2 U lo0
fe80::1%lo0 link#2 UHS lo0
ff02::/16 link#2 URS lo0
+8
View File
@@ -0,0 +1,8 @@
Routing tables
Internet:
Destination Gateway Flags Nhop# Mtu Netif Expire
default 192.0.2.1 UGS 4 1500 em0
127.0.0.1 link#2 UH 1 16384 lo0
192.0.2.0/24 link#1 U 2 1500 em0
192.0.2.104 link#2 UHS 3 16384 lo0
+13
View File
@@ -0,0 +1,13 @@
Routing tables
Internet6:
Destination Gateway Flags Nhop# Mtu Netif Expire
::/96 link#2 URS 6 16384 lo0
::1 link#2 UHS 1 16384 lo0
::ffff:0.0.0.0/96 link#2 URS 6 16384 lo0
fe80::%lo0/10 link#2 URS 6 16384 lo0
fe80::%em0/64 link#1 U 5 1500 em0
fe80::be24:11ff:fe20:b020%lo0 link#2 UHS 4 16384 lo0
fe80::%lo0/64 link#2 U 3 16384 lo0
fe80::1%lo0 link#2 UHS 2 16384 lo0
ff02::/16 link#2 URS 6 16384 lo0
@@ -0,0 +1,38 @@
USER PID PPID %CPU %MEM VSZ RSS STAT STARTED COMMAND
root 0 0 0.2 0.0 0 528 DLs Wed Oct 7 22:33:37 2026 [kernel]
root 1 0 0.0 0.1 12712 1196 SLs Wed Oct 7 22:33:37 2026 /sbin/init
root 2 0 0.0 0.0 0 32 WL Wed Oct 7 22:33:37 2026 [clock]
root 3 0 0.0 0.0 0 48 DL Wed Oct 7 22:33:37 2026 [crypto]
root 4 0 0.0 0.0 0 48 DL Wed Oct 7 22:33:37 2026 [cam]
root 5 0 0.0 0.0 0 16 DL Wed Oct 7 22:33:37 2026 [busdma]
root 6 0 0.0 0.0 0 16 DL Wed Oct 7 22:33:37 2026 [rand_harvestq]
root 7 0 0.0 0.0 0 48 DL Wed Oct 7 22:33:37 2026 [pagedaemon]
root 8 0 0.0 0.0 0 16 DL Wed Oct 7 22:33:37 2026 [vmdaemon]
root 9 0 0.0 0.0 0 48 DL Wed Oct 7 22:33:37 2026 [bufdaemon]
root 10 0 0.0 0.0 0 16 DL Wed Oct 7 22:33:37 2026 [audit]
root 11 0 190.4 0.0 0 32 RNL Wed Oct 7 22:33:37 2026 [idle]
root 12 0 0.0 0.0 0 256 WL Wed Oct 7 22:33:37 2026 [intr]
root 13 0 0.0 0.0 0 48 DL Wed Oct 7 22:33:37 2026 [geom]
root 14 0 0.0 0.0 0 640 DL Wed Oct 7 22:33:37 2026 [usb]
root 15 0 0.0 0.0 0 16 DL Wed Oct 7 22:33:37 2026 [vnlru]
root 16 0 0.0 0.0 0 16 DL Wed Oct 7 22:33:37 2026 [syncer]
root 830 1 0.0 0.1 14536 2796 Is Wed Oct 7 22:33:57 2026 dhclient: system.syslog (dhclient)
root 833 1 0.0 0.1 14536 2932 Is Wed Oct 7 22:33:57 2026 dhclient: em0 [priv] (dhclient)
_dhcp 949 1 0.0 0.1 14540 2964 ICs Wed Oct 7 22:34:17 2026 dhclient: em0 (dhclient)
root 989 1 0.0 0.2 15804 4236 Ss Wed Oct 7 22:34:17 2026 /sbin/devd
root 1260 1 0.0 0.1 14448 3056 SCs Wed Oct 7 22:34:17 2026 /usr/sbin/syslogd -s
root 1263 1 0.0 0.1 14448 2892 I Wed Oct 7 22:34:17 2026 syslogd: syslogd.casper (syslogd)
root 1264 1 0.0 0.1 14448 2796 Is Wed Oct 7 22:34:17 2026 syslogd: system.net (syslogd)
root 1448 1 0.2 0.5 25284 9844 Ss Wed Oct 7 22:34:17 2026 sshd: /usr/sbin/sshd [listener] 0 of 10-100 startups (sshd)
root 1486 1 0.0 0.1 14300 2796 Is Wed Oct 7 22:34:17 2026 /usr/sbin/cron -s
root 2324 1448 0.0 0.5 25792 10724 Ss Wed Oct 7 22:45:53 2026 sshd-session: netork [priv] (sshd-session)
netork 2326 2324 0.0 0.5 25792 10988 S Wed Oct 7 22:45:53 2026 sshd-session: netork@notty (sshd-session)
netork 2327 2326 0.0 0.2 14844 3132 Rs Wed Oct 7 22:45:53 2026 ps -axww -o user,pid,ppid,%cpu,%mem,vsz,rss,stat,lstart,command
root 1505 1 0.0 0.1 14224 2468 Is+ Wed Oct 7 22:34:17 2026 /usr/libexec/getty Pc ttyv0
root 1506 1 0.0 0.1 14224 2468 Is+ Wed Oct 7 22:34:17 2026 /usr/libexec/getty Pc ttyv1
root 1507 1 0.0 0.1 14224 2464 Is+ Wed Oct 7 22:34:17 2026 /usr/libexec/getty Pc ttyv2
root 1508 1 0.0 0.1 14224 2464 Is+ Wed Oct 7 22:34:17 2026 /usr/libexec/getty Pc ttyv3
root 1509 1 0.0 0.1 14224 2452 Is+ Wed Oct 7 22:34:17 2026 /usr/libexec/getty Pc ttyv4
root 1510 1 0.0 0.1 14224 2472 Is+ Wed Oct 7 22:34:17 2026 /usr/libexec/getty Pc ttyv5
root 1511 1 0.0 0.1 14224 2464 Is+ Wed Oct 7 22:34:17 2026 /usr/libexec/getty Pc ttyv6
root 1512 1 0.0 0.1 14224 2460 Is+ Wed Oct 7 22:34:17 2026 /usr/libexec/getty Pc ttyv7
+25
View File
@@ -0,0 +1,25 @@
/etc/rc.d/hostid
/etc/rc.d/hostid_save
/etc/rc.d/kldxref
/etc/rc.d/var_run
/etc/rc.d/devmatch
/etc/rc.d/cleanvar
/etc/rc.d/rctl
/etc/rc.d/ip6addrctl
/etc/rc.d/mixer
/etc/rc.d/netif
/etc/rc.d/devd
/etc/rc.d/resolv
/etc/rc.d/virecover
/etc/rc.d/gptboot
/etc/rc.d/cleartmp
/etc/rc.d/dmesg
/etc/rc.d/motd
/etc/rc.d/os-release
/etc/rc.d/newsyslog
/etc/rc.d/syslogd
/etc/rc.d/savecore
/etc/rc.d/utx
/etc/rc.d/sshd
/etc/rc.d/cron
/etc/rc.d/bgfsck
+5
View File
@@ -0,0 +1,5 @@
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
root sshd 1448 6 tcp6 *:22 *:*
root sshd 1448 7 tcp4 *:22 *:*
root syslogd 1260 6 udp6 *:514 *:*
root syslogd 1260 7 udp4 *:514 *:*
@@ -0,0 +1,4 @@
root sshd 1448 6 tcp6 *:22 *:*
root sshd 1448 7 tcp4 *:22 *:*
root syslogd 1260 6 udp6 *:514 *:*
root syslogd 1260 7 udp4 *:514 *:*
+2
View File
@@ -0,0 +1,2 @@
Device 1K-blocks Used Avail Capacity
/dev/ada0p3 1677312 0 1677312 0%
@@ -0,0 +1,4 @@
QEMU Virtual CPU version 2.5+
2
2107084800
amd64
@@ -0,0 +1 @@
{ sec = 1791405216, usec = 766333 } Wed Oct 7 22:33:36 2026
@@ -0,0 +1,5 @@
bsd=01
FreeBSD
15.1-RELEASE
FreeBSD 15.1-RELEASE releng/15.1-n283562-96841ea08dcf GENERIC
@@ -0,0 +1,4 @@
2
503080
466318
4096
+6
View File
@@ -0,0 +1,6 @@
dumpdev: AUTO
hostname: bsd=01
ifconfig_em0: DHCP
ifconfig_em0_ipv6: inet6 accept_rtadv
moused_nondefault_enable: NO
sshd_enable: YES
+1
View File
@@ -0,0 +1 @@
FreeBSD bsd=01 15.1-RELEASE FreeBSD 15.1-RELEASE releng/15.1-n283562-96841ea08dcf GENERIC amd64
+1
View File
@@ -0,0 +1 @@
10:45PM up 12 mins, 0 users, load averages: 0.17, 0.18, 0.10
@@ -0,0 +1 @@
/usr/sbin/bsnmpd