refactor(ish): parameterise dp creation by iface, not name

This commit is contained in:
Matthias Radestock committed 2016-03-30 14:07:33 +01:00
1 parent 8eb52538de
commit 0f89f8562f
2 files changed
+5 -10

No files matched your search

+3 -8
View File
@@ -61,7 +61,7 @@ type FastDatapath struct {
forwarders map[mesh.PeerName]*fastDatapathForwarder
}
func NewFastDatapath(dpName string, port int) (*FastDatapath, error) {
func NewFastDatapath(iface *net.Interface, port int) (*FastDatapath, error) {
dpif, err := odp.NewDpif()
if err != nil {
return nil, err
@@ -74,18 +74,13 @@ func NewFastDatapath(dpName string, port int) (*FastDatapath, error) {
}
}()
dp, err := dpif.LookupDatapath(dpName)
if err != nil {
return nil, err
}
iface, err := net.InterfaceByName(dpName)
dp, err := dpif.LookupDatapath(iface.Name)
if err != nil {
return nil, err
}
fastdp := &FastDatapath{
dpname: dpName,
dpname: iface.Name,
dpif: dpif,
dp: dp,
iface: iface,