[ovs-dev] [genl 6/6] dpif-linux: Stop listening for RTNL notifications.

Ethan Jackson ethan at nicira.com
Fri Aug 26 18:37:54 UTC 2011


Thanks for the review.  Here is an incremental which I've applied to deal with
the deletion of nl_set_mcgroup().

---
 lib/dpif-linux.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
index 5f52e0b..a9bb36a 100644
--- a/lib/dpif-linux.c
+++ b/lib/dpif-linux.c
@@ -253,10 +253,12 @@ open_dpif(const struct dpif_linux_dp *dp, struct dpif **dpifp)
     int i;
 
     dpif = xmalloc(sizeof *dpif);
-    error = nln_notifier_register(nln, &dpif->port_notifier,
-                                  dpif_linux_port_changed, dpif);
-    if (error) {
-        goto error_free;
+    if (nln) {
+        error = nln_notifier_register(nln, &dpif->port_notifier,
+                                      dpif_linux_port_changed, dpif);
+        if (error) {
+            goto error_free;
+        }
     }
 
     dpif_init(&dpif->dpif, &dpif_linux_class, dp->name,
@@ -289,8 +291,12 @@ static void
 dpif_linux_close(struct dpif *dpif_)
 {
     struct dpif_linux *dpif = dpif_linux_cast(dpif_);
+
+    if (nln) {
+        nln_notifier_unregister(nln, &dpif->port_notifier);
+    }
+
     nl_sock_destroy(dpif->mc_sock);
-    nln_notifier_unregister(nln, &dpif->port_notifier);
     sset_destroy(&dpif->changed_ports);
     free(dpif->lru_bitmap);
     free(dpif);
@@ -1100,11 +1106,6 @@ dpif_linux_init(void)
 {
     static int error = -1;
 
-    if (!nln) {
-        static struct dpif_linux_vport vport;
-        nln = nln_create(NETLINK_GENERIC, 0, dpif_linux_nln_parse, &vport);
-    }
-
     if (error < 0) {
         unsigned int ovs_vport_mcgroup;
 
@@ -1133,7 +1134,9 @@ dpif_linux_init(void)
                                            &ovs_vport_mcgroup);
         }
         if (!error) {
-            error = nln_set_mcgroup(nln, ovs_vport_mcgroup);
+            static struct dpif_linux_vport vport;
+            nln = nln_create(NETLINK_GENERIC, ovs_vport_mcgroup,
+                             dpif_linux_nln_parse, &vport);
         }
     }
 
-- 
1.7.6




More information about the dev mailing list