ofproto-dpif: Install internal rule should not change the match content.
[cascardo/ovs.git] / ofproto / ofproto-dpif.c
index 7d082bc..fdb4cd6 100644 (file)
@@ -1241,13 +1241,13 @@ add_internal_flows(struct ofproto_dpif *ofproto)
 
     ofpbuf_clear(&ofpacts);
     error = add_internal_miss_flow(ofproto, id++, &ofpacts,
-                              &ofproto->no_packet_in_rule);
+                                   &ofproto->no_packet_in_rule);
     if (error) {
         return error;
     }
 
     error = add_internal_miss_flow(ofproto, id++, &ofpacts,
-                              &ofproto->drop_frags_rule);
+                                   &ofproto->drop_frags_rule);
     if (error) {
         return error;
     }
@@ -1264,7 +1264,7 @@ add_internal_flows(struct ofproto_dpif *ofproto)
     match_init_catchall(&match);
     match_set_recirc_id(&match, 0);
 
-    error = ofproto_dpif_add_internal_flow(ofproto, &match, 2,  &ofpacts,
+    error = ofproto_dpif_add_internal_flow(ofproto, &match, 2, &ofpacts,
                                            &unused_rulep);
     if (error) {
         return error;
@@ -1277,7 +1277,7 @@ add_internal_flows(struct ofproto_dpif *ofproto)
      */
     ofpbuf_clear(&ofpacts);
     match_init_catchall(&match);
-    error = ofproto_dpif_add_internal_flow(ofproto, &match, 1,  &ofpacts,
+    error = ofproto_dpif_add_internal_flow(ofproto, &match, 1, &ofpacts,
                                            &unused_rulep);
 
     return error;
@@ -4514,6 +4514,13 @@ ofproto_dpif_unixctl_init(void)
                              ofproto_unixctl_dpif_dump_flows, NULL);
 }
 
+/* Returns true if 'table' is the table used for internal rules,
+ * false otherwise. */
+bool
+table_is_internal(uint8_t table_id)
+{
+    return table_id == TBL_INTERNAL;
+}
 \f
 /* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.)
  *
@@ -4794,7 +4801,7 @@ ofproto_dpif_free_recirc_id(struct ofproto_dpif *ofproto, uint32_t recirc_id)
 
 int
 ofproto_dpif_add_internal_flow(struct ofproto_dpif *ofproto,
-                               struct match *match, int priority,
+                               const struct match *match, int priority,
                                const struct ofpbuf *ofpacts,
                                struct rule **rulep)
 {
@@ -4826,8 +4833,8 @@ ofproto_dpif_add_internal_flow(struct ofproto_dpif *ofproto,
         return error;
     }
 
-    rule = rule_dpif_lookup_in_table(ofproto, TBL_INTERNAL, &match->flow,
-                                     &match->wc, false);
+    rule = rule_dpif_lookup_in_table(ofproto, TBL_INTERNAL, &fm.match.flow,
+                                     &fm.match.wc, false);
     if (rule) {
         *rulep = &rule->up;
     } else {