From: Andy Zhou Date: Tue, 30 Jul 2013 17:52:35 +0000 (-0700) Subject: ofproto-dpif: Only track drop flows that are installed X-Git-Tag: sliver-openvswitch-2.0.90-1~34^2~13 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=92e02bc6bbc2e0c68842dc269dec80f0885bdb33 ofproto-dpif: Only track drop flows that are installed Signed-off-by: Andy Zhou Signed-off-by: Ben Pfaff --- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 8c7164b2b..839de6955 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -3799,15 +3799,20 @@ handle_miss_upcalls(struct dpif_backer *backer, struct dpif_upcall *upcalls, drop_key = drop_key_lookup(backer, upcall->key, upcall->key_len); if (!drop_key) { - drop_key = xmalloc(sizeof *drop_key); - drop_key->key = xmemdup(upcall->key, upcall->key_len); - drop_key->key_len = upcall->key_len; - - hmap_insert(&backer->drop_keys, &drop_key->hmap_node, - hash_bytes(drop_key->key, drop_key->key_len, 0)); - dpif_flow_put(backer->dpif, DPIF_FP_CREATE | DPIF_FP_MODIFY, - drop_key->key, drop_key->key_len, - NULL, 0, NULL, 0, NULL); + int ret; + ret = dpif_flow_put(backer->dpif, + DPIF_FP_CREATE | DPIF_FP_MODIFY, + upcall->key, upcall->key_len, + NULL, 0, NULL, 0, NULL); + + if (!ret) { + drop_key = xmalloc(sizeof *drop_key); + drop_key->key = xmemdup(upcall->key, upcall->key_len); + drop_key->key_len = upcall->key_len; + + hmap_insert(&backer->drop_keys, &drop_key->hmap_node, + hash_bytes(drop_key->key, drop_key->key_len, 0)); + } } continue; }