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:
parent
3c6852dc18
commit
fe27d45262
12 changed files with 253 additions and 2 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue