Skip to content

Commit 5bf38ae

Browse files
committed
pinctrl: Use unicast for MAC binding ARP probe.
We already have the MAC address within the MAC binding row. There is no need to flood the ARP request as this serves as liveness check. Send the ARP probe as unicast instead. The test wait_row_count checks are narrowed to specific IP/port combinations because unicast ARP is not intercepted by the pipeline and instead it travels to the target. That will result in additional MAC bindings which will remain through out the test. Acked-by: Ilya Maximets <i.maximets@ovn.org> Acked-by: Mark Michelson <mmichels@redhat.com> Signed-off-by: Ales Musil <amusil@redhat.com> Signed-off-by: Dumitru Ceara <dceara@redhat.com> (cherry picked from commit 59c7361)
1 parent e4cdfc3 commit 5bf38ae

4 files changed

Lines changed: 32 additions & 23 deletions

File tree

controller/mac-cache.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,8 @@ mac_binding_probe_stats_run(struct vector *stats_vec, uint64_t *req_delay,
961961
send_self_originated_neigh_packet(probe_data->swconn,
962962
sbrec->datapath->tunnel_key,
963963
pb->tunnel_key, laddr.ea,
964-
&local, &mb->data.ip,
964+
mb->data.mac, &local,
965+
&mb->data.ip,
965966
OFTABLE_LOCAL_OUTPUT);
966967
}
967968

