From e03248b7cb460a79d6e4b4aef5815d59f3d0ea32 Mon Sep 17 00:00:00 2001 From: Jarno Rajahalme Date: Mon, 17 Jun 2013 03:55:25 +0300 Subject: [PATCH] ofproto: Make handle_openflow's msg argument const. handle_openflow() must not modify the received message. Make this explicit. Signed-off-by: Jarno Rajahalme Signed-off-by: Ben Pfaff --- 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 1a1ab6c19..09519681c 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 506f9c75d..429e67822 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 5431fa71a..7f9a88f92 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) { -- 2.20.1