diff --git a/CHANGELOG-developer.next.asciidoc b/CHANGELOG-developer.next.asciidoc index 1bdd746251a8..cf378879b15e 100644 --- a/CHANGELOG-developer.next.asciidoc +++ b/CHANGELOG-developer.next.asciidoc @@ -189,6 +189,7 @@ The list below covers the major changes between 7.0.0-rc2 and main only. - Allow assignment of packetbeat protocols to interfaces. {issue}36574[36564] {pull}36852[36852] - Add Active Directory entity collector for Filebeat entity analytics. {pull}37854[37854] - Make logs for empty and small files less noisy when using fingerprint file identity in filestream. {pull}38421[38421] +- Improve robustness and error reporting from packetbeat default route testing. {pull}39757[39757] ==== Deprecated diff --git a/packetbeat/route/route_windows_test.go b/packetbeat/route/route_windows_test.go index 3968c187fc75..f216dabc3389 100644 --- a/packetbeat/route/route_windows_test.go +++ b/packetbeat/route/route_windows_test.go @@ -60,6 +60,9 @@ func defaultRoute(af int) (name string, index int, err error) { inTable = f[0] == "-------" continue } + if len(f) < 5 { + return "", -1, fmt.Errorf("unexpected netsh %s line: %q\n\n%s", name, sc.Text(), r) + } if strings.Contains(f[3], "/") { ip, _, err := net.ParseCIDR(f[3]) if err != nil || !ip.IsUnspecified() { @@ -98,7 +101,7 @@ func defaultRoute(af int) (name string, index int, err error) { continue } if len(f) < 5 { - return "", -1, fmt.Errorf("unexpected netsh %s line: %q", name, sc.Text()) + return "", -1, fmt.Errorf("unexpected netsh %s line: %q\n\n%s", name, sc.Text(), d) } idx, err := strconv.Atoi(f[0]) if err != nil {