From 30b05709eb9e495ed0b372b0b9fee74724c6ce0b Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 26 Apr 2026 00:50:27 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E4=BF=AE=E6=AD=A3H3C=20ARP=E8=A1=A8?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E5=99=A8=E9=80=82=E9=85=8D=E7=9C=9F=E5=AE=9E?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修正标题行匹配: Type: (带冒号) - 跳过IP address标题行 - 适配真实ARP表格式: IP MAC VLAN Interface Aging Type - 正确解析MAC到IP映射 --- internal/device/h3c.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/internal/device/h3c.go b/internal/device/h3c.go index 1bba855..9948778 100644 --- a/internal/device/h3c.go +++ b/internal/device/h3c.go @@ -199,13 +199,14 @@ func (p *H3CParser) parseARPTable(output string) map[string]string { for _, line := range lines { // 跳过空行和标题行 if strings.TrimSpace(line) == "" || - strings.Contains(line, "Type") || - strings.Contains(line, "------") { + strings.Contains(line, "Type:") || + strings.Contains(line, "------") || + strings.Contains(line, "IP address") { continue } - // ARP表格式: IP Address MAC Address Interface/Vlan - // 例: 172.16.12.1 a4bb-6de2-62cd GE1/0/1 + // ARP表格式: IP address MAC address VLAN/VSI name Interface Aging Type + // 例: 172.16.8.10 743a-2047-38e0 8 GE1/0/47 1163 D fields := strings.Fields(line) if len(fields) >= 2 { ip := fields[0]