Support pre-Linux 2.6.20 genetlink, which didn't have "done" functions for dumps.
authorBen Pfaff <blp@nicira.com>
Mon, 5 May 2008 18:41:48 +0000 (11:41 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 5 May 2008 21:56:28 +0000 (14:56 -0700)
datapath/datapath.c

index 9b7710a2332c36de32945def780345cdda24f1b9..a3ee25a70079f20db44de4fe6a9a4c332994ab08 100644 (file)
@@ -77,7 +77,7 @@ static DEFINE_MUTEX(dp_mutex);
 
 static int dp_maint_func(void *data);
 static int send_port_status(struct net_bridge_port *p, uint8_t status);
-
+static int dp_genl_openflow_done(struct netlink_callback *);
 
 /* nla_shrink - reduce amount of space reserved by nla_reserve
  * @skb: socket buffer from which to recover room
@@ -1373,6 +1373,11 @@ dp_genl_openflow_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
        void *body;
        int err;
 
+       /* Set up the cleanup function for this dump.  Linux 2.6.20 and later
+        * support setting up cleanup functions via the .doneit member of
+        * struct genl_ops.  This kluge supports earlier versions also. */
+       cb->done = dp_genl_openflow_done;
+
        rcu_read_lock();
        if (!cb->args[0]) {
                struct nlattr *attrs[DP_GENL_A_MAX + 1];
@@ -1491,7 +1496,6 @@ static struct genl_ops dp_genl_ops_openflow = {
        .policy = dp_genl_openflow_policy,
        .doit = dp_genl_openflow,
        .dumpit = dp_genl_openflow_dumpit,
-       .done = dp_genl_openflow_done,
 };
 
 static struct nla_policy dp_genl_benchmark_policy[DP_GENL_A_MAX + 1] = {