controller/pinctrl.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5191,7 +5191,8 @@ send_arp_nd_update(const struct sbrec_port_binding *pb, const char *nexthop,
51915191
void
51925192
send_self_originated_neigh_packet(struct rconn *swconn,
51935193
uint32_t dp_key, uint32_t port_key,
5194-
struct eth_addr eth,
5194+
struct eth_addr eth_src,
5195+
struct eth_addr eth_dst,
51955196
struct in6_addr *local,
51965197
struct in6_addr *target,
51975198
uint8_t table_id)
@@ -5200,13 +5201,15 @@ send_self_originated_neigh_packet(struct rconn *swconn,
52005201
struct dp_packet packet;
52015202
dp_packet_use_stub(&packet, packet_stub, sizeof packet_stub);
52025203
if (!local) {
5203-
compose_rarp(&packet, eth);
5204+
compose_rarp(&packet, eth_src);
52045205
} else if (IN6_IS_ADDR_V4MAPPED(local)) {
5205-
compose_arp(&packet, ARP_OP_REQUEST, eth, eth_addr_zero, true,
5206+
compose_arp(&packet, ARP_OP_REQUEST, eth_src, eth_dst,
5207+
eth_addr_is_zero(eth_dst),
52065208
in6_addr_get_mapped_ipv4(local),
52075209
in6_addr_get_mapped_ipv4(target));
52085210
} else {
5209-
compose_nd_ns(&packet, true, eth, eth_addr_zero, local, target);
5211+
compose_nd_ns(&packet, eth_addr_is_zero(eth_dst), eth_src,
5212+
eth_dst, local, target);
52105213
}
52115214

52125215
/* Inject GARP request. */
@@ -5261,13 +5264,15 @@ send_garp_rarp(struct rconn *swconn, struct garp_rarp_node *garp_rarp,
52615264
send_self_originated_neigh_packet(swconn,
52625265
garp_rarp->dp_key,
52635266
garp_rarp->port_key,
5264-
garp_rarp->ea, &addr, &addr,
5267+
garp_rarp->ea, eth_addr_zero,
5268+
&addr, &addr,
52655269
OFTABLE_LOG_INGRESS_PIPELINE);
52665270
} else {
52675271
send_self_originated_neigh_packet(swconn,
52685272
garp_rarp->dp_key,
52695273
garp_rarp->port_key,
5270-
garp_rarp->ea, NULL, NULL,
5274+
garp_rarp->ea, eth_addr_zero,
5275+
NULL, NULL,
52715276
OFTABLE_LOG_INGRESS_PIPELINE);
52725277
}
52735278

@@ -6379,7 +6384,8 @@ send_arp_nd(struct rconn *swconn, struct arp_nd_data *e,
63796384
/* Compose a ARP request packet. */
63806385
send_self_originated_neigh_packet(swconn,
63816386
e->dp_key, e->port_key,
6382-
e->ea, &e->src_ip, &e->dst_ip,
6387+
e->ea, eth_addr_zero,
6388+
&e->src_ip, &e->dst_ip,
63836389
OFTABLE_LOCAL_OUTPUT);
63846390

63856391
/* Set the next announcement. At most 5 announcements are sent for a

controller/pinctrl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ struct ovs_list *get_ports_to_activate_in_engine(void);
7979
bool pinctrl_is_port_activated(int64_t dp_key, int64_t port_key);
8080
void send_self_originated_neigh_packet(struct rconn *swconn,
8181
uint32_t dp_key, uint32_t port_key,
82-
struct eth_addr eth,
82+
struct eth_addr eth_src,
83+
struct eth_addr eth_dst,
8384
struct in6_addr *local,
8485
struct in6_addr *target,
8586
uint8_t table_id);

tests/ovn.at

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37035,8 +37035,8 @@ OVS_WAIT_UNTIL([test $(ovs-ofctl dump-flows br-int table=OFTABLE_MAC_CACHE_USE |
3703537035
send_udp hv1 vif1 00:00:00:00:10:00 00:00:00:00:10:2a 192.168.20.100 192.168.10.100
3703637036
send_udp hv1 vif2 00:00:00:00:20:00 00:00:00:00:10:2b 192.168.10.100 192.168.20.100
3703737037
# Wait for ARP requests to be generated.
37038-
dump_arp 1 00:00:00:00:20:00 ff:ff:ff:ff:ff:ff 192.168.20.1 192.168.20.100 00:00:00:00:00:00 > expected1
37039-
dump_arp 1 00:00:00:00:10:00 ff:ff:ff:ff:ff:ff 192.168.10.1 192.168.10.100 00:00:00:00:00:00 > expected2
37038+
dump_arp 1 00:00:00:00:20:00 00:00:00:00:10:1b 192.168.20.1 192.168.20.100 00:00:00:00:10:1b > expected1
37039+
dump_arp 1 00:00:00:00:10:00 00:00:00:00:10:1a 192.168.10.1 192.168.10.100 00:00:00:00:10:1a > expected2
3704037040
OVN_CHECK_PACKETS_CONTAIN([hv1/vif1-tx.pcap], [expected2])
3704137041

3704237042
# Check MAC_Binding timestamp is updated receiving the ARP replay.
@@ -37045,8 +37045,8 @@ send_garp hv1 vif2 2 00:00:00:00:10:1b 00:00:00:00:20:00 192.168.20.100 192.168.
3704537045
OVS_WAIT_UNTIL([test $(fetch_column Mac_Binding timestamp ip=192.168.10.100) -gt $ts0])
3704637046

3704737047
# Refresh OFTABLE_MAC_BINDING entires.
37048-
dump_arp 1 00:00:00:00:20:00 ff:ff:ff:ff:ff:ff 192.168.20.1 192.168.20.100 00:00:00:00:00:00 >> expected1
37049-
dump_arp 1 00:00:00:00:10:00 ff:ff:ff:ff:ff:ff 192.168.10.1 192.168.10.100 00:00:00:00:00:00 >> expected2
37048+
dump_arp 1 00:00:00:00:20:00 00:00:00:00:10:1b 192.168.20.1 192.168.20.100 00:00:00:00:10:1b >> expected1
37049+
dump_arp 1 00:00:00:00:10:00 00:00:00:00:10:1a 192.168.10.1 192.168.10.100 00:00:00:00:10:1a >> expected2
3705037050
OVS_WAIT_UNTIL([test $(ovs-ofctl dump-flows br-int table=OFTABLE_MAC_CACHE_USE | \
3705137051
awk '/arp_spa=192.168.20.100/{print substr($6,10,1)}') -ge $((aging_th/2))])
3705237052
send_udp hv1 vif1 00:00:00:00:10:00 00:00:00:00:10:2a 192.168.20.100 192.168.10.100
@@ -37073,8 +37073,8 @@ OVS_WAIT_UNTIL([test $(ovs-ofctl dump-flows br-int table=OFTABLE_MAC_CACHE_USE |
3707337073
send_udp6 hv1 vif1 00:00:00:00:10:00 00:00:00:00:10:2a fd12::64 fd11::64
3707437074
send_udp6 hv1 vif2 00:00:00:00:20:00 00:00:00:00:10:2b fd11::64 fd12::64
3707537075

37076-
dump_ns 33:33:ff:00:00:64 00:00:00:00:10:00 ff02::1:ff00:64 fd11::1 fd11::64 > expected2
37077-
dump_ns 33:33:ff:00:00:64 00:00:00:00:10:00 ff02::1:ff00:64 fd11::1 fd11::64 >> expected2
37076+
dump_ns 00:00:00:00:10:1a 00:00:00:00:10:00 fd11::64 fd11::1 fd11::64 > expected2
37077+
dump_ns 00:00:00:00:10:1a 00:00:00:00:10:00 fd11::64 fd11::1 fd11::64 >> expected2
3707837078
OVN_CHECK_PACKETS_CONTAIN([hv1/vif1-tx.pcap], [expected2])
3707937079

3708037080
send_na hv1 vif1 00:00:00:00:10:1a 00:00:00:00:10:00 fd11::64 fd11::1
@@ -37175,16 +37175,16 @@ send_udp6 hv1 vif1 00:00:00:00:10:00 00:00:00:00:10:2b fd11::64 fd12::64
3717537175

3717637176
# Verify ARP probes use the correct source IPs from matching subnets.
3717737177
# ARP for 10.10.10.100 must use source IP 10.10.10.1 (first subnet).
37178-
dump_arp 1 00:00:00:00:10:00 ff:ff:ff:ff:ff:ff 10.10.10.1 10.10.10.100 00:00:00:00:00:00 > expected
37178+
dump_arp 1 00:00:00:00:10:00 00:00:00:00:10:1a 10.10.10.1 10.10.10.100 00:00:00:00:10:1a > expected
3717937179
# ARP for 42.42.42.253 must use source IP 42.42.42.1 (second subnet).
37180-
dump_arp 1 00:00:00:00:10:00 ff:ff:ff:ff:ff:ff 42.42.42.1 42.42.42.253 00:00:00:00:00:00 >> expected
37180+
dump_arp 1 00:00:00:00:10:00 00:00:00:00:10:1b 42.42.42.1 42.42.42.253 00:00:00:00:10:1b >> expected
3718137181
OVN_CHECK_PACKETS_CONTAIN([hv1/vif1-tx.pcap], [expected])
3718237182

3718337183
# Verify NS probes use the correct source IPs from matching subnets.
3718437184
# NS for fd11::64 must use source IP fd11::1 (first IPv6 subnet).
37185-
dump_ns 33:33:ff:00:00:64 00:00:00:00:10:00 ff02::1:ff00:64 fd11::1 fd11::64 > expected_v6
37185+
dump_ns 00:00:00:00:10:1a 00:00:00:00:10:00 fd11::64 fd11::1 fd11::64 > expected_v6
3718637186
# NS for fd12::64 must use source IP fd12::1 (second IPv6 subnet).
37187-
dump_ns 33:33:ff:00:00:64 00:00:00:00:10:00 ff02::1:ff00:64 fd12::1 fd12::64 >> expected_v6
37187+
dump_ns 00:00:00:00:10:1b 00:00:00:00:10:00 fd12::64 fd12::1 fd12::64 >> expected_v6
3718837188
OVN_CHECK_PACKETS_CONTAIN([hv1/vif1-tx.pcap], [expected_v6])
3718937189

3719037190
# Send ARP/NA replies and check MAC_Binding UUIDs remain consistent.
@@ -37261,8 +37261,8 @@ wait_row_count mac_binding 0 ip="$ext_ip" logical_port="lr-ls"
3726137261

3726237262
# hv1 should have sent out arps for mac binding refresh
3726337263
arp_req=$(fmt_pkt \
37264-
"Ether(dst='ff:ff:ff:ff:ff:ff', src='$lrp_mac')/ \
37265-
ARP(hwsrc='$lrp_mac', hwdst='00:00:00:00:00:00', psrc='$lrp_ip', pdst='$ext_ip')")
37264+
"Ether(dst='$ext_mac', src='$lrp_mac')/ \
37265+
ARP(hwsrc='$lrp_mac', hwdst='$ext_mac', psrc='$lrp_ip', pdst='$ext_ip')")
3726637266
echo $arp_req >> hv1_snoopvif.expected
3726737267
OVN_CHECK_PACKETS_CONTAIN([hv1/snoopvif-tx.pcap], [hv1_snoopvif.expected])
3726837268

@@ -37372,7 +37372,8 @@ send_imcp_echo_req hv1 public 00:00:00:00:10:00 00:00:00:00:10:1a 192.168.20.2 1
3737237372
OVS_WAIT_UNTIL([test $(grep -c "Sending ARP/ND.*ip: 192.168.20.2" hv1/ovn-controller.log) -eq 2])
3737337373

3737437374
check ovn-nbctl --wait=hv acl-del join
37375-
wait_row_count mac_binding 0
37375+
wait_row_count mac_binding 0 ip="192.168.10.100" logical_port="gw-public"
37376+
wait_row_count mac_binding 0 ip="192.168.20.2" logical_port="gw-join"
3737637377

3737737378
send_icmp6_echo_req hv1 public 00:00:00:00:10:00 00:00:00:00:50:01 fd12::2 fd11::64
3737837379
wait_row_count mac_binding 1 mac=\"00:00:00:00:30:00\" ip=\"fd12::2\"
@@ -37389,7 +37390,7 @@ sleep $((aging_th / 2))
3738937390
send_icmp6_echo_req hv1 public 00:00:00:00:10:00 00:00:00:00:50:01 fd12::2 fd11::64
3739037391
OVS_WAIT_UNTIL([test $(grep -c "Sending ARP/ND.*ip: fd12::2" hv1/ovn-controller.log) -eq 2])
3739137392

37392-
wait_row_count mac_binding 0
37393+
wait_row_count mac_binding 0 ip=\"fd12::2\" logical_port="gw-join"
3739337394

3739437395
OVN_CLEANUP([hv1])
3739537396
AT_CLEANUP

0 commit comments

Comments
 (0)