add dead codde to bring up iface
This commit is contained in:
parent
c7e9210a96
commit
deef2574e7
@ -23,6 +23,7 @@ func main() {
|
||||
dsnet.Add()
|
||||
|
||||
case "up":
|
||||
dsnet.Up()
|
||||
|
||||
case "update":
|
||||
|
||||
|
15
up.go
15
up.go
@ -17,14 +17,14 @@ func CreateInterface(conf *DsnetConfig) {
|
||||
linkAttrs := netlink.NewLinkAttrs()
|
||||
linkAttrs.Name = conf.InterfaceName
|
||||
|
||||
iface := &netlink.GenericLink{
|
||||
link := &netlink.GenericLink{
|
||||
LinkAttrs: linkAttrs,
|
||||
LinkType: "wireguard",
|
||||
}
|
||||
|
||||
err := netlink.LinkAdd(iface)
|
||||
err := netlink.LinkAdd(link)
|
||||
if err != nil {
|
||||
ExitFail("Could not add '%s' (%v)", linkAttrs.Name, err)
|
||||
ExitFail("Could not add interface '%s' (%v)", linkAttrs.Name, err)
|
||||
}
|
||||
|
||||
addr := &netlink.Addr{
|
||||
@ -34,7 +34,7 @@ func CreateInterface(conf *DsnetConfig) {
|
||||
},
|
||||
}
|
||||
|
||||
err = netlink.AddrAdd(iface, addr)
|
||||
err = netlink.AddrAdd(link, addr)
|
||||
if err != nil {
|
||||
ExitFail("Could not add addr %s to interface %s", addr.IP, err)
|
||||
}
|
||||
@ -52,4 +52,11 @@ func CreateInterface(conf *DsnetConfig) {
|
||||
if err != nil {
|
||||
ExitFail("Could not configure device '%s' (%v)", linkAttrs.Name, err)
|
||||
}
|
||||
|
||||
// bring up interface (needs conf first)
|
||||
//err = netlink.LinkSetUp(link)
|
||||
//
|
||||
//if err != nil {
|
||||
// ExitFail("Could not bring up device '%s' (%v)", linkAttrs.Name, err)
|
||||
//}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user