in-band: Drop in-band flows when turning off in-band control.
authorBen Pfaff <blp@nicira.com>
Tue, 6 Apr 2010 22:24:38 +0000 (15:24 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 20 Apr 2010 18:01:44 +0000 (11:01 -0700)
Destroying the in-band control object didn't remove the flows related to
in-band control, so they could persist until another event caused the
flow table to be reset.  Changing or removing the controller is one such
event, which would probably happen at the same time as turning off in-band
control, so this is a rather minor flaw, but it still seems good to fix it.

ofproto/in-band.c
ofproto/ofproto.c

index f3cd02b88b351a4349f46d47afe4998273f9c457..8e7f43073f871592983c39b83485a59167254d0d 100644 (file)
@@ -645,6 +645,12 @@ void
 in_band_destroy(struct in_band *in_band)
 {
     if (in_band) {
+        int i;
+
+        for (i = 0; i < N_IB_RULES; i++) {
+            drop_flow(in_band, i);
+        }
+
         switch_status_unregister(in_band->ss_cat);
         netdev_close(in_band->local_netdev);
         netdev_close(in_band->remote_netdev);
index 0746bc9836175920d5adc1b2188ef457b19cc4ec..ba9ef1903db12d59260fbd2a170010e6bfaca885 100644 (file)
@@ -718,8 +718,9 @@ ofproto_destroy(struct ofproto *p)
         return;
     }
 
-    /* Destroy fail-open early, because it touches the classifier. */
+    /* Destroy fail-open and in-band early, since they touch the classifier. */
     ofproto_set_failure(p, false);
+    ofproto_set_in_band(p, false);
 
     ofproto_flush_flows(p);
     classifier_destroy(&p->cls);
@@ -737,7 +738,6 @@ ofproto_destroy(struct ofproto *p)
     shash_destroy(&p->port_by_name);
 
     switch_status_destroy(p->switch_status);
-    in_band_destroy(p->in_band);
     discovery_destroy(p->discovery);
     pinsched_destroy(p->miss_sched);
     pinsched_destroy(p->action_sched);