f-41: subnet: export du préfixe dans la VRF, suppression refusée tant qu'une VM l'utilise #41

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-10-11 20:28:16 +02:00
commit fe27d45262
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
12 changed files with 253 additions and 2 deletions

View file

@ -1,7 +1,9 @@
package netif
import (
"errors"
"net"
"syscall"
"github.com/vishvananda/netlink"
)
@ -25,3 +27,10 @@ func RouteDel(table int, dst *net.IPNet) error {
Table: table,
})
}
func RouteDelIfExists(table int, dst *net.IPNet) error {
if err := RouteDel(table, dst); err != nil && !errors.Is(err, syscall.ESRCH) {
return err
}
return nil
}