[ovs-dev,IPv6,v2,04/10] ovn: Rename "nd" action to "nd_na".
diff mbox

Message ID 1469773580-33112-4-git-send-email-jpettit@ovn.org
State Accepted
Headers show

Commit Message

Justin Pettit July 29, 2016, 6:26 a.m. UTC
Rename "nd" to "nd_na" to be more descriptive and consistent with other
ND messages and actions.  This commit also fixes some minor
documentation issues and limits the action to responding to Neighbor
Solicitation messages.

Signed-off-by: Justin Pettit <jpettit@ovn.org>

---
v1->v2: Change "nd_adv" to "nd_na".

 include/ovn/actions.h    |  4 ++--
 ovn/controller/pinctrl.c | 15 +++++++--------
 ovn/lib/actions.c        | 17 +++++++++--------
 ovn/northd/ovn-northd.c  |  2 +-
 ovn/ovn-sb.xml           | 14 +++++++-------
 tests/ovn.at             |  8 ++++----
 6 files changed, 30 insertions(+), 30 deletions(-)

Comments

Ben Pfaff July 29, 2016, 4:54 p.m. UTC | #1
On Thu, Jul 28, 2016 at 11:26:14PM -0700, Justin Pettit wrote:
> Rename "nd" to "nd_na" to be more descriptive and consistent with other
> ND messages and actions.  This commit also fixes some minor
> documentation issues and limits the action to responding to Neighbor
> Solicitation messages.
> 
> Signed-off-by: Justin Pettit <jpettit@ovn.org>
> 
> ---
> v1->v2: Change "nd_adv" to "nd_na".

Acked-by: Ben Pfaff <blp@ovn.org>

Patch
diff mbox

diff --git a/include/ovn/actions.h b/include/ovn/actions.h
index 114c71e..2ae9cd2 100644
--- a/include/ovn/actions.h
+++ b/include/ovn/actions.h
@@ -73,11 +73,11 @@  enum action_opcode {
      */
     ACTION_OPCODE_PUT_DHCP_OPTS,
 
-    /* "na { ...actions... }".
+    /* "nd_na { ...actions... }".
      *
      * The actions, in OpenFlow 1.3 format, follow the action_header.
      */
-    ACTION_OPCODE_NA,
+    ACTION_OPCODE_ND_NA,
 };
 
 /* Header. */
diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c
index 06103dd..c03e2cf 100644
--- a/ovn/controller/pinctrl.c
+++ b/ovn/controller/pinctrl.c
@@ -69,9 +69,9 @@  static void send_garp_run(const struct ovsrec_bridge *,
                           const char *chassis_id,
                           const struct lport_index *lports,
                           struct hmap *local_datapaths);
-static void pinctrl_handle_na(const struct flow *ip_flow,
-                              const struct match *md,
-                              struct ofpbuf *userdata);
+static void pinctrl_handle_nd_na(const struct flow *ip_flow,
+                                 const struct match *md,
+                                 struct ofpbuf *userdata);
 static void reload_metadata(struct ofpbuf *ofpacts,
                             const struct match *md);
 
@@ -410,8 +410,8 @@  process_packet_in(const struct ofp_header *msg)
         pinctrl_handle_put_dhcp_opts(&packet, &pin, &userdata, &continuation);
         break;
 
-    case ACTION_OPCODE_NA:
-        pinctrl_handle_na(&headers, &pin.flow_metadata, &userdata);
+    case ACTION_OPCODE_ND_NA:
+        pinctrl_handle_nd_na(&headers, &pin.flow_metadata, &userdata);
         break;
 
     default:
@@ -947,9 +947,8 @@  reload_metadata(struct ofpbuf *ofpacts, const struct match *md)
 }
 
 static void
-pinctrl_handle_na(const struct flow *ip_flow,
-                  const struct match *md,
-                  struct ofpbuf *userdata)
+pinctrl_handle_nd_na(const struct flow *ip_flow, const struct match *md,
+                     struct ofpbuf *userdata)
 {
     /* This action only works for IPv6 ND packets, and the switch should only
      * send us ND packets this way, but check here just to be sure. */
diff --git a/ovn/lib/actions.c b/ovn/lib/actions.c
index fd5a867..6b8ea3f 100644
--- a/ovn/lib/actions.c
+++ b/ovn/lib/actions.c
@@ -249,8 +249,8 @@  put_controller_op(struct ofpbuf *ofpacts, enum action_opcode opcode)
     finish_controller_op(ofpacts, ofs);
 }
 
-/* Implements the "arp" and "na" actions, which execute nested actions on a
- * packet derived from the one being processed. */
+/* Implements the "arp" and "nd_na" actions, which execute nested
+ * actions on a packet derived fro: the one being processed. */
 static void
 parse_nested_action(struct action_context *ctx, enum action_opcode opcode,
                     const char *prereq)
@@ -278,10 +278,11 @@  parse_nested_action(struct action_context *ctx, enum action_opcode opcode,
 
     ctx->ofpacts = outer_ofpacts;
 
-    /* Add a "controller" action with the actions nested inside "{...}",
-     * converted to OpenFlow, as its userdata.  ovn-controller will convert the
-     * packet to ARP or NA and then send the packet and actions back to the
-     * switch inside an OFPT_PACKET_OUT message. */
+    /* Add a "controller" OpenFlow action with the actions nested inside the
+     * requested OVN action's "{...}", converted to OpenFlow, as its userdata.
+     * ovn-controller will convert the packet to the requested type and
+     * then send the packet and actions back to the switch inside an
+     * OFPT_PACKET_OUT message. */
     size_t oc_offset = start_controller_op(ctx->ofpacts, opcode, false);
     ofpacts_put_openflow_actions(inner_ofpacts.data, inner_ofpacts.size,
                                  ctx->ofpacts, OFP13_VERSION);
@@ -1064,8 +1065,8 @@  parse_action(struct action_context *ctx)
         parse_ct_lb_action(ctx);
     } else if (lexer_match_id(ctx->lexer, "arp")) {
         parse_nested_action(ctx, ACTION_OPCODE_ARP, "ip4");
-    } else if (lexer_match_id(ctx->lexer, "na")) {
-        parse_nested_action(ctx, ACTION_OPCODE_NA, "nd");
+    } else if (lexer_match_id(ctx->lexer, "nd_na")) {
+        parse_nested_action(ctx, ACTION_OPCODE_ND_NA, "nd_ns");
     } else if (lexer_match_id(ctx->lexer, "get_arp")) {
         parse_get_arp_action(ctx);
     } else if (lexer_match_id(ctx->lexer, "put_arp")) {
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index 4a25fad..af13ec2 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -2496,7 +2496,7 @@  build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
                 }
                 ds_clear(&actions);
                 ds_put_format(&actions,
-                    "na { eth.src = %s; "
+                    "nd_na { eth.src = %s; "
                     "nd.tll = %s; "
                     "outport = inport; "
                     "inport = \"\"; /* Allow sending out inport. */ "
diff --git a/ovn/ovn-sb.xml b/ovn/ovn-sb.xml
index 01b7d45..792f495 100644
--- a/ovn/ovn-sb.xml
+++ b/ovn/ovn-sb.xml
@@ -1109,16 +1109,16 @@ 
         </dd>
 
         <dt>
-          <code>na { <var>action</var>; </code>...<code> };</code>
+          <code>nd_na { <var>action</var>; </code>...<code> };</code>
         </dt>
 
         <dd>
           <p>
-            Temporarily replaces the IPv6 packet being processed by an IPv6
-            neighbor advertisement (NA) packet and executes each nested
-            <var>action</var> on the NA packet.  Actions following the
-            <var>na</var> action, if any, apply to the original, unmodified
-            packet.
+            Temporarily replaces the IPv6 neighbor solicitation packet
+            being processed by an IPv6 neighbor advertisement (NA)
+            packet and executes each nested <var>action</var> on the NA
+            packet.  Actions following the <code>nd_na</code> action,
+            if any, apply to the original, unmodified packet.
           </p>
 
           <p>
@@ -1144,7 +1144,7 @@ 
           </p>
 
           <p>
-            <b>Prerequisite:</b> <code>nd</code>
+            <b>Prerequisite:</b> <code>nd_ns</code>
           </p>
         </dd>
 
diff --git a/tests/ovn.at b/tests/ovn.at
index ecad4d5..ab42c75 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -696,8 +696,8 @@  reg1[0] = put_dhcp_opts(offerip=1.2.3.4, xyzzy); => Syntax error at `xyzzy' expe
 reg1[0] = put_dhcp_opts(offerip="xyzzy"); => DHCP option offerip requires numeric value.
 reg1[0] = put_dhcp_opts(offerip=1.2.3.4, domain=1.2.3.4); => DHCP option domain requires string value.
 
-# na
-na { eth.src = 12:34:56:78:9a:bc; nd.tll = 12:34:56:78:9a:bc; outport = inport; inport = ""; /* Allow sending out inport. */ output; }; => actions=controller(userdata=00.00.00.03.00.00.00.00.00.19.00.10.80.00.08.06.12.34.56.78.9a.bc.00.00.00.19.00.10.80.00.42.06.12.34.56.78.9a.bc.00.00.ff.ff.00.18.00.00.23.20.00.06.00.20.00.00.00.00.00.01.1c.04.00.01.1e.04.00.19.00.10.00.01.1c.04.00.00.00.00.00.00.00.00.00.19.00.10.00.00.00.02.00.00.00.00.00.00.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00), prereqs=nd
+# nd_na
+nd_na { eth.src = 12:34:56:78:9a:bc; nd.tll = 12:34:56:78:9a:bc; outport = inport; inport = ""; /* Allow sending out inport. */ output; }; => actions=controller(userdata=00.00.00.03.00.00.00.00.00.19.00.10.80.00.08.06.12.34.56.78.9a.bc.00.00.00.19.00.10.80.00.42.06.12.34.56.78.9a.bc.00.00.ff.ff.00.18.00.00.23.20.00.06.00.20.00.00.00.00.00.01.1c.04.00.01.1e.04.00.19.00.10.00.01.1c.04.00.00.00.00.00.00.00.00.00.19.00.10.00.00.00.02.00.00.00.00.00.00.00.00.ff.ff.00.10.00.00.23.20.00.0e.ff.f8.40.00.00.00), prereqs=nd_ns
 
 # 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
@@ -3630,8 +3630,8 @@  OVN_CLEANUP([hv1])
 
 AT_CLEANUP
 
-AT_SETUP([ovn -- nd ])
-AT_KEYWORDS([ovn-nd])
+AT_SETUP([ovn -- nd_na ])
+AT_KEYWORDS([ovn-nd_na])
 AT_SKIP_IF([test $HAVE_PYTHON = no])
 ovn_start