Skip to content

Commit 2f6d344

Browse files
committed
ofproto: Delete fail-open flow when turning off fail-open mode.
fail_open_destroy() was not deleting the fail-open flow, so turning off fail-open mode did not work if fail-open had already been triggered. This commit fixes the problem. Reported by Paul Ingram <paul@nicira.com>.
1 parent 48d014b commit 2f6d344

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

ofproto/fail-open.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2009 Nicira Networks.
2+
* Copyright (c) 2008, 2009, 2010 Nicira Networks.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -76,6 +76,8 @@ struct fail_open {
7676
struct rconn_packet_counter *bogus_packet_counter;
7777
};
7878

79+
static void fail_open_recover(struct fail_open *);
80+
7981
/* Returns true if 'fo' should be in fail-open mode, otherwise false. */
8082
static inline bool
8183
should_fail_open(const struct fail_open *fo)
@@ -155,7 +157,15 @@ fail_open_run(struct fail_open *fo)
155157
void
156158
fail_open_maybe_recover(struct fail_open *fo)
157159
{
158-
if (fail_open_is_active(fo) && rconn_is_admitted(fo->controller)) {
160+
if (rconn_is_admitted(fo->controller)) {
161+
fail_open_recover(fo);
162+
}
163+
}
164+
165+
static void
166+
fail_open_recover(struct fail_open *fo)
167+
{
168+
if (fail_open_is_active(fo)) {
159169
flow_t flow;
160170

161171
VLOG_WARN("No longer in fail-open mode");
@@ -235,6 +245,7 @@ void
235245
fail_open_destroy(struct fail_open *fo)
236246
{
237247
if (fo) {
248+
fail_open_recover(fo);
238249
/* We don't own fo->controller. */
239250
switch_status_unregister(fo->ss_cat);
240251
rconn_packet_counter_destroy(fo->bogus_packet_counter);

ofproto/ofproto.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,9 @@ ofproto_destroy(struct ofproto *p)
679679
return;
680680
}
681681

682+
/* Destroy fail-open early, because it touches the classifier. */
683+
ofproto_set_failure(p, false);
684+
682685
ofproto_flush_flows(p);
683686
classifier_destroy(&p->cls);
684687

@@ -697,7 +700,6 @@ ofproto_destroy(struct ofproto *p)
697700
switch_status_destroy(p->switch_status);
698701
in_band_destroy(p->in_band);
699702
discovery_destroy(p->discovery);
700-
fail_open_destroy(p->fail_open);
701703
pinsched_destroy(p->miss_sched);
702704
pinsched_destroy(p->action_sched);
703705
netflow_destroy(p->netflow);

0 commit comments

Comments
 (0)