Skip to content

Commit

Permalink
packetbeat/route: improve netsh output handling
Browse files Browse the repository at this point in the history
  • Loading branch information
efd6 committed May 29, 2024
1 parent f411b06 commit 553fbac
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packetbeat/route/route_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 553fbac

Please sign in to comment.