Skip to content

Commit

Permalink
ovn-northd: Support pinging logical router ports.
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Pettit <[email protected]>
Acked-by: Russell Bryant <[email protected]>
  • Loading branch information
Justin Pettit authored and justinpettit committed Nov 9, 2015
1 parent f6ecf94 commit dd7652e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
5 changes: 1 addition & 4 deletions ovn/northd/ovn-northd.8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ ip4.dst = ip4.src;
ip4.src = <var>S</var>;
ip.ttl = 255;
icmp4.type = 0;
inport = \"\"; /* Allow sending out inport. */
next;
</pre>

Expand All @@ -348,10 +349,6 @@ next;
each individual <code>inport</code>, and use the same actions in
which <var>S</var> is a function of <code>inport</code>.
</p>

<p>
Not yet implemented.
</p>
</li>

<li>
Expand Down
23 changes: 20 additions & 3 deletions ovn/northd/ovn-northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1295,8 +1295,6 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
/* This flow table structure is documented in ovn-northd(8), so please
* update ovn-northd.8.xml if you change anything. */

/* XXX ICMP echo reply */

/* Logical router ingress table 0: Admission control framework. */
struct ovn_datapath *od;
HMAP_FOR_EACH (od, key_node, datapaths) {
Expand Down Expand Up @@ -1384,12 +1382,31 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
match, "drop;");
free(match);

/* ICMP echo reply. These flows reply to ICMP echo requests
* received for the router's IP address. */
match = xasprintf(
"inport == %s && (ip4.dst == "IP_FMT" || ip4.dst == "IP_FMT") && "
"icmp4.type == 8 && icmp4.code == 0",
op->json_key, IP_ARGS(op->ip), IP_ARGS(op->bcast));
char *actions = xasprintf(
"ip4.dst = ip4.src; "
"ip4.src = "IP_FMT"; "
"ip.ttl = 255; "
"icmp4.type = 0; "
"inport = \"\"; /* Allow sending out inport. */ "
"next; ",
IP_ARGS(op->ip));
ovn_lflow_add(lflows, op->od, S_ROUTER_IN_IP_INPUT, 90,
match, actions);
free(match);
free(actions);

/* ARP reply. These flows reply to ARP requests for the router's own
* IP address. */
match = xasprintf(
"inport == %s && arp.tpa == "IP_FMT" && arp.op == 1",
op->json_key, IP_ARGS(op->ip));
char *actions = xasprintf(
actions = xasprintf(
"eth.dst = eth.src; "
"eth.src = "ETH_ADDR_FMT"; "
"arp.op = 2; /* ARP reply */ "
Expand Down

0 comments on commit dd7652e

Please sign in to comment.