Clear MAC table on each SNMP poll and reduce ping threshold

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ian Gulliver
2026-01-31 13:20:20 -08:00
parent 5a7596b456
commit 32da723b2c
7 changed files with 20 additions and 4 deletions

View File

@@ -94,7 +94,11 @@
"Bash(go test:*)",
"Bash(git stash:*)",
"Bash(git revert:*)",
"Bash(done)"
"Bash(done)",
"Bash(while read id)",
"Bash(do cat /home/flamingcow/tendrils/status)",
"Bash(for id in node_01kgay2wynew8tjh1bpr9sd11e node_01kgay2wynew2t7qmfvtkrq2nb node_01kgay2wykevgbkxfvavxgpq30 node_01kgay2wynew5b80p45h8mdtpj node_01kgay2wynevtsrw26tprvqysw node_01kgay2wynevy9gp10a6rr4y2d)",
"Bash(do)"
],
"ask": [
"Bash(rm *)"

2
.gitignore vendored
View File

@@ -5,4 +5,4 @@ log
*~
cert.pem
key.pem
status
status*

View File

@@ -217,3 +217,6 @@ locations:
nodes:
- names: ["sunset"]
- names: ["RX-CONTROL-1"]
shared_names:
- "ULXD4Q G50 REV5"

View File

@@ -503,6 +503,13 @@ func (n *Nodes) UpdateMACTable(node *Node, peerMAC net.HardwareAddr, ifaceName s
node.MACTable[peerMAC.String()] = ifaceName
}
func (n *Nodes) ClearMACTable(node *Node) {
n.mu.Lock()
defer n.mu.Unlock()
node.MACTable = map[string]string{}
}
func (n *Nodes) SetDanteClockMaster(ip net.IP) {
n.Update(nil, nil, []net.IP{ip}, "", "", "ptp")

View File

@@ -24,7 +24,7 @@ type PingManager struct {
failures map[string]int
}
const pingFailureThreshold = 5
const pingFailureThreshold = 3
func NewPingManager() *PingManager {
pm := &PingManager{

View File

@@ -544,6 +544,8 @@ func (t *Tendrils) queryBridgeMIB(snmp *gosnmp.GoSNMP, node *Node, ifNames map[i
bridgePortToIfIndex := t.getBridgePortMapping(snmp)
t.nodes.ClearMACTable(node)
for _, entry := range macPorts {
mac := entry.mac

View File

@@ -453,7 +453,7 @@ type Node struct {
ID string `json:"id"`
Names NameSet `json:"names"`
Interfaces InterfaceMap `json:"interfaces"`
MACTable map[string]string `json:"-"`
MACTable map[string]string `json:"mac_table,omitempty"`
PoEBudget *PoEBudget `json:"poe_budget,omitempty"`
DanteTxChannels int `json:"dante_tx_channels,omitempty"`
DanteClockMasterSeen time.Time `json:"-"`