[ovs-dev] [PATCH 1/2] ofproto: Make handle_openflow's msg argument const.

Jarno Rajahalme jarno.rajahalme at nsn.com
Mon Jun 17 00:55:25 UTC 2013


handle_openflow() must not modify the received message. Make this
explicit.

Signed-off-by: Jarno Rajahalme <jarno.rajahalme at nsn.com>
---
 ofproto/connmgr.c |    8 +++++---
 ofproto/connmgr.h |    2 +-
 ofproto/ofproto.c |    4 ++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index 1a1ab6c..0951968 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -108,7 +108,7 @@ static void ofconn_reconfigure(struct ofconn *,
 
 static void ofconn_run(struct ofconn *,
                        bool (*handle_openflow)(struct ofconn *,
-                                               struct ofpbuf *ofp_msg));
+                                               const struct ofpbuf *ofp_msg));
 static void ofconn_wait(struct ofconn *, bool handling_openflow);
 
 static const char *ofconn_get_target(const struct ofconn *);
@@ -269,7 +269,8 @@ connmgr_destroy(struct connmgr *mgr)
  * fail-open processing) are suppressed too. */
 void
 connmgr_run(struct connmgr *mgr,
-            bool (*handle_openflow)(struct ofconn *, struct ofpbuf *ofp_msg))
+            bool (*handle_openflow)(struct ofconn *,
+                                    const struct ofpbuf *ofp_msg))
 {
     struct ofconn *ofconn, *next_ofconn;
     struct ofservice *ofservice;
@@ -1234,7 +1235,8 @@ ofconn_may_recv(const struct ofconn *ofconn)
 
 static void
 ofconn_run(struct ofconn *ofconn,
-           bool (*handle_openflow)(struct ofconn *, struct ofpbuf *ofp_msg))
+           bool (*handle_openflow)(struct ofconn *,
+                                   const struct ofpbuf *ofp_msg))
 {
     struct connmgr *mgr = ofconn->connmgr;
     size_t i;
diff --git a/ofproto/connmgr.h b/ofproto/connmgr.h
index 506f9c7..429e678 100644
--- a/ofproto/connmgr.h
+++ b/ofproto/connmgr.h
@@ -71,7 +71,7 @@ void connmgr_destroy(struct connmgr *);
 
 void connmgr_run(struct connmgr *,
                  bool (*handle_openflow)(struct ofconn *,
-                                         struct ofpbuf *ofp_msg));
+                                         const struct ofpbuf *ofp_msg));
 void connmgr_wait(struct connmgr *, bool handling_openflow);
 
 void connmgr_get_memory_usage(const struct connmgr *, struct simap *usage);
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 5431fa7..7f9a88f 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -199,7 +199,7 @@ static enum ofperr add_flow(struct ofproto *, struct ofconn *,
                             const struct ofputil_flow_mod *,
                             const struct ofp_header *);
 static void delete_flow__(struct rule *, struct ofopgroup *);
-static bool handle_openflow(struct ofconn *, struct ofpbuf *);
+static bool handle_openflow(struct ofconn *, const struct ofpbuf *);
 static enum ofperr handle_flow_mod__(struct ofproto *, struct ofconn *,
                                      const struct ofputil_flow_mod *,
                                      const struct ofp_header *);
@@ -4146,7 +4146,7 @@ handle_openflow__(struct ofconn *ofconn, const struct ofpbuf *msg)
 }
 
 static bool
-handle_openflow(struct ofconn *ofconn, struct ofpbuf *ofp_msg)
+handle_openflow(struct ofconn *ofconn, const struct ofpbuf *ofp_msg)
 {
     int error = handle_openflow__(ofconn, ofp_msg);
     if (error && error != OFPROTO_POSTPONE) {
-- 
1.7.10.4




More information about the dev mailing list