Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8901596152 | ||
|
|
7c504e5056 | ||
|
|
333c44f3ba |
@@ -4,7 +4,9 @@ import (
|
|||||||
"bee/audit/internal/schema"
|
"bee/audit/internal/schema"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@@ -140,6 +142,9 @@ func parseLspciDevice(fields map[string]string) schema.HardwarePCIeDevice {
|
|||||||
} else if numaNode, ok := parsePCINumaNode(fields["NUMANode"]); ok {
|
} else if numaNode, ok := parsePCINumaNode(fields["NUMANode"]); ok {
|
||||||
dev.NUMANode = &numaNode
|
dev.NUMANode = &numaNode
|
||||||
}
|
}
|
||||||
|
if group, ok := readPCIIOMMUGroup(bdf); ok {
|
||||||
|
dev.IOMMUGroup = &group
|
||||||
|
}
|
||||||
if width, ok := readPCIIntAttribute(bdf, "current_link_width"); ok {
|
if width, ok := readPCIIntAttribute(bdf, "current_link_width"); ok {
|
||||||
dev.LinkWidth = &width
|
dev.LinkWidth = &width
|
||||||
}
|
}
|
||||||
@@ -179,6 +184,21 @@ func parseLspciDevice(fields map[string]string) schema.HardwarePCIeDevice {
|
|||||||
return dev
|
return dev
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// readPCIIOMMUGroup resolves the IOMMU group number for a BDF via the
|
||||||
|
// iommu_group symlink in sysfs: .../devices/<bdf>/iommu_group -> .../kernel/iommu_groups/<N>
|
||||||
|
func readPCIIOMMUGroup(bdf string) (int, bool) {
|
||||||
|
link := "/sys/bus/pci/devices/" + bdf + "/iommu_group"
|
||||||
|
target, err := os.Readlink(link)
|
||||||
|
if err != nil {
|
||||||
|
return 0, false
|
||||||
|
}
|
||||||
|
n, err := strconv.Atoi(filepath.Base(target))
|
||||||
|
if err != nil {
|
||||||
|
return 0, false
|
||||||
|
}
|
||||||
|
return n, true
|
||||||
|
}
|
||||||
|
|
||||||
// readPCIIDs reads vendor and device IDs from sysfs for a given BDF.
|
// readPCIIDs reads vendor and device IDs from sysfs for a given BDF.
|
||||||
func readPCIIDs(bdf string) (vendorID, deviceID int) {
|
func readPCIIDs(bdf string) (vendorID, deviceID int) {
|
||||||
base := "/sys/bus/pci/devices/" + bdf
|
base := "/sys/bus/pci/devices/" + bdf
|
||||||
|
|||||||
@@ -211,6 +211,7 @@ type HardwarePCIeDevice struct {
|
|||||||
Firmware *string `json:"firmware,omitempty"`
|
Firmware *string `json:"firmware,omitempty"`
|
||||||
MacAddresses []string `json:"mac_addresses,omitempty"`
|
MacAddresses []string `json:"mac_addresses,omitempty"`
|
||||||
Present *bool `json:"present,omitempty"`
|
Present *bool `json:"present,omitempty"`
|
||||||
|
IOMMUGroup *int `json:"iommu_group,omitempty"`
|
||||||
Telemetry map[string]any `json:"-"`
|
Telemetry map[string]any `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 77 KiB |
@@ -47,18 +47,30 @@ vim-tiny
|
|||||||
mc
|
mc
|
||||||
htop
|
htop
|
||||||
nvtop
|
nvtop
|
||||||
btop
|
|
||||||
sudo
|
sudo
|
||||||
zstd
|
zstd
|
||||||
mstflint
|
mstflint
|
||||||
memtester
|
memtester
|
||||||
stress-ng
|
stress-ng
|
||||||
stressapptest
|
stressapptest
|
||||||
|
fio
|
||||||
|
iperf3
|
||||||
|
iotop
|
||||||
|
nload
|
||||||
|
tcpdump
|
||||||
|
hdparm
|
||||||
|
sysstat
|
||||||
|
lsscsi
|
||||||
|
sg3-utils
|
||||||
|
jq
|
||||||
|
curl
|
||||||
|
net-tools
|
||||||
|
|
||||||
# QR codes (for displaying audit results)
|
# QR codes (for displaying audit results)
|
||||||
qrencode
|
qrencode
|
||||||
|
|
||||||
# Local desktop (openbox + chromium kiosk)
|
# Local desktop (openbox + chromium kiosk)
|
||||||
|
gparted
|
||||||
openbox
|
openbox
|
||||||
tint2
|
tint2
|
||||||
feh
|
feh
|
||||||
|
|||||||
Reference in New Issue
Block a user