f-21: code: change from ip to interface type
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
066b90dff4
commit
9ec6e64327
8 changed files with 41 additions and 40 deletions
|
|
@ -1,20 +1,22 @@
|
|||
package netif
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"github.com/vishvananda/netlink"
|
||||
)
|
||||
|
||||
func CreateVxlan(name string, vxlanID int, localIP net.IP) error {
|
||||
func CreateVxlan(name string, vxlanID int, localIface string) error {
|
||||
link, err := netlink.LinkByName(localIface)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
vxlan := &netlink.Vxlan{
|
||||
LinkAttrs: netlink.LinkAttrs{
|
||||
Name: name,
|
||||
},
|
||||
VxlanId: vxlanID,
|
||||
Port: 4789,
|
||||
SrcAddr: localIP,
|
||||
Learning: false,
|
||||
VxlanId: vxlanID,
|
||||
Port: 4789,
|
||||
VtepDevIndex: link.Attrs().Index,
|
||||
Learning: false,
|
||||
}
|
||||
return netlink.LinkAdd(vxlan)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue