diff options
author | Petr Machata <petrm@mellanox.com> | 2018-11-21 08:02:37 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-11-21 17:10:30 -0800 |
commit | 0ec566aacc26da9292cddfe7109a467ac8a8d9a6 (patch) | |
tree | b20328f42e50e1076cc6976e834ee83c261a488e /drivers/net/vxlan.c | |
parent | 45598c1cee69b9c7ce111fa634226ab335fafabe (diff) | |
download | linux-0ec566aacc26da9292cddfe7109a467ac8a8d9a6.tar.bz2 |
vxlan: Don't override user-added entries with ext-learned ones
When an external learning event collides with an user-added entry, the
user-added entry shouldn't be taken over. Otherwise on an unlearn event
the entry would be completely lost, even though the user added it by
hand.
Therefore skip update of FDB flags and state for these cases. This is in
accordance with the bridge behavior.
Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxlan.c')
-rw-r--r-- | drivers/net/vxlan.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 9171c1f42fe9..b50705a50686 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -780,16 +780,24 @@ static int vxlan_fdb_update(struct vxlan_dev *vxlan, "lost race to create %pM\n", mac); return -EEXIST; } - if (f->state != state) { - f->state = state; - f->updated = jiffies; - notify = 1; - } - if (f->flags != fdb_flags) { - f->flags = fdb_flags; - f->updated = jiffies; - notify = 1; + + /* Do not allow an externally learned entry to take over an + * entry added by the user. + */ + if (!(fdb_flags & NTF_EXT_LEARNED) || + !(f->flags & NTF_VXLAN_ADDED_BY_USER)) { + if (f->state != state) { + f->state = state; + f->updated = jiffies; + notify = 1; + } + if (f->flags != fdb_flags) { + f->flags = fdb_flags; + f->updated = jiffies; + notify = 1; + } } + if ((flags & NLM_F_REPLACE)) { /* Only change unicasts */ if (!(is_multicast_ether_addr(f->eth_addr) || |