f-28: fix: debug somme minor errors

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-05-21 00:15:45 +02:00
commit 732a293857
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
3 changed files with 14 additions and 9 deletions

View file

@ -15,7 +15,13 @@ func GetDefaultGateway() (net.IP, error) {
return nil, fmt.Errorf("list routes: %w", err)
}
for _, r := range routes {
if r.Dst == nil && r.Gw != nil {
if r.Gw == nil {
continue
}
if r.Dst == nil {
return r.Gw, nil
}
if ones, _ := r.Dst.Mask.Size(); ones == 0 {
return r.Gw, nil
}
}