ovn-northd: Restrict use of unspecified source addresses
[cascardo/ovs.git] / ovn / northd / ovn-northd.8.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <manpage program="ovn-northd" section="8" title="ovn-northd">
3     <h1>Name</h1>
4     <p>ovn-northd -- Open Virtual Network central control daemon</p>
5
6     <h1>Synopsis</h1>
7     <p><code>ovn-northd</code> [<var>options</var>]</p>
8
9     <h1>Description</h1>
10     <p>
11       <code>ovn-northd</code> is a centralized daemon responsible for
12       translating the high-level OVN configuration into logical
13       configuration consumable by daemons such as
14       <code>ovn-controller</code>.  It translates the logical network
15       configuration in terms of conventional network concepts, taken
16       from the OVN Northbound Database (see <code>ovn-nb</code>(5)),
17       into logical datapath flows in the OVN Southbound Database (see
18       <code>ovn-sb</code>(5)) below it.
19     </p>
20
21     <h1>Configuration</h1>
22     <p>
23       <code>ovn-northd</code> requires a connection to the Northbound
24       and Southbound databases.  The default is <code>db.sock</code>
25       in the local Open vSwitch's "run" directory.  This may be
26       overridden with the following commands:
27     </p>
28     <ul>
29       <li>
30         <p>
31           <code>--ovnnb-db=<var>database</var></code>
32         </p>
33         <p>
34           The database containing the OVN Northbound Database.
35         </p>
36       </li>
37       <li>
38         <p>
39           <code>--ovnsb-db=<var>database</var></code>
40         </p>
41         <p>
42           The database containing the OVN Southbound Database.
43         </p>
44       </li>
45     </ul>
46     <p>
47       The <var>database</var> argument must take one of the following forms:
48     </p>
49     <ul>
50       <li>
51         <p>
52           <code>ssl:<var>ip</var>:<var>port</var></code>
53         </p>
54         <p>
55           The specified SSL <var>port</var> on the host at the given
56           <var>ip</var>, which must be expressed as an IP address (not a DNS
57           name) in IPv4 or IPv6 address format.  If <var>ip</var> is an IPv6
58           address, then wrap <var>ip</var> with square brackets, e.g.:
59           <code>ssl:[::1]:6640</code>.  The <code>--private-key</code>,
60           <code>--certificate</code>, and <code>--ca-cert</code> options are
61           mandatory when this form is used.
62         </p>
63       </li>
64       <li>
65         <p>
66           <code>tcp:<var>ip</var>:<var>port</var></code>
67         </p>
68         <p>
69           Connect to the given TCP <var>port</var> on <var>ip</var>, where
70           <var>ip</var> can be IPv4 or IPv6 address. If <var>ip</var> is an
71           IPv6 address, then wrap <var>ip</var> with square brackets, e.g.:
72           <code>tcp:[::1]:6640</code>.
73         </p>
74       </li>
75       <li>
76         <p>
77           <code>unix:<var>file</var></code>
78         </p>
79         <p>
80           On POSIX, connect to the Unix domain server socket named
81           <var>file</var>.
82         </p>
83         <p>
84           On Windows, connect to a localhost TCP port whose value is written
85           in <var>file</var>.
86         </p>
87       </li>
88     </ul>
89
90     <h1>Runtime Management Commands</h1>
91     <p>
92       <code>ovs-appctl</code> can send commands to a running
93       <code>ovn-northd</code> process.  The currently supported commands
94       are described below.
95       <dl>
96       <dt><code>exit</code></dt>
97       <dd>
98         Causes <code>ovn-northd</code> to gracefully terminate.
99       </dd>
100       </dl>
101     </p>
102
103     <h1>Logical Flow Table Structure</h1>
104
105     <p>
106       One of the main purposes of <code>ovn-northd</code> is to populate the
107       <code>Logical_Flow</code> table in the <code>OVN_Southbound</code>
108       database.  This section describes how <code>ovn-northd</code> does this
109       for switch and router logical datapaths.
110     </p>
111
112     <h2>Logical Switch Datapaths</h2>
113
114     <h3>Ingress Table 0: Admission Control and Ingress Port Security - L2</h3>
115
116     <p>
117       Ingress table 0 contains these logical flows:
118     </p>
119
120     <ul>
121       <li>
122         Priority 100 flows to drop packets with VLAN tags or multicast Ethernet
123         source addresses.
124       </li>
125
126       <li>
127         Priority 50 flows that implement ingress port security for each enabled
128         logical port.  For logical ports on which port security is enabled,
129         these match the <code>inport</code> and the valid <code>eth.src</code>
130         address(es) and advance only those packets to the next flow table.  For
131         logical ports on which port security is not enabled, these advance all
132         packets that match the <code>inport</code>.
133       </li>
134     </ul>
135
136     <p>
137       There are no flows for disabled logical ports because the default-drop
138       behavior of logical flow tables causes packets that ingress from them to
139       be dropped.
140     </p>
141
142     <h3>Ingress Table 1: Ingress Port Security - IP</h3>
143
144     <p>
145       Ingress table 1 contains these logical flows:
146     </p>
147
148     <ul>
149       <li>
150         <p>
151           For each element in the port security set having one or more IPv4 or
152           IPv6 addresses (or both),
153         </p>
154
155         <ul>
156           <li>
157             Priority 90 flow to allow IPv4 traffic if it has IPv4 addresses
158             which match the <code>inport</code>, valid <code>eth.src</code>
159             and valid <code>ip4.src</code> address(es).
160           </li>
161
162           <li>
163             Priority 90 flow to allow IPv4 DHCP discovery traffic if it has a
164             valid <code>eth.src</code>. This is necessary since DHCP discovery
165             messages are sent from the unspecified IPv4 address (0.0.0.0) since
166             the IPv4 address has not yet been assigned.
167           </li>
168
169           <li>
170             Priority 90 flow to allow IPv6 traffic if it has IPv6 addresses
171             which match the <code>inport</code>, valid <code>eth.src</code> and
172             valid <code>ip6.src</code> address(es).
173           </li>
174
175           <li>
176             Priority 90 flow to allow IPv6 DAD (Duplicate Address Detection)
177             traffic if it has a valid <code>eth.src</code>. This is is
178             necessary since DAD include requires joining an multicast group and
179             sending neighbor solicitations for the newly assigned address. Since
180             no address is yet assigned, these are sent from the unspecified
181             IPv6 address (::).
182           </li>
183
184           <li>
185             Priority 80 flow to drop IP (both IPv4 and IPv6) traffic which
186             match the <code>inport</code> and valid <code>eth.src</code>.
187           </li>
188         </ul>
189       </li>
190
191       <li>
192         One priority-0 fallback flow that matches all packets and advances to
193         table 2.
194       </li>
195     </ul>
196
197     <h3>Ingress Table 2: Ingress Port Security - Neighbor discovery</h3>
198
199     <p>
200       Ingress table 2 contains these logical flows:
201     </p>
202
203     <ul>
204       <li>
205         <p>
206           For each element in the port security set,
207         </p>
208
209         <ul>
210           <li>
211             Priority 90 flow to allow ARP traffic which match the
212             <code>inport</code> and valid <code>eth.src</code> and
213             <code>arp.sha</code>. If the element has one or more
214             IPv4 addresses, then it also matches the valid
215             <code>arp.spa</code>.
216           </li>
217
218           <li>
219             Priority 90 flow to allow IPv6 Neighbor Solicitation and
220             Advertisement traffic which match the <code>inport</code>,
221             valid <code>eth.src</code> and
222             <code>nd.sll</code>/<code>nd.tll</code>.
223             If the element has one or more IPv6 addresses, then it also
224             matches the valid <code>nd.target</code> address(es) for Neighbor
225             Advertisement traffic.
226           </li>
227
228           <li>
229             Priority 80 flow to drop ARP and IPv6 Neighbor Solicitation and
230             Advertisement traffic which match the <code>inport</code> and
231             valid <code>eth.src</code>.
232           </li>
233         </ul>
234       </li>
235
236       <li>
237         One priority-0 fallback flow that matches all packets and advances to
238         table 3.
239       </li>
240     </ul>
241
242     <h3>Ingress Table 3: <code>from-lport</code> Pre-ACLs</h3>
243
244     <p>
245       Ingress table 3 prepares flows for possible stateful ACL processing
246       in table 4.  It contains a priority-0 flow that simply moves
247       traffic to table 4.  If stateful ACLs are used in the logical
248       datapath, a priority-100 flow is added that sends IP packets to
249       the connection tracker before advancing to table 4.
250     </p>
251
252     <h3>Ingress table 4: <code>from-lport</code> ACLs</h3>
253
254     <p>
255       Logical flows in this table closely reproduce those in the
256       <code>ACL</code> table in the <code>OVN_Northbound</code> database
257       for the <code>from-lport</code> direction.  <code>allow</code>
258       ACLs translate into logical flows with the <code>next;</code>
259       action, <code>allow-related</code> ACLs translate into logical
260       flows with the <code>ct_commit; next;</code> actions, other ACLs
261       translate to <code>drop;</code>.  The <code>priority</code> values
262       from the <code>ACL</code> table have a limited range and have 1000
263       added to them to leave room for OVN default flows at both higher
264       and lower priorities.
265     </p>
266
267     <p>
268       Ingress table 4 also contains a priority 0 flow with action
269       <code>next;</code>, so that ACLs allow packets by default.  If the
270       logical datapath has a statetful ACL, the following flows will
271       also be added:
272     </p>
273
274     <ul>
275       <li>
276         A priority-1 flow to commit IP traffic to the connection
277         tracker.  This is needed for the default allow policy because,
278         while the initiater's direction may not have any stateful rules,
279         the server's may and then its return traffic would not be known
280         and marked as invalid.
281       </li>
282
283       <li>
284         A priority-65535 flow that allows any traffic that has been
285         committed to the connection tracker (i.e., established flows).
286       </li>
287
288       <li>
289         A priority-65535 flow that allows any traffic that is considered
290         related to a committed flow in the connection tracker (e.g., an
291         ICMP Port Unreachable from a non-listening UDP port).
292       </li>
293
294       <li>
295         A priority-65535 flow that drops all traffic marked by the
296         connection tracker as invalid.
297       </li>
298     </ul>
299
300     <h3>Ingress Table 5: ARP responder</h3>
301
302     <p>
303       This table implements ARP responder for known IPs.  It contains these
304       logical flows:
305     </p>
306
307     <ul>
308       <li>
309         Priority-100 flows to skip ARP responder if inport is of type
310         <code>localnet</code>, and advances directly to table 6.
311       </li>
312
313       <li>
314         <p>
315           Priority-50 flows that matches ARP requests to each known IP address
316           <var>A</var> of logical port <var>P</var>, and respond with ARP
317           replies directly with corresponding Ethernet address <var>E</var>:
318         </p>
319
320         <pre>
321 eth.dst = eth.src;
322 eth.src = <var>E</var>;
323 arp.op = 2; /* ARP reply. */
324 arp.tha = arp.sha;
325 arp.sha = <var>E</var>;
326 arp.tpa = arp.spa;
327 arp.spa = <var>A</var>;
328 outport = <var>P</var>;
329 inport = ""; /* Allow sending out inport. */
330 output;
331         </pre>
332
333         <p>
334           These flows are omitted for logical ports (other than router ports)
335           that are down.
336         </p>
337       </li>
338
339       <li>
340         One priority-0 fallback flow that matches all packets and advances to
341         table 6.
342       </li>
343     </ul>
344
345     <h3>Ingress Table 6: Destination Lookup</h3>
346
347     <p>
348       This table implements switching behavior.  It contains these logical
349       flows:
350     </p>
351
352     <ul>
353       <li>
354         A priority-100 flow that outputs all packets with an Ethernet broadcast
355         or multicast <code>eth.dst</code> to the <code>MC_FLOOD</code>
356         multicast group, which <code>ovn-northd</code> populates with all
357         enabled logical ports.
358       </li>
359
360       <li>
361         One priority-50 flow that matches each known Ethernet address against
362         <code>eth.dst</code> and outputs the packet to the single associated
363         output port.
364       </li>
365
366       <li>
367         One priority-0 fallback flow that matches all packets and outputs them
368         to the <code>MC_UNKNOWN</code> multicast group, which
369         <code>ovn-northd</code> populates with all enabled logical ports that
370         accept unknown destination packets.  As a small optimization, if no
371         logical ports accept unknown destination packets,
372         <code>ovn-northd</code> omits this multicast group and logical flow.
373       </li>
374     </ul>
375
376     <h3>Egress Table 0: <code>to-lport</code> Pre-ACLs</h3>
377
378     <p>
379       This is similar to ingress table 3 except for <code>to-lport</code>
380       traffic.
381     </p>
382
383     <h3>Egress Table 1: <code>to-lport</code> ACLs</h3>
384
385     <p>
386       This is similar to ingress table 4 except for <code>to-lport</code> ACLs.
387     </p>
388
389     <h3>Egress Table 2: Egress Port Security - IP</h3>
390
391     <p>
392       This is similar to the ingress port security logic in table 1 except
393       that <code>outport</code>, <code>eth.dst</code>, <code>ip4.dst</code>
394       and <code>ip6.dst</code> are checked instead of <code>inport</code>,
395       <code>eth.src</code>, <code>ip4.src</code> and <code>ip6.src</code>
396     </p>
397
398     <h3>Egress Table 3: Egress Port Security - L2</h3>
399
400     <p>
401       This is similar to the ingress port security logic in ingress table 0,
402       but with important differences.  Most obviously, <code>outport</code> and
403       <code>eth.dst</code> are checked instead of <code>inport</code> and
404       <code>eth.src</code>.  Second, packets directed to broadcast or multicast
405       <code>eth.dst</code> are always accepted instead of being subject to the
406       port security rules; this is implemented through a priority-100 flow that
407       matches on <code>eth.mcast</code> with action <code>output;</code>.
408       Finally, to ensure that even broadcast and multicast packets are not
409       delivered to disabled logical ports, a priority-150 flow for each
410       disabled logical <code>outport</code> overrides the priority-100 flow
411       with a <code>drop;</code> action.
412     </p>
413
414     <h2>Logical Router Datapaths</h2>
415
416     <p>
417       Logical router datapaths will only exist for <ref table="Logical_Router"
418       db="OVN_Northbound"/> rows in the <ref db="OVN_Northbound"/> database
419       that do not have <ref column="enabled" table="Logical_Router"
420       db="OVN_Northbound"/> set to <code>false</code>
421     </p>
422
423     <h3>Ingress Table 0: L2 Admission Control</h3>
424
425     <p>
426       This table drops packets that the router shouldn't see at all based on
427       their Ethernet headers.  It contains the following flows:
428     </p>
429
430     <ul>
431       <li>
432         Priority-100 flows to drop packets with VLAN tags or multicast Ethernet
433         source addresses.
434       </li>
435
436       <li>
437         For each enabled router port <var>P</var> with Ethernet address
438         <var>E</var>, a priority-50 flow that matches <code>inport ==
439         <var>P</var> &amp;&amp; (eth.mcast || eth.dst ==
440         <var>E</var></code>), with action <code>next;</code>.
441       </li>
442     </ul>
443
444     <p>
445       Other packets are implicitly dropped.
446     </p>
447
448     <h3>Ingress Table 1: IP Input</h3>
449
450     <p>
451       This table is the core of the logical router datapath functionality.  It
452       contains the following flows to implement very basic IP host
453       functionality.
454     </p>
455
456     <ul>
457       <li>
458         <p>
459           L3 admission control: A priority-100 flow drops packets that match
460           any of the following:
461         </p>
462
463         <ul>
464           <li>
465             <code>ip4.src[28..31] == 0xe</code> (multicast source)
466           </li>
467           <li>
468             <code>ip4.src == 255.255.255.255</code> (broadcast source)
469           </li>
470           <li>
471             <code>ip4.src == 127.0.0.0/8 || ip4.dst == 127.0.0.0/8</code>
472             (localhost source or destination)
473           </li>
474           <li>
475             <code>ip4.src == 0.0.0.0/8 || ip4.dst == 0.0.0.0/8</code> (zero
476             network source or destination)
477           </li>
478           <li>
479             <code>ip4.src</code> is any IP address owned by the router.
480           </li>
481           <li>
482             <code>ip4.src</code> is the broadcast address of any IP network
483             known to the router.
484           </li>
485         </ul>
486       </li>
487
488       <li>
489         <p>
490           ICMP echo reply.  These flows reply to ICMP echo requests received
491           for the router's IP address.  Let <var>A</var> be an IP address or
492           broadcast address owned by a router port.  Then, for each
493           <var>A</var>, a priority-90 flow matches on <code>ip4.dst ==
494           <var>A</var></code> and <code>icmp4.type == 8 &amp;&amp; icmp4.code
495           == 0</code> (ICMP echo request).  These flows use the following
496           actions where, if <var>A</var> is unicast, then <var>S</var> is
497           <var>A</var>, and if <var>A</var> is broadcast, <var>S</var> is the
498           router's IP address in <var>A</var>'s network:
499         </p>
500
501         <pre>
502 ip4.dst = ip4.src;
503 ip4.src = <var>S</var>;
504 ip.ttl = 255;
505 icmp4.type = 0;
506 inport = ""; /* Allow sending out inport. */
507 next;
508         </pre>
509
510         <p>
511           Similar flows match on <code>ip4.dst == 255.255.255.255</code> and
512           each individual <code>inport</code>, and use the same actions in
513           which <var>S</var> is a function of <code>inport</code>.
514         </p>
515       </li>
516
517       <li>
518         <p>
519           Reply to ARP requests.  These flows reply to ARP requests for the
520           router's own IP address.  For each router port <var>P</var> that owns
521           IP address <var>A</var> and Ethernet address <var>E</var>, a
522           priority-90 flow matches <code>inport == <var>P</var> &amp;&amp;
523           arp.op == 1 &amp;&amp; arp.tpa == <var>A</var></code> (ARP request)
524           with the following actions:
525         </p>
526
527         <pre>
528 eth.dst = eth.src;
529 eth.src = <var>E</var>;
530 arp.op = 2; /* ARP reply. */
531 arp.tha = arp.sha;
532 arp.sha = <var>E</var>;
533 arp.tpa = arp.spa;
534 arp.spa = <var>A</var>;
535 outport = <var>P</var>;
536 inport = ""; /* Allow sending out inport. */
537 output;
538         </pre>
539       </li>
540
541       <li>
542         ARP reply handling.  These flows use ARP replies to populate the
543         logical router's ARP table.  A priority-90 flow with match <code>arp.op
544         == 2</code> has actions <code>put_arp(inport, arp.spa,
545         arp.sha);</code>.
546       </li>
547
548       <li>
549         <p>
550           UDP port unreachable.  Priority-80 flows generate ICMP port
551           unreachable messages in reply to UDP datagrams directed to the
552           router's IP address.  The logical router doesn't accept any UDP
553           traffic so it always generates such a reply.
554         </p>
555
556         <p>
557           These flows should not match IP fragments with nonzero offset.
558         </p>
559
560         <p>
561           Details TBD.  Not yet implemented.
562         </p>
563       </li>
564
565       <li>
566         <p>
567           TCP reset.  Priority-80 flows generate TCP reset messages in reply to
568           TCP datagrams directed to the router's IP address.  The logical
569           router doesn't accept any TCP traffic so it always generates such a
570           reply.
571         </p>
572
573         <p>
574           These flows should not match IP fragments with nonzero offset.
575         </p>
576
577         <p>
578           Details TBD.  Not yet implemented.
579         </p>
580       </li>
581
582       <li>
583         <p>
584           Protocol unreachable.  Priority-70 flows generate ICMP protocol
585           unreachable messages in reply to packets directed to the router's IP
586           address on IP protocols other than UDP, TCP, and ICMP.
587         </p>
588
589         <p>
590           These flows should not match IP fragments with nonzero offset.
591         </p>
592
593         <p>
594           Details TBD.  Not yet implemented.
595         </p>
596       </li>
597
598       <li>
599         Drop other IP traffic to this router.  These flows drop any other
600         traffic destined to an IP address of this router that is not already
601         handled by one of the flows above, which amounts to ICMP (other than
602         echo requests) and fragments with nonzero offsets.  For each IP address
603         <var>A</var> owned by the router, a priority-60 flow matches
604         <code>ip4.dst == <var>A</var></code> and drops the traffic.
605       </li>
606     </ul>
607
608     <p>
609       The flows above handle all of the traffic that might be directed to the
610       router itself.  The following flows (with lower priorities) handle the
611       remaining traffic, potentially for forwarding:
612     </p>
613
614     <ul>
615       <li>
616         Drop Ethernet local broadcast.  A priority-50 flow with match
617         <code>eth.bcast</code> drops traffic destined to the local Ethernet
618         broadcast address.  By definition this traffic should not be forwarded.
619       </li>
620
621       <li>
622         Drop IP multicast.  A priority-50 flow with match
623         <code>ip4.mcast</code> drops IP multicast traffic.
624       </li>
625
626       <li>
627         <p>
628           ICMP time exceeded.  For each router port <var>P</var>, whose IP
629           address is <var>A</var>, a priority-40 flow with match <code>inport
630           == <var>P</var> &amp;&amp; ip.ttl == {0, 1} &amp;&amp;
631           !ip.later_frag</code> matches packets whose TTL has expired, with the
632           following actions to send an ICMP time exceeded reply:
633         </p>
634
635         <pre>
636 icmp4 {
637     icmp4.type = 11; /* Time exceeded. */
638     icmp4.code = 0;  /* TTL exceeded in transit. */
639     ip4.dst = ip4.src;
640     ip4.src = <var>A</var>;
641     ip.ttl = 255;
642     next;
643 };
644         </pre>
645
646         <p>
647           Not yet implemented.
648         </p>
649       </li>
650
651       <li>
652         TTL discard.  A priority-30 flow with match <code>ip.ttl == {0,
653         1}</code> and actions <code>drop;</code> drops other packets whose TTL
654         has expired, that should not receive a ICMP error reply (i.e. fragments
655         with nonzero offset).
656       </li>
657
658       <li>
659         Next table.  A priority-0 flows match all packets that aren't already
660         handled and uses actions <code>next;</code> to feed them to the ingress
661         table for routing.
662       </li>
663     </ul>
664
665     <h3>Ingress Table 2: IP Routing</h3>
666
667     <p>
668       A packet that arrives at this table is an IP packet that should be routed
669       to the address in <code>ip4.dst</code>.  This table implements IP
670       routing, setting <code>reg0</code> to the next-hop IP address (leaving
671       <code>ip4.dst</code>, the packet's final destination, unchanged) and
672       advances to the next table for ARP resolution.  It also sets
673       <code>reg1</code> to the IP address owned by the selected router port
674       (which is used later in table 4 as the IP source address for an ARP
675       request, if needed).
676     </p>
677
678     <p>
679       This table contains the following logical flows:
680     </p>
681
682     <ul>
683       <li>
684         <p>
685           Routing table.  For each route to IPv4 network <var>N</var> with
686           netmask <var>M</var>, on router port <var>P</var> with IP address
687           <var>A</var> and Ethernet
688           address <var>E</var>, a logical flow with match <code>ip4.dst ==
689           <var>N</var>/<var>M</var></code>, whose priority is the number of
690           1-bits in <var>M</var>, has the following actions:
691         </p>
692
693         <pre>
694 ip.ttl--;
695 reg0 = <var>G</var>;
696 reg1 = <var>A</var>;
697 eth.src = <var>E</var>;
698 outport = <var>P</var>;
699 next;
700         </pre>
701
702         <p>
703           (Ingress table 1 already verified that <code>ip.ttl--;</code> will
704           not yield a TTL exceeded error.)
705         </p>
706
707         <p>
708           If the route has a gateway, <var>G</var> is the gateway IP address.
709           Instead, if the route is from a configured static route, <var>G</var>
710           is the next hop IP address.  Else it is <code>ip4.dst</code>.
711         </p>
712       </li>
713
714       <li>
715         <p>
716           Destination unreachable.  For each router port <var>P</var>, which
717           owns IP address <var>A</var>, a priority-0 logical flow with match
718           <code>in_port == <var>P</var> &amp;&amp; !ip.later_frag &amp;&amp;
719           !icmp</code> has the following actions:
720         </p>
721
722         <pre>
723 icmp4 {
724     icmp4.type = 3; /* Destination unreachable. */
725     icmp4.code = 0; /* Network unreachable. */
726     ip4.dst = ip4.src;
727     ip4.src = <var>A</var>;
728     ip.ttl = 255;
729     next(2);
730 };
731         </pre>
732
733         <p>
734           (The <code>!icmp</code> check prevents recursion if the destination
735           unreachable message itself cannot be routed.)
736         </p>
737
738         <p>
739           These flows are omitted if the logical router has a default route,
740           that is, a route with netmask 0.0.0.0.
741         </p>
742       </li>
743     </ul>
744
745     <h3>Ingress Table 3: ARP Resolution</h3>
746
747     <p>
748       Any packet that reaches this table is an IP packet whose next-hop IP
749       address is in <code>reg0</code>.  (<code>ip4.dst</code> is the final
750       destination.)  This table resolves the IP address in <code>reg0</code>
751       into an output port in <code>outport</code> and an Ethernet address in
752       <code>eth.dst</code>, using the following flows:
753     </p>
754
755     <ul>
756       <li>
757         <p>
758           Static MAC bindings.  MAC bindings can be known statically based on
759           data in the <code>OVN_Northbound</code> database.  For router ports
760           connected to logical switches, MAC bindings can be known statically
761           from the <code>addresses</code> column in the
762           <code>Logical_Port</code> table.  For router ports connected to other
763           logical routers, MAC bindings can be known statically from the
764           <code>mac</code> and <code>network</code> column in the
765           <code>Logical_Router_Port</code> table.
766         </p>
767
768         <p>
769           For each IP address <var>A</var> whose host is known to have Ethernet
770           address <var>E</var> on router port <var>P</var>, a priority-100 flow
771           with match <code>outport === <var>P</var> &amp;&amp; reg0 ==
772           <var>A</var></code> has actions <code>eth.dst = <var>E</var>;
773           next;</code>.
774         </p>
775
776         <p>
777           For each logical router port with an IP address <var>A</var> and
778           a mac address of <var>E</var> that is reachable via a different
779           logical router port <var>P</var>, a priority-100 flow with
780           match <code>outport === <var>P</var> &amp;&amp; reg0 ==
781           <var>A</var></code> has actions <code>eth.dst = <var>E</var>;
782           next;</code>.
783         </p>
784       </li>
785
786       <li>
787         <p>
788           Dynamic MAC bindings.  This flows resolves MAC-to-IP bindings that
789           have become known dynamically through ARP.  (The next table will
790           issue an ARP request for cases where the binding is not yet known.)
791         </p>
792
793         <p>
794           A priority-0 logical flow with match <code>1</code> has actions
795           <code>get_arp(outport, reg0); next;</code>.
796         </p>
797       </li>
798     </ul>
799
800     <h3>Ingress Table 4: ARP Request</h3>
801
802     <p>
803       In the common case where the Ethernet destination has been resolved, this
804       table outputs the packet.  Otherwise, it composes and sends an ARP
805       request.  It holds the following flows:
806     </p>
807
808     <ul>
809       <li>
810         <p>
811           Unknown MAC address.  A priority-100 flow with match <code>eth.dst ==
812           00:00:00:00:00:00</code> has the following actions:
813         </p>
814
815         <pre>
816 arp {
817     eth.dst = ff:ff:ff:ff:ff:ff;
818     arp.spa = reg1;
819     arp.op = 1;  /* ARP request. */
820     output;
821 };
822         </pre>
823
824         <p>
825           (Ingress table 2 initialized <code>reg1</code> with the IP address
826           owned by <code>outport</code>.)
827         </p>
828
829         <p>
830           The IP packet that triggers the ARP request is dropped.
831         </p>
832       </li>
833
834       <li>
835         Known MAC address.  A priority-0 flow with match <code>1</code> has
836         actions <code>output;</code>.
837       </li>
838     </ul>
839
840     <h3>Egress Table 0: Delivery</h3>
841
842     <p>
843       Packets that reach this table are ready for delivery.  It contains
844       priority-100 logical flows that match packets on each enabled logical
845       router port, with action <code>output;</code>.
846     </p>
847
848 </manpage>