[ovs-dev] [PATCH] ofproto: Get enough headroom in fail-open when connected to controller.

Ben Pfaff blp at nicira.com
Wed Sep 1 17:18:18 UTC 2010


Since commit 750638bb "ofproto: Avoid ofpbuf_clone() for OFPAT_CONTROLLER
common case," send_packet_in() needs at least DPIF_RECV_MSG_PADDING bytes
of headroom, which ofpbuf_clone() doesn't supply.  This commit should fix
that.

This fixes an assertion failure in ofpbuf_prealloc_headroom() via
send_packet_in().

Reported-by: Justin Pettit <jpettit at nicira.com>
---
 ofproto/ofproto.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index adc5282..34ea32c 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -4154,7 +4154,10 @@ handle_odp_miss_msg(struct ofproto *p, struct ofpbuf *packet)
          *
          * See the top-level comment in fail-open.c for more information.
          */
-        send_packet_in(p, ofpbuf_clone(packet));
+        struct ofpbuf *copy = ofpbuf_new(packet->size + DPIF_RECV_MSG_PADDING);
+        ofpbuf_reserve(copy, DPIF_RECV_MSG_PADDING);
+        ofpbuf_put(copy, packet->data, packet->size);
+        send_packet_in(p, copy);
     }
 
     ofpbuf_pull(packet, sizeof *msg);
-- 
1.7.1





More information about the dev mailing list