[ovs-dev] [ovn-ipv6 23/26] ovn: Rename "nd" action to "nd_adv".

Justin Pettit jpettit at ovn.org
Tue Jul 12 06:56:53 UTC 2016


Rename "nd" to "nd_adv" 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 at ovn.org>
---
 ovn/controller/pinctrl.c | 15 +++++++--------
 ovn/lib/actions.c        | 17 +++++++++--------
 ovn/lib/actions.h        |  4 ++--
 ovn/northd/ovn-northd.c  |  2 +-
 ovn/ovn-sb.xml           | 14 +++++++-------
 tests/ovn.at             |  8 ++++----
 6 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c
index fdf21c7..77e5dc6 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_adv(const struct flow *ip_flow,
+                                  const struct match *md,
+                                  struct ofpbuf *userdata);
 static void reload_metadata(struct ofpbuf *ofpacts,
                             const struct match *md);
 
@@ -409,8 +409,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_ADV:
+        pinctrl_handle_nd_adv(&headers, &pin.flow_metadata, &userdata);
         break;
 
     default:
@@ -945,9 +945,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_adv(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 3d10d61..57ca580 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_adv" 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);
@@ -1062,8 +1063,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_adv")) {
+        parse_nested_action(ctx, ACTION_OPCODE_ND_ADV, "nd_sol");
     } 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/lib/actions.h b/ovn/lib/actions.h
index 48f0140..2268302 100644
--- a/ovn/lib/actions.h
+++ b/ovn/lib/actions.h
@@ -73,11 +73,11 @@ enum action_opcode {
      */
     ACTION_OPCODE_PUT_DHCP_OPTS,
 
-    /* "na { ...actions... }".
+    /* "nd_adv { ...actions... }".
      *
      * The actions, in OpenFlow 1.3 format, follow the action_header.
      */
-    ACTION_OPCODE_NA,
+    ACTION_OPCODE_ND_ADV,
 };
 
 /* Header. */
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index b262e86..b99c183 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -1886,7 +1886,7 @@ build_lswitch_flows(struct hmap *datapaths, struct hmap *ports,
                 }
                 ds_clear(&actions);
                 ds_put_format(&actions,
-                    "na { eth.src = %s; "
+                    "nd_adv { 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 2914349..edc696e 100644
--- a/ovn/ovn-sb.xml
+++ b/ovn/ovn-sb.xml
@@ -1076,16 +1076,16 @@
         </dd>
 
         <dt>
-          <code>na { <var>action</var>; </code>...<code> };</code>
+          <code>nd_adv { <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_adv</code> action,
+            if any, apply to the original, unmodified packet.
           </p>
 
           <p>
@@ -1111,7 +1111,7 @@
           </p>
 
           <p>
-            <b>Prerequisite:</b> <code>nd</code>
+            <b>Prerequisite:</b> <code>nd_sol</code>
           </p>
         </dd>
 
diff --git a/tests/ovn.at b/tests/ovn.at
index 12de125..fb2d3a3 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -647,8 +647,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_adv
+nd_adv { 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_sol
 
 # 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
@@ -3416,8 +3416,8 @@ OVN_CLEANUP([hv1])
 
 AT_CLEANUP
 
-AT_SETUP([ovn -- nd ])
-AT_KEYWORDS([ovn-nd])
+AT_SETUP([ovn -- nd_adv ])
+AT_KEYWORDS([ovn-nd_adv])
 AT_SKIP_IF([test $HAVE_PYTHON = no])
 ovn_start
 
-- 
1.9.1




More information about the dev mailing list