ofproto: Omit hidden tables from "next tables".
authorBen Pfaff <blp@nicira.com>
Thu, 1 Jan 2015 22:40:44 +0000 (14:40 -0800)
committerBen Pfaff <blp@nicira.com>
Fri, 2 Jan 2015 19:08:13 +0000 (11:08 -0800)
Hidden tables are intended to be concealed from OpenFlow, but their
presence leaked through the "next tables" and "instructions" in the OF1.3+
table features reply.  This fixes the problem.

Reported-by: "Ronaldo A. Ferreira" <ronaldof@CS.Princeton.EDU>
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Thomas Graf <tgraf@noironetworks.com>
AUTHORS
ofproto/ofproto.c
tests/ofproto.at

diff --git a/AUTHORS b/AUTHORS
index eb0ee70..7d34353 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -298,6 +298,7 @@ Robert Strickler        anomalyst@gmail.com
 Roger Leigh             rleigh@codelibre.net
 RogĂ©rio Vinhal Nunes
 Roman Sokolkov          rsokolkov@gmail.com
+Ronaldo A. Ferreira     ronaldof@CS.Princeton.EDU
 Saul St. John           sstjohn@cs.wisc.edu
 Scott Hendricks         shendricks@nicira.com
 Sean Brady              sbrady@gtfservices.com
index dc7b551..6d78fe4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Nicira, Inc.
  * Copyright (c) 2010 Jean Tourrilhes - HP-Labs.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -2934,10 +2934,15 @@ query_tables(struct ofproto *ofproto,
         atomic_read_relaxed(&ofproto->tables[i].miss_config, &f->miss_config);
         f->max_entries = 1000000;
 
-        bitmap_set_multiple(f->nonmiss.next, i + 1,
-                            ofproto->n_tables - (i + 1), true);
+        bool more_tables = false;
+        for (int j = i + 1; j < ofproto->n_tables; j++) {
+            if (!(ofproto->tables[j].flags & OFTABLE_HIDDEN)) {
+                bitmap_set1(f->nonmiss.next, j);
+                more_tables = true;
+            }
+        }
         f->nonmiss.instructions = (1u << N_OVS_INSTRUCTIONS) - 1;
-        if (i == ofproto->n_tables - 1) {
+        if (!more_tables) {
             f->nonmiss.instructions &= ~(1u << OVSINST_OFPIT11_GOTO_TABLE);
         }
         f->nonmiss.write.ofpacts = (UINT64_C(1) << N_OFPACTS) - 1;
index 8cfecc6..8f4e25e 100644 (file)
@@ -1313,6 +1313,11 @@ OVS_VSWITCHD_START
  x=0
  name=classifier
  while test $x -lt 254; do
+   if test $x = 253; then
+     goto=
+   else
+     goto=,goto_table
+   fi
    echo "
   table $x (\"$name\"):
     active=0, lookup=0, matched=0
@@ -1320,7 +1325,7 @@ OVS_VSWITCHD_START
     config=controller
     max_entries=1000000
     instructions (table miss and others):
-      instructions: apply_actions,clear_actions,write_actions,write_metadata,goto_table
+      instructions: apply_actions,clear_actions,write_actions,write_metadata$goto
       Write-Actions and Apply-Actions features:
         actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
         supported on Set-Field: metadata in_port_oxm eth_src eth_dst vlan_vid vlan_pcp mpls_label mpls_tc ip_src ip_dst ipv6_src ipv6_dst ip_dscp nw_ecn arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst
@@ -1389,16 +1394,23 @@ OVS_VSWITCHD_START
  while test $x -lt 254; do
    y=`expr $x + 1`
    if test $x = 253; then
-       next=254
+     next=
+     goto=
    else
-       next=$y-254
+     goto=,goto_table
+     if test $x = 252; then
+       next='
+      next tables: 253'
+     else
+       next="
+      next tables: $y-253"
+     fi
    fi
    echo "  table $x (\"$name\"):
     metadata: match=0xffffffffffffffff write=0xffffffffffffffff
     max_entries=1000000
-    instructions (table miss and others):
-      next tables: $next
-      instructions: meter,apply_actions,clear_actions,write_actions,write_metadata,goto_table
+    instructions (table miss and others):$next
+      instructions: meter,apply_actions,clear_actions,write_actions,write_metadata$goto
       Write-Actions and Apply-Actions features:
         actions: output group set_field strip_vlan push_vlan mod_nw_ttl dec_ttl set_mpls_ttl dec_mpls_ttl push_mpls pop_mpls set_queue
         supported on Set-Field: tun_id tun_src tun_dst metadata in_port in_port_oxm pkt_mark reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 xreg0 xreg1 xreg2 xreg3 eth_src eth_dst vlan_tci vlan_vid vlan_pcp mpls_label mpls_tc ip_src ip_dst ipv6_src ipv6_dst nw_tos ip_dscp nw_ecn nw_ttl arp_op arp_spa arp_tpa arp_sha arp_tha tcp_src tcp_dst udp_src udp_dst sctp_src sctp_dst