[ovs-dev] [PATCH 2/6] Modify dpif_linux_port_add() to set the destination port for VXLAN ports.

Ben Pfaff blp at nicira.com
Thu Feb 14 18:00:58 UTC 2013


On Thu, Feb 14, 2013 at 09:37:26AM -0500, Kyle Mestery wrote:
> Signed-off-by: Kyle Mestery <kmestery at cisco.com>
> Acked-by: Ethan Jackson <ethan at nicira.com>

I'm pretty sure this introduces a memory leak because ofpbuf_init()
allocates data and I don't see it getting freed anywhere.  So I applied
the following incremental:

diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c
index 34b9532..3cf1225 100644
--- a/lib/dpif-linux.c
+++ b/lib/dpif-linux.c
@@ -489,6 +489,7 @@ dpif_linux_port_add(struct dpif *dpif_, struct netdev *netdev,
     struct nl_sock *sock = NULL;
     uint32_t upcall_pid;
     struct ofpbuf *buf;
+    uint64_t options_stub[64 / 8];
     struct ofpbuf options;
     int error;
 
@@ -518,7 +519,7 @@ dpif_linux_port_add(struct dpif *dpif_, struct netdev *netdev,
 
     tnl_cfg = netdev_get_tunnel_config(netdev);
     if (tnl_cfg && tnl_cfg->dst_port != 0) {
-        ofpbuf_init(&options, 64);
+        ofpbuf_use_stack(&options, options_stub, sizeof options_stub);
         nl_msg_put_u16(&options, OVS_TUNNEL_ATTR_DST_PORT,
                        htons(tnl_cfg->dst_port));
         request.options = options.data;

I haven't pushed this yet, please let me know if you see a problem.

Thanks,

Ben.



More information about the dev mailing list