From patchwork Wed Aug 5 07:05:12 2020
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Han Zhou Logical_Switch_Port
table. For router ports
connected to other logical routers, MAC bindings can be known
statically from the mac
and networks
- column in the Logical_Router_Port
table.
+ column in the Logical_Router_Port
table. (Note: the
+ flow is NOT installed for the IP addresses that belong to a neighbor
+ logical router port if the current router has the
+ options:dynamic_neigh_routers
set to true
)
diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 03c62ba..5dd49f9 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -10401,6 +10401,12 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports, continue; } + if (peer->od->nbr && + smap_get_bool(&peer->od->nbr->options, + "dynamic_neigh_routers", false)) { + continue; + } + for (size_t i = 0; i < op->od->n_router_ports; i++) { const char *router_port_name = smap_get( &op->od->router_ports[i]->nbsp->options, diff --git a/ovn-nb.xml b/ovn-nb.xml index 5e434d2..4c59338 100644 --- a/ovn-nb.xml +++ b/ovn-nb.xml @@ -1846,6 +1846,19 @@ connected to the logical router. Default: False.
+
+ If set to true
, the router will resolve neighbor
+ routers' MAC addresses only by dynamic ARP/ND, instead of
+ prepopulating static mappings for all neighbor routers in the ARP/ND
+ Resolution stage. This reduces number of flows, but requires ARP/ND
+ messages to resolve the IP-MAC bindings when needed. It is
+ false
by default. It is recommended to set to
+ true
when a large number of logical routers are
+ connected to the same logical switch but most of them never need to
+ send traffic between each other.
+
R = lookup_arp_ip(P, A);
+ + Parameters: logical port string field P, 32-bit + IP address field A. +
+ ++ Result: stored to a 1-bit subfield R. +
+ +
+ Looks up A in P's mac binding table. If an
+ entry is found, stores 1
in the 1-bit subfield
+ R, else 0.
+
+ Example:
+
+ reg0[0] = lookup_arp_ip(inport, arp.spa);
+
+
nd_ns { action;
... };
@@ -1632,6 +1660,33 @@
R = lookup_nd_ip(P, A);
+ + Parameters: logical port string field P, 128-bit + IP address field A. +
+ ++ Result: stored to a 1-bit subfield R. +
+ +
+ Looks up A in P's mac binding table. If an
+ entry is found, stores 1
in the 1-bit subfield
+ R, else 0.
+
+ Example:
+
+ reg0[0] = lookup_nd_ip(inport, ip6.src);
+
+
R = put_dhcp_opts(D1 = V1, D2 = V2, ..., Dn = Vn);
For each router port P that owns IP address A,
which belongs to subnet S with prefix length L,
- a priority-100 flow is added which matches
- inport == P &&
- arp.spa == S/L && arp.op == 1
- (ARP request) with the
- following actions:
+ if the option always_learn_from_arp_request
is
+ true
for this router, a priority-100 flow is added which
+ matches inport == P && arp.spa ==
+ S/L && arp.op == 1
(ARP request)
+ with the following actions:
+
+reg9[2] = lookup_arp(inport, arp.spa, arp.sha); +next; ++ +
+ If the option always_learn_from_arp_request
is
+ false
, the following two flows are added.
+
+ A priority-110 flow is added which matches inport ==
+ P && arp.spa == S/L
+ && arp.tpa == A && arp.op == 1
+ (ARP request) with the following actions:
reg9[2] = lookup_arp(inport, arp.spa, arp.sha); +reg9[3] = 1; +next; ++ +
+ A priority-100 flow is added which matches inport ==
+ P && arp.spa == S/L
+ && arp.op == 1
(ARP request) with the following
+ actions:
+
+reg9[2] = lookup_arp(inport, arp.spa, arp.sha); +reg9[3] = lookup_arp_ip(inport, arp.spa); next;
If the logical router port P is a distributed gateway
router port, additional match
- is_chassis_resident(cr-P)
is added so that
- the resident gateway chassis handles the neighbor lookup.
+ is_chassis_resident(cr-P)
is added for all
+ these flows.
A priority-100 flow which matches on ARP reply packets and applies
- the actions:
+ the actions if the option always_learn_from_arp_request
+ is true
:
reg9[2] = lookup_arp(inport, arp.spa, arp.sha); next;+ +
+ If the option always_learn_from_arp_request
+ is false
, the above actions will be:
+
+reg9[2] = lookup_arp(inport, arp.spa, arp.sha); +reg9[3] = 1; +next; ++
A priority-100 flow which matches on IPv6 Neighbor Discovery
- advertisement packet and applies the actions:
+ advertisement packet and applies the actions if the option
+ always_learn_from_arp_request
is true
:
reg9[2] = lookup_nd(inport, nd.target, nd.tll); next;+ +
+ If the option always_learn_from_arp_request
+ is false
, the above actions will be:
+
+reg9[2] = lookup_nd(inport, nd.target, nd.tll); +reg9[3] = 1; +next; +
A priority-100 flow which matches on IPv6 Neighbor Discovery
- solicitation packet and applies the actions:
+ solicitation packet and applies the actions if the option
+ always_learn_from_arp_request
is true
:
+
+reg9[2] = lookup_nd(inport, ip6.src, nd.sll); +next; ++ +
+ If the option always_learn_from_arp_request
+ is false
, the above actions will be:
reg9[2] = lookup_nd(inport, ip6.src, nd.sll); +reg9[3] = lookup_nd_ip(inport, ip6.src); next;
This table adds flows to learn the mac bindings from the ARP and - IPv6 Neighbor Solicitation/Advertisement packets if ARP/ND lookup - failed in the previous table. + IPv6 Neighbor Solicitation/Advertisement packets if it is needed + according to the lookup results from the previous stage.
reg9[2] will be 1
if the lookup_arp/lookup_nd
- in the previous table was successful, or if there was no need to do the
- lookup.
+ in the previous table was successful or skipped, meaning no need
+ to learn mac binding from the packet.
+
+ reg9[3] will be 1
if the
+ lookup_arp_ip/lookup_nd_ip
in the previous table was
+ successful or skipped, meaning it is ok to learn mac binding from
+ the packet (if reg9[2] is 0).
reg9[2] == 1
and advances the packet
- to the next table as there is no need to learn the neighbor.
+ A priority-100 flow with the match reg9[2] == 1 || reg9[3] ==
+ 0
and advances the packet to the next table as there is no need
+ to learn the neighbor.
+ This option controls the behavior when handling IPv4 ARP requests or + IPv6 ND-NS packets - whether a dynamic neighbor (MAC binding) entry + is added/updated. +
+ +
+ true
- Always learn the MAC-IP binding, and add/update
+ the MAC binding entry.
+
+ false
- If there is a MAC binding for that IP and the
+ MAC is different, or, if TPA of ARP request belongs to any router
+ port on this router, then update/add that MAC-IP binding. Otherwise,
+ don't update/add entries.
+
+ It is true
by default. It is recommended to set to
+ false
when a large number of logical routers are
+ connected to the same logical switch but most of them never need to
+ send traffic between each other, to reduce the size of the MAC
+ binding table.
+