refactor(ish): parameterise dp creation by iface, not name
This commit is contained in:
1 parent
8eb52538de
commit
0f89f8562f
2 files changed
+5
-10
No files matched your search
+3
-8
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user