Skip to content

Commit

Permalink
ovn: Rename "nd" action to "nd_na".
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
justinpettit committed Jul 29, 2016
1 parent acdd922 commit f8a8db3
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions include/ovn/actions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
15 changes: 7 additions & 8 deletions ovn/controller/pinctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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. */
Expand Down
17 changes: 9 additions & 8 deletions ovn/lib/actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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")) {
Expand Down
2 changes: 1 addition & 1 deletion ovn/northd/ovn-northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */ "
Expand Down
14 changes: 7 additions & 7 deletions ovn/ovn-sb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1073,16 +1073,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>
Expand All @@ -1108,7 +1108,7 @@
</p>

<p>
<b>Prerequisite:</b> <code>nd</code>
<b>Prerequisite:</b> <code>nd_ns</code>
</p>
</dd>

Expand Down
8 changes: 4 additions & 4 deletions tests/ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,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
Expand Down Expand Up @@ -3619,8 +3619,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

Expand Down

0 comments on commit f8a8db3

Please sign in to comment.