[ovs-dev,13/21] dpif_dummy_override: Allow overriding a non-existing provider
diff mbox

Message ID 1445228952-22445-13-git-send-email-yamamoto@midokura.com
State Awaiting Upstream
Headers show

Commit Message

Takashi Yamamoto Oct. 19, 2015, 4:29 a.m. UTC
This allows --enable-dummy=system with a userland-only build.
It's useful for testsuite.

Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>
---
 lib/dpif-netdev.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Ben Pfaff Nov. 10, 2015, 4:26 a.m. UTC | #1
On Mon, Oct 19, 2015 at 01:29:04PM +0900, YAMAMOTO Takashi wrote:
> This allows --enable-dummy=system with a userland-only build.
> It's useful for testsuite.
> 
> Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>

Acked-by: Ben Pfaff <blp@ovn.org>

Patch
diff mbox

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 47fa9e2..4dcfded 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -3786,7 +3786,14 @@  dpif_dummy_register__(const char *type)
 static void
 dpif_dummy_override(const char *type)
 {
-    if (!dp_unregister_provider(type)) {
+    int error;
+
+    /*
+     * Ignore EAFNOSUPPORT to allow --enable-dummy=system with
+     * a userland-only build.  It's useful for testsuite.
+     */
+    error = dp_unregister_provider(type);
+    if (error == 0 || error == EAFNOSUPPORT) {
         dpif_dummy_register__(type);
     }
 }