Do not segfault if the datapath exists
If the datapath exists when creating it, dpif.CreateDatapath will return an empty handle which access will cause the segfault.
This commit is contained in:
1 parent
7ffd96f425
commit
fa05dcf6ee
1 file changed
+7
-2
+7
-2
@@ -21,8 +21,13 @@ func CreateDatapath(dpname string) (supported bool, err error) {
|
||||
defer dpif.Close()
|
||||
|
||||
dp, err := dpif.CreateDatapath(dpname)
|
||||
if err != nil && !odp.IsDatapathNameAlreadyExistsError(err) {
|
||||
return true, err
|
||||
if err != nil {
|
||||
if !odp.IsDatapathNameAlreadyExistsError(err) {
|
||||
return true, err
|
||||
}
|
||||
if dp, err = dpif.LookupDatapath(dpname); err != nil {
|
||||
return true, err
|
||||
}
|
||||
}
|
||||
|
||||
// Pick an ephemeral port number to use in probing for vxlan
|
||||
|
||||
Reference in new issue
Block a user