summaryrefslogtreecommitdiff
path: root/ofproto/ofproto-dpif-monitor.c
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2013-10-10 17:52:31 -0700
committerEthan Jackson <ethan@nicira.com>2013-10-10 18:19:09 -0700
commit30fe866b46dd6b5658dfa7c2fb60b8f756ea6f95 (patch)
tree7cac71d9a230edc1ceeb22d2386cbb5c83088c24 /ofproto/ofproto-dpif-monitor.c
parentf6c8a6b163af343c66aea54953553d84863835f7 (diff)
downloadopenvswitch-30fe866b46dd6b5658dfa7c2fb60b8f756ea6f95.tar.gz
monitor: Fix improper use of stubs.
Stubs must be uninitialized when used in case they allocate memory. Signed-off-by: Ethan Jackson <ethan@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'ofproto/ofproto-dpif-monitor.c')
-rw-r--r--ofproto/ofproto-dpif-monitor.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ofproto/ofproto-dpif-monitor.c b/ofproto/ofproto-dpif-monitor.c
index a0c3843f1..75cf206cf 100644
--- a/ofproto/ofproto-dpif-monitor.c
+++ b/ofproto/ofproto-dpif-monitor.c
@@ -142,24 +142,26 @@ ofproto_dpif_monitor_port_update(const struct ofport_dpif *ofport,
void
ofproto_dpif_monitor_run_fast(void)
{
- struct mport *mport;
- static uint32_t buf_stub[128 / 4];
+ uint32_t stub[512 / 4];
struct ofpbuf packet;
+ struct mport *mport;
+ ofpbuf_use_stub(&packet, stub, sizeof stub);
ovs_rwlock_rdlock(&monitor_rwlock);
HMAP_FOR_EACH (mport, hmap_node, &monitor_hmap) {
if (mport->cfm && cfm_should_send_ccm(mport->cfm)) {
- ofpbuf_use_stub(&packet, buf_stub, sizeof buf_stub);
+ ofpbuf_clear(&packet);
cfm_compose_ccm(mport->cfm, &packet, mport->hw_addr);
ofproto_dpif_send_packet(mport->ofport, &packet);
}
if (mport->bfd && bfd_should_send_packet(mport->bfd)) {
- ofpbuf_use_stub(&packet, buf_stub, sizeof buf_stub);
+ ofpbuf_clear(&packet);
bfd_put_packet(mport->bfd, &packet, mport->hw_addr);
ofproto_dpif_send_packet(mport->ofport, &packet);
}
}
ovs_rwlock_unlock(&monitor_rwlock);
+ ofpbuf_uninit(&packet);
}
/* Executes bfd_run(), cfm_run() on all mports. */