@@ -8474,33 +8474,11 @@ build_lrouter_flows_ingress_table_0_op(
}
static void
-build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
- struct hmap *lflows, struct shash *meter_groups,
- struct hmap *lbs)
+build_lrouter_flows_arp_nd_mac_learn_od(struct ovn_datapath *od, struct hmap *lflows)
{
- /* This flow table structure is documented in ovn-northd(8), so please
- * update ovn-northd.8.xml if you change anything. */
-
struct ds match = DS_EMPTY_INITIALIZER;
struct ds actions = DS_EMPTY_INITIALIZER;
-
- struct ovn_datapath *od;
- HMAP_FOR_EACH (od, key_node, datapaths) {
- build_lrouter_flows_ingress_table_0_od(od, lflows);
- }
-
- struct ovn_port *op;
- HMAP_FOR_EACH (op, key_node, ports) {
- build_lrouter_flows_ingress_table_0_op(op, lflows);
- }
-
- /* Logical router ingress table 1: LOOKUP_NEIGHBOR and
- * table 2: LEARN_NEIGHBOR. */
- HMAP_FOR_EACH (od, key_node, datapaths) {
- if (!od->nbr) {
- continue;
- }
-
+ if (od->nbr) {
/* Learn MAC bindings from ARP/IPv6 ND.
*
* For ARP packets, table LOOKUP_NEIGHBOR does a lookup for the
@@ -8586,11 +8564,17 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
ovn_lflow_add(lflows, od, S_ROUTER_IN_LEARN_NEIGHBOR, 90,
"nd_ns", "put_nd(inport, ip6.src, nd.sll); next;");
}
+ ds_destroy(&match);
+ ds_destroy(&actions);
+}
- HMAP_FOR_EACH (op, key_node, ports) {
- if (!op->nbrp) {
- continue;
- }
+static void
+build_lrouter_flows_arp_nd_mac_learn_op(struct ovn_port *op, struct hmap *lflows)
+{
+ struct ds match = DS_EMPTY_INITIALIZER;
+ struct ds actions = DS_EMPTY_INITIALIZER;
+
+ if (op->nbrp) {
bool learn_from_arp_request = smap_get_bool(&op->od->nbr->options,
"always_learn_from_arp_request", true);
@@ -8647,6 +8631,39 @@ build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
}
}
+ ds_destroy(&match);
+ ds_destroy(&actions);
+}
+
+static void
+build_lrouter_flows(struct hmap *datapaths, struct hmap *ports,
+ struct hmap *lflows, struct shash *meter_groups,
+ struct hmap *lbs)
+{
+ /* This flow table structure is documented in ovn-northd(8), so please
+ * update ovn-northd.8.xml if you change anything. */
+
+ struct ds match = DS_EMPTY_INITIALIZER;
+ struct ds actions = DS_EMPTY_INITIALIZER;
+
+ struct ovn_datapath *od;
+ HMAP_FOR_EACH (od, key_node, datapaths) {
+ build_lrouter_flows_ingress_table_0_od(od, lflows);
+ }
+
+ struct ovn_port *op;
+ HMAP_FOR_EACH (op, key_node, ports) {
+ build_lrouter_flows_ingress_table_0_op(op, lflows);
+ }
+
+ HMAP_FOR_EACH (od, key_node, datapaths) {
+ build_lrouter_flows_arp_nd_mac_learn_od(od, lflows);
+ }
+
+ HMAP_FOR_EACH (op, key_node, ports) {
+ build_lrouter_flows_arp_nd_mac_learn_op(op, lflows);
+ }
+
/* Logical router ingress table 3: IP Input. */
HMAP_FOR_EACH (od, key_node, datapaths) {
if (!od->nbr) {