f-88: fip: face publique, traduction et routage par source sur l'hôte #88
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
4effb5028a
commit
350a1dd82f
8 changed files with 538 additions and 18 deletions
|
|
@ -51,6 +51,19 @@ func TableRoutesVia(table int, iface string) ([]*net.IPNet, error) {
|
|||
return dsts, nil
|
||||
}
|
||||
|
||||
func RouteReplaceDev(table int, dst *net.IPNet, iface string) error {
|
||||
link, err := netlink.LinkByName(iface)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return netlink.RouteReplace(&netlink.Route{
|
||||
LinkIndex: link.Attrs().Index,
|
||||
Dst: dst,
|
||||
Table: table,
|
||||
Scope: netlink.SCOPE_LINK,
|
||||
})
|
||||
}
|
||||
|
||||
func RouteDelViaIfExists(table int, dst *net.IPNet, gw net.IP, iface string) error {
|
||||
link, err := netlink.LinkByName(iface)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue