fix(snmp,db): save FDB to PG (empty inet null), bridge_port + MAC normalize

Made-with: Cursor
This commit is contained in:
PTah
2026-04-13 11:58:48 +10:00
parent 264865f9d8
commit 936cc6b9bb
6 changed files with 108 additions and 27 deletions
+7 -6
View File
@@ -119,11 +119,12 @@ type InterfaceResult struct {
// PortDeviceResult — MAC/IP, обнаруженные за конкретным портом (ifIndex) через BRIDGE-MIB + ARP.
type PortDeviceResult struct {
IP string `json:"ip"`
IfIndex int `json:"if_index"`
MAC string `json:"mac"`
LearnedIP string `json:"learned_ip"`
CheckedAt time.Time `json:"checked_at"`
IP string `json:"ip"`
IfIndex int `json:"if_index"`
BridgePort int `json:"bridge_port,omitempty"`
MAC string `json:"mac"`
LearnedIP string `json:"learned_ip"`
CheckedAt time.Time `json:"checked_at"`
}
type MemoryStore struct {
@@ -409,7 +410,7 @@ func (s *MemoryStore) ListPortDeviceResults(scanID string, filterIP string, filt
if filterIP != "" && r.IP != filterIP {
continue
}
if filterIfIndex > 0 && r.IfIndex != filterIfIndex {
if filterIfIndex > 0 && r.IfIndex != filterIfIndex && r.BridgePort != filterIfIndex {
continue
}
filtered = append(filtered, r)