Skip to content

Commit c4f2082

Browse files
idoschkuba-moo
authored andcommitted
vxlan: Always refresh FDB 'updated' time when learning is enabled
Currently, when learning is enabled and a packet is received from the expected remote, the 'updated' field of the FDB entry is not refreshed. This will become a problem when we switch the VXLAN driver to age out entries based on the 'updated' field. Solve this by always refreshing an FDB entry when we receive a packet with a matching source MAC address, regardless if it was received via the expected remote or not as it indicates the host is alive. This is consistent with the bridge driver's FDB. Reviewed-by: Petr Machata <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Reviewed-by: Nikolay Aleksandrov <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 1370c45 commit c4f2082

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/net/vxlan/vxlan_core.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,10 @@ static enum skb_drop_reason vxlan_snoop(struct net_device *dev,
14661466
f = vxlan_find_mac(vxlan, src_mac, vni);
14671467
if (likely(f)) {
14681468
struct vxlan_rdst *rdst = first_remote_rcu(f);
1469+
unsigned long now = jiffies;
1470+
1471+
if (READ_ONCE(f->updated) != now)
1472+
WRITE_ONCE(f->updated, now);
14691473

14701474
if (likely(vxlan_addr_equal(&rdst->remote_ip, src_ip) &&
14711475
rdst->remote_ifindex == ifindex))
@@ -1485,7 +1489,6 @@ static enum skb_drop_reason vxlan_snoop(struct net_device *dev,
14851489
src_mac, &rdst->remote_ip.sa, &src_ip->sa);
14861490

14871491
rdst->remote_ip = *src_ip;
1488-
WRITE_ONCE(f->updated, jiffies);
14891492
vxlan_fdb_notify(vxlan, f, rdst, RTM_NEWNEIGH, true, NULL);
14901493
} else {
14911494
u32 hash_index = fdb_head_index(vxlan, src_mac, vni);

0 commit comments

Comments
 (0)