dpif-netlink: add GENEVE creation support
[cascardo/ovs.git] / lib / ofpbuf.c
index eab523e..3019c4a 100644 (file)
  */
 
 #include <config.h>
-#include "ofpbuf.h"
+#include "openvswitch/ofpbuf.h"
 #include <stdlib.h>
 #include <string.h>
-#include "dynamic-string.h"
+#include "openvswitch/dynamic-string.h"
 #include "netdev-dpdk.h"
 #include "util.h"
 
@@ -29,7 +29,7 @@ ofpbuf_init__(struct ofpbuf *b, size_t allocated, enum ofpbuf_source source)
     b->source = source;
     b->header = NULL;
     b->msg = NULL;
-    list_poison(&b->list_node);
+    ovs_list_poison(&b->list_node);
 }
 
 static void
@@ -185,7 +185,11 @@ ofpbuf_clone_with_headroom(const struct ofpbuf *b, size_t headroom)
 
         new_buffer->header = (char *) new_buffer->data + header_offset;
     }
-    new_buffer->msg = b->msg;
+    if (b->msg) {
+        ptrdiff_t msg_offset = (char *) b->msg - (char *) b->data;
+
+        new_buffer->msg = (char *) new_buffer->data + msg_offset;
+    }
 
     return new_buffer;
 }