f-42: l3vni: route par défaut du netns, export de la passerelle en type 5 #42
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
00617d6e0c
commit
10c388ce65
12 changed files with 171 additions and 5 deletions
|
|
@ -51,6 +51,24 @@ func TableRoutesVia(table int, iface string) ([]*net.IPNet, error) {
|
|||
return dsts, nil
|
||||
}
|
||||
|
||||
func RouteDelViaIfExists(table int, dst *net.IPNet, gw net.IP, iface string) error {
|
||||
link, err := netlink.LinkByName(iface)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = netlink.RouteDel(&netlink.Route{
|
||||
LinkIndex: link.Attrs().Index,
|
||||
Dst: dst,
|
||||
Gw: gw,
|
||||
Table: table,
|
||||
Type: unix.RTN_UNICAST,
|
||||
})
|
||||
if err != nil && !errors.Is(err, syscall.ESRCH) {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func unreachableDefault(table, metric int) *netlink.Route {
|
||||
return &netlink.Route{
|
||||
Dst: defaultIPv4,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue