in-band: use open_type when opening internal device
[cascardo/ovs.git] / ofproto / in-band.c
index efea19f..e3ee41a 100644 (file)
@@ -422,9 +422,10 @@ in_band_create(struct ofproto *ofproto, const char *local_name,
     struct in_band *in_band;
     struct netdev *local_netdev;
     int error;
+    const char *type = ofproto_port_open_type(ofproto->type, "internal");
 
     *in_bandp = NULL;
-    error = netdev_open(local_name, "internal", &local_netdev);
+    error = netdev_open(local_name, type, &local_netdev);
     if (error) {
         VLOG_ERR("%s: failed to initialize in-band control: cannot open "
                  "datapath local port %s (%s)", ofproto->name,
@@ -449,10 +450,9 @@ void
 in_band_destroy(struct in_band *ib)
 {
     if (ib) {
-        struct in_band_rule *rule, *next;
+        struct in_band_rule *rule;
 
-        HMAP_FOR_EACH_SAFE (rule, next, hmap_node, &ib->rules) {
-            hmap_remove(&ib->rules, &rule->hmap_node);
+        HMAP_FOR_EACH_POP (rule, hmap_node, &ib->rules) {
             free(rule);
         }
         hmap_destroy(&ib->rules);