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" <ronal...@cs.princeton.edu>
Signed-off-by: Ben Pfaff <b...@nicira.com>
---
 AUTHORS           |  1 +
 ofproto/ofproto.c | 13 +++++++++----
 tests/ofproto.at  | 24 ++++++++++++++++++------
 3 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index f6ab641..69faf6f 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -297,6 +297,7 @@ Robert Strickler        anomal...@gmail.com
 Roger Leigh             rle...@codelibre.net
 Rogério Vinhal Nunes
 Roman Sokolkov          rsokol...@gmail.com
+Ronaldo A. Ferreira     ronal...@cs.princeton.edu
 Saul St. John           sstj...@cs.wisc.edu
 Scott Hendricks         shendri...@nicira.com
 Sean Brady              sbr...@gtfservices.com
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index dc7b551..6d78fe4 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -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;
diff --git a/tests/ofproto.at b/tests/ofproto.at
index 8cfecc6..8f4e25e 100644
--- a/tests/ofproto.at
+++ b/tests/ofproto.at
@@ -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
-- 
2.1.3

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to