Commit ccdfd4f7 authored by Petr Machata's avatar Petr Machata Committed by David S. Miller

vxlan: Have vxlan_fdb_replace() save original rdst value

To enable rollbacks after vetoed FDB updates, extend vxlan_fdb_replace()
to take an additional argument where it should store the original values
of a modified rdst. Update the sole caller.

The following patch will make use of the saved value.
Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a76d1ca2
...@@ -625,7 +625,7 @@ EXPORT_SYMBOL_GPL(vxlan_fdb_clear_offload); ...@@ -625,7 +625,7 @@ EXPORT_SYMBOL_GPL(vxlan_fdb_clear_offload);
/* Replace destination of unicast mac */ /* Replace destination of unicast mac */
static int vxlan_fdb_replace(struct vxlan_fdb *f, static int vxlan_fdb_replace(struct vxlan_fdb *f,
union vxlan_addr *ip, __be16 port, __be32 vni, union vxlan_addr *ip, __be16 port, __be32 vni,
__u32 ifindex) __u32 ifindex, struct vxlan_rdst *oldrd)
{ {
struct vxlan_rdst *rd; struct vxlan_rdst *rd;
...@@ -637,6 +637,7 @@ static int vxlan_fdb_replace(struct vxlan_fdb *f, ...@@ -637,6 +637,7 @@ static int vxlan_fdb_replace(struct vxlan_fdb *f,
if (!rd) if (!rd)
return 0; return 0;
*oldrd = *rd;
dst_cache_reset(&rd->dst_cache); dst_cache_reset(&rd->dst_cache);
rd->remote_ip = *ip; rd->remote_ip = *ip;
rd->remote_port = port; rd->remote_port = port;
...@@ -865,6 +866,7 @@ static int vxlan_fdb_update_existing(struct vxlan_dev *vxlan, ...@@ -865,6 +866,7 @@ static int vxlan_fdb_update_existing(struct vxlan_dev *vxlan,
{ {
__u16 fdb_flags = (ndm_flags & ~NTF_USE); __u16 fdb_flags = (ndm_flags & ~NTF_USE);
struct vxlan_rdst *rd = NULL; struct vxlan_rdst *rd = NULL;
struct vxlan_rdst oldrd;
int notify = 0; int notify = 0;
int rc; int rc;
...@@ -890,7 +892,7 @@ static int vxlan_fdb_update_existing(struct vxlan_dev *vxlan, ...@@ -890,7 +892,7 @@ static int vxlan_fdb_update_existing(struct vxlan_dev *vxlan,
if (!(is_multicast_ether_addr(f->eth_addr) || if (!(is_multicast_ether_addr(f->eth_addr) ||
is_zero_ether_addr(f->eth_addr))) { is_zero_ether_addr(f->eth_addr))) {
rc = vxlan_fdb_replace(f, ip, port, vni, rc = vxlan_fdb_replace(f, ip, port, vni,
ifindex); ifindex, &oldrd);
notify |= rc; notify |= rc;
} else { } else {
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment