[ovs-dev] [ICMP v2 3/7] ovn: Use "ip.ttl--" instead of "ip4.ttl--".

Justin Pettit jpettit at nicira.com
Tue Nov 3 23:48:46 UTC 2015


Signed-off-by: Justin Pettit <jpettit at nicira.com>
---
 ovn/lib/actions.c           |    4 ++--
 ovn/northd/ovn-northd.8.xml |   14 +++++++-------
 ovn/northd/ovn-northd.c     |    2 +-
 tests/ovn.at                |    5 +++--
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/ovn/lib/actions.c b/ovn/lib/actions.c
index ccf97f0..693b1c1 100644
--- a/ovn/lib/actions.c
+++ b/ovn/lib/actions.c
@@ -247,9 +247,9 @@ parse_actions(struct action_context *ctx)
             parse_next_action(ctx);
         } else if (lexer_match_id(ctx->lexer, "output")) {
             emit_resubmit(ctx, ctx->output_ptable);
-        } else if (lexer_match_id(ctx->lexer, "ip4.ttl")) {
+        } else if (lexer_match_id(ctx->lexer, "ip.ttl")) {
             if (lexer_match(ctx->lexer, LEX_T_DECREMENT)) {
-                struct expr *e = expr_parse_string("ip4", ctx->symtab,
+                struct expr *e = expr_parse_string("ip", ctx->symtab,
                                                    &ctx->error);
                 ctx->prereqs = expr_combine(EXPR_T_AND, ctx->prereqs, e);
                 ofpact_put_DEC_TTL(ctx->ofpacts);
diff --git a/ovn/northd/ovn-northd.8.xml b/ovn/northd/ovn-northd.8.xml
index 4bd1990..6f0a420 100644
--- a/ovn/northd/ovn-northd.8.xml
+++ b/ovn/northd/ovn-northd.8.xml
@@ -338,7 +338,7 @@
         <pre>
 ip4.dst = ip4.src;
 ip4.src = <var>S</var>;
-ip4.ttl = 255;
+ip.ttl = 255;
 icmp4.type = 0;
 next;
         </pre>
@@ -460,7 +460,7 @@ output;
         <p>
           ICMP time exceeded.  For each router port <var>P</var>, whose IP
           address is <var>A</var>, a priority-40 flow with match <code>inport
-          == <var>P</var> &amp;&amp; ip4.ttl == {0, 1} &amp;&amp;
+          == <var>P</var> &amp;&amp; ip.ttl == {0, 1} &amp;&amp;
           !ip.later_frag</code> matches packets whose TTL has expired, with the
           following actions to send an ICMP time exceeded reply:
         </p>
@@ -471,7 +471,7 @@ icmp4 {
     icmp4.code = 0;  /* TTL exceeded in transit. */
     ip4.dst = ip4.src;
     ip4.src = <var>A</var>;
-    ip4.ttl = 255;
+    ip.ttl = 255;
     next;
 };
         </pre>
@@ -482,7 +482,7 @@ icmp4 {
       </li>
 
       <li>
-        TTL discard.  A priority-30 flow with match <code>ip4.ttl == {0,
+        TTL discard.  A priority-30 flow with match <code>ip.ttl == {0,
         1}</code> and actions <code>drop;</code> drops other packets whose TTL
         has expired, that should not receive a ICMP error reply (i.e. fragments
         with nonzero offset).
@@ -519,13 +519,13 @@ icmp4 {
         </p>
 
         <pre>
-ip4.ttl--;
+ip.ttl--;
 reg0 = <var>G</var>;
 next;
         </pre>
 
         <p>
-          (Ingress table 1 already verified that <code>ip4.ttl--;</code> will
+          (Ingress table 1 already verified that <code>ip.ttl--;</code> will
           not yield a TTL exceeded error.)
         </p>
 
@@ -549,7 +549,7 @@ icmp4 {
     icmp4.code = 0; /* Network unreachable. */
     ip4.dst = ip4.src;
     ip4.src = <var>A</var>;
-    ip4.ttl = 255;
+    ip.ttl = 255;
     next(2);
 };
         </pre>
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index b196837..c7d56fe 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -1272,7 +1272,7 @@ add_route(struct hmap *lflows, struct ovn_datapath *od,
                             IP_ARGS(network), IP_ARGS(mask));
 
     struct ds actions = DS_EMPTY_INITIALIZER;
-    ds_put_cstr(&actions, "ip4.ttl--; reg0 = ");
+    ds_put_cstr(&actions, "ip.ttl--; reg0 = ");
     if (gateway) {
         ds_put_format(&actions, IP_FMT, IP_ARGS(gateway));
     } else {
diff --git a/tests/ovn.at b/tests/ovn.at
index 3e58ff3..68fcc9a 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -459,7 +459,8 @@ reg0 <-> reg1; => actions=push:OXM_OF_PKT_REG0[0..31],push:OXM_OF_PKT_REG0[32..6
 vlan.pcp <-> reg0[0..2]; => actions=push:OXM_OF_PKT_REG0[32..34],push:NXM_OF_VLAN_TCI[13..15],pop:OXM_OF_PKT_REG0[32..34],pop:NXM_OF_VLAN_TCI[13..15], prereqs=vlan.tci[12]
 reg0[10] <-> vlan.pcp[1]; => actions=push:NXM_OF_VLAN_TCI[14],push:OXM_OF_PKT_REG0[42],pop:NXM_OF_VLAN_TCI[14],pop:OXM_OF_PKT_REG0[42], prereqs=vlan.tci[12]
 outport <-> inport; => actions=push:NXM_NX_REG6[],push:NXM_NX_REG7[],pop:NXM_NX_REG6[],pop:NXM_NX_REG7[], prereqs=1
-ip4.ttl--; => actions=dec_ttl, prereqs=ip4
+ip.ttl--; => actions=dec_ttl, prereqs=ip
+ip.ttl = 4; => actions=set_field:4->nw_ttl, prereqs=eth.type == 0x800 || eth.type == 0x86dd
 
 # Contradictionary prerequisites (allowed but not useful):
 ip4.src = ip6.src[0..31]; => actions=move:NXM_NX_IPV6_SRC[0..31]->NXM_OF_IP_SRC[], prereqs=eth.type == 0x800 && eth.type == 0x86dd
@@ -504,7 +505,7 @@ inport <-> reg0; => Can't exchange string field (inport) with integer field (reg
 inport <-> big_string; => String fields inport and big_string are incompatible for exchange.
 ip.proto <-> reg0[0..7]; => Field ip.proto is not modifiable.
 reg0[0..7] <-> ip.proto; => Field ip.proto is not modifiable.
-ip4.ttl => Syntax error at end of input expecting `--'.
+ip.ttl => Syntax error at end of input expecting `--'.
 ]])
 sed 's/ =>.*//' test-cases.txt > input.txt
 sed 's/.* => //' test-cases.txt > expout
-- 
1.7.5.4




More information about the dev mailing list