Skip to content

Commit

Permalink
ofproto-dpif: Set need_revalidate when removing cfm from ofport.
Browse files Browse the repository at this point in the history
When cfm is deleted from a port, all modules should release their
reference so that the cfm struct can be removed from the global hmap
and freed.  Therein, the reference held by xlate module can only be
released when the need_revalidate flag is set (e.g set to
REV_RECONFIGURE).  And this flag should be set while removing cfm
from ofport.  Unfortunately, this has never been done before and the
bug was hidden by another bug fixed in recent commit a190839
(netdev-vport: Do not update netdev when there is no config change.)

To fix this issue, this commit makes the code set need_revalidate
when removing cfm from ofport.

Signed-off-by: Alex Wang <alexw@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
  • Loading branch information
yew011 committed Mar 28, 2015
1 parent 3638617 commit 0e45cfe
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ofproto/ofproto-dpif.c
Expand Up @@ -1822,14 +1822,12 @@ static int
set_cfm(struct ofport *ofport_, const struct cfm_settings *s)
{
struct ofport_dpif *ofport = ofport_dpif_cast(ofport_);
struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofport->up.ofproto);
struct cfm *old = ofport->cfm;
int error = 0;

if (s) {
if (!ofport->cfm) {
struct ofproto_dpif *ofproto;

ofproto = ofproto_dpif_cast(ofport->up.ofproto);
ofproto->backer->need_revalidate = REV_RECONFIGURE;
ofport->cfm = cfm_create(ofport->up.netdev);
}

Expand All @@ -1843,6 +1841,9 @@ set_cfm(struct ofport *ofport_, const struct cfm_settings *s)
cfm_unref(ofport->cfm);
ofport->cfm = NULL;
out:
if (ofport->cfm != old) {
ofproto->backer->need_revalidate = REV_RECONFIGURE;
}
ofproto_dpif_monitor_port_update(ofport, ofport->bfd, ofport->cfm,
ofport->up.pp.hw_addr);
return error;
Expand Down

0 comments on commit 0e45cfe

Please sign in to comment.