AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/09/17 06:36 flow patch-triage
5m Args:
null

Results:
{
  "EnableConfigs": [
    "VXLAN"
  ],
  "FocusSymbols": [
    "vxlan_changelink",
    "vxlan_xmit",
    "vxlan_xmit_one",
    "vxlan_rcv",
    "vxlan_vnifilter_dump_dev",
    "vxlan_vnilist_update_group",
    "vxlan_mdb_xmit",
    "vxlan_multicast_join"
  ],
  "KMSANReasoning": "The patch series refactors the VXLAN driver and Mellanox driver offload code by making `vxlan-\u003ecfg` dynamically allocated and RCU-protected (instead of embedded in `struct vxlan_dev`), replacing embedded `default_dst` with direct configuration fields and `lowerdev`, and converting the `VXLAN_F_MDB` flag into a device bitflag.\n\nFrom a memory sanitization perspective:\n1. All allocated instances of `struct vxlan_config` are created via `kmemdup` from a stack `conf` structure that is explicitly zero-initialized via `memset(conf, 0, sizeof(*conf))` in `vxlan_nl2conf`.\n2. Stack structures such as `struct ifla_vxlan_port_range ports` in `vxlan_fill_info` have all fields explicitly assigned without padding (`low` and `high`, 4 bytes total). Similarly, `struct mlxsw_sp_nve_params params` has all fields initialized in `mlxsw_sp_bridge_*_vxlan_join`.\n3. Netlink messages and attributes sent to user space (e.g. in `vxlan_fdb_info`, `vxlan_vnifilter_dump_dev`, `vxlan_fill_info`) remain zero-initialized or explicitly populated as before.\n4. The risks introduced by this refactoring primarily involve RCU dereferencing correctness, pointer lifetime/UAF (covered by KASAN), and synchronization (covered by LOCKDEP).\n\nThere are no uninitialized memory reads or information leak risks that would require a dedicated KMSAN fuzzing session.",
  "NeedsKMSAN": false,
  "Reasoning": "The patch refactors the VXLAN virtual network device driver to manage its configuration (`vxlan_config`) dynamically via RCU instead of embedding it directly in `struct vxlan_dev`. It modifies RCU dereferencing across both the packet processing datapath (vxlan_rcv, vxlan_xmit, vxlan_xmit_one) and netlink control path (vxlan_changelink, vnifilter, mdb, and multicast operations). VXLAN is fully reachable in standard virtualized fuzzing environments via netlink and socket operations without dedicated hardware.",
  "WorthFuzzing": true
}

1/1 2026/09/17 06:36 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit fe645304dc0934987015440d0a8826871ca891f2\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Thu Sep 17 06:36:03 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c\nindex 7a18a469961db..467fbe43b89e9 100644\n--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c\n+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c\n@@ -241,9 +241,16 @@ static bool mlx5e_tc_tun_encap_info_equal_vxlan(struct mlx5e_encap_key *a,\n static int mlx5e_tc_tun_get_remote_ifindex(struct net_device *mirred_dev)\n {\n \tconst struct vxlan_dev *vxlan = netdev_priv(mirred_dev);\n-\tconst struct vxlan_rdst *dst = \u0026vxlan-\u003edefault_dst;\n+\tconst struct vxlan_config *cfg;\n+\tint ifindex = 0;\n \n-\treturn dst-\u003eremote_ifindex;\n+\trcu_read_lock();\n+\tcfg = rcu_dereference(vxlan-\u003ecfg);\n+\tif (cfg)\n+\t\tifindex = cfg-\u003eremote_ifindex;\n+\trcu_read_unlock();\n+\n+\treturn ifindex;\n }\n \n struct mlx5e_tc_tunnel vxlan_tunnel = {\ndiff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c\nindex 52c2fe3644d4b..21e7b499f3879 100644\n--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c\n+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c\n@@ -59,8 +59,11 @@ static bool mlxsw_sp_nve_vxlan_can_offload(const struct mlxsw_sp_nve *nve,\n \t\t\t\t\t   const struct mlxsw_sp_nve_params *params,\n \t\t\t\t\t   struct netlink_ext_ack *extack)\n {\n-\tstruct vxlan_dev *vxlan = netdev_priv(params-\u003edev);\n-\tstruct vxlan_config *cfg = \u0026vxlan-\u003ecfg;\n+\tconst struct vxlan_config *cfg;\n+\tstruct vxlan_dev *vxlan;\n+\n+\tvxlan = netdev_priv(params-\u003edev);\n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n \n \tif (vxlan_addr_multicast(\u0026cfg-\u003eremote_ip)) {\n \t\tNL_SET_ERR_MSG_MOD(extack, \"VxLAN: Multicast destination IP is not supported\");\n@@ -92,6 +95,11 @@ static bool mlxsw_sp_nve_vxlan_can_offload(const struct mlxsw_sp_nve *nve,\n \t\treturn false;\n \t}\n \n+\tif (test_bit(VXLAN_DEV_F_MDB, \u0026vxlan-\u003eflags)) {\n+\t\tNL_SET_ERR_MSG_MOD(extack, \"VxLAN: MDB entries are not supported\");\n+\t\treturn false;\n+\t}\n+\n \tswitch (cfg-\u003esaddr.sa.sa_family) {\n \tcase AF_INET:\n \t\tif (!mlxsw_sp_nve_vxlan_ipv4_flags_check(cfg, extack))\n@@ -148,8 +156,11 @@ static void mlxsw_sp_nve_vxlan_config(const struct mlxsw_sp_nve *nve,\n \t\t\t\t      const struct mlxsw_sp_nve_params *params,\n \t\t\t\t      struct mlxsw_sp_nve_config *config)\n {\n-\tstruct vxlan_dev *vxlan = netdev_priv(params-\u003edev);\n-\tstruct vxlan_config *cfg = \u0026vxlan-\u003ecfg;\n+\tconst struct vxlan_config *cfg;\n+\tstruct vxlan_dev *vxlan;\n+\n+\tvxlan = netdev_priv(params-\u003edev);\n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n \n \tconfig-\u003etype = MLXSW_SP_NVE_TYPE_VXLAN;\n \tconfig-\u003ettl = cfg-\u003ettl;\ndiff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c\nindex fe45e533a4b2e..de60b698bea98 100644\n--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c\n+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c\n@@ -2513,15 +2513,17 @@ mlxsw_sp_bridge_vlan_aware_vxlan_join(struct mlxsw_sp_bridge_device *bridge_devi\n {\n \tstruct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_device-\u003edev);\n \tstruct vxlan_dev *vxlan = netdev_priv(vxlan_dev);\n-\tstruct mlxsw_sp_nve_params params = {\n-\t\t.type = MLXSW_SP_NVE_TYPE_VXLAN,\n-\t\t.vni = vxlan-\u003ecfg.vni,\n-\t\t.dev = vxlan_dev,\n-\t\t.ethertype = ethertype,\n-\t};\n+\tstruct mlxsw_sp_nve_params params;\n+\tconst struct vxlan_config *cfg;\n \tstruct mlxsw_sp_fid *fid;\n \tint err;\n \n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\tparams.type = MLXSW_SP_NVE_TYPE_VXLAN;\n+\tparams.vni = cfg-\u003evni;\n+\tparams.dev = vxlan_dev;\n+\tparams.ethertype = ethertype;\n+\n \t/* If the VLAN is 0, we need to find the VLAN that is configured as\n \t * PVID and egress untagged on the bridge port of the VxLAN device.\n \t * It is possible no such VLAN exists\n@@ -2704,15 +2706,17 @@ mlxsw_sp_bridge_8021d_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,\n {\n \tstruct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_device-\u003edev);\n \tstruct vxlan_dev *vxlan = netdev_priv(vxlan_dev);\n-\tstruct mlxsw_sp_nve_params params = {\n-\t\t.type = MLXSW_SP_NVE_TYPE_VXLAN,\n-\t\t.vni = vxlan-\u003ecfg.vni,\n-\t\t.dev = vxlan_dev,\n-\t\t.ethertype = ETH_P_8021Q,\n-\t};\n+\tstruct mlxsw_sp_nve_params params;\n+\tconst struct vxlan_config *cfg;\n \tstruct mlxsw_sp_fid *fid;\n \tint err;\n \n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\tparams.type = MLXSW_SP_NVE_TYPE_VXLAN;\n+\tparams.vni = cfg-\u003evni;\n+\tparams.dev = vxlan_dev;\n+\tparams.ethertype = ETH_P_8021Q;\n+\n \tfid = mlxsw_sp_fid_8021d_get(mlxsw_sp, bridge_device-\u003edev-\u003eifindex);\n \tif (IS_ERR(fid)) {\n \t\tNL_SET_ERR_MSG_MOD(extack, \"Failed to create 802.1D FID\");\n@@ -2933,10 +2937,13 @@ static void __mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp,\n \t\t\t\t\t  const struct net_device *vxlan_dev)\n {\n \tstruct vxlan_dev *vxlan = netdev_priv(vxlan_dev);\n+\tconst struct vxlan_config *cfg;\n \tstruct mlxsw_sp_fid *fid;\n \n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\n \t/* If the VxLAN device is down, then the FID does not have a VNI */\n-\tfid = mlxsw_sp_fid_lookup_by_vni(mlxsw_sp, vxlan-\u003ecfg.vni);\n+\tfid = mlxsw_sp_fid_lookup_by_vni(mlxsw_sp, cfg-\u003evni);\n \tif (!fid)\n \t\treturn;\n \n@@ -3029,11 +3036,13 @@ static void mlxsw_sp_fdb_vxlan_call_notifiers(struct net_device *dev,\n \tstruct switchdev_notifier_vxlan_fdb_info info;\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n \tenum switchdev_notifier_type type;\n+\tconst struct vxlan_config *cfg;\n \n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n \ttype = adding ? SWITCHDEV_VXLAN_FDB_ADD_TO_BRIDGE :\n \t\t\tSWITCHDEV_VXLAN_FDB_DEL_TO_BRIDGE;\n \tmlxsw_sp_switchdev_addr_vxlan_convert(proto, addr, \u0026info.remote_ip);\n-\tinfo.remote_port = vxlan-\u003ecfg.dst_port;\n+\tinfo.remote_port = cfg-\u003edst_port;\n \tinfo.remote_vni = vni;\n \tinfo.remote_ifindex = 0;\n \tether_addr_copy(info.eth_addr, mac);\n@@ -3236,8 +3245,10 @@ __mlxsw_sp_fdb_notify_mac_uc_tunnel_process(struct mlxsw_sp *mlxsw_sp,\n \n \tif (adding \u0026\u0026 netif_is_vxlan(dev)) {\n \t\tstruct vxlan_dev *vxlan = netdev_priv(dev);\n+\t\tconst struct vxlan_config *cfg;\n \n-\t\tif (!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_LEARN))\n+\t\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\t\tif (!(cfg-\u003eflags \u0026 VXLAN_F_LEARN))\n \t\t\treturn -EINVAL;\n \t}\n \n@@ -3722,9 +3733,11 @@ mlxsw_sp_switchdev_vxlan_work_prepare(struct mlxsw_sp_switchdev_event_work *\n {\n \tstruct vxlan_dev *vxlan = netdev_priv(switchdev_work-\u003edev);\n \tstruct switchdev_notifier_vxlan_fdb_info *vxlan_fdb_info;\n-\tstruct vxlan_config *cfg = \u0026vxlan-\u003ecfg;\n+\tconst struct vxlan_config *cfg;\n \tstruct netlink_ext_ack *extack;\n \n+\tcfg = rcu_dereference_rtnl(vxlan-\u003ecfg);\n+\n \textack = switchdev_notifier_info_to_extack(info);\n \tvxlan_fdb_info = container_of(info,\n \t\t\t\t      struct switchdev_notifier_vxlan_fdb_info,\n@@ -3851,11 +3864,15 @@ mlxsw_sp_switchdev_vxlan_vlan_add(struct mlxsw_sp *mlxsw_sp,\n \t\t\t\t  struct netlink_ext_ack *extack)\n {\n \tstruct vxlan_dev *vxlan = netdev_priv(vxlan_dev);\n-\t__be32 vni = vxlan-\u003ecfg.vni;\n+\tconst struct vxlan_config *cfg;\n \tstruct mlxsw_sp_fid *fid;\n \tu16 old_vid;\n+\t__be32 vni;\n \tint err;\n \n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\tvni = cfg-\u003evni;\n+\n \t/* We cannot have the same VLAN as PVID and egress untagged on multiple\n \t * VxLAN devices. Note that we get this notification before the VLAN is\n \t * actually added to the bridge's database, so it is not possible for\n@@ -3935,12 +3952,16 @@ mlxsw_sp_switchdev_vxlan_vlan_del(struct mlxsw_sp *mlxsw_sp,\n \t\t\t\t  const struct net_device *vxlan_dev, u16 vid)\n {\n \tstruct vxlan_dev *vxlan = netdev_priv(vxlan_dev);\n-\t__be32 vni = vxlan-\u003ecfg.vni;\n+\tconst struct vxlan_config *cfg;\n \tstruct mlxsw_sp_fid *fid;\n+\t__be32 vni;\n \n \tif (!netif_running(vxlan_dev))\n \t\treturn;\n \n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\tvni = cfg-\u003evni;\n+\n \tfid = mlxsw_sp_fid_lookup_by_vni(mlxsw_sp, vni);\n \tif (!fid)\n \t\treturn;\ndiff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c\nindex 347245cc1de4e..63b707deb7fd0 100644\n--- a/drivers/net/vxlan/vxlan_core.c\n+++ b/drivers/net/vxlan/vxlan_core.c\n@@ -110,20 +110,23 @@ static struct vxlan_dev *vxlan_vs_find_vni(struct vxlan_sock *vs,\n \t\tvni = 0;\n \n \thlist_for_each_entry_rcu(node, vni_head(vs, vni), hlist) {\n+\t\tconst struct vxlan_config *cfg;\n+\n \t\tif (!node-\u003evxlan)\n \t\t\tcontinue;\n+\n+\t\tcfg = rcu_dereference(node-\u003evxlan-\u003ecfg);\n+\n \t\tvnode = NULL;\n-\t\tif (node-\u003evxlan-\u003ecfg.flags \u0026 VXLAN_F_VNIFILTER) {\n+\t\tif (cfg-\u003eflags \u0026 VXLAN_F_VNIFILTER) {\n \t\t\tvnode = vxlan_vnifilter_lookup(node-\u003evxlan, vni);\n \t\t\tif (!vnode)\n \t\t\t\tcontinue;\n-\t\t} else if (node-\u003evxlan-\u003edefault_dst.remote_vni != vni) {\n+\t\t} else if (cfg-\u003evni != vni) {\n \t\t\tcontinue;\n \t\t}\n \n \t\tif (IS_ENABLED(CONFIG_IPV6)) {\n-\t\t\tconst struct vxlan_config *cfg = \u0026node-\u003evxlan-\u003ecfg;\n-\n \t\t\tif ((cfg-\u003eflags \u0026 VXLAN_F_IPV6_LINKLOCAL) \u0026\u0026\n \t\t\t    cfg-\u003eremote_ifindex != ifindex)\n \t\t\t\tcontinue;\n@@ -157,6 +160,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,\n \t\t\t  u32 portid, u32 seq, int type, unsigned int flags,\n \t\t\t  const struct vxlan_rdst *rdst)\n {\n+\tconst struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan-\u003ecfg);\n \tunsigned long now = jiffies;\n \tstruct nda_cacheinfo ci;\n \tbool send_ip, send_eth;\n@@ -216,10 +220,10 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,\n \t\t\tgoto nla_put_failure;\n \n \t\tif (rdst-\u003eremote_port \u0026\u0026\n-\t\t    rdst-\u003eremote_port != vxlan-\u003ecfg.dst_port \u0026\u0026\n+\t\t    rdst-\u003eremote_port != cfg-\u003edst_port \u0026\u0026\n \t\t    nla_put_be16(skb, NDA_PORT, rdst-\u003eremote_port))\n \t\t\tgoto nla_put_failure;\n-\t\tif (rdst-\u003eremote_vni != vxlan-\u003edefault_dst.remote_vni \u0026\u0026\n+\t\tif (rdst-\u003eremote_vni != cfg-\u003evni \u0026\u0026\n \t\t    nla_put_u32(skb, NDA_VNI, be32_to_cpu(rdst-\u003eremote_vni)))\n \t\t\tgoto nla_put_failure;\n \t\tif (rdst-\u003eremote_ifindex \u0026\u0026\n@@ -227,7 +231,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,\n \t\t\tgoto nla_put_failure;\n \t}\n \n-\tif ((vxlan-\u003ecfg.flags \u0026 VXLAN_F_COLLECT_METADATA) \u0026\u0026 fdb-\u003ekey.vni \u0026\u0026\n+\tif ((cfg-\u003eflags \u0026 VXLAN_F_COLLECT_METADATA) \u0026\u0026 fdb-\u003ekey.vni \u0026\u0026\n \t    nla_put_u32(skb, NDA_SRC_VNI,\n \t\t\tbe32_to_cpu(fdb-\u003ekey.vni)))\n \t\tgoto nla_put_failure;\n@@ -377,14 +381,15 @@ static void vxlan_fdb_miss(struct vxlan_dev *vxlan, const u8 eth_addr[ETH_ALEN])\n \n /* Look up Ethernet address in forwarding table */\n static struct vxlan_fdb *vxlan_find_mac_rcu(struct vxlan_dev *vxlan,\n+\t\t\t\t\t    const struct vxlan_config *cfg,\n \t\t\t\t\t    const u8 *mac, __be32 vni)\n {\n \tstruct vxlan_fdb_key key;\n \n \tmemset(\u0026key, 0, sizeof(key));\n \tmemcpy(key.eth_addr, mac, sizeof(key.eth_addr));\n-\tif (!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_COLLECT_METADATA))\n-\t\tkey.vni = vxlan-\u003edefault_dst.remote_vni;\n+\tif (!(cfg-\u003eflags \u0026 VXLAN_F_COLLECT_METADATA))\n+\t\tkey.vni = cfg-\u003evni;\n \telse\n \t\tkey.vni = vni;\n \n@@ -393,11 +398,12 @@ static struct vxlan_fdb *vxlan_find_mac_rcu(struct vxlan_dev *vxlan,\n }\n \n static struct vxlan_fdb *vxlan_find_mac_tx(struct vxlan_dev *vxlan,\n+\t\t\t\t\t   const struct vxlan_config *cfg,\n \t\t\t\t\t   const u8 *mac, __be32 vni)\n {\n \tstruct vxlan_fdb *f;\n \n-\tf = vxlan_find_mac_rcu(vxlan, mac, vni);\n+\tf = vxlan_find_mac_rcu(vxlan, cfg, mac, vni);\n \tif (f) {\n \t\tunsigned long now = jiffies;\n \n@@ -416,7 +422,7 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,\n \tlockdep_assert_held_once(\u0026vxlan-\u003ehash_lock);\n \n \trcu_read_lock();\n-\tf = vxlan_find_mac_rcu(vxlan, mac, vni);\n+\tf = vxlan_find_mac_rcu(vxlan, rcu_dereference(vxlan-\u003ecfg), mac, vni);\n \trcu_read_unlock();\n \n \treturn f;\n@@ -457,7 +463,7 @@ int vxlan_fdb_find_uc(struct net_device *dev, const u8 *mac, __be32 vni,\n \n \trcu_read_lock();\n \n-\tf = vxlan_find_mac_rcu(vxlan, eth_addr, vni);\n+\tf = vxlan_find_mac_rcu(vxlan, rcu_dereference(vxlan-\u003ecfg), eth_addr, vni);\n \tif (f)\n \t\trdst = first_remote_rcu(f);\n \tif (!rdst) {\n@@ -798,6 +804,7 @@ static int vxlan_fdb_nh_update(struct vxlan_dev *vxlan, struct vxlan_fdb *fdb,\n \t\t\t       u32 nhid, struct netlink_ext_ack *extack)\n {\n \tstruct nexthop *old_nh = rtnl_dereference(fdb-\u003enh);\n+\tconst struct vxlan_config *cfg;\n \tstruct nexthop *nh;\n \tint err = -EINVAL;\n \n@@ -826,7 +833,8 @@ static int vxlan_fdb_nh_update(struct vxlan_dev *vxlan, struct vxlan_fdb *fdb,\n \t}\n \n \t/* check nexthop group family */\n-\tswitch (vxlan-\u003edefault_dst.remote_ip.sa.sa_family) {\n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\tswitch (cfg-\u003eremote_ip.sa.sa_family) {\n \tcase AF_INET:\n \t\tif (!nexthop_has_v4(nh)) {\n \t\t\terr = -EAFNOSUPPORT;\n@@ -863,12 +871,13 @@ int vxlan_fdb_create(struct vxlan_dev *vxlan,\n \t\t     u32 nhid, struct vxlan_fdb **fdb,\n \t\t     struct netlink_ext_ack *extack)\n {\n+\tconst struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan-\u003ecfg);\n \tstruct vxlan_rdst *rd = NULL;\n \tstruct vxlan_fdb *f;\n \tint rc;\n \n-\tif (vxlan-\u003ecfg.addrmax \u0026\u0026\n-\t    vxlan-\u003eaddrcnt \u003e= vxlan-\u003ecfg.addrmax)\n+\tif (cfg-\u003eaddrmax \u0026\u0026\n+\t    vxlan-\u003eaddrcnt \u003e= cfg-\u003eaddrmax)\n \t\treturn -ENOSPC;\n \n \tnetdev_dbg(vxlan-\u003edev, \"add %pM -\u003e %pIS\\n\", mac, ip);\n@@ -1154,6 +1163,7 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,\n \t\t\t   __be32 *vni, u32 *ifindex, u32 *nhid,\n \t\t\t   struct netlink_ext_ack *extack)\n {\n+\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\n \tstruct net *net = dev_net(vxlan-\u003edev);\n \tint err;\n \n@@ -1170,7 +1180,7 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,\n \t\t\treturn err;\n \t\t}\n \t} else {\n-\t\tunion vxlan_addr *remote = \u0026vxlan-\u003edefault_dst.remote_ip;\n+\t\tconst union vxlan_addr *remote = \u0026cfg-\u003eremote_ip;\n \n \t\tif (remote-\u003esa.sa_family == AF_INET) {\n \t\t\tip-\u003esin.sin_addr.s_addr = htonl(INADDR_ANY);\n@@ -1190,7 +1200,7 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,\n \t\t}\n \t\t*port = nla_get_be16(tb[NDA_PORT]);\n \t} else {\n-\t\t*port = vxlan-\u003ecfg.dst_port;\n+\t\t*port = cfg-\u003edst_port;\n \t}\n \n \tif (tb[NDA_VNI]) {\n@@ -1200,7 +1210,7 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,\n \t\t}\n \t\t*vni = cpu_to_be32(nla_get_u32(tb[NDA_VNI]));\n \t} else {\n-\t\t*vni = vxlan-\u003edefault_dst.remote_vni;\n+\t\t*vni = cfg-\u003evni;\n \t}\n \n \tif (tb[NDA_SRC_VNI]) {\n@@ -1210,7 +1220,7 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,\n \t\t}\n \t\t*src_vni = cpu_to_be32(nla_get_u32(tb[NDA_SRC_VNI]));\n \t} else {\n-\t\t*src_vni = vxlan-\u003edefault_dst.remote_vni;\n+\t\t*src_vni = cfg-\u003evni;\n \t}\n \n \tif (tb[NDA_IFINDEX]) {\n@@ -1241,6 +1251,7 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],\n \t\t\t const unsigned char *addr, u16 vid, u16 flags,\n \t\t\t bool *notified, struct netlink_ext_ack *extack)\n {\n+\tconst struct vxlan_config *cfg;\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n \t/* struct net *net = dev_net(vxlan-\u003edev); */\n \tunion vxlan_addr ip;\n@@ -1268,7 +1279,8 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],\n \t\treturn -EINVAL;\n \t}\n \n-\tif (vxlan-\u003edefault_dst.remote_ip.sa.sa_family != ip.sa.sa_family)\n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\tif (cfg-\u003eremote_ip.sa.sa_family != ip.sa.sa_family)\n \t\treturn -EAFNOSUPPORT;\n \n \tspin_lock_bh(\u0026vxlan-\u003ehash_lock);\n@@ -1405,18 +1417,21 @@ static int vxlan_fdb_get(struct sk_buff *skb,\n \t\t\t struct netlink_ext_ack *extack)\n {\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n+\tconst struct vxlan_config *cfg;\n \tstruct vxlan_fdb *f;\n \t__be32 vni;\n \tint err;\n \n+\tcfg = rcu_dereference_rtnl(vxlan-\u003ecfg);\n+\n \tif (tb[NDA_VNI])\n \t\tvni = cpu_to_be32(nla_get_u32(tb[NDA_VNI]));\n \telse\n-\t\tvni = vxlan-\u003edefault_dst.remote_vni;\n+\t\tvni = cfg-\u003evni;\n \n \trcu_read_lock();\n \n-\tf = vxlan_find_mac_rcu(vxlan, addr, vni);\n+\tf = vxlan_find_mac_rcu(vxlan, cfg, addr, vni);\n \tif (!f) {\n \t\tNL_SET_ERR_MSG(extack, \"Fdb entry not found\");\n \t\terr = -ENOENT;\n@@ -1434,6 +1449,7 @@ static int vxlan_fdb_get(struct sk_buff *skb,\n  * and Tunnel endpoint.\n  */\n static enum skb_drop_reason vxlan_snoop(struct net_device *dev,\n+\t\t\t\t\tconst struct vxlan_config *cfg,\n \t\t\t\t\tunion vxlan_addr *src_ip,\n \t\t\t\t\tconst u8 *src_mac, u32 src_ifindex,\n \t\t\t\t\t__be32 vni)\n@@ -1452,7 +1468,7 @@ static enum skb_drop_reason vxlan_snoop(struct net_device *dev,\n \t\tifindex = src_ifindex;\n #endif\n \n-\tf = vxlan_find_mac_rcu(vxlan, src_mac, vni);\n+\tf = vxlan_find_mac_rcu(vxlan, cfg, src_mac, vni);\n \tif (likely(f)) {\n \t\tstruct vxlan_rdst *rdst = first_remote_rcu(f);\n \t\tunsigned long now = jiffies;\n@@ -1488,9 +1504,9 @@ static enum skb_drop_reason vxlan_snoop(struct net_device *dev,\n \t\t\tvxlan_fdb_update(vxlan, src_mac, src_ip,\n \t\t\t\t\t NUD_REACHABLE,\n \t\t\t\t\t NLM_F_EXCL|NLM_F_CREATE,\n-\t\t\t\t\t vxlan-\u003ecfg.dst_port,\n+\t\t\t\t\t cfg-\u003edst_port,\n \t\t\t\t\t vni,\n-\t\t\t\t\t vxlan-\u003edefault_dst.remote_vni,\n+\t\t\t\t\t cfg-\u003evni,\n \t\t\t\t\t ifindex, NTF_SELF, 0, true, NULL);\n \t\tspin_unlock(\u0026vxlan-\u003ehash_lock);\n \t}\n@@ -1518,6 +1534,7 @@ static bool __vxlan_sock_release_prep(struct vxlan_sock *vs)\n \n static void vxlan_sock_release(struct vxlan_dev *vxlan)\n {\n+\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\n \tstruct vxlan_sock *sock4 = rtnl_dereference(vxlan-\u003evn4_sock);\n #if IS_ENABLED(CONFIG_IPV6)\n \tstruct vxlan_sock *sock6 = rtnl_dereference(vxlan-\u003evn6_sock);\n@@ -1527,7 +1544,7 @@ static void vxlan_sock_release(struct vxlan_dev *vxlan)\n \n \tRCU_INIT_POINTER(vxlan-\u003evn4_sock, NULL);\n \n-\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_VNIFILTER)\n+\tif (cfg-\u003eflags \u0026 VXLAN_F_VNIFILTER)\n \t\tvxlan_vs_del_vnigrp(vxlan);\n \telse\n \t\tvxlan_vs_del_dev(vxlan);\n@@ -1598,6 +1615,7 @@ static void vxlan_parse_gbp_hdr(struct sk_buff *skb, u32 vxflags,\n }\n \n static enum skb_drop_reason vxlan_set_mac(struct vxlan_dev *vxlan,\n+\t\t\t\t\t  const struct vxlan_config *cfg,\n \t\t\t\t\t  struct vxlan_sock *vs,\n \t\t\t\t\t  struct sk_buff *skb, __be32 vni)\n {\n@@ -1623,10 +1641,10 @@ static enum skb_drop_reason vxlan_set_mac(struct vxlan_dev *vxlan,\n #endif\n \t}\n \n-\tif (!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_LEARN))\n+\tif (!(cfg-\u003eflags \u0026 VXLAN_F_LEARN))\n \t\treturn SKB_NOT_DROPPED_YET;\n \n-\treturn vxlan_snoop(skb-\u003edev, \u0026saddr, eth_hdr(skb)-\u003eh_source,\n+\treturn vxlan_snoop(skb-\u003edev, cfg, \u0026saddr, eth_hdr(skb)-\u003eh_source,\n \t\t\t   ifindex, vni);\n }\n \n@@ -1657,18 +1675,21 @@ static bool vxlan_ecn_decapsulate(struct vxlan_sock *vs, void *oiph,\n static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)\n {\n \tstruct vxlan_vni_node *vninode = NULL;\n-\tconst struct vxlanhdr *vh;\n-\tstruct vxlan_dev *vxlan;\n-\tstruct vxlan_sock *vs;\n-\tstruct vxlan_metadata _md;\n-\tstruct vxlan_metadata *md = \u0026_md;\n \t__be16 protocol = htons(ETH_P_TEB);\n+\tconst struct vxlan_config *cfg;\n \tenum skb_drop_reason reason;\n+\tconst struct vxlanhdr *vh;\n+\tstruct vxlan_metadata *md;\n+\tstruct vxlan_metadata _md;\n+\tstruct vxlan_dev *vxlan;\n \tbool raw_proto = false;\n-\tvoid *oiph;\n+\tstruct vxlan_sock *vs;\n \t__be32 vni = 0;\n+\tvoid *oiph;\n \tint nh;\n \n+\tmd = \u0026_md;\n+\n \t/* Need UDP and VXLAN header to be present */\n \treason = pskb_may_pull_reason(skb, VXLAN_HLEN);\n \tif (reason)\n@@ -1696,8 +1717,10 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)\n \t\tgoto drop;\n \t}\n \n-\tif (vh-\u003evx_flags \u0026 vxlan-\u003ecfg.reserved_bits.vx_flags ||\n-\t    vh-\u003evx_vni \u0026 vxlan-\u003ecfg.reserved_bits.vx_vni) {\n+\tcfg = rcu_dereference(vxlan-\u003ecfg);\n+\n+\tif (vh-\u003evx_flags \u0026 cfg-\u003ereserved_bits.vx_flags ||\n+\t    vh-\u003evx_vni \u0026 cfg-\u003ereserved_bits.vx_vni) {\n \t\t/* If the header uses bits besides those enabled by the\n \t\t * netdevice configuration, treat this as a malformed packet.\n \t\t * This behavior diverges from VXLAN RFC (RFC7348) which\n@@ -1709,12 +1732,12 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)\n \t\treason = SKB_DROP_REASON_VXLAN_INVALID_HDR;\n \t\tDEV_STATS_INC(vxlan-\u003edev, rx_frame_errors);\n \t\tDEV_STATS_INC(vxlan-\u003edev, rx_errors);\n-\t\tvxlan_vnifilter_count(vxlan, vni, vninode,\n+\t\tvxlan_vnifilter_count(vxlan, cfg, vni, vninode,\n \t\t\t\t      VXLAN_VNI_STATS_RX_ERRORS, 0);\n \t\tgoto drop;\n \t}\n \n-\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_GPE) {\n+\tif (cfg-\u003eflags \u0026 VXLAN_F_GPE) {\n \t\tif (!vxlan_parse_gpe_proto(vh, \u0026protocol))\n \t\t\tgoto drop;\n \t\traw_proto = true;\n@@ -1726,8 +1749,8 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)\n \t\tgoto drop;\n \t}\n \n-\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_REMCSUM_RX) {\n-\t\treason = vxlan_remcsum(skb, vxlan-\u003ecfg.flags);\n+\tif (cfg-\u003eflags \u0026 VXLAN_F_REMCSUM_RX) {\n+\t\treason = vxlan_remcsum(skb, cfg-\u003eflags);\n \t\tif (unlikely(reason))\n \t\t\tgoto drop;\n \t}\n@@ -1752,14 +1775,14 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)\n \t\tmemset(md, 0, sizeof(*md));\n \t}\n \n-\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_GBP)\n-\t\tvxlan_parse_gbp_hdr(skb, vxlan-\u003ecfg.flags, md);\n+\tif (cfg-\u003eflags \u0026 VXLAN_F_GBP)\n+\t\tvxlan_parse_gbp_hdr(skb, cfg-\u003eflags, md);\n \t/* Note that GBP and GPE can never be active together. This is\n \t * ensured in vxlan_dev_configure.\n \t */\n \n \tif (!raw_proto) {\n-\t\treason = vxlan_set_mac(vxlan, vs, skb, vni);\n+\t\treason = vxlan_set_mac(vxlan, cfg, vs, skb, vni);\n \t\tif (reason)\n \t\t\tgoto drop;\n \t} else {\n@@ -1780,7 +1803,7 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)\n \tif (reason) {\n \t\tDEV_STATS_INC(vxlan-\u003edev, rx_length_errors);\n \t\tDEV_STATS_INC(vxlan-\u003edev, rx_errors);\n-\t\tvxlan_vnifilter_count(vxlan, vni, vninode,\n+\t\tvxlan_vnifilter_count(vxlan, cfg, vni, vninode,\n \t\t\t\t      VXLAN_VNI_STATS_RX_ERRORS, 0);\n \t\tgoto drop;\n \t}\n@@ -1792,7 +1815,7 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)\n \t\treason = SKB_DROP_REASON_IP_TUNNEL_ECN;\n \t\tDEV_STATS_INC(vxlan-\u003edev, rx_frame_errors);\n \t\tDEV_STATS_INC(vxlan-\u003edev, rx_errors);\n-\t\tvxlan_vnifilter_count(vxlan, vni, vninode,\n+\t\tvxlan_vnifilter_count(vxlan, cfg, vni, vninode,\n \t\t\t\t      VXLAN_VNI_STATS_RX_ERRORS, 0);\n \t\tgoto drop;\n \t}\n@@ -1802,14 +1825,15 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)\n \tif (unlikely(!(vxlan-\u003edev-\u003eflags \u0026 IFF_UP))) {\n \t\trcu_read_unlock();\n \t\tdev_dstats_rx_dropped(vxlan-\u003edev);\n-\t\tvxlan_vnifilter_count(vxlan, vni, vninode,\n+\t\tvxlan_vnifilter_count(vxlan, cfg, vni, vninode,\n \t\t\t\t      VXLAN_VNI_STATS_RX_DROPS, 0);\n \t\treason = SKB_DROP_REASON_DEV_READY;\n \t\tgoto drop;\n \t}\n \n \tdev_dstats_rx_add(vxlan-\u003edev, skb-\u003elen);\n-\tvxlan_vnifilter_count(vxlan, vni, vninode, VXLAN_VNI_STATS_RX, skb-\u003elen);\n+\tvxlan_vnifilter_count(vxlan, cfg, vni, vninode, VXLAN_VNI_STATS_RX,\n+\t\t\t      skb-\u003elen);\n \tgro_cells_receive(\u0026vxlan-\u003egro_cells, skb);\n \n \trcu_read_unlock();\n@@ -1850,7 +1874,8 @@ static int vxlan_err_lookup(struct sock *sk, struct sk_buff *skb)\n \treturn 0;\n }\n \n-static int arp_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)\n+static int arp_reduce(struct net_device *dev, struct sk_buff *skb,\n+\t\t      const struct vxlan_config *cfg, __be32 vni)\n {\n \tstruct neigh_table *tbl = arp_table(dev_net(dev));\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n@@ -1864,7 +1889,7 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)\n \n \tif (!pskb_network_may_pull(skb, arp_hdr_len(dev))) {\n \t\tdev_dstats_tx_dropped(dev);\n-\t\tvxlan_vnifilter_count(vxlan, vni, NULL,\n+\t\tvxlan_vnifilter_count(vxlan, cfg, vni, NULL,\n \t\t\t\t      VXLAN_VNI_STATS_TX_DROPS, 0);\n \t\tgoto out;\n \t}\n@@ -1905,7 +1930,7 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)\n \t\tneigh_ha_snapshot(ha, n, n-\u003edev);\n \n \t\trcu_read_lock();\n-\t\tf = vxlan_find_mac_tx(vxlan, ha, vni);\n+\t\tf = vxlan_find_mac_tx(vxlan, cfg, ha, vni);\n \t\tif (f)\n \t\t\trdst = first_remote_rcu(f);\n \t\tif (rdst \u0026\u0026 vxlan_addr_any(\u0026rdst-\u003eremote_ip)) {\n@@ -1931,11 +1956,11 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)\n \n \t\tif (netif_rx(reply) == NET_RX_DROP) {\n \t\t\tdev_dstats_rx_dropped(dev);\n-\t\t\tvxlan_vnifilter_count(vxlan, vni, NULL,\n+\t\t\tvxlan_vnifilter_count(vxlan, cfg, vni, NULL,\n \t\t\t\t\t      VXLAN_VNI_STATS_RX_DROPS, 0);\n \t\t}\n \n-\t} else if (vxlan-\u003ecfg.flags \u0026 VXLAN_F_L3MISS) {\n+\t} else if (cfg-\u003eflags \u0026 VXLAN_F_L3MISS) {\n \t\tunion vxlan_addr ipa = {\n \t\t\t.sin.sin_addr.s_addr = tip,\n \t\t\t.sin.sin_family = AF_INET,\n@@ -2043,7 +2068,8 @@ static struct sk_buff *vxlan_na_create(struct sk_buff *request,\n \treturn reply;\n }\n \n-static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)\n+static int neigh_reduce(struct net_device *dev, struct sk_buff *skb,\n+\t\t\tconst struct vxlan_config *cfg, __be32 vni)\n {\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n \tconst struct in6_addr *daddr;\n@@ -2077,7 +2103,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)\n \t\t}\n \n \t\tneigh_ha_snapshot(ha, n, n-\u003edev);\n-\t\tf = vxlan_find_mac_tx(vxlan, ha, vni);\n+\t\tf = vxlan_find_mac_tx(vxlan, cfg, ha, vni);\n \t\tif (f)\n \t\t\trdst = first_remote_rcu(f);\n \t\tif (rdst \u0026\u0026 vxlan_addr_any(\u0026rdst-\u003eremote_ip)) {\n@@ -2096,10 +2122,10 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)\n \n \t\tif (netif_rx(reply) == NET_RX_DROP) {\n \t\t\tdev_dstats_rx_dropped(dev);\n-\t\t\tvxlan_vnifilter_count(vxlan, vni, NULL,\n+\t\t\tvxlan_vnifilter_count(vxlan, cfg, vni, NULL,\n \t\t\t\t\t      VXLAN_VNI_STATS_RX_DROPS, 0);\n \t\t}\n-\t} else if (vxlan-\u003ecfg.flags \u0026 VXLAN_F_L3MISS) {\n+\t} else if (cfg-\u003eflags \u0026 VXLAN_F_L3MISS) {\n \t\tunion vxlan_addr ipa = {\n \t\t\t.sin6.sin6_addr = msg-\u003etarget,\n \t\t\t.sin6.sin6_family = AF_INET6,\n@@ -2115,9 +2141,9 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)\n }\n #endif\n \n-static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)\n+static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb,\n+\t\t\t       const struct vxlan_config *cfg)\n {\n-\tstruct vxlan_dev *vxlan = netdev_priv(dev);\n \tstruct neigh_table *tbl;\n \tstruct neighbour *n;\n \n@@ -2136,7 +2162,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)\n \t\ttbl = arp_table(dev_net(dev));\n \t\tpip = ip_hdr(skb);\n \t\tn = neigh_lookup(tbl, \u0026pip-\u003edaddr, dev);\n-\t\tif (!n \u0026\u0026 (vxlan-\u003ecfg.flags \u0026 VXLAN_F_L3MISS)) {\n+\t\tif (!n \u0026\u0026 (cfg-\u003eflags \u0026 VXLAN_F_L3MISS)) {\n \t\t\tunion vxlan_addr ipa = {\n \t\t\t\t.sin.sin_addr.s_addr = pip-\u003edaddr,\n \t\t\t\t.sin.sin_family = AF_INET,\n@@ -2164,7 +2190,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)\n \t\ttbl = nd_table(dev_net(dev));\n \t\tpip6 = ipv6_hdr(skb);\n \t\tn = neigh_lookup(tbl, \u0026pip6-\u003edaddr, dev);\n-\t\tif (!n \u0026\u0026 (vxlan-\u003ecfg.flags \u0026 VXLAN_F_L3MISS)) {\n+\t\tif (!n \u0026\u0026 (cfg-\u003eflags \u0026 VXLAN_F_L3MISS)) {\n \t\t\tunion vxlan_addr ipa = {\n \t\t\t\t.sin6.sin6_addr = pip6-\u003edaddr,\n \t\t\t\t.sin6.sin6_family = AF_INET6,\n@@ -2282,20 +2308,28 @@ static int vxlan_build_skb(struct sk_buff *skb, struct dst_entry *dst,\n \n /* Bypass encapsulation if the destination is local */\n static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,\n-\t\t\t       struct vxlan_dev *dst_vxlan, __be32 vni,\n-\t\t\t       bool snoop)\n+\t\t\t       struct vxlan_dev *dst_vxlan,\n+\t\t\t       const struct vxlan_config *src_cfg,\n+\t\t\t       __be32 vni, bool snoop)\n {\n+\tconst struct vxlan_config *dst_cfg;\n \tunion vxlan_addr loopback;\n-\tunion vxlan_addr *remote_ip = \u0026dst_vxlan-\u003edefault_dst.remote_ip;\n \tunsigned int len = skb-\u003elen;\n-\tstruct net_device *dev;\n+\tstruct net_device *dev = dst_vxlan-\u003edev;\n \n \tskb-\u003epkt_type = PACKET_HOST;\n \tskb-\u003eencapsulation = 0;\n-\tskb-\u003edev = dst_vxlan-\u003edev;\n+\tskb-\u003edev = dev;\n \t__skb_pull(skb, skb_network_offset(skb));\n \n-\tif (remote_ip-\u003esa.sa_family == AF_INET) {\n+\trcu_read_lock();\n+\tdst_cfg = rcu_dereference(dst_vxlan-\u003ecfg);\n+\tif (unlikely(!(dev-\u003eflags \u0026 IFF_UP))) {\n+\t\tkfree_skb_reason(skb, SKB_DROP_REASON_DEV_READY);\n+\t\tgoto drop;\n+\t}\n+\n+\tif (dst_cfg-\u003eremote_ip.sa.sa_family == AF_INET) {\n \t\tloopback.sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);\n \t\tloopback.sa.sa_family =  AF_INET;\n #if IS_ENABLED(CONFIG_IPV6)\n@@ -2305,27 +2339,20 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,\n #endif\n \t}\n \n-\trcu_read_lock();\n-\tdev = skb-\u003edev;\n-\tif (unlikely(!(dev-\u003eflags \u0026 IFF_UP))) {\n-\t\tkfree_skb_reason(skb, SKB_DROP_REASON_DEV_READY);\n-\t\tgoto drop;\n-\t}\n-\n-\tif ((dst_vxlan-\u003ecfg.flags \u0026 VXLAN_F_LEARN) \u0026\u0026 snoop)\n-\t\tvxlan_snoop(dev, \u0026loopback, eth_hdr(skb)-\u003eh_source, 0, vni);\n+\tif ((dst_cfg-\u003eflags \u0026 VXLAN_F_LEARN) \u0026\u0026 snoop)\n+\t\tvxlan_snoop(dev, dst_cfg, \u0026loopback, eth_hdr(skb)-\u003eh_source, 0, vni);\n \n \tdev_dstats_tx_add(src_vxlan-\u003edev, len);\n-\tvxlan_vnifilter_count(src_vxlan, vni, NULL, VXLAN_VNI_STATS_TX, len);\n+\tvxlan_vnifilter_count(src_vxlan, src_cfg, vni, NULL, VXLAN_VNI_STATS_TX, len);\n \n \tif (__netif_rx(skb) == NET_RX_SUCCESS) {\n \t\tdev_dstats_rx_add(dst_vxlan-\u003edev, len);\n-\t\tvxlan_vnifilter_count(dst_vxlan, vni, NULL, VXLAN_VNI_STATS_RX,\n+\t\tvxlan_vnifilter_count(dst_vxlan, dst_cfg, vni, NULL, VXLAN_VNI_STATS_RX,\n \t\t\t\t      len);\n \t} else {\n drop:\n \t\tdev_dstats_rx_dropped(dev);\n-\t\tvxlan_vnifilter_count(dst_vxlan, vni, NULL,\n+\t\tvxlan_vnifilter_count(dst_vxlan, dst_cfg, vni, NULL,\n \t\t\t\t      VXLAN_VNI_STATS_RX_DROPS, 0);\n \t}\n \trcu_read_unlock();\n@@ -2333,6 +2360,7 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,\n \n static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev,\n \t\t\t\t struct vxlan_dev *vxlan,\n+\t\t\t\t const struct vxlan_config *cfg,\n \t\t\t\t int addr_family,\n \t\t\t\t __be16 dst_port, int dst_ifindex, __be32 vni,\n \t\t\t\t struct dst_entry *dst,\n@@ -2348,22 +2376,22 @@ static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev,\n \t/* Bypass encapsulation if the destination is local */\n \tif (rt_flags \u0026 RTCF_LOCAL \u0026\u0026\n \t    !(rt_flags \u0026 (RTCF_BROADCAST | RTCF_MULTICAST)) \u0026\u0026\n-\t    vxlan-\u003ecfg.flags \u0026 VXLAN_F_LOCALBYPASS) {\n+\t    cfg-\u003eflags \u0026 VXLAN_F_LOCALBYPASS) {\n \t\tstruct vxlan_dev *dst_vxlan;\n \n \t\tdst_release(dst);\n \t\tdst_vxlan = vxlan_find_vni(vxlan-\u003enet, dst_ifindex, vni,\n \t\t\t\t\t   addr_family, dst_port,\n-\t\t\t\t\t   vxlan-\u003ecfg.flags);\n+\t\t\t\t\t   cfg-\u003eflags);\n \t\tif (!dst_vxlan) {\n \t\t\tDEV_STATS_INC(dev, tx_errors);\n-\t\t\tvxlan_vnifilter_count(vxlan, vni, NULL,\n+\t\t\tvxlan_vnifilter_count(vxlan, cfg, vni, NULL,\n \t\t\t\t\t      VXLAN_VNI_STATS_TX_ERRORS, 0);\n \t\t\tkfree_skb_reason(skb, SKB_DROP_REASON_VXLAN_VNI_NOT_FOUND);\n \n \t\t\treturn -ENOENT;\n \t\t}\n-\t\tvxlan_encap_bypass(skb, vxlan, dst_vxlan, vni, true);\n+\t\tvxlan_encap_bypass(skb, vxlan, dst_vxlan, cfg, vni, true);\n \t\treturn 1;\n \t}\n \n@@ -2371,30 +2399,35 @@ static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev,\n }\n \n void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,\n+\t\t    const struct vxlan_config *cfg,\n \t\t    __be32 default_vni, struct vxlan_rdst *rdst, bool did_rsc)\n {\n+\tunsigned int pkt_len = skb-\u003elen;\n+\tstruct vxlan_metadata _md = {};\n+\t__be16 src_port = 0, dst_port;\n+\tstruct dst_entry *ndst = NULL;\n+\tenum skb_drop_reason reason;\n \tstruct dst_cache *dst_cache;\n+\tconst struct iphdr *old_iph;\n \tstruct ip_tunnel_info *info;\n \tstruct ip_tunnel_key *pkey;\n+\tstruct vxlan_metadata *md;\n \tstruct ip_tunnel_key key;\n-\tstruct vxlan_dev *vxlan = netdev_priv(dev);\n-\tconst struct iphdr *old_iph;\n-\tstruct vxlan_metadata _md = {};\n-\tstruct vxlan_metadata *md = \u0026_md;\n-\tunsigned int pkt_len = skb-\u003elen;\n-\t__be16 src_port = 0, dst_port;\n-\tstruct dst_entry *ndst = NULL;\n+\tstruct vxlan_dev *vxlan;\n+\tu32 flags = cfg-\u003eflags;\n+\tbool udp_sum = false;\n+\tbool no_eth_encap;\n \tint addr_family;\n+\tbool use_cache;\n+\t__be32 vni = 0;\n \t__u8 tos, ttl;\n \tint ifindex;\n \tint err = 0;\n-\tu32 flags = vxlan-\u003ecfg.flags;\n-\tbool use_cache;\n-\tbool udp_sum = false;\n-\tbool xnet = !net_eq(vxlan-\u003enet, dev_net(vxlan-\u003edev));\n-\tenum skb_drop_reason reason;\n-\tbool no_eth_encap;\n-\t__be32 vni = 0;\n+\tbool xnet;\n+\n+\tvxlan = netdev_priv(dev);\n+\txnet = !net_eq(vxlan-\u003enet, dev_net(vxlan-\u003edev));\n+\tmd = \u0026_md;\n \n \tno_eth_encap = flags \u0026 VXLAN_F_GPE \u0026\u0026 skb-\u003eprotocol != htons(ETH_P_TEB);\n \treason = skb_vlan_inet_prepare(skb, no_eth_encap);\n@@ -2414,23 +2447,23 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,\n \t\tif (vxlan_addr_any(\u0026rdst-\u003eremote_ip)) {\n \t\t\tif (did_rsc) {\n \t\t\t\t/* short-circuited back to local bridge */\n-\t\t\t\tvxlan_encap_bypass(skb, vxlan, vxlan,\n+\t\t\t\tvxlan_encap_bypass(skb, vxlan, vxlan, cfg,\n \t\t\t\t\t\t   default_vni, true);\n \t\t\t\treturn;\n \t\t\t}\n \t\t\tgoto drop;\n \t\t}\n \n-\t\taddr_family = vxlan-\u003ecfg.saddr.sa.sa_family;\n-\t\tdst_port = rdst-\u003eremote_port ? rdst-\u003eremote_port : vxlan-\u003ecfg.dst_port;\n+\t\taddr_family = cfg-\u003esaddr.sa.sa_family;\n+\t\tdst_port = rdst-\u003eremote_port ? rdst-\u003eremote_port : cfg-\u003edst_port;\n \t\tvni = (rdst-\u003eremote_vni) ? : default_vni;\n \t\tifindex = rdst-\u003eremote_ifindex;\n \n \t\tif (addr_family == AF_INET) {\n-\t\t\tkey.u.ipv4.src = vxlan-\u003ecfg.saddr.sin.sin_addr.s_addr;\n+\t\t\tkey.u.ipv4.src = cfg-\u003esaddr.sin.sin_addr.s_addr;\n \t\t\tkey.u.ipv4.dst = rdst-\u003eremote_ip.sin.sin_addr.s_addr;\n \t\t} else {\n-\t\t\tkey.u.ipv6.src = vxlan-\u003ecfg.saddr.sin6.sin6_addr;\n+\t\t\tkey.u.ipv6.src = cfg-\u003esaddr.sin6.sin6_addr;\n \t\t\tkey.u.ipv6.dst = rdst-\u003eremote_ip.sin6.sin6_addr;\n \t\t}\n \n@@ -2439,11 +2472,11 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,\n \t\tif (flags \u0026 VXLAN_F_TTL_INHERIT) {\n \t\t\tttl = ip_tunnel_get_ttl(old_iph, skb);\n \t\t} else {\n-\t\t\tttl = vxlan-\u003ecfg.ttl;\n+\t\t\tttl = cfg-\u003ettl;\n \t\t\tif (!ttl \u0026\u0026 vxlan_addr_multicast(\u0026rdst-\u003eremote_ip))\n \t\t\t\tttl = 1;\n \t\t}\n-\t\ttos = vxlan-\u003ecfg.tos;\n+\t\ttos = cfg-\u003etos;\n \t\tif (tos == 1)\n \t\t\ttos = ip_tunnel_get_dsfield(old_iph, skb);\n \t\tif (tos \u0026\u0026 !info)\n@@ -2454,9 +2487,9 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,\n \t\telse\n \t\t\tudp_sum = !(flags \u0026 VXLAN_F_UDP_ZERO_CSUM6_TX);\n #if IS_ENABLED(CONFIG_IPV6)\n-\t\tswitch (vxlan-\u003ecfg.label_policy) {\n+\t\tswitch (cfg-\u003elabel_policy) {\n \t\tcase VXLAN_LABEL_FIXED:\n-\t\t\tkey.label = vxlan-\u003ecfg.label;\n+\t\t\tkey.label = cfg-\u003elabel;\n \t\t\tbreak;\n \t\tcase VXLAN_LABEL_INHERIT:\n \t\t\tkey.label = ip_tunnel_get_flowlabel(old_iph, skb);\n@@ -2474,7 +2507,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,\n \t\t}\n \t\tpkey = \u0026info-\u003ekey;\n \t\taddr_family = ip_tunnel_info_af(info);\n-\t\tdst_port = info-\u003ekey.tp_dst ? : vxlan-\u003ecfg.dst_port;\n+\t\tdst_port = info-\u003ekey.tp_dst ? : cfg-\u003edst_port;\n \t\tvni = tunnel_id_to_key32(info-\u003ekey.tun_id);\n \t\tifindex = 0;\n \t\tdst_cache = \u0026info-\u003edst_cache;\n@@ -2487,8 +2520,8 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,\n \t\ttos = info-\u003ekey.tos;\n \t\tudp_sum = test_bit(IP_TUNNEL_CSUM_BIT, info-\u003ekey.tun_flags);\n \t}\n-\tsrc_port = udp_flow_src_port(dev_net(dev), skb, vxlan-\u003ecfg.port_min,\n-\t\t\t\t     vxlan-\u003ecfg.port_max, true);\n+\tsrc_port = udp_flow_src_port(dev_net(dev), skb, cfg-\u003eport_min,\n+\t\t\t\t     cfg-\u003eport_max, true);\n \n \trcu_read_lock();\n \tif (addr_family == AF_INET) {\n@@ -2521,15 +2554,15 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,\n \n \t\tif (!info) {\n \t\t\t/* Bypass encapsulation if the destination is local */\n-\t\t\terr = encap_bypass_if_local(skb, dev, vxlan, AF_INET,\n+\t\t\terr = encap_bypass_if_local(skb, dev, vxlan, cfg, AF_INET,\n \t\t\t\t\t\t    dst_port, ifindex, vni,\n \t\t\t\t\t\t    \u0026rt-\u003edst, rt-\u003ert_flags);\n \t\t\tif (err)\n \t\t\t\tgoto out_unlock;\n \n-\t\t\tif (vxlan-\u003ecfg.df == VXLAN_DF_SET) {\n+\t\t\tif (cfg-\u003edf == VXLAN_DF_SET) {\n \t\t\t\tdf = htons(IP_DF);\n-\t\t\t} else if (vxlan-\u003ecfg.df == VXLAN_DF_INHERIT) {\n+\t\t\t} else if (cfg-\u003edf == VXLAN_DF_INHERIT) {\n \t\t\t\tstruct ethhdr *eth = eth_hdr(skb);\n \n \t\t\t\tif (ntohs(eth-\u003eh_proto) == ETH_P_IPV6 ||\n@@ -2558,7 +2591,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,\n \t\t\t\tunclone-\u003ekey.u.ipv4.src = pkey-\u003eu.ipv4.dst;\n \t\t\t\tunclone-\u003ekey.u.ipv4.dst = saddr;\n \t\t\t}\n-\t\t\tvxlan_encap_bypass(skb, vxlan, vxlan, vni, false);\n+\t\t\tvxlan_encap_bypass(skb, vxlan, vxlan, cfg, vni, false);\n \t\t\tdst_release(ndst);\n \t\t\tgoto out_unlock;\n \t\t}\n@@ -2608,7 +2641,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,\n \t\tif (!info) {\n \t\t\tu32 rt6i_flags = dst_rt6_info(ndst)-\u003ert6i_flags;\n \n-\t\t\terr = encap_bypass_if_local(skb, dev, vxlan, AF_INET6,\n+\t\t\terr = encap_bypass_if_local(skb, dev, vxlan, cfg, AF_INET6,\n \t\t\t\t\t\t    dst_port, ifindex, vni,\n \t\t\t\t\t\t    ndst, rt6i_flags);\n \t\t\tif (err)\n@@ -2632,7 +2665,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,\n \t\t\t\tunclone-\u003ekey.u.ipv6.dst = saddr;\n \t\t\t}\n \n-\t\t\tvxlan_encap_bypass(skb, vxlan, vxlan, vni, false);\n+\t\t\tvxlan_encap_bypass(skb, vxlan, vxlan, cfg, vni, false);\n \t\t\tdst_release(ndst);\n \t\t\tgoto out_unlock;\n \t\t}\n@@ -2653,14 +2686,14 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,\n \t\t\t\t     ip6cb_flags);\n #endif\n \t}\n-\tvxlan_vnifilter_count(vxlan, vni, NULL, VXLAN_VNI_STATS_TX, pkt_len);\n+\tvxlan_vnifilter_count(vxlan, cfg, vni, NULL, VXLAN_VNI_STATS_TX, pkt_len);\n out_unlock:\n \trcu_read_unlock();\n \treturn;\n \n drop:\n \tdev_dstats_tx_dropped(dev);\n-\tvxlan_vnifilter_count(vxlan, vni, NULL, VXLAN_VNI_STATS_TX_DROPS, 0);\n+\tvxlan_vnifilter_count(vxlan, cfg, vni, NULL, VXLAN_VNI_STATS_TX_DROPS, 0);\n \tkfree_skb_reason(skb, reason);\n \treturn;\n \n@@ -2672,11 +2705,12 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,\n \t\tDEV_STATS_INC(dev, tx_carrier_errors);\n \tdst_release(ndst);\n \tDEV_STATS_INC(dev, tx_errors);\n-\tvxlan_vnifilter_count(vxlan, vni, NULL, VXLAN_VNI_STATS_TX_ERRORS, 0);\n+\tvxlan_vnifilter_count(vxlan, cfg, vni, NULL, VXLAN_VNI_STATS_TX_ERRORS, 0);\n \tkfree_skb_reason(skb, reason);\n }\n \n static void vxlan_xmit_nh(struct sk_buff *skb, struct net_device *dev,\n+\t\t\t  const struct vxlan_config *cfg,\n \t\t\t  struct vxlan_fdb *f, __be32 vni, bool did_rsc)\n {\n \tstruct vxlan_rdst nh_rdst;\n@@ -2693,7 +2727,7 @@ static void vxlan_xmit_nh(struct sk_buff *skb, struct net_device *dev,\n \tdo_xmit = vxlan_fdb_nh_path_select(nh, hash, \u0026nh_rdst);\n \n \tif (likely(do_xmit))\n-\t\tvxlan_xmit_one(skb, dev, vni, \u0026nh_rdst, did_rsc);\n+\t\tvxlan_xmit_one(skb, dev, cfg, vni, \u0026nh_rdst, did_rsc);\n \telse\n \t\tgoto drop;\n \n@@ -2701,15 +2735,15 @@ static void vxlan_xmit_nh(struct sk_buff *skb, struct net_device *dev,\n \n drop:\n \tdev_dstats_tx_dropped(dev);\n-\tvxlan_vnifilter_count(netdev_priv(dev), vni, NULL,\n+\tvxlan_vnifilter_count(netdev_priv(dev), cfg, vni, NULL,\n \t\t\t      VXLAN_VNI_STATS_TX_DROPS, 0);\n \tdev_kfree_skb(skb);\n }\n \n static netdev_tx_t vxlan_xmit_nhid(struct sk_buff *skb, struct net_device *dev,\n-\t\t\t\t   u32 nhid, __be32 vni)\n+\t\t\t\t   u32 nhid, __be32 vni,\n+\t\t\t\t   const struct vxlan_config *cfg)\n {\n-\tstruct vxlan_dev *vxlan = netdev_priv(dev);\n \tstruct vxlan_rdst nh_rdst;\n \tstruct nexthop *nh;\n \tbool do_xmit;\n@@ -2727,11 +2761,11 @@ static netdev_tx_t vxlan_xmit_nhid(struct sk_buff *skb, struct net_device *dev,\n \tdo_xmit = vxlan_fdb_nh_path_select(nh, hash, \u0026nh_rdst);\n \trcu_read_unlock();\n \n-\tif (vxlan-\u003ecfg.saddr.sa.sa_family != nh_rdst.remote_ip.sa.sa_family)\n+\tif (cfg-\u003esaddr.sa.sa_family != nh_rdst.remote_ip.sa.sa_family)\n \t\tgoto drop;\n \n \tif (likely(do_xmit))\n-\t\tvxlan_xmit_one(skb, dev, vni, \u0026nh_rdst, false);\n+\t\tvxlan_xmit_one(skb, dev, cfg, vni, \u0026nh_rdst, false);\n \telse\n \t\tgoto drop;\n \n@@ -2739,7 +2773,7 @@ static netdev_tx_t vxlan_xmit_nhid(struct sk_buff *skb, struct net_device *dev,\n \n drop:\n \tdev_dstats_tx_dropped(dev);\n-\tvxlan_vnifilter_count(netdev_priv(dev), vni, NULL,\n+\tvxlan_vnifilter_count(netdev_priv(dev), cfg, vni, NULL,\n \t\t\t      VXLAN_VNI_STATS_TX_DROPS, 0);\n \tdev_kfree_skb(skb);\n \treturn NETDEV_TX_OK;\n@@ -2756,34 +2790,47 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n \tstruct vxlan_rdst *rdst, *fdst = NULL;\n \tconst struct ip_tunnel_info *info;\n+\tconst struct vxlan_config *cfg;\n+\t__be32 default_vni;\n \tstruct vxlan_fdb *f;\n \tstruct ethhdr *eth;\n \t__be32 vni = 0;\n-\tu32 nhid = 0;\n \tbool did_rsc;\n+\tu32 nhid = 0;\n+\tu32 flags;\n+\n+\trcu_read_lock();\n+\tcfg = rcu_dereference(vxlan-\u003ecfg);\n+\tflags = cfg-\u003eflags;\n+\tdefault_vni = cfg-\u003evni;\n \n \tinfo = skb_tunnel_info(skb);\n \n \tskb_reset_mac_header(skb);\n \n-\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_COLLECT_METADATA) {\n+\tif (flags \u0026 VXLAN_F_COLLECT_METADATA) {\n \t\tif (info \u0026\u0026 info-\u003emode \u0026 IP_TUNNEL_INFO_BRIDGE \u0026\u0026\n \t\t    info-\u003emode \u0026 IP_TUNNEL_INFO_TX) {\n \t\t\tvni = tunnel_id_to_key32(info-\u003ekey.tun_id);\n \t\t\tnhid = info-\u003ekey.nhid;\n \t\t} else {\n \t\t\tif (info \u0026\u0026 info-\u003emode \u0026 IP_TUNNEL_INFO_TX)\n-\t\t\t\tvxlan_xmit_one(skb, dev, vni, NULL, false);\n+\t\t\t\tvxlan_xmit_one(skb, dev, cfg, vni, NULL, false);\n \t\t\telse\n \t\t\t\tkfree_skb_reason(skb, SKB_DROP_REASON_TUNNEL_TXINFO);\n+\t\t\trcu_read_unlock();\n \t\t\treturn NETDEV_TX_OK;\n \t\t}\n \t}\n \n-\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_PROXY) {\n+\tif (flags \u0026 VXLAN_F_PROXY) {\n \t\teth = eth_hdr(skb);\n-\t\tif (ntohs(eth-\u003eh_proto) == ETH_P_ARP)\n-\t\t\treturn arp_reduce(dev, skb, vni);\n+\t\tif (ntohs(eth-\u003eh_proto) == ETH_P_ARP) {\n+\t\t\tnetdev_tx_t res = arp_reduce(dev, skb, cfg, vni);\n+\n+\t\t\trcu_read_unlock();\n+\t\t\treturn res;\n+\t\t}\n #if IS_ENABLED(CONFIG_IPV6)\n \t\telse if (ntohs(eth-\u003eh_proto) == ETH_P_IPV6 \u0026\u0026\n \t\t\t pskb_network_may_pull(skb, sizeof(struct ipv6hdr) +\n@@ -2792,53 +2839,57 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)\n \t\t\tstruct nd_msg *m = (struct nd_msg *)(ipv6_hdr(skb) + 1);\n \n \t\t\tif (m-\u003eicmph.icmp6_code == 0 \u0026\u0026\n-\t\t\t    m-\u003eicmph.icmp6_type == NDISC_NEIGHBOUR_SOLICITATION)\n-\t\t\t\treturn neigh_reduce(dev, skb, vni);\n+\t\t\t    m-\u003eicmph.icmp6_type == NDISC_NEIGHBOUR_SOLICITATION) {\n+\t\t\t\tnetdev_tx_t res = neigh_reduce(dev, skb, cfg, vni);\n+\n+\t\t\t\trcu_read_unlock();\n+\t\t\t\treturn res;\n+\t\t\t}\n \t\t}\n #endif\n \t}\n \n-\tif (nhid)\n-\t\treturn vxlan_xmit_nhid(skb, dev, nhid, vni);\n+\tif (nhid) {\n+\t\tnetdev_tx_t res = vxlan_xmit_nhid(skb, dev, nhid, vni, cfg);\n+\n+\t\trcu_read_unlock();\n+\t\treturn res;\n+\t}\n \n-\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_MDB) {\n+\tif (test_bit(VXLAN_DEV_F_MDB, \u0026vxlan-\u003eflags)) {\n \t\tstruct vxlan_mdb_entry *mdb_entry;\n \n-\t\trcu_read_lock();\n-\t\tmdb_entry = vxlan_mdb_entry_skb_get(vxlan, skb, vni);\n+\t\tmdb_entry = vxlan_mdb_entry_skb_get(vxlan, cfg, skb, vni);\n \t\tif (mdb_entry) {\n-\t\t\tnetdev_tx_t ret;\n+\t\t\tnetdev_tx_t ret = vxlan_mdb_xmit(vxlan, cfg, mdb_entry, skb);\n \n-\t\t\tret = vxlan_mdb_xmit(vxlan, mdb_entry, skb);\n \t\t\trcu_read_unlock();\n \t\t\treturn ret;\n \t\t}\n-\t\trcu_read_unlock();\n \t}\n \n \teth = eth_hdr(skb);\n-\trcu_read_lock();\n-\tf = vxlan_find_mac_tx(vxlan, eth-\u003eh_dest, vni);\n+\tf = vxlan_find_mac_tx(vxlan, cfg, eth-\u003eh_dest, vni);\n \tdid_rsc = false;\n \n-\tif (f \u0026\u0026 (f-\u003eflags \u0026 NTF_ROUTER) \u0026\u0026 (vxlan-\u003ecfg.flags \u0026 VXLAN_F_RSC) \u0026\u0026\n+\tif (f \u0026\u0026 (f-\u003eflags \u0026 NTF_ROUTER) \u0026\u0026 (flags \u0026 VXLAN_F_RSC) \u0026\u0026\n \t    (ntohs(eth-\u003eh_proto) == ETH_P_IP ||\n \t     ntohs(eth-\u003eh_proto) == ETH_P_IPV6)) {\n-\t\tdid_rsc = route_shortcircuit(dev, skb);\n+\t\tdid_rsc = route_shortcircuit(dev, skb, cfg);\n \t\teth = eth_hdr(skb);\n \t\tif (did_rsc)\n-\t\t\tf = vxlan_find_mac_tx(vxlan, eth-\u003eh_dest, vni);\n+\t\t\tf = vxlan_find_mac_tx(vxlan, cfg, eth-\u003eh_dest, vni);\n \t}\n \n \tif (f == NULL) {\n-\t\tf = vxlan_find_mac_tx(vxlan, all_zeros_mac, vni);\n+\t\tf = vxlan_find_mac_tx(vxlan, cfg, all_zeros_mac, vni);\n \t\tif (f == NULL) {\n-\t\t\tif ((vxlan-\u003ecfg.flags \u0026 VXLAN_F_L2MISS) \u0026\u0026\n+\t\t\tif ((flags \u0026 VXLAN_F_L2MISS) \u0026\u0026\n \t\t\t    !is_multicast_ether_addr(eth-\u003eh_dest))\n \t\t\t\tvxlan_fdb_miss(vxlan, eth-\u003eh_dest);\n \n \t\t\tdev_dstats_tx_dropped(dev);\n-\t\t\tvxlan_vnifilter_count(vxlan, vni, NULL,\n+\t\t\tvxlan_vnifilter_count(vxlan, cfg, vni, NULL,\n \t\t\t\t\t      VXLAN_VNI_STATS_TX_DROPS, 0);\n \t\t\tkfree_skb_reason(skb, SKB_DROP_REASON_NO_TX_TARGET);\n \t\t\tgoto out;\n@@ -2846,8 +2897,8 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)\n \t}\n \n \tif (rcu_access_pointer(f-\u003enh)) {\n-\t\tvxlan_xmit_nh(skb, dev, f,\n-\t\t\t      (vni ? : vxlan-\u003edefault_dst.remote_vni), did_rsc);\n+\t\tvxlan_xmit_nh(skb, dev, cfg, f,\n+\t\t\t      (vni ? : default_vni), did_rsc);\n \t} else {\n \t\tlist_for_each_entry_rcu(rdst, \u0026f-\u003eremotes, list) {\n \t\t\tstruct sk_buff *skb1;\n@@ -2858,10 +2909,10 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)\n \t\t\t}\n \t\t\tskb1 = skb_clone(skb, GFP_ATOMIC);\n \t\t\tif (skb1)\n-\t\t\t\tvxlan_xmit_one(skb1, dev, vni, rdst, did_rsc);\n+\t\t\t\tvxlan_xmit_one(skb1, dev, cfg, vni, rdst, did_rsc);\n \t\t}\n \t\tif (fdst)\n-\t\t\tvxlan_xmit_one(skb, dev, vni, fdst, did_rsc);\n+\t\t\tvxlan_xmit_one(skb, dev, cfg, vni, fdst, did_rsc);\n \t\telse\n \t\t\tkfree_skb_reason(skb, SKB_DROP_REASON_NO_TX_TARGET);\n \t}\n@@ -2876,12 +2927,15 @@ static void vxlan_cleanup(struct timer_list *t)\n {\n \tstruct vxlan_dev *vxlan = timer_container_of(vxlan, t, age_timer);\n \tunsigned long next_timer = jiffies + FDB_AGE_INTERVAL;\n+\tconst struct vxlan_config *cfg;\n \tstruct vxlan_fdb *f;\n \n \tif (!netif_running(vxlan-\u003edev))\n \t\treturn;\n \n \trcu_read_lock();\n+\tcfg = rcu_dereference(vxlan-\u003ecfg);\n+\n \thlist_for_each_entry_rcu(f, \u0026vxlan-\u003efdb_list, fdb_node) {\n \t\tunsigned long timeout;\n \n@@ -2891,7 +2945,7 @@ static void vxlan_cleanup(struct timer_list *t)\n \t\tif (f-\u003eflags \u0026 NTF_EXT_LEARNED)\n \t\t\tcontinue;\n \n-\t\ttimeout = READ_ONCE(f-\u003eupdated) + vxlan-\u003ecfg.age_interval * HZ;\n+\t\ttimeout = READ_ONCE(f-\u003eupdated) + cfg-\u003eage_interval * HZ;\n \t\tif (time_before_eq(timeout, jiffies)) {\n \t\t\tspin_lock(\u0026vxlan-\u003ehash_lock);\n \t\t\tif (!hlist_unhashed(\u0026f-\u003efdb_node)) {\n@@ -2923,10 +2977,14 @@ static void vxlan_vs_del_dev(struct vxlan_dev *vxlan)\n static void vxlan_vs_add_dev(struct vxlan_sock *vs, struct vxlan_dev *vxlan,\n \t\t\t     struct vxlan_dev_node *node)\n {\n-\t__be32 vni = vxlan-\u003edefault_dst.remote_vni;\n+\tconst struct vxlan_config *cfg;\n+\t__be32 vni;\n \n \tASSERT_RTNL();\n \n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\tvni = cfg-\u003evni;\n+\n \tnode-\u003evxlan = vxlan;\n \thlist_add_head_rcu(\u0026node-\u003ehlist, vni_head(vs, vni));\n }\n@@ -2935,13 +2993,16 @@ static void vxlan_vs_add_dev(struct vxlan_sock *vs, struct vxlan_dev *vxlan,\n static int vxlan_init(struct net_device *dev)\n {\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n+\tconst struct vxlan_config *cfg;\n \tint err;\n \n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\n \terr = rhashtable_init(\u0026vxlan-\u003efdb_hash_tbl, \u0026vxlan_fdb_rht_params);\n \tif (err)\n \t\treturn err;\n \n-\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_VNIFILTER) {\n+\tif (cfg-\u003eflags \u0026 VXLAN_F_VNIFILTER) {\n \t\terr = vxlan_vnigroup_init(vxlan);\n \t\tif (err)\n \t\t\tgoto err_rhashtable_destroy;\n@@ -2961,7 +3022,7 @@ static int vxlan_init(struct net_device *dev)\n err_gro_cells_destroy:\n \tgro_cells_destroy(\u0026vxlan-\u003egro_cells);\n err_vnigroup_uninit:\n-\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_VNIFILTER)\n+\tif (cfg-\u003eflags \u0026 VXLAN_F_VNIFILTER)\n \t\tvxlan_vnigroup_uninit(vxlan);\n err_rhashtable_destroy:\n \trhashtable_destroy(\u0026vxlan-\u003efdb_hash_tbl);\n@@ -2971,10 +3032,13 @@ static int vxlan_init(struct net_device *dev)\n static void vxlan_uninit(struct net_device *dev)\n {\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n+\tconst struct vxlan_config *cfg;\n+\n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n \n \tvxlan_mdb_fini(vxlan);\n \n-\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_VNIFILTER)\n+\tif (cfg-\u003eflags \u0026 VXLAN_F_VNIFILTER)\n \t\tvxlan_vnigroup_uninit(vxlan);\n \n \tgro_cells_destroy(\u0026vxlan-\u003egro_cells);\n@@ -2986,6 +3050,7 @@ static void vxlan_uninit(struct net_device *dev)\n static int vxlan_open(struct net_device *dev)\n {\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n+\tconst struct vxlan_config *cfg;\n \tint ret;\n \n \tret = vxlan_sock_add(vxlan);\n@@ -2998,7 +3063,8 @@ static int vxlan_open(struct net_device *dev)\n \t\treturn ret;\n \t}\n \n-\tif (vxlan-\u003ecfg.age_interval)\n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\tif (cfg-\u003eage_interval)\n \t\tmod_timer(\u0026vxlan-\u003eage_timer, jiffies + FDB_AGE_INTERVAL);\n \n \treturn ret;\n@@ -3020,8 +3086,10 @@ struct vxlan_fdb_flush_desc {\n static bool vxlan_fdb_is_default_entry(const struct vxlan_fdb *f,\n \t\t\t\t       const struct vxlan_dev *vxlan)\n {\n+\tconst struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan-\u003ecfg);\n+\n \treturn is_zero_ether_addr(f-\u003ekey.eth_addr) \u0026\u0026\n-\t       f-\u003ekey.vni == vxlan-\u003ecfg.vni;\n+\t       f-\u003ekey.vni == cfg-\u003evni;\n }\n \n static bool vxlan_fdb_nhid_matches(const struct vxlan_fdb *f, u32 nhid)\n@@ -3238,15 +3306,18 @@ static void vxlan_set_multicast_list(struct net_device *dev)\n static int vxlan_change_mtu(struct net_device *dev, int new_mtu)\n {\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n-\tstruct vxlan_rdst *dst = \u0026vxlan-\u003edefault_dst;\n-\tstruct net_device *lowerdev = __dev_get_by_index(vxlan-\u003enet,\n-\t\t\t\t\t\t\t dst-\u003eremote_ifindex);\n+\tconst struct vxlan_config *cfg;\n+\tstruct net_device *lowerdev;\n+\n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\n+\tlowerdev = __dev_get_by_index(vxlan-\u003enet, cfg-\u003eremote_ifindex);\n \n \t/* This check is different than dev-\u003emax_mtu, because it looks at\n \t * the lowerdev-\u003emtu, rather than the static dev-\u003emax_mtu\n \t */\n \tif (lowerdev) {\n-\t\tint max_mtu = lowerdev-\u003emtu - vxlan_headroom(vxlan-\u003ecfg.flags);\n+\t\tint max_mtu = lowerdev-\u003emtu - vxlan_headroom(cfg-\u003eflags);\n \t\tif (new_mtu \u003e max_mtu)\n \t\t\treturn -EINVAL;\n \t}\n@@ -3259,11 +3330,14 @@ static int vxlan_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)\n {\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n \tstruct ip_tunnel_info *info = skb_tunnel_info(skb);\n+\tconst struct vxlan_config *cfg;\n \t__be16 sport, dport;\n \n-\tsport = udp_flow_src_port(dev_net(dev), skb, vxlan-\u003ecfg.port_min,\n-\t\t\t\t  vxlan-\u003ecfg.port_max, true);\n-\tdport = info-\u003ekey.tp_dst ? : vxlan-\u003ecfg.dst_port;\n+\tcfg = rcu_dereference(vxlan-\u003ecfg);\n+\n+\tsport = udp_flow_src_port(dev_net(dev), skb, cfg-\u003eport_min,\n+\t\t\t\t  cfg-\u003eport_max, true);\n+\tdport = info-\u003ekey.tp_dst ? : cfg-\u003edst_port;\n \n \tif (ip_tunnel_info_af(info) == AF_INET) {\n \t\tstruct vxlan_sock *sock4 = rcu_dereference(vxlan-\u003evn4_sock);\n@@ -3373,6 +3447,15 @@ static void vxlan_offload_rx_ports(struct net_device *dev, bool push)\n \t}\n }\n \n+static void vxlan_free_dev(struct net_device *dev)\n+{\n+\tstruct vxlan_dev *vxlan = netdev_priv(dev);\n+\tstruct vxlan_config *cfg = rcu_dereference_protected(vxlan-\u003ecfg, 1);\n+\n+\tRCU_INIT_POINTER(vxlan-\u003ecfg, NULL);\n+\tkfree(cfg);\n+}\n+\n /* Initialize the device structure. */\n static void vxlan_setup(struct net_device *dev)\n {\n@@ -3381,6 +3464,8 @@ static void vxlan_setup(struct net_device *dev)\n \teth_hw_addr_random(dev);\n \tether_setup(dev);\n \n+\tdev-\u003epriv_destructor = vxlan_free_dev;\n+\n \tdev-\u003eneeds_free_netdev = true;\n \tSET_NETDEV_DEVTYPE(dev, \u0026vxlan_type);\n \n@@ -3555,9 +3640,11 @@ static int vxlan_get_link_ksettings(struct net_device *dev,\n \t\t\t\t    struct ethtool_link_ksettings *cmd)\n {\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n-\tstruct vxlan_rdst *dst = \u0026vxlan-\u003edefault_dst;\n-\tstruct net_device *lowerdev = __dev_get_by_index(vxlan-\u003enet,\n-\t\t\t\t\t\t\t dst-\u003eremote_ifindex);\n+\tconst struct vxlan_config *cfg;\n+\tstruct net_device *lowerdev;\n+\n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\tlowerdev = __dev_get_by_index(vxlan-\u003enet, cfg-\u003eremote_ifindex);\n \n \tif (!lowerdev) {\n \t\tcmd-\u003ebase.duplex = DUPLEX_UNKNOWN;\n@@ -3663,21 +3750,22 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, bool ipv6,\n \n static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)\n {\n-\tbool metadata = vxlan-\u003ecfg.flags \u0026 VXLAN_F_COLLECT_METADATA;\n+\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\n+\tbool metadata = cfg-\u003eflags \u0026 VXLAN_F_COLLECT_METADATA;\n \tstruct vxlan_sock *vs = NULL;\n \tstruct vxlan_dev_node *node;\n \tint l3mdev_index = 0;\n \n \tASSERT_RTNL();\n \n-\tif (vxlan-\u003ecfg.remote_ifindex)\n+\tif (cfg-\u003eremote_ifindex)\n \t\tl3mdev_index = l3mdev_master_upper_ifindex_by_index(\n-\t\t\tvxlan-\u003enet, vxlan-\u003ecfg.remote_ifindex);\n+\t\t\tvxlan-\u003enet, cfg-\u003eremote_ifindex);\n \n-\tif (!vxlan-\u003ecfg.no_share) {\n+\tif (!cfg-\u003eno_share) {\n \t\trcu_read_lock();\n \t\tvs = vxlan_find_sock(vxlan-\u003enet, ipv6 ? AF_INET6 : AF_INET,\n-\t\t\t\t     vxlan-\u003ecfg.dst_port, vxlan-\u003ecfg.flags,\n+\t\t\t\t     cfg-\u003edst_port, cfg-\u003eflags,\n \t\t\t\t     l3mdev_index);\n \t\tif (vs \u0026\u0026 !refcount_inc_not_zero(\u0026vs-\u003erefcnt)) {\n \t\t\trcu_read_unlock();\n@@ -3687,7 +3775,7 @@ static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)\n \t}\n \tif (!vs)\n \t\tvs = vxlan_socket_create(vxlan-\u003enet, ipv6,\n-\t\t\t\t\t vxlan-\u003ecfg.dst_port, vxlan-\u003ecfg.flags,\n+\t\t\t\t\t cfg-\u003edst_port, cfg-\u003eflags,\n \t\t\t\t\t l3mdev_index);\n \tif (IS_ERR(vs))\n \t\treturn PTR_ERR(vs);\n@@ -3702,7 +3790,7 @@ static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)\n \t\tnode = \u0026vxlan-\u003ehlist4;\n \t}\n \n-\tif (metadata \u0026\u0026 (vxlan-\u003ecfg.flags \u0026 VXLAN_F_VNIFILTER))\n+\tif (metadata \u0026\u0026 (cfg-\u003eflags \u0026 VXLAN_F_VNIFILTER))\n \t\tvxlan_vs_add_vnigrp(vxlan, vs, ipv6);\n \telse\n \t\tvxlan_vs_add_dev(vs, vxlan, node);\n@@ -3712,11 +3800,14 @@ static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)\n \n static int vxlan_sock_add(struct vxlan_dev *vxlan)\n {\n-\tbool metadata = vxlan-\u003ecfg.flags \u0026 VXLAN_F_COLLECT_METADATA;\n-\tbool ipv6 = vxlan-\u003ecfg.flags \u0026 VXLAN_F_IPV6 || metadata;\n-\tbool ipv4 = !ipv6 || metadata;\n+\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\n+\tbool metadata, ipv6, ipv4;\n \tint ret = 0;\n \n+\tmetadata = cfg-\u003eflags \u0026 VXLAN_F_COLLECT_METADATA;\n+\tipv6 = (cfg-\u003eflags \u0026 VXLAN_F_IPV6) || metadata;\n+\tipv4 = !ipv6 || metadata;\n+\n \tRCU_INIT_POINTER(vxlan-\u003evn4_sock, NULL);\n #if IS_ENABLED(CONFIG_IPV6)\n \tRCU_INIT_POINTER(vxlan-\u003evn6_sock, NULL);\n@@ -3734,28 +3825,33 @@ static int vxlan_sock_add(struct vxlan_dev *vxlan)\n }\n \n int vxlan_vni_in_use(struct net *src_net, struct vxlan_dev *vxlan,\n-\t\t     struct vxlan_config *conf, __be32 vni)\n+\t\t     const struct vxlan_config *conf, __be32 vni)\n {\n \tstruct vxlan_net *vn = net_generic(src_net, vxlan_net_id);\n \tstruct vxlan_dev *tmp;\n \n \tlist_for_each_entry(tmp, \u0026vn-\u003evxlan_list, next) {\n+\t\tconst struct vxlan_config *tmp_cfg;\n+\n \t\tif (tmp == vxlan)\n \t\t\tcontinue;\n-\t\tif (tmp-\u003ecfg.flags \u0026 VXLAN_F_VNIFILTER) {\n+\n+\t\ttmp_cfg = rtnl_dereference(tmp-\u003ecfg);\n+\n+\t\tif (tmp_cfg-\u003eflags \u0026 VXLAN_F_VNIFILTER) {\n \t\t\tif (!vxlan_vnifilter_lookup(tmp, vni))\n \t\t\t\tcontinue;\n-\t\t} else if (tmp-\u003ecfg.vni != vni) {\n+\t\t} else if (tmp_cfg-\u003evni != vni) {\n \t\t\tcontinue;\n \t\t}\n-\t\tif (tmp-\u003ecfg.dst_port != conf-\u003edst_port)\n+\t\tif (tmp_cfg-\u003edst_port != conf-\u003edst_port)\n \t\t\tcontinue;\n-\t\tif ((tmp-\u003ecfg.flags \u0026 (VXLAN_F_RCV_FLAGS | VXLAN_F_IPV6)) !=\n+\t\tif ((tmp_cfg-\u003eflags \u0026 (VXLAN_F_RCV_FLAGS | VXLAN_F_IPV6)) !=\n \t\t    (conf-\u003eflags \u0026 (VXLAN_F_RCV_FLAGS | VXLAN_F_IPV6)))\n \t\t\tcontinue;\n \n \t\tif ((conf-\u003eflags \u0026 VXLAN_F_IPV6_LINKLOCAL) \u0026\u0026\n-\t\t    tmp-\u003ecfg.remote_ifindex != conf-\u003eremote_ifindex)\n+\t\t    tmp_cfg-\u003eremote_ifindex != conf-\u003eremote_ifindex)\n \t\t\tcontinue;\n \n \t\treturn -EEXIST;\n@@ -3917,16 +4013,16 @@ static int vxlan_config_validate(struct net *src_net, struct vxlan_config *conf,\n }\n \n static void vxlan_config_apply(struct net_device *dev,\n-\t\t\t       struct vxlan_config *conf,\n+\t\t\t       struct vxlan_config *new_cfg,\n \t\t\t       struct net_device *lowerdev,\n \t\t\t       struct net *src_net,\n-\t\t\t       bool changelink)\n+\t\t\t       bool changelink, bool lowerdev_changed)\n {\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n-\tstruct vxlan_rdst *dst = \u0026vxlan-\u003edefault_dst;\n \tunsigned short needed_headroom = ETH_HLEN;\n+\tstruct vxlan_config *old_cfg;\n \tint max_mtu = ETH_MAX_MTU;\n-\tu32 flags = conf-\u003eflags;\n+\tu32 flags = new_cfg-\u003eflags;\n \n \tif (!changelink) {\n \t\tif (flags \u0026 VXLAN_F_GPE)\n@@ -3934,19 +4030,13 @@ static void vxlan_config_apply(struct net_device *dev,\n \t\telse\n \t\t\tvxlan_ether_setup(dev);\n \n-\t\tif (conf-\u003emtu)\n-\t\t\tdev-\u003emtu = conf-\u003emtu;\n+\t\tif (new_cfg-\u003emtu)\n+\t\t\tdev-\u003emtu = new_cfg-\u003emtu;\n \n \t\tvxlan-\u003enet = src_net;\n \t}\n \n-\tdst-\u003eremote_vni = conf-\u003evni;\n-\n-\tmemcpy(\u0026dst-\u003eremote_ip, \u0026conf-\u003eremote_ip, sizeof(conf-\u003eremote_ip));\n-\n \tif (lowerdev) {\n-\t\tdst-\u003eremote_ifindex = conf-\u003eremote_ifindex;\n-\n \t\tnetif_inherit_tso_max(dev, lowerdev);\n \n \t\tneeded_headroom = lowerdev-\u003ehard_header_len;\n@@ -3958,11 +4048,12 @@ static void vxlan_config_apply(struct net_device *dev,\n \t\tif (max_mtu \u003c ETH_MIN_MTU)\n \t\t\tmax_mtu = ETH_MIN_MTU;\n \n-\t\tif (!changelink \u0026\u0026 !conf-\u003emtu)\n+\t\tif (!changelink \u0026\u0026 !new_cfg-\u003emtu)\n \t\t\tdev-\u003emtu = max_mtu;\n \t}\n \n-\tif (dev-\u003emtu \u003e max_mtu)\n+\t/* A changelink leaving the lower device alone must not shrink the mtu */\n+\tif (lowerdev_changed \u0026\u0026 dev-\u003emtu \u003e max_mtu)\n \t\tdev-\u003emtu = max_mtu;\n \n \tif (flags \u0026 VXLAN_F_COLLECT_METADATA)\n@@ -3970,7 +4061,10 @@ static void vxlan_config_apply(struct net_device *dev,\n \tneeded_headroom += vxlan_headroom(flags);\n \tdev-\u003eneeded_headroom = needed_headroom;\n \n-\tmemcpy(\u0026vxlan-\u003ecfg, conf, sizeof(*conf));\n+\told_cfg = rtnl_dereference(vxlan-\u003ecfg);\n+\trcu_assign_pointer(vxlan-\u003ecfg, new_cfg);\n+\tif (old_cfg)\n+\t\tkfree_rcu(old_cfg, rcu);\n }\n \n static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,\n@@ -3979,13 +4073,18 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,\n {\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n \tstruct net_device *lowerdev;\n+\tstruct vxlan_config *new_cfg;\n \tint ret;\n \n \tret = vxlan_config_validate(src_net, conf, \u0026lowerdev, vxlan, extack);\n \tif (ret)\n \t\treturn ret;\n \n-\tvxlan_config_apply(dev, conf, lowerdev, src_net, false);\n+\tnew_cfg = kmemdup(conf, sizeof(*conf), GFP_KERNEL);\n+\tif (!new_cfg)\n+\t\treturn -ENOMEM;\n+\n+\tvxlan_config_apply(dev, new_cfg, lowerdev, src_net, false, true);\n \n \treturn 0;\n }\n@@ -3997,22 +4096,25 @@ static int vxlan_dev_create(struct net *net, struct net_device *dev,\n \tstruct vxlan_net *vn = net_generic(net, vxlan_net_id);\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n \tstruct net_device *remote_dev = NULL;\n-\tstruct vxlan_rdst *dst;\n+\tconst struct vxlan_config *cfg;\n \tint err;\n \n-\tdst = \u0026vxlan-\u003edefault_dst;\n \terr = vxlan_dev_configure(net, dev, conf, extack);\n \tif (err)\n \t\treturn err;\n \n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\n \tdev-\u003eethtool_ops = \u0026vxlan_ethtool_ops;\n \n \terr = register_netdevice(dev);\n-\tif (err)\n+\tif (err) {\n+\t\tvxlan_free_dev(dev);\n \t\treturn err;\n+\t}\n \n-\tif (dst-\u003eremote_ifindex) {\n-\t\tremote_dev = __dev_get_by_index(net, dst-\u003eremote_ifindex);\n+\tif (cfg-\u003eremote_ifindex) {\n+\t\tremote_dev = __dev_get_by_index(net, cfg-\u003eremote_ifindex);\n \t\tif (!remote_dev) {\n \t\t\terr = -ENODEV;\n \t\t\tgoto unregister;\n@@ -4022,7 +4124,7 @@ static int vxlan_dev_create(struct net *net, struct net_device *dev,\n \t\tif (err)\n \t\t\tgoto unregister;\n \n-\t\tdst-\u003eremote_dev = remote_dev;\n+\t\tvxlan-\u003elowerdev = remote_dev;\n \t}\n \n \terr = rtnl_configure_link(dev, NULL, 0, NULL);\n@@ -4030,16 +4132,18 @@ static int vxlan_dev_create(struct net *net, struct net_device *dev,\n \t\tgoto unlink;\n \n \t/* create an fdb entry for a valid default destination */\n-\tif (!vxlan_addr_any(\u0026dst-\u003eremote_ip)) {\n+\tif (!vxlan_addr_any(\u0026cfg-\u003eremote_ip)) {\n+\t\tunion vxlan_addr rip = cfg-\u003eremote_ip;\n+\n \t\tspin_lock_bh(\u0026vxlan-\u003ehash_lock);\n \t\terr = vxlan_fdb_update(vxlan, all_zeros_mac,\n-\t\t\t\t       \u0026dst-\u003eremote_ip,\n+\t\t\t\t       \u0026rip,\n \t\t\t\t       NUD_REACHABLE | NUD_PERMANENT,\n \t\t\t\t       NLM_F_EXCL | NLM_F_CREATE,\n-\t\t\t\t       vxlan-\u003ecfg.dst_port,\n-\t\t\t\t       dst-\u003eremote_vni,\n-\t\t\t\t       dst-\u003eremote_vni,\n-\t\t\t\t       dst-\u003eremote_ifindex,\n+\t\t\t\t       cfg-\u003edst_port,\n+\t\t\t\t       cfg-\u003evni,\n+\t\t\t\t       cfg-\u003evni,\n+\t\t\t\t       cfg-\u003eremote_ifindex,\n \t\t\t\t       NTF_SELF, 0, true, extack);\n \t\tspin_unlock_bh(\u0026vxlan-\u003ehash_lock);\n \t\tif (err)\n@@ -4100,8 +4204,12 @@ static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[],\n \tmemset(conf, 0, sizeof(*conf));\n \n \t/* if changelink operation, start with old existing cfg */\n-\tif (changelink)\n-\t\tmemcpy(conf, \u0026vxlan-\u003ecfg, sizeof(*conf));\n+\tif (changelink) {\n+\t\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\n+\n+\t\tif (cfg)\n+\t\t\tmemcpy(conf, cfg, sizeof(*conf));\n+\t}\n \n \tif (data[IFLA_VXLAN_ID]) {\n \t\t__be32 vni = cpu_to_be32(nla_get_u32(data[IFLA_VXLAN_ID]));\n@@ -4447,17 +4555,19 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],\n \t\t\t    struct nlattr *data[],\n \t\t\t    struct netlink_ext_ack *extack)\n {\n+\tbool lowerdev_changed, rem_ip_changed, change_igmp;\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n-\tbool rem_ip_changed, change_igmp;\n+\tconst struct vxlan_config *cfg;\n+\tstruct vxlan_config *new_cfg;\n \tstruct net_device *lowerdev;\n \tstruct vxlan_config conf;\n-\tstruct vxlan_rdst *dst;\n \tint err;\n \n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\n \tif (!rtnl_dev_link_net_capable(dev, vxlan-\u003enet))\n \t\treturn -EPERM;\n \n-\tdst = \u0026vxlan-\u003edefault_dst;\n \terr = vxlan_nl2conf(tb, data, dev, \u0026conf, true, extack);\n \tif (err)\n \t\treturn err;\n@@ -4467,75 +4577,94 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],\n \tif (err)\n \t\treturn err;\n \n-\tif (dst-\u003eremote_dev == lowerdev)\n-\t\tlowerdev = NULL;\n+\tnew_cfg = kmemdup(\u0026conf, sizeof(conf), GFP_KERNEL);\n+\tif (!new_cfg)\n+\t\treturn -ENOMEM;\n \n-\terr = netdev_adjacent_change_prepare(dst-\u003eremote_dev, lowerdev, dev,\n-\t\t\t\t\t     extack);\n-\tif (err)\n-\t\treturn err;\n+\tlowerdev_changed = vxlan-\u003elowerdev != lowerdev;\n+\tif (lowerdev_changed) {\n+\t\terr = netdev_adjacent_change_prepare(vxlan-\u003elowerdev, lowerdev,\n+\t\t\t\t\t\t     dev, extack);\n+\t\tif (err) {\n+\t\t\tkfree(new_cfg);\n+\t\t\treturn err;\n+\t\t}\n+\t}\n \n-\trem_ip_changed = !vxlan_addr_equal(\u0026conf.remote_ip, \u0026dst-\u003eremote_ip);\n+\trem_ip_changed = !vxlan_addr_equal(\u0026conf.remote_ip, \u0026cfg-\u003eremote_ip);\n \tchange_igmp = vxlan-\u003edev-\u003eflags \u0026 IFF_UP \u0026\u0026\n \t\t      (rem_ip_changed ||\n-\t\t       dst-\u003eremote_ifindex != conf.remote_ifindex);\n+\t\t       cfg-\u003eremote_ifindex != conf.remote_ifindex);\n \n \t/* handle default dst entry */\n-\tif (rem_ip_changed) {\n+\tif (rem_ip_changed || cfg-\u003eremote_ifindex != conf.remote_ifindex) {\n \t\tspin_lock_bh(\u0026vxlan-\u003ehash_lock);\n \t\tif (!vxlan_addr_any(\u0026conf.remote_ip)) {\n \t\t\terr = vxlan_fdb_update(vxlan, all_zeros_mac,\n \t\t\t\t\t       \u0026conf.remote_ip,\n \t\t\t\t\t       NUD_REACHABLE | NUD_PERMANENT,\n \t\t\t\t\t       NLM_F_APPEND | NLM_F_CREATE,\n-\t\t\t\t\t       vxlan-\u003ecfg.dst_port,\n+\t\t\t\t\t       cfg-\u003edst_port,\n \t\t\t\t\t       conf.vni, conf.vni,\n \t\t\t\t\t       conf.remote_ifindex,\n \t\t\t\t\t       NTF_SELF, 0, true, extack);\n \t\t\tif (err) {\n \t\t\t\tspin_unlock_bh(\u0026vxlan-\u003ehash_lock);\n-\t\t\t\tnetdev_adjacent_change_abort(dst-\u003eremote_dev,\n-\t\t\t\t\t\t\t     lowerdev, dev);\n+\t\t\t\tif (lowerdev_changed)\n+\t\t\t\t\tnetdev_adjacent_change_abort(vxlan-\u003elowerdev,\n+\t\t\t\t\t\t\t\t     lowerdev, dev);\n+\t\t\t\tkfree(new_cfg);\n \t\t\t\treturn err;\n \t\t\t}\n \t\t}\n-\t\tif (!vxlan_addr_any(\u0026dst-\u003eremote_ip))\n+\t\tif (!vxlan_addr_any(\u0026cfg-\u003eremote_ip))\n \t\t\t__vxlan_fdb_delete(vxlan, all_zeros_mac,\n-\t\t\t\t\t   dst-\u003eremote_ip,\n-\t\t\t\t\t   vxlan-\u003ecfg.dst_port,\n-\t\t\t\t\t   dst-\u003eremote_vni,\n-\t\t\t\t\t   dst-\u003eremote_vni,\n-\t\t\t\t\t   dst-\u003eremote_ifindex,\n+\t\t\t\t\t   cfg-\u003eremote_ip,\n+\t\t\t\t\t   cfg-\u003edst_port,\n+\t\t\t\t\t   cfg-\u003evni,\n+\t\t\t\t\t   cfg-\u003evni,\n+\t\t\t\t\t   cfg-\u003eremote_ifindex,\n \t\t\t\t\t   true);\n \t\tspin_unlock_bh(\u0026vxlan-\u003ehash_lock);\n \n-\t\t/* If vni filtering device, also update fdb entries of\n-\t\t * all vnis that were using default remote ip\n+\t\t/* If vni filtering device, also update default fdb entries of\n+\t\t * all vnis\n \t\t */\n-\t\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_VNIFILTER) {\n-\t\t\terr = vxlan_vnilist_update_group(vxlan, \u0026dst-\u003eremote_ip,\n-\t\t\t\t\t\t\t \u0026conf.remote_ip, extack);\n+\t\tif (cfg-\u003eflags \u0026 VXLAN_F_VNIFILTER) {\n+\t\t\terr = vxlan_vnilist_update_group(vxlan, \u0026cfg-\u003eremote_ip,\n+\t\t\t\t\t\t\t \u0026conf.remote_ip,\n+\t\t\t\t\t\t\t cfg-\u003eremote_ifindex,\n+\t\t\t\t\t\t\t conf.remote_ifindex,\n+\t\t\t\t\t\t\t extack);\n \t\t\tif (err) {\n-\t\t\t\tnetdev_adjacent_change_abort(dst-\u003eremote_dev,\n-\t\t\t\t\t\t\t     lowerdev, dev);\n+\t\t\t\tif (lowerdev_changed)\n+\t\t\t\t\tnetdev_adjacent_change_abort(vxlan-\u003elowerdev,\n+\t\t\t\t\t\t\t\t     lowerdev, dev);\n+\t\t\t\tkfree(new_cfg);\n \t\t\t\treturn err;\n \t\t\t}\n \t\t}\n \t}\n \n-\tif (change_igmp \u0026\u0026 vxlan_addr_multicast(\u0026dst-\u003eremote_ip))\n+\tif (change_igmp \u0026\u0026 vxlan_addr_multicast(\u0026cfg-\u003eremote_ip))\n \t\terr = vxlan_multicast_leave(vxlan);\n \n-\tif (netif_running(dev) \u0026\u0026 conf.age_interval != vxlan-\u003ecfg.age_interval)\n+\tif (netif_running(dev) \u0026\u0026 conf.age_interval != cfg-\u003eage_interval)\n \t\tmod_timer(\u0026vxlan-\u003eage_timer, jiffies);\n \n-\tnetdev_adjacent_change_commit(dst-\u003eremote_dev, lowerdev, dev);\n-\tif (lowerdev \u0026\u0026 lowerdev != dst-\u003eremote_dev)\n-\t\tdst-\u003eremote_dev = lowerdev;\n-\tvxlan_config_apply(dev, \u0026conf, lowerdev, vxlan-\u003enet, true);\n+\tif (lowerdev_changed) {\n+\t\tif (lowerdev)\n+\t\t\tnetdev_adjacent_change_commit(vxlan-\u003elowerdev, lowerdev,\n+\t\t\t\t\t\t      dev);\n+\t\telse\n+\t\t\tnetdev_upper_dev_unlink(vxlan-\u003elowerdev, dev);\n+\t\tvxlan-\u003elowerdev = lowerdev;\n+\t}\n+\tvxlan_config_apply(dev, new_cfg, lowerdev, vxlan-\u003enet, true,\n+\t\t\t   lowerdev_changed);\n \n \tif (!err \u0026\u0026 change_igmp \u0026\u0026\n-\t    vxlan_addr_multicast(\u0026dst-\u003eremote_ip))\n+\t    vxlan_addr_multicast(\u0026new_cfg-\u003eremote_ip))\n \t\terr = vxlan_multicast_join(vxlan);\n \n \treturn err;\n@@ -4550,8 +4679,8 @@ static void vxlan_dellink(struct net_device *dev, struct list_head *head)\n \n \tlist_del(\u0026vxlan-\u003enext);\n \tunregister_netdevice_queue(dev, head);\n-\tif (vxlan-\u003edefault_dst.remote_dev)\n-\t\tnetdev_upper_dev_unlink(vxlan-\u003edefault_dst.remote_dev, dev);\n+\tif (vxlan-\u003elowerdev)\n+\t\tnetdev_upper_dev_unlink(vxlan-\u003elowerdev, dev);\n }\n \n static size_t vxlan_get_size(const struct net_device *dev)\n@@ -4595,110 +4724,114 @@ static size_t vxlan_get_size(const struct net_device *dev)\n static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev)\n {\n \tconst struct vxlan_dev *vxlan = netdev_priv(dev);\n-\tconst struct vxlan_rdst *dst = \u0026vxlan-\u003edefault_dst;\n-\tstruct ifla_vxlan_port_range ports = {\n-\t\t.low =  htons(vxlan-\u003ecfg.port_min),\n-\t\t.high = htons(vxlan-\u003ecfg.port_max),\n-\t};\n+\tstruct ifla_vxlan_port_range ports;\n+\tconst struct vxlan_config *cfg;\n+\n+\trcu_read_lock();\n+\tcfg = rcu_dereference(vxlan-\u003ecfg);\n \n-\tif (nla_put_u32(skb, IFLA_VXLAN_ID, be32_to_cpu(dst-\u003eremote_vni)))\n+\tif (nla_put_u32(skb, IFLA_VXLAN_ID, be32_to_cpu(cfg-\u003evni)))\n \t\tgoto nla_put_failure;\n \n-\tif (!vxlan_addr_any(\u0026dst-\u003eremote_ip)) {\n-\t\tif (dst-\u003eremote_ip.sa.sa_family == AF_INET) {\n+\tif (!vxlan_addr_any(\u0026cfg-\u003eremote_ip)) {\n+\t\tif (cfg-\u003eremote_ip.sa.sa_family == AF_INET) {\n \t\t\tif (nla_put_in_addr(skb, IFLA_VXLAN_GROUP,\n-\t\t\t\t\t    dst-\u003eremote_ip.sin.sin_addr.s_addr))\n+\t\t\t\t\t    cfg-\u003eremote_ip.sin.sin_addr.s_addr))\n \t\t\t\tgoto nla_put_failure;\n #if IS_ENABLED(CONFIG_IPV6)\n \t\t} else {\n \t\t\tif (nla_put_in6_addr(skb, IFLA_VXLAN_GROUP6,\n-\t\t\t\t\t     \u0026dst-\u003eremote_ip.sin6.sin6_addr))\n+\t\t\t\t\t     \u0026cfg-\u003eremote_ip.sin6.sin6_addr))\n \t\t\t\tgoto nla_put_failure;\n #endif\n \t\t}\n \t}\n \n-\tif (dst-\u003eremote_ifindex \u0026\u0026 nla_put_u32(skb, IFLA_VXLAN_LINK, dst-\u003eremote_ifindex))\n+\tif (cfg-\u003eremote_ifindex \u0026\u0026 nla_put_u32(skb, IFLA_VXLAN_LINK, cfg-\u003eremote_ifindex))\n \t\tgoto nla_put_failure;\n \n-\tif (!vxlan_addr_any(\u0026vxlan-\u003ecfg.saddr)) {\n-\t\tif (vxlan-\u003ecfg.saddr.sa.sa_family == AF_INET) {\n+\tif (!vxlan_addr_any(\u0026cfg-\u003esaddr)) {\n+\t\tif (cfg-\u003esaddr.sa.sa_family == AF_INET) {\n \t\t\tif (nla_put_in_addr(skb, IFLA_VXLAN_LOCAL,\n-\t\t\t\t\t    vxlan-\u003ecfg.saddr.sin.sin_addr.s_addr))\n+\t\t\t\t\t    cfg-\u003esaddr.sin.sin_addr.s_addr))\n \t\t\t\tgoto nla_put_failure;\n #if IS_ENABLED(CONFIG_IPV6)\n \t\t} else {\n \t\t\tif (nla_put_in6_addr(skb, IFLA_VXLAN_LOCAL6,\n-\t\t\t\t\t     \u0026vxlan-\u003ecfg.saddr.sin6.sin6_addr))\n+\t\t\t\t\t     \u0026cfg-\u003esaddr.sin6.sin6_addr))\n \t\t\t\tgoto nla_put_failure;\n #endif\n \t\t}\n \t}\n \n-\tif (nla_put_u8(skb, IFLA_VXLAN_TTL, vxlan-\u003ecfg.ttl) ||\n+\tif (nla_put_u8(skb, IFLA_VXLAN_TTL, cfg-\u003ettl) ||\n \t    nla_put_u8(skb, IFLA_VXLAN_TTL_INHERIT,\n-\t\t       !!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_TTL_INHERIT)) ||\n-\t    nla_put_u8(skb, IFLA_VXLAN_TOS, vxlan-\u003ecfg.tos) ||\n-\t    nla_put_u8(skb, IFLA_VXLAN_DF, vxlan-\u003ecfg.df) ||\n-\t    nla_put_be32(skb, IFLA_VXLAN_LABEL, vxlan-\u003ecfg.label) ||\n-\t    nla_put_u32(skb, IFLA_VXLAN_LABEL_POLICY, vxlan-\u003ecfg.label_policy) ||\n+\t\t       !!(cfg-\u003eflags \u0026 VXLAN_F_TTL_INHERIT)) ||\n+\t    nla_put_u8(skb, IFLA_VXLAN_TOS, cfg-\u003etos) ||\n+\t    nla_put_u8(skb, IFLA_VXLAN_DF, cfg-\u003edf) ||\n+\t    nla_put_be32(skb, IFLA_VXLAN_LABEL, cfg-\u003elabel) ||\n+\t    nla_put_u32(skb, IFLA_VXLAN_LABEL_POLICY, cfg-\u003elabel_policy) ||\n \t    nla_put_u8(skb, IFLA_VXLAN_LEARNING,\n-\t\t       !!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_LEARN)) ||\n+\t\t       !!(cfg-\u003eflags \u0026 VXLAN_F_LEARN)) ||\n \t    nla_put_u8(skb, IFLA_VXLAN_PROXY,\n-\t\t       !!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_PROXY)) ||\n+\t\t       !!(cfg-\u003eflags \u0026 VXLAN_F_PROXY)) ||\n \t    nla_put_u8(skb, IFLA_VXLAN_RSC,\n-\t\t       !!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_RSC)) ||\n+\t\t       !!(cfg-\u003eflags \u0026 VXLAN_F_RSC)) ||\n \t    nla_put_u8(skb, IFLA_VXLAN_L2MISS,\n-\t\t       !!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_L2MISS)) ||\n+\t\t       !!(cfg-\u003eflags \u0026 VXLAN_F_L2MISS)) ||\n \t    nla_put_u8(skb, IFLA_VXLAN_L3MISS,\n-\t\t       !!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_L3MISS)) ||\n+\t\t       !!(cfg-\u003eflags \u0026 VXLAN_F_L3MISS)) ||\n \t    nla_put_u8(skb, IFLA_VXLAN_COLLECT_METADATA,\n-\t\t       !!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_COLLECT_METADATA)) ||\n-\t    nla_put_u32(skb, IFLA_VXLAN_AGEING, vxlan-\u003ecfg.age_interval) ||\n-\t    nla_put_u32(skb, IFLA_VXLAN_LIMIT, vxlan-\u003ecfg.addrmax) ||\n-\t    nla_put_be16(skb, IFLA_VXLAN_PORT, vxlan-\u003ecfg.dst_port) ||\n+\t\t       !!(cfg-\u003eflags \u0026 VXLAN_F_COLLECT_METADATA)) ||\n+\t    nla_put_u32(skb, IFLA_VXLAN_AGEING, cfg-\u003eage_interval) ||\n+\t    nla_put_u32(skb, IFLA_VXLAN_LIMIT, cfg-\u003eaddrmax) ||\n+\t    nla_put_be16(skb, IFLA_VXLAN_PORT, cfg-\u003edst_port) ||\n \t    nla_put_u8(skb, IFLA_VXLAN_UDP_CSUM,\n-\t\t       !(vxlan-\u003ecfg.flags \u0026 VXLAN_F_UDP_ZERO_CSUM_TX)) ||\n+\t\t       !(cfg-\u003eflags \u0026 VXLAN_F_UDP_ZERO_CSUM_TX)) ||\n \t    nla_put_u8(skb, IFLA_VXLAN_UDP_ZERO_CSUM6_TX,\n-\t\t       !!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_UDP_ZERO_CSUM6_TX)) ||\n+\t\t       !!(cfg-\u003eflags \u0026 VXLAN_F_UDP_ZERO_CSUM6_TX)) ||\n \t    nla_put_u8(skb, IFLA_VXLAN_UDP_ZERO_CSUM6_RX,\n-\t\t       !!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_UDP_ZERO_CSUM6_RX)) ||\n+\t\t       !!(cfg-\u003eflags \u0026 VXLAN_F_UDP_ZERO_CSUM6_RX)) ||\n \t    nla_put_u8(skb, IFLA_VXLAN_REMCSUM_TX,\n-\t\t       !!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_REMCSUM_TX)) ||\n+\t\t       !!(cfg-\u003eflags \u0026 VXLAN_F_REMCSUM_TX)) ||\n \t    nla_put_u8(skb, IFLA_VXLAN_REMCSUM_RX,\n-\t\t       !!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_REMCSUM_RX)) ||\n+\t\t       !!(cfg-\u003eflags \u0026 VXLAN_F_REMCSUM_RX)) ||\n \t    nla_put_u8(skb, IFLA_VXLAN_LOCALBYPASS,\n-\t\t       !!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_LOCALBYPASS)))\n+\t\t       !!(cfg-\u003eflags \u0026 VXLAN_F_LOCALBYPASS)))\n \t\tgoto nla_put_failure;\n \n+\tports.low = htons(cfg-\u003eport_min);\n+\tports.high = htons(cfg-\u003eport_max);\n \tif (nla_put(skb, IFLA_VXLAN_PORT_RANGE, sizeof(ports), \u0026ports))\n \t\tgoto nla_put_failure;\n \n-\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_GBP \u0026\u0026\n+\tif (cfg-\u003eflags \u0026 VXLAN_F_GBP \u0026\u0026\n \t    nla_put_flag(skb, IFLA_VXLAN_GBP))\n \t\tgoto nla_put_failure;\n \n-\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_GPE \u0026\u0026\n+\tif (cfg-\u003eflags \u0026 VXLAN_F_GPE \u0026\u0026\n \t    nla_put_flag(skb, IFLA_VXLAN_GPE))\n \t\tgoto nla_put_failure;\n \n-\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_REMCSUM_NOPARTIAL \u0026\u0026\n+\tif (cfg-\u003eflags \u0026 VXLAN_F_REMCSUM_NOPARTIAL \u0026\u0026\n \t    nla_put_flag(skb, IFLA_VXLAN_REMCSUM_NOPARTIAL))\n \t\tgoto nla_put_failure;\n \n-\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_VNIFILTER \u0026\u0026\n+\tif (cfg-\u003eflags \u0026 VXLAN_F_VNIFILTER \u0026\u0026\n \t    nla_put_u8(skb, IFLA_VXLAN_VNIFILTER,\n-\t\t       !!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_VNIFILTER)))\n+\t\t       !!(cfg-\u003eflags \u0026 VXLAN_F_VNIFILTER)))\n \t\tgoto nla_put_failure;\n \n \tif (nla_put(skb, IFLA_VXLAN_RESERVED_BITS,\n-\t\t    sizeof(vxlan-\u003ecfg.reserved_bits),\n-\t\t    \u0026vxlan-\u003ecfg.reserved_bits))\n+\t\t    sizeof(cfg-\u003ereserved_bits),\n+\t\t    \u0026cfg-\u003ereserved_bits))\n \t\tgoto nla_put_failure;\n \n+\trcu_read_unlock();\n \treturn 0;\n \n nla_put_failure:\n+\trcu_read_unlock();\n \treturn -EMSGSIZE;\n }\n \n@@ -4731,7 +4864,7 @@ static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn,\n \tLIST_HEAD(list_kill);\n \n \tlist_for_each_entry_safe(vxlan, next, \u0026vn-\u003evxlan_list, next) {\n-\t\tstruct vxlan_rdst *dst = \u0026vxlan-\u003edefault_dst;\n+\t\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\n \n \t\t/* In case we created vxlan device with carrier\n \t\t * and we loose the carrier due to module unload\n@@ -4739,7 +4872,7 @@ static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn,\n \t\t * cases, it's not necessary and remote_ifindex\n \t\t * is 0 here, so no matches.\n \t\t */\n-\t\tif (dst-\u003eremote_ifindex == dev-\u003eifindex)\n+\t\tif (cfg-\u003eremote_ifindex == dev-\u003eifindex)\n \t\t\tvxlan_dellink(vxlan-\u003edev, \u0026list_kill);\n \t}\n \n@@ -4752,6 +4885,10 @@ static int vxlan_netdevice_event(struct notifier_block *unused,\n \tstruct net_device *dev = netdev_notifier_info_to_dev(ptr);\n \tstruct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);\n \n+\tif ((event == NETDEV_REGISTER || event == NETDEV_UNREGISTER) \u0026\u0026\n+\t    netif_is_vxlan(dev))\n+\t\tvxlan_vnifilter_seq_inc(dev_net(dev));\n+\n \tif (event == NETDEV_UNREGISTER)\n \t\tvxlan_handle_lowerdev_unregister(vn, dev);\n \telse if (event == NETDEV_UDP_TUNNEL_PUSH_INFO)\ndiff --git a/drivers/net/vxlan/vxlan_mdb.c b/drivers/net/vxlan/vxlan_mdb.c\nindex 841f42ffecb9a..c1a0551990555 100644\n--- a/drivers/net/vxlan/vxlan_mdb.c\n+++ b/drivers/net/vxlan/vxlan_mdb.c\n@@ -165,6 +165,7 @@ static int vxlan_mdb_entry_info_fill(const struct vxlan_dev *vxlan,\n \t\t\t\t     const struct vxlan_mdb_entry *mdb_entry,\n \t\t\t\t     const struct vxlan_mdb_remote *remote)\n {\n+\tconst struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan-\u003ecfg);\n \tstruct vxlan_rdst *rd = rtnl_dereference(remote-\u003erd);\n \tstruct br_mdb_entry e;\n \tstruct nlattr *nest;\n@@ -189,12 +190,12 @@ static int vxlan_mdb_entry_info_fill(const struct vxlan_dev *vxlan,\n \t    vxlan_nla_put_addr(skb, MDBA_MDB_EATTR_DST, \u0026rd-\u003eremote_ip))\n \t\tgoto nest_err;\n \n-\tif (rd-\u003eremote_port \u0026\u0026 rd-\u003eremote_port != vxlan-\u003ecfg.dst_port \u0026\u0026\n+\tif (rd-\u003eremote_port \u0026\u0026 rd-\u003eremote_port != cfg-\u003edst_port \u0026\u0026\n \t    nla_put_u16(skb, MDBA_MDB_EATTR_DST_PORT,\n \t\t\tbe16_to_cpu(rd-\u003eremote_port)))\n \t\tgoto nest_err;\n \n-\tif (rd-\u003eremote_vni != vxlan-\u003edefault_dst.remote_vni \u0026\u0026\n+\tif (rd-\u003eremote_vni != cfg-\u003evni \u0026\u0026\n \t    nla_put_u32(skb, MDBA_MDB_EATTR_VNI, be32_to_cpu(rd-\u003eremote_vni)))\n \t\tgoto nest_err;\n \n@@ -202,7 +203,7 @@ static int vxlan_mdb_entry_info_fill(const struct vxlan_dev *vxlan,\n \t    nla_put_u32(skb, MDBA_MDB_EATTR_IFINDEX, rd-\u003eremote_ifindex))\n \t\tgoto nest_err;\n \n-\tif ((vxlan-\u003ecfg.flags \u0026 VXLAN_F_COLLECT_METADATA) \u0026\u0026\n+\tif ((cfg-\u003eflags \u0026 VXLAN_F_COLLECT_METADATA) \u0026\u0026\n \t    mdb_entry-\u003ekey.vni \u0026\u0026 nla_put_u32(skb, MDBA_MDB_EATTR_SRC_VNI,\n \t\t\t\t\t      be32_to_cpu(mdb_entry-\u003ekey.vni)))\n \t\tgoto nest_err;\n@@ -613,16 +614,19 @@ static int vxlan_mdb_config_init(struct vxlan_mdb_config *cfg,\n {\n \tstruct br_mdb_entry *entry = nla_data(tb[MDBA_SET_ENTRY]);\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n+\tconst struct vxlan_config *vcfg;\n+\n+\tvcfg = rtnl_dereference(vxlan-\u003ecfg);\n \n \tmemset(cfg, 0, sizeof(*cfg));\n \tcfg-\u003evxlan = vxlan;\n-\tcfg-\u003egroup.vni = vxlan-\u003edefault_dst.remote_vni;\n+\tcfg-\u003egroup.vni = vcfg-\u003evni;\n \tINIT_LIST_HEAD(\u0026cfg-\u003esrc_list);\n \tcfg-\u003enlflags = nlmsg_flags;\n \tcfg-\u003efilter_mode = MCAST_EXCLUDE;\n \tcfg-\u003ert_protocol = RTPROT_STATIC;\n-\tcfg-\u003eremote_vni = vxlan-\u003edefault_dst.remote_vni;\n-\tcfg-\u003eremote_port = vxlan-\u003ecfg.dst_port;\n+\tcfg-\u003eremote_vni = vcfg-\u003evni;\n+\tcfg-\u003eremote_port = vcfg-\u003edst_port;\n \n \tif (entry-\u003eifindex != dev-\u003eifindex) {\n \t\tNL_SET_ERR_MSG_MOD(extack, \"Port net device must be the VXLAN net device\");\n@@ -957,11 +961,12 @@ vxlan_mdb_nlmsg_remote_size(const struct vxlan_dev *vxlan,\n \t\t\t    const struct vxlan_mdb_entry *mdb_entry,\n \t\t\t    const struct vxlan_mdb_remote *remote)\n {\n+\tconst struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan-\u003ecfg);\n \tconst struct vxlan_mdb_entry_key *group = \u0026mdb_entry-\u003ekey;\n \tstruct vxlan_rdst *rd = rtnl_dereference(remote-\u003erd);\n \tsize_t nlmsg_size;\n \n-\t\t     /* MDBA_MDB_ENTRY_INFO */\n+\t/* MDBA_MDB_ENTRY_INFO */\n \tnlmsg_size = nla_total_size(sizeof(struct br_mdb_entry)) +\n \t\t     /* MDBA_MDB_EATTR_TIMER */\n \t\t     nla_total_size(sizeof(u32));\n@@ -978,16 +983,16 @@ vxlan_mdb_nlmsg_remote_size(const struct vxlan_dev *vxlan,\n \t/* MDBA_MDB_EATTR_DST */\n \tnlmsg_size += nla_total_size(vxlan_addr_size(\u0026rd-\u003eremote_ip));\n \t/* MDBA_MDB_EATTR_DST_PORT */\n-\tif (rd-\u003eremote_port \u0026\u0026 rd-\u003eremote_port != vxlan-\u003ecfg.dst_port)\n+\tif (rd-\u003eremote_port \u0026\u0026 rd-\u003eremote_port != cfg-\u003edst_port)\n \t\tnlmsg_size += nla_total_size(sizeof(u16));\n \t/* MDBA_MDB_EATTR_VNI */\n-\tif (rd-\u003eremote_vni != vxlan-\u003edefault_dst.remote_vni)\n+\tif (rd-\u003eremote_vni != cfg-\u003evni)\n \t\tnlmsg_size += nla_total_size(sizeof(u32));\n \t/* MDBA_MDB_EATTR_IFINDEX */\n \tif (rd-\u003eremote_ifindex)\n \t\tnlmsg_size += nla_total_size(sizeof(u32));\n \t/* MDBA_MDB_EATTR_SRC_VNI */\n-\tif ((vxlan-\u003ecfg.flags \u0026 VXLAN_F_COLLECT_METADATA) \u0026\u0026 group-\u003evni)\n+\tif ((cfg-\u003eflags \u0026 VXLAN_F_COLLECT_METADATA) \u0026\u0026 group-\u003evni)\n \t\tnlmsg_size += nla_total_size(sizeof(u32));\n \n \treturn nlmsg_size;\n@@ -1216,7 +1221,7 @@ vxlan_mdb_entry_get(struct vxlan_dev *vxlan,\n \t\tgoto err_free_entry;\n \n \tif (hlist_is_singular_node(\u0026mdb_entry-\u003emdb_node, \u0026vxlan-\u003emdb_list))\n-\t\tvxlan-\u003ecfg.flags |= VXLAN_F_MDB;\n+\t\tset_bit(VXLAN_DEV_F_MDB, \u0026vxlan-\u003eflags);\n \n \treturn mdb_entry;\n \n@@ -1233,7 +1238,7 @@ static void vxlan_mdb_entry_put(struct vxlan_dev *vxlan,\n \t\treturn;\n \n \tif (hlist_is_singular_node(\u0026mdb_entry-\u003emdb_node, \u0026vxlan-\u003emdb_list))\n-\t\tvxlan-\u003ecfg.flags \u0026= ~VXLAN_F_MDB;\n+\t\tclear_bit(VXLAN_DEV_F_MDB, \u0026vxlan-\u003eflags);\n \n \trhashtable_remove_fast(\u0026vxlan-\u003emdb_tbl, \u0026mdb_entry-\u003erhnode,\n \t\t\t       vxlan_mdb_rht_params);\n@@ -1483,11 +1488,13 @@ static int vxlan_mdb_get_parse(struct net_device *dev, struct nlattr *tb[],\n {\n \tstruct br_mdb_entry *entry = nla_data(tb[MDBA_GET_ENTRY]);\n \tstruct nlattr *mdbe_attrs[MDBE_ATTR_MAX + 1];\n+\tconst struct vxlan_config *cfg;\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n \tint err;\n \n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n \tmemset(group, 0, sizeof(*group));\n-\tgroup-\u003evni = vxlan-\u003edefault_dst.remote_vni;\n+\tgroup-\u003evni = cfg-\u003evni;\n \n \tif (!tb[MDBA_GET_ENTRY_ATTRS]) {\n \t\tvxlan_mdb_group_set(group, entry, NULL);\n@@ -1621,6 +1628,7 @@ int vxlan_mdb_get(struct net_device *dev, struct nlattr *tb[], u32 portid,\n }\n \n struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan,\n+\t\t\t\t\t\tconst struct vxlan_config *cfg,\n \t\t\t\t\t\tstruct sk_buff *skb,\n \t\t\t\t\t\t__be32 src_vni)\n {\n@@ -1634,8 +1642,8 @@ struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan,\n \t/* When not in collect metadata mode, 'src_vni' is zero, but MDB\n \t * entries are stored with the VNI of the VXLAN device.\n \t */\n-\tif (!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_COLLECT_METADATA))\n-\t\tsrc_vni = vxlan-\u003edefault_dst.remote_vni;\n+\tif (!(cfg-\u003eflags \u0026 VXLAN_F_COLLECT_METADATA))\n+\t\tsrc_vni = cfg-\u003evni;\n \n \tmemset(\u0026group, 0, sizeof(group));\n \tgroup.vni = src_vni;\n@@ -1700,6 +1708,7 @@ struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan,\n }\n \n netdev_tx_t vxlan_mdb_xmit(struct vxlan_dev *vxlan,\n+\t\t\t   const struct vxlan_config *cfg,\n \t\t\t   const struct vxlan_mdb_entry *mdb_entry,\n \t\t\t   struct sk_buff *skb)\n {\n@@ -1721,12 +1730,12 @@ netdev_tx_t vxlan_mdb_xmit(struct vxlan_dev *vxlan,\n \n \t\tskb1 = skb_clone(skb, GFP_ATOMIC);\n \t\tif (skb1)\n-\t\t\tvxlan_xmit_one(skb1, vxlan-\u003edev, src_vni,\n+\t\t\tvxlan_xmit_one(skb1, vxlan-\u003edev, cfg, src_vni,\n \t\t\t\t       rcu_dereference(remote-\u003erd), false);\n \t}\n \n \tif (fremote)\n-\t\tvxlan_xmit_one(skb, vxlan-\u003edev, src_vni,\n+\t\tvxlan_xmit_one(skb, vxlan-\u003edev, cfg, src_vni,\n \t\t\t       rcu_dereference(fremote-\u003erd), false);\n \telse\n \t\tkfree_skb_reason(skb, SKB_DROP_REASON_NO_TX_TARGET);\n@@ -1757,7 +1766,7 @@ void vxlan_mdb_fini(struct vxlan_dev *vxlan)\n \tstruct vxlan_mdb_flush_desc desc = {};\n \n \tvxlan_mdb_flush(vxlan, \u0026desc);\n-\tWARN_ON_ONCE(vxlan-\u003ecfg.flags \u0026 VXLAN_F_MDB);\n+\tWARN_ON_ONCE(test_bit(VXLAN_DEV_F_MDB, \u0026vxlan-\u003eflags));\n \trhashtable_free_and_destroy(\u0026vxlan-\u003emdb_tbl, vxlan_mdb_check_empty,\n \t\t\t\t    NULL);\n }\ndiff --git a/drivers/net/vxlan/vxlan_multicast.c b/drivers/net/vxlan/vxlan_multicast.c\nindex 3b75b48dc726d..6fcc4a3673436 100644\n--- a/drivers/net/vxlan/vxlan_multicast.c\n+++ b/drivers/net/vxlan/vxlan_multicast.c\n@@ -14,11 +14,12 @@\n /* Update multicast group membership when first VNI on\n  * multicast address is brought up\n  */\n-int vxlan_igmp_join(struct vxlan_dev *vxlan, union vxlan_addr *rip,\n+int vxlan_igmp_join(struct vxlan_dev *vxlan, const union vxlan_addr *rip,\n \t\t    int rifindex)\n {\n-\tunion vxlan_addr *ip = (rip ? : \u0026vxlan-\u003edefault_dst.remote_ip);\n-\tint ifindex = (rifindex ? : vxlan-\u003edefault_dst.remote_ifindex);\n+\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\n+\tconst union vxlan_addr *ip = (rip ? : \u0026cfg-\u003eremote_ip);\n+\tint ifindex = (rifindex ? : cfg-\u003eremote_ifindex);\n \tint ret = -EINVAL;\n \tstruct sock *sk;\n \n@@ -47,11 +48,12 @@ int vxlan_igmp_join(struct vxlan_dev *vxlan, union vxlan_addr *rip,\n \treturn ret;\n }\n \n-int vxlan_igmp_leave(struct vxlan_dev *vxlan, union vxlan_addr *rip,\n+int vxlan_igmp_leave(struct vxlan_dev *vxlan, const union vxlan_addr *rip,\n \t\t     int rifindex)\n {\n-\tunion vxlan_addr *ip = (rip ? : \u0026vxlan-\u003edefault_dst.remote_ip);\n-\tint ifindex = (rifindex ? : vxlan-\u003edefault_dst.remote_ifindex);\n+\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\n+\tconst union vxlan_addr *ip = (rip ? : \u0026cfg-\u003eremote_ip);\n+\tint ifindex = (rifindex ? : cfg-\u003eremote_ifindex);\n \tint ret = -EINVAL;\n \tstruct sock *sk;\n \n@@ -80,8 +82,8 @@ int vxlan_igmp_leave(struct vxlan_dev *vxlan, union vxlan_addr *rip,\n \treturn ret;\n }\n \n-static bool vxlan_group_used_match(union vxlan_addr *ip, int ifindex,\n-\t\t\t\t   union vxlan_addr *rip, int rifindex)\n+static bool vxlan_group_used_match(const union vxlan_addr *ip, int ifindex,\n+\t\t\t\t   const union vxlan_addr *rip, int rifindex)\n {\n \tif (!vxlan_addr_multicast(rip))\n \t\treturn false;\n@@ -96,14 +98,16 @@ static bool vxlan_group_used_match(union vxlan_addr *ip, int ifindex,\n }\n \n static bool vxlan_group_used_by_vnifilter(struct vxlan_dev *vxlan,\n-\t\t\t\t\t  union vxlan_addr *ip, int ifindex)\n+\t\t\t\t\t  const struct vxlan_config *cfg,\n+\t\t\t\t\t  const union vxlan_addr *ip,\n+\t\t\t\t\t  int ifindex)\n {\n \tstruct vxlan_vni_group *vg = rtnl_dereference(vxlan-\u003evnigrp);\n \tstruct vxlan_vni_node *v, *tmp;\n \n \tif (vxlan_group_used_match(ip, ifindex,\n-\t\t\t\t   \u0026vxlan-\u003edefault_dst.remote_ip,\n-\t\t\t\t   vxlan-\u003edefault_dst.remote_ifindex))\n+\t\t\t\t   \u0026cfg-\u003eremote_ip,\n+\t\t\t\t   cfg-\u003eremote_ifindex))\n \t\treturn true;\n \n \tlist_for_each_entry_safe(v, tmp, \u0026vg-\u003evni_list, vlist) {\n@@ -112,7 +116,7 @@ static bool vxlan_group_used_by_vnifilter(struct vxlan_dev *vxlan,\n \n \t\tif (vxlan_group_used_match(ip, ifindex,\n \t\t\t\t\t   \u0026v-\u003eremote_ip,\n-\t\t\t\t\t   vxlan-\u003edefault_dst.remote_ifindex))\n+\t\t\t\t\t   cfg-\u003eremote_ifindex))\n \t\t\treturn true;\n \t}\n \n@@ -121,16 +125,17 @@ static bool vxlan_group_used_by_vnifilter(struct vxlan_dev *vxlan,\n \n /* See if multicast group is already in use by other ID */\n bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,\n-\t\t      __be32 vni, union vxlan_addr *rip, int rifindex)\n+\t\t      __be32 vni, const union vxlan_addr *rip, int rifindex)\n {\n-\tunion vxlan_addr *ip = (rip ? : \u0026dev-\u003edefault_dst.remote_ip);\n-\tint ifindex = (rifindex ? : dev-\u003edefault_dst.remote_ifindex);\n+\tconst struct vxlan_config *dev_cfg = rtnl_dereference(dev-\u003ecfg);\n+\tconst union vxlan_addr *ip = (rip ? : \u0026dev_cfg-\u003eremote_ip);\n+\tint ifindex = (rifindex ? : dev_cfg-\u003eremote_ifindex);\n \tstruct vxlan_dev *vxlan;\n \tstruct vxlan_sock *sock4;\n #if IS_ENABLED(CONFIG_IPV6)\n \tstruct vxlan_sock *sock6;\n #endif\n-\tunsigned short family = dev-\u003edefault_dst.remote_ip.sa.sa_family;\n+\tunsigned short family = dev_cfg-\u003eremote_ip.sa.sa_family;\n \n \tsock4 = rtnl_dereference(dev-\u003evn4_sock);\n \n@@ -147,6 +152,8 @@ bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,\n #endif\n \n \tlist_for_each_entry(vxlan, \u0026vn-\u003evxlan_list, next) {\n+\t\tconst struct vxlan_config *cfg;\n+\n \t\tif (!netif_running(vxlan-\u003edev) || vxlan == dev)\n \t\t\tcontinue;\n \n@@ -158,13 +165,15 @@ bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,\n \t\t    rtnl_dereference(vxlan-\u003evn6_sock) != sock6)\n \t\t\tcontinue;\n #endif\n-\t\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_VNIFILTER) {\n-\t\t\tif (!vxlan_group_used_by_vnifilter(vxlan, ip, ifindex))\n+\t\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\n+\t\tif (cfg-\u003eflags \u0026 VXLAN_F_VNIFILTER) {\n+\t\t\tif (!vxlan_group_used_by_vnifilter(vxlan, cfg, ip, ifindex))\n \t\t\t\tcontinue;\n \t\t} else {\n \t\t\tif (!vxlan_group_used_match(ip, ifindex,\n-\t\t\t\t\t\t    \u0026vxlan-\u003edefault_dst.remote_ip,\n-\t\t\t\t\t\t    vxlan-\u003edefault_dst.remote_ifindex))\n+\t\t\t\t\t\t    \u0026cfg-\u003eremote_ip,\n+\t\t\t\t\t\t    cfg-\u003eremote_ifindex))\n \t\t\t\tcontinue;\n \t\t}\n \n@@ -174,7 +183,8 @@ bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,\n \treturn false;\n }\n \n-static int vxlan_multicast_join_vnigrp(struct vxlan_dev *vxlan)\n+static int vxlan_multicast_join_vnigrp(struct vxlan_dev *vxlan,\n+\t\t\t\t       const struct vxlan_config *cfg)\n {\n \tstruct vxlan_vni_group *vg = rtnl_dereference(vxlan-\u003evnigrp);\n \tstruct vxlan_vni_node *v, *tmp, *vgood = NULL;\n@@ -185,7 +195,7 @@ static int vxlan_multicast_join_vnigrp(struct vxlan_dev *vxlan)\n \t\t\tcontinue;\n \t\t/* skip if address is same as default address */\n \t\tif (vxlan_addr_equal(\u0026v-\u003eremote_ip,\n-\t\t\t\t     \u0026vxlan-\u003edefault_dst.remote_ip))\n+\t\t\t\t     \u0026cfg-\u003eremote_ip))\n \t\t\tcontinue;\n \t\tret = vxlan_igmp_join(vxlan, \u0026v-\u003eremote_ip, 0);\n \t\tif (ret == -EADDRINUSE)\n@@ -200,7 +210,7 @@ static int vxlan_multicast_join_vnigrp(struct vxlan_dev *vxlan)\n \t\t\tif (!vxlan_addr_multicast(\u0026v-\u003eremote_ip))\n \t\t\t\tcontinue;\n \t\t\tif (vxlan_addr_equal(\u0026v-\u003eremote_ip,\n-\t\t\t\t\t     \u0026vxlan-\u003edefault_dst.remote_ip))\n+\t\t\t\t\t     \u0026cfg-\u003eremote_ip))\n \t\t\t\tcontinue;\n \t\t\tvxlan_igmp_leave(vxlan, \u0026v-\u003eremote_ip, 0);\n \t\t\tif (v == vgood)\n@@ -233,37 +243,39 @@ static int vxlan_multicast_leave_vnigrp(struct vxlan_dev *vxlan)\n \n int vxlan_multicast_join(struct vxlan_dev *vxlan)\n {\n+\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\n \tint ret = 0;\n \n-\tif (vxlan_addr_multicast(\u0026vxlan-\u003edefault_dst.remote_ip)) {\n-\t\tret = vxlan_igmp_join(vxlan, \u0026vxlan-\u003edefault_dst.remote_ip,\n-\t\t\t\t      vxlan-\u003edefault_dst.remote_ifindex);\n+\tif (vxlan_addr_multicast(\u0026cfg-\u003eremote_ip)) {\n+\t\tret = vxlan_igmp_join(vxlan, \u0026cfg-\u003eremote_ip,\n+\t\t\t\t      cfg-\u003eremote_ifindex);\n \t\tif (ret == -EADDRINUSE)\n \t\t\tret = 0;\n \t\tif (ret)\n \t\t\treturn ret;\n \t}\n \n-\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_VNIFILTER)\n-\t\treturn vxlan_multicast_join_vnigrp(vxlan);\n+\tif (cfg-\u003eflags \u0026 VXLAN_F_VNIFILTER)\n+\t\treturn vxlan_multicast_join_vnigrp(vxlan, cfg);\n \n \treturn 0;\n }\n \n int vxlan_multicast_leave(struct vxlan_dev *vxlan)\n {\n+\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\n \tstruct vxlan_net *vn = net_generic(vxlan-\u003enet, vxlan_net_id);\n \tint ret = 0;\n \n-\tif (vxlan_addr_multicast(\u0026vxlan-\u003edefault_dst.remote_ip) \u0026\u0026\n+\tif (vxlan_addr_multicast(\u0026cfg-\u003eremote_ip) \u0026\u0026\n \t    !vxlan_group_used(vn, vxlan, 0, NULL, 0)) {\n-\t\tret = vxlan_igmp_leave(vxlan, \u0026vxlan-\u003edefault_dst.remote_ip,\n-\t\t\t\t       vxlan-\u003edefault_dst.remote_ifindex);\n+\t\tret = vxlan_igmp_leave(vxlan, \u0026cfg-\u003eremote_ip,\n+\t\t\t\t       cfg-\u003eremote_ifindex);\n \t\tif (ret)\n \t\t\treturn ret;\n \t}\n \n-\tif (vxlan-\u003ecfg.flags \u0026 VXLAN_F_VNIFILTER)\n+\tif (cfg-\u003eflags \u0026 VXLAN_F_VNIFILTER)\n \t\treturn vxlan_multicast_leave_vnigrp(vxlan);\n \n \treturn 0;\ndiff --git a/drivers/net/vxlan/vxlan_private.h b/drivers/net/vxlan/vxlan_private.h\nindex b1eec22163608..92d656fc1c751 100644\n--- a/drivers/net/vxlan/vxlan_private.h\n+++ b/drivers/net/vxlan/vxlan_private.h\n@@ -22,6 +22,8 @@ struct vxlan_net {\n \t/* sock_list is protected by rtnl lock */\n \tstruct hlist_head sock_list[PORT_HASH_SIZE];\n \tstruct notifier_block nexthop_notifier_block;\n+\t/* Generation counter for RTM_GETTUNNEL dumps */\n+\tatomic_t vnifilter_seq;\n };\n \n struct vxlan_fdb_key {\n@@ -177,6 +179,13 @@ vxlan_vnifilter_lookup(struct vxlan_dev *vxlan, __be32 vni)\n \t\t\t\t      vxlan_vni_rht_params);\n }\n \n+static inline void vxlan_vnifilter_seq_inc(const struct net *net)\n+{\n+\tstruct vxlan_net *vn = net_generic(net, vxlan_net_id);\n+\n+\tatomic_inc(\u0026vn-\u003evnifilter_seq);\n+}\n+\n /* vxlan_core.c */\n int vxlan_fdb_create(struct vxlan_dev *vxlan,\n \t\t     const u8 *mac, union vxlan_addr *ip,\n@@ -195,9 +204,10 @@ int vxlan_fdb_update(struct vxlan_dev *vxlan,\n \t\t     __u32 ifindex, __u16 ndm_flags, u32 nhid,\n \t\t     bool swdev_notify, struct netlink_ext_ack *extack);\n void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,\n+\t\t    const struct vxlan_config *cfg,\n \t\t    __be32 default_vni, struct vxlan_rdst *rdst, bool did_rsc);\n int vxlan_vni_in_use(struct net *src_net, struct vxlan_dev *vxlan,\n-\t\t     struct vxlan_config *conf, __be32 vni);\n+\t\t     const struct vxlan_config *conf, __be32 vni);\n \n /* vxlan_vnifilter.c */\n int vxlan_vnigroup_init(struct vxlan_dev *vxlan);\n@@ -205,7 +215,8 @@ void vxlan_vnigroup_uninit(struct vxlan_dev *vxlan);\n \n int vxlan_vnifilter_init(void);\n void vxlan_vnifilter_uninit(void);\n-void vxlan_vnifilter_count(struct vxlan_dev *vxlan, __be32 vni,\n+void vxlan_vnifilter_count(struct vxlan_dev *vxlan,\n+\t\t\t   const struct vxlan_config *cfg, __be32 vni,\n \t\t\t   struct vxlan_vni_node *vninode,\n \t\t\t   int type, unsigned int len);\n \n@@ -214,8 +225,9 @@ void vxlan_vs_add_vnigrp(struct vxlan_dev *vxlan,\n \t\t\t bool ipv6);\n void vxlan_vs_del_vnigrp(struct vxlan_dev *vxlan);\n int vxlan_vnilist_update_group(struct vxlan_dev *vxlan,\n-\t\t\t       union vxlan_addr *old_remote_ip,\n-\t\t\t       union vxlan_addr *new_remote_ip,\n+\t\t\t       const union vxlan_addr *old_remote_ip,\n+\t\t\t       const union vxlan_addr *new_remote_ip,\n+\t\t\t       u32 old_ifindex, u32 new_ifindex,\n \t\t\t       struct netlink_ext_ack *extack);\n \n \n@@ -223,10 +235,10 @@ int vxlan_vnilist_update_group(struct vxlan_dev *vxlan,\n int vxlan_multicast_join(struct vxlan_dev *vxlan);\n int vxlan_multicast_leave(struct vxlan_dev *vxlan);\n bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,\n-\t\t      __be32 vni, union vxlan_addr *rip, int rifindex);\n-int vxlan_igmp_join(struct vxlan_dev *vxlan, union vxlan_addr *rip,\n+\t\t      __be32 vni, const union vxlan_addr *rip, int rifindex);\n+int vxlan_igmp_join(struct vxlan_dev *vxlan, const union vxlan_addr *rip,\n \t\t    int rifindex);\n-int vxlan_igmp_leave(struct vxlan_dev *vxlan, union vxlan_addr *rip,\n+int vxlan_igmp_leave(struct vxlan_dev *vxlan, const union vxlan_addr *rip,\n \t\t     int rifindex);\n \n /* vxlan_mdb.c */\n@@ -241,9 +253,11 @@ int vxlan_mdb_del_bulk(struct net_device *dev, struct nlattr *tb[],\n int vxlan_mdb_get(struct net_device *dev, struct nlattr *tb[], u32 portid,\n \t\t  u32 seq, struct netlink_ext_ack *extack);\n struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan,\n+\t\t\t\t\t\tconst struct vxlan_config *cfg,\n \t\t\t\t\t\tstruct sk_buff *skb,\n \t\t\t\t\t\t__be32 src_vni);\n netdev_tx_t vxlan_mdb_xmit(struct vxlan_dev *vxlan,\n+\t\t\t   const struct vxlan_config *cfg,\n \t\t\t   const struct vxlan_mdb_entry *mdb_entry,\n \t\t\t   struct sk_buff *skb);\n int vxlan_mdb_init(struct vxlan_dev *vxlan);\ndiff --git a/drivers/net/vxlan/vxlan_vnifilter.c b/drivers/net/vxlan/vxlan_vnifilter.c\nindex dd94085e08865..543eaf420f4c2 100644\n--- a/drivers/net/vxlan/vxlan_vnifilter.c\n+++ b/drivers/net/vxlan/vxlan_vnifilter.c\n@@ -171,13 +171,14 @@ static void vxlan_vnifilter_stats_add(struct vxlan_vni_node *vninode,\n \tu64_stats_update_end(\u0026pstats-\u003esyncp);\n }\n \n-void vxlan_vnifilter_count(struct vxlan_dev *vxlan, __be32 vni,\n+void vxlan_vnifilter_count(struct vxlan_dev *vxlan,\n+\t\t\t   const struct vxlan_config *cfg, __be32 vni,\n \t\t\t   struct vxlan_vni_node *vninode,\n \t\t\t   int type, unsigned int len)\n {\n \tstruct vxlan_vni_node *vnode;\n \n-\tif (!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_VNIFILTER))\n+\tif (!(cfg-\u003eflags \u0026 VXLAN_F_VNIFILTER))\n \t\treturn;\n \n \tif (vninode) {\n@@ -333,22 +334,36 @@ static int vxlan_vnifilter_dump_dev(const struct net_device *dev,\n \t\t\t\t    struct sk_buff *skb,\n \t\t\t\t    struct netlink_callback *cb)\n {\n-\tstruct vxlan_vni_node *tmp, *v, *vbegin = NULL, *vend = NULL;\n+\tstruct vxlan_vni_node *v, *vbegin = NULL, *vend = NULL;\n \tstruct vxlan_dev *vxlan = netdev_priv(dev);\n \tstruct tunnel_msg *new_tmsg, *tmsg;\n-\tint idx = 0, s_idx = cb-\u003eargs[1];\n+\tconst struct vxlan_config *cfg;\n \tstruct vxlan_vni_group *vg;\n \tstruct nlmsghdr *nlh;\n+\tint idx = 0, s_idx;\n \tbool dump_stats;\n \tint err = 0;\n \n-\tif (!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_VNIFILTER))\n+\tif (cb-\u003eargs[2] != dev-\u003eifindex) {\n+\t\tcb-\u003eargs[1] = 0;\n+\t\tcb-\u003eargs[2] = dev-\u003eifindex;\n+\t}\n+\ts_idx = cb-\u003eargs[1];\n+\n+\tcfg = rcu_dereference(vxlan-\u003ecfg);\n+\tif (!(cfg-\u003eflags \u0026 VXLAN_F_VNIFILTER)) {\n+\t\tcb-\u003eargs[1] = 0;\n+\t\tcb-\u003eargs[2] = 0;\n \t\treturn -EINVAL;\n+\t}\n \n \t/* RCU needed because of the vni locking rules (rcu || rtnl) */\n \tvg = rcu_dereference(vxlan-\u003evnigrp);\n-\tif (!vg || !vg-\u003enum_vnis)\n+\tif (!vg || !vg-\u003enum_vnis) {\n+\t\tcb-\u003eargs[1] = 0;\n+\t\tcb-\u003eargs[2] = 0;\n \t\treturn 0;\n+\t}\n \n \ttmsg = nlmsg_data(cb-\u003enlh);\n \tdump_stats = !!(tmsg-\u003eflags \u0026 TUNNEL_MSG_FLAG_STATS);\n@@ -362,7 +377,7 @@ static int vxlan_vnifilter_dump_dev(const struct net_device *dev,\n \tnew_tmsg-\u003efamily = PF_BRIDGE;\n \tnew_tmsg-\u003eifindex = dev-\u003eifindex;\n \n-\tlist_for_each_entry_safe(v, tmp, \u0026vg-\u003evni_list, vlist) {\n+\tlist_for_each_entry_rcu(v, \u0026vg-\u003evni_list, vlist) {\n \t\tif (idx \u003c s_idx) {\n \t\t\tidx++;\n \t\t\tcontinue;\n@@ -394,12 +409,26 @@ static int vxlan_vnifilter_dump_dev(const struct net_device *dev,\n \t}\n \n \tcb-\u003eargs[1] = err ? idx : 0;\n+\tcb-\u003eargs[2] = err ? dev-\u003eifindex : 0;\n \n \tnlmsg_end(skb, nlh);\n \n+\tnl_dump_check_consistent(cb, nlh);\n+\n \treturn err;\n }\n \n+static u32 vxlan_vnifilter_base_seq(const struct net *net)\n+{\n+\tconst struct vxlan_net *vn = net_generic(net, vxlan_net_id);\n+\tu32 res = atomic_read(\u0026vn-\u003evnifilter_seq);\n+\n+\t/* Must not return 0 (see nl_dump_check_consistent()) */\n+\tif (!res)\n+\t\tres = 0x80000000;\n+\treturn res;\n+}\n+\n static int vxlan_vnifilter_dump(struct sk_buff *skb, struct netlink_callback *cb)\n {\n \tint idx = 0, err = 0, s_idx = cb-\u003eargs[0];\n@@ -419,6 +448,9 @@ static int vxlan_vnifilter_dump(struct sk_buff *skb, struct netlink_callback *cb\n \t}\n \n \trcu_read_lock();\n+\n+\tcb-\u003eseq = vxlan_vnifilter_base_seq(net);\n+\n \tif (tmsg-\u003eifindex) {\n \t\tdev = dev_get_by_index_rcu(net, tmsg-\u003eifindex);\n \t\tif (!dev) {\n@@ -471,23 +503,31 @@ static const struct nla_policy vni_filter_policy[VXLAN_VNIFILTER_MAX + 1] = {\n };\n \n static int vxlan_update_default_fdb_entry(struct vxlan_dev *vxlan, __be32 vni,\n-\t\t\t\t\t  union vxlan_addr *old_remote_ip,\n-\t\t\t\t\t  union vxlan_addr *remote_ip,\n+\t\t\t\t\t  const union vxlan_addr *old_remote_ip,\n+\t\t\t\t\t  const union vxlan_addr *remote_ip,\n+\t\t\t\t\t  u32 old_ifindex, u32 new_ifindex,\n \t\t\t\t\t  struct netlink_ext_ack *extack)\n {\n-\tstruct vxlan_rdst *dst = \u0026vxlan-\u003edefault_dst;\n+\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\n \tint err = 0;\n \n+\tif (old_remote_ip \u0026\u0026 remote_ip \u0026\u0026\n+\t    vxlan_addr_equal(old_remote_ip, remote_ip) \u0026\u0026\n+\t    old_ifindex == new_ifindex)\n+\t\treturn 0;\n+\n \tspin_lock_bh(\u0026vxlan-\u003ehash_lock);\n \tif (remote_ip \u0026\u0026 !vxlan_addr_any(remote_ip)) {\n+\t\tunion vxlan_addr rip = *remote_ip;\n+\n \t\terr = vxlan_fdb_update(vxlan, all_zeros_mac,\n-\t\t\t\t       remote_ip,\n+\t\t\t\t       \u0026rip,\n \t\t\t\t       NUD_REACHABLE | NUD_PERMANENT,\n \t\t\t\t       NLM_F_APPEND | NLM_F_CREATE,\n-\t\t\t\t       vxlan-\u003ecfg.dst_port,\n+\t\t\t\t       cfg-\u003edst_port,\n \t\t\t\t       vni,\n \t\t\t\t       vni,\n-\t\t\t\t       dst-\u003eremote_ifindex,\n+\t\t\t\t       new_ifindex,\n \t\t\t\t       NTF_SELF, 0, true, extack);\n \t\tif (err) {\n \t\t\tspin_unlock_bh(\u0026vxlan-\u003ehash_lock);\n@@ -498,9 +538,9 @@ static int vxlan_update_default_fdb_entry(struct vxlan_dev *vxlan, __be32 vni,\n \tif (old_remote_ip \u0026\u0026 !vxlan_addr_any(old_remote_ip)) {\n \t\t__vxlan_fdb_delete(vxlan, all_zeros_mac,\n \t\t\t\t   *old_remote_ip,\n-\t\t\t\t   vxlan-\u003ecfg.dst_port,\n+\t\t\t\t   cfg-\u003edst_port,\n \t\t\t\t   vni, vni,\n-\t\t\t\t   dst-\u003eremote_ifindex,\n+\t\t\t\t   old_ifindex,\n \t\t\t\t   true);\n \t}\n \tspin_unlock_bh(\u0026vxlan-\u003ehash_lock);\n@@ -515,8 +555,8 @@ static int vxlan_vni_update_group(struct vxlan_dev *vxlan,\n \t\t\t\t  struct netlink_ext_ack *extack)\n {\n \tstruct vxlan_net *vn = net_generic(vxlan-\u003enet, vxlan_net_id);\n-\tstruct vxlan_rdst *dst = \u0026vxlan-\u003edefault_dst;\n-\tunion vxlan_addr *newrip = NULL, *oldrip = NULL;\n+\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\n+\tconst union vxlan_addr *newrip = NULL, *oldrip = NULL;\n \tunion vxlan_addr old_remote_ip;\n \tint ret = 0;\n \n@@ -528,8 +568,8 @@ static int vxlan_vni_update_group(struct vxlan_dev *vxlan,\n \tif (group \u0026\u0026 !vxlan_addr_any(group)) {\n \t\tnewrip = group;\n \t} else {\n-\t\tif (!vxlan_addr_any(\u0026dst-\u003eremote_ip))\n-\t\t\tnewrip = \u0026dst-\u003eremote_ip;\n+\t\tif (!vxlan_addr_any(\u0026cfg-\u003eremote_ip))\n+\t\t\tnewrip = \u0026cfg-\u003eremote_ip;\n \t}\n \n \t/* if old rip exists, and no newrip,\n@@ -546,6 +586,8 @@ static int vxlan_vni_update_group(struct vxlan_dev *vxlan,\n \n \tret = vxlan_update_default_fdb_entry(vxlan, vninode-\u003evni,\n \t\t\t\t\t     oldrip, newrip,\n+\t\t\t\t\t     cfg-\u003eremote_ifindex,\n+\t\t\t\t\t     cfg-\u003eremote_ifindex,\n \t\t\t\t\t     extack);\n \tif (ret)\n \t\tgoto out;\n@@ -557,7 +599,7 @@ static int vxlan_vni_update_group(struct vxlan_dev *vxlan,\n \t\tif (vxlan_addr_multicast(\u0026old_remote_ip) \u0026\u0026\n \t\t    !vxlan_group_used(vn, vxlan, vninode-\u003evni,\n \t\t\t\t      \u0026old_remote_ip,\n-\t\t\t\t      vxlan-\u003edefault_dst.remote_ifindex)) {\n+\t\t\t\t      cfg-\u003eremote_ifindex)) {\n \t\t\tret = vxlan_igmp_leave(vxlan, \u0026old_remote_ip,\n \t\t\t\t\t       0);\n \t\t\tif (ret)\n@@ -581,10 +623,12 @@ static int vxlan_vni_update_group(struct vxlan_dev *vxlan,\n }\n \n int vxlan_vnilist_update_group(struct vxlan_dev *vxlan,\n-\t\t\t       union vxlan_addr *old_remote_ip,\n-\t\t\t       union vxlan_addr *new_remote_ip,\n+\t\t\t       const union vxlan_addr *old_remote_ip,\n+\t\t\t       const union vxlan_addr *new_remote_ip,\n+\t\t\t       u32 old_ifindex, u32 new_ifindex,\n \t\t\t       struct netlink_ext_ack *extack)\n {\n+\tconst union vxlan_addr *oldrip, *newrip;\n \tstruct list_head *headp, *hpos;\n \tstruct vxlan_vni_group *vg;\n \tstruct vxlan_vni_node *vent;\n@@ -595,14 +639,24 @@ int vxlan_vnilist_update_group(struct vxlan_dev *vxlan,\n \theadp = \u0026vg-\u003evni_list;\n \tlist_for_each_prev(hpos, headp) {\n \t\tvent = list_entry(hpos, struct vxlan_vni_node, vlist);\n+\n \t\tif (vxlan_addr_any(\u0026vent-\u003eremote_ip)) {\n-\t\t\tret = vxlan_update_default_fdb_entry(vxlan, vent-\u003evni,\n-\t\t\t\t\t\t\t     old_remote_ip,\n-\t\t\t\t\t\t\t     new_remote_ip,\n-\t\t\t\t\t\t\t     extack);\n-\t\t\tif (ret)\n-\t\t\t\treturn ret;\n+\t\t\toldrip = old_remote_ip;\n+\t\t\tnewrip = new_remote_ip;\n+\t\t} else {\n+\t\t\t/* A vni with its own group keeps it, but its fdb entry\n+\t\t\t * is still keyed on the device remote_ifindex.\n+\t\t\t */\n+\t\t\toldrip = \u0026vent-\u003eremote_ip;\n+\t\t\tnewrip = \u0026vent-\u003eremote_ip;\n \t\t}\n+\n+\t\tret = vxlan_update_default_fdb_entry(vxlan, vent-\u003evni,\n+\t\t\t\t\t\t     oldrip, newrip,\n+\t\t\t\t\t\t     old_ifindex, new_ifindex,\n+\t\t\t\t\t\t     extack);\n+\t\tif (ret)\n+\t\t\treturn ret;\n \t}\n \n \treturn 0;\n@@ -612,20 +666,20 @@ static void vxlan_vni_delete_group(struct vxlan_dev *vxlan,\n \t\t\t\t   struct vxlan_vni_node *vninode)\n {\n \tstruct vxlan_net *vn = net_generic(vxlan-\u003enet, vxlan_net_id);\n-\tstruct vxlan_rdst *dst = \u0026vxlan-\u003edefault_dst;\n+\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\n \n \t/* if per vni remote_ip not present, delete the\n \t * default dst remote_ip previously added for this vni\n \t */\n \tif (!vxlan_addr_any(\u0026vninode-\u003eremote_ip) ||\n-\t    !vxlan_addr_any(\u0026dst-\u003eremote_ip)) {\n+\t    !vxlan_addr_any(\u0026cfg-\u003eremote_ip)) {\n \t\tspin_lock_bh(\u0026vxlan-\u003ehash_lock);\n \t\t__vxlan_fdb_delete(vxlan, all_zeros_mac,\n \t\t\t\t   (vxlan_addr_any(\u0026vninode-\u003eremote_ip) ?\n-\t\t\t\t   dst-\u003eremote_ip : vninode-\u003eremote_ip),\n-\t\t\t\t   vxlan-\u003ecfg.dst_port,\n+\t\t\t\t   cfg-\u003eremote_ip : vninode-\u003eremote_ip),\n+\t\t\t\t   cfg-\u003edst_port,\n \t\t\t\t   vninode-\u003evni, vninode-\u003evni,\n-\t\t\t\t   dst-\u003eremote_ifindex,\n+\t\t\t\t   cfg-\u003eremote_ifindex,\n \t\t\t\t   true);\n \t\tspin_unlock_bh(\u0026vxlan-\u003ehash_lock);\n \t}\n@@ -634,7 +688,7 @@ static void vxlan_vni_delete_group(struct vxlan_dev *vxlan,\n \t\tif (vxlan_addr_multicast(\u0026vninode-\u003eremote_ip) \u0026\u0026\n \t\t    !vxlan_group_used(vn, vxlan, vninode-\u003evni,\n \t\t\t\t      \u0026vninode-\u003eremote_ip,\n-\t\t\t\t      dst-\u003eremote_ifindex)) {\n+\t\t\t\t      cfg-\u003eremote_ifindex)) {\n \t\t\tvxlan_igmp_leave(vxlan, \u0026vninode-\u003eremote_ip, 0);\n \t\t}\n \t}\n@@ -659,13 +713,16 @@ static int vxlan_vni_update(struct vxlan_dev *vxlan,\n \tif (ret)\n \t\treturn ret;\n \n-\tif (*changed)\n+\tif (*changed) {\n+\t\tvxlan_vnifilter_seq_inc(dev_net(vxlan-\u003edev));\n \t\tvxlan_vnifilter_notify(vxlan, vninode, RTM_NEWTUNNEL);\n+\t}\n \n \treturn 0;\n }\n \n-static void __vxlan_vni_add_list(struct vxlan_vni_group *vg,\n+static void __vxlan_vni_add_list(struct vxlan_dev *vxlan,\n+\t\t\t\t struct vxlan_vni_group *vg,\n \t\t\t\t struct vxlan_vni_node *v)\n {\n \tstruct list_head *headp, *hpos;\n@@ -681,13 +738,16 @@ static void __vxlan_vni_add_list(struct vxlan_vni_group *vg,\n \t}\n \tlist_add_rcu(\u0026v-\u003evlist, hpos);\n \tvg-\u003enum_vnis++;\n+\tvxlan_vnifilter_seq_inc(dev_net(vxlan-\u003edev));\n }\n \n-static void __vxlan_vni_del_list(struct vxlan_vni_group *vg,\n+static void __vxlan_vni_del_list(struct vxlan_dev *vxlan,\n+\t\t\t\t struct vxlan_vni_group *vg,\n \t\t\t\t struct vxlan_vni_node *v)\n {\n \tlist_del_rcu(\u0026v-\u003evlist);\n \tvg-\u003enum_vnis--;\n+\tvxlan_vnifilter_seq_inc(dev_net(vxlan-\u003edev));\n }\n \n static struct vxlan_vni_node *vxlan_vni_alloc(struct vxlan_dev *vxlan,\n@@ -723,6 +783,7 @@ static int vxlan_vni_add(struct vxlan_dev *vxlan,\n \t\t\t u32 vni, union vxlan_addr *group,\n \t\t\t struct netlink_ext_ack *extack)\n {\n+\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\n \tstruct vxlan_vni_node *vninode;\n \t__be32 v = cpu_to_be32(vni);\n \tbool changed = false;\n@@ -731,7 +792,7 @@ static int vxlan_vni_add(struct vxlan_dev *vxlan,\n \tif (vxlan_vnifilter_lookup(vxlan, v))\n \t\treturn vxlan_vni_update(vxlan, vg, v, group, \u0026changed, extack);\n \n-\terr = vxlan_vni_in_use(vxlan-\u003enet, vxlan, \u0026vxlan-\u003ecfg, v);\n+\terr = vxlan_vni_in_use(vxlan-\u003enet, vxlan, cfg, v);\n \tif (err) {\n \t\tNL_SET_ERR_MSG(extack, \"VNI in use\");\n \t\treturn err;\n@@ -749,7 +810,7 @@ static int vxlan_vni_add(struct vxlan_dev *vxlan,\n \t\treturn err;\n \t}\n \n-\t__vxlan_vni_add_list(vg, vninode);\n+\t__vxlan_vni_add_list(vxlan, vg, vninode);\n \n \tif (vxlan-\u003edev-\u003eflags \u0026 IFF_UP)\n \t\tvxlan_vs_add_del_vninode(vxlan, vninode, false);\n@@ -795,7 +856,7 @@ static int vxlan_vni_del(struct vxlan_dev *vxlan,\n \tif (err)\n \t\tgoto out;\n \n-\t__vxlan_vni_del_list(vg, vninode);\n+\t__vxlan_vni_del_list(vxlan, vg, vninode);\n \n \tvxlan_vnifilter_notify(vxlan, vninode, RTM_DELTUNNEL);\n \n@@ -844,6 +905,7 @@ static int vxlan_process_vni_filter(struct vxlan_dev *vxlan,\n \t\t\t\t    int cmd, struct netlink_ext_ack *extack)\n {\n \tstruct nlattr *vattrs[VXLAN_VNIFILTER_ENTRY_MAX + 1];\n+\tconst struct vxlan_config *cfg;\n \tu32 vni_start = 0, vni_end = 0;\n \tunion vxlan_addr group;\n \tint err;\n@@ -881,7 +943,8 @@ static int vxlan_process_vni_filter(struct vxlan_dev *vxlan,\n \t\tmemset(\u0026group, 0, sizeof(group));\n \t}\n \n-\tif (vxlan_addr_multicast(\u0026group) \u0026\u0026 !vxlan-\u003edefault_dst.remote_ifindex) {\n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n+\tif (vxlan_addr_multicast(\u0026group) \u0026\u0026 !cfg-\u003eremote_ifindex) {\n \t\tNL_SET_ERR_MSG(extack,\n \t\t\t       \"Local interface required for multicast remote group\");\n \n@@ -909,7 +972,7 @@ void vxlan_vnigroup_uninit(struct vxlan_dev *vxlan)\n #if IS_ENABLED(CONFIG_IPV6)\n \t\thlist_del_init_rcu(\u0026v-\u003ehlist6.hlist);\n #endif\n-\t\t__vxlan_vni_del_list(vg, v);\n+\t\t__vxlan_vni_del_list(vxlan, vg, v);\n \t\tvxlan_vnifilter_notify(vxlan, v, RTM_DELTUNNEL);\n \t\tcall_rcu(\u0026v-\u003ercu, vxlan_vni_node_rcu_free);\n \t}\n@@ -940,6 +1003,7 @@ static int vxlan_vnifilter_process(struct sk_buff *skb, struct nlmsghdr *nlh,\n \t\t\t\t   struct netlink_ext_ack *extack)\n {\n \tstruct net *net = sock_net(skb-\u003esk);\n+\tconst struct vxlan_config *cfg;\n \tstruct tunnel_msg *tmsg;\n \tstruct vxlan_dev *vxlan;\n \tstruct net_device *dev;\n@@ -964,8 +1028,9 @@ static int vxlan_vnifilter_process(struct sk_buff *skb, struct nlmsghdr *nlh,\n \t}\n \n \tvxlan = netdev_priv(dev);\n+\tcfg = rtnl_dereference(vxlan-\u003ecfg);\n \n-\tif (!(vxlan-\u003ecfg.flags \u0026 VXLAN_F_VNIFILTER))\n+\tif (!(cfg-\u003eflags \u0026 VXLAN_F_VNIFILTER))\n \t\treturn -EOPNOTSUPP;\n \n \tnlmsg_for_each_attr_type(attr, VXLAN_VNIFILTER_ENTRY, nlh,\ndiff --git a/include/net/vxlan.h b/include/net/vxlan.h\nindex 7b82075055237..c3c9f2ccc3d1b 100644\n--- a/include/net/vxlan.h\n+++ b/include/net/vxlan.h\n@@ -204,7 +204,6 @@ struct vxlan_rdst {\n \tu8\t\t\t offloaded:1;\n \t__be32\t\t\t remote_vni;\n \tu32\t\t\t remote_ifindex;\n-\tstruct net_device\t *remote_dev;\n \tstruct list_head\t list;\n \tstruct rcu_head\t\t rcu;\n \tstruct dst_cache\t dst_cache;\n@@ -229,6 +228,7 @@ struct vxlan_config {\n \tbool\t\t\t\tno_share;\n \tenum ifla_vxlan_df\t\tdf;\n \tstruct vxlanhdr\t\t\treserved_bits;\n+\tstruct rcu_head\t\t\trcu;\n };\n \n enum {\n@@ -294,14 +294,15 @@ struct vxlan_dev {\n #endif\n \tstruct net_device *dev;\n \tstruct net\t  *net;\t\t/* netns for packet i/o */\n-\tstruct vxlan_rdst default_dst;\t/* default destination */\n+\tstruct net_device *lowerdev;\n \n \tstruct timer_list age_timer;\n \tspinlock_t\t  hash_lock;\n \tunsigned int\t  addrcnt;\n \tstruct gro_cells  gro_cells;\n+\tunsigned long\t  flags;\n \n-\tstruct vxlan_config\tcfg;\n+\tstruct vxlan_config __rcu\t*cfg;\n \n \tstruct vxlan_vni_group  __rcu *vnigrp;\n \n@@ -313,6 +314,10 @@ struct vxlan_dev {\n \tunsigned int mdb_seq;\n };\n \n+enum vxlan_dev_flags {\n+\tVXLAN_DEV_F_MDB,\n+};\n+\n #define VXLAN_F_LEARN\t\t\t0x01\n #define VXLAN_F_PROXY\t\t\t0x02\n #define VXLAN_F_RSC\t\t\t0x04\n@@ -331,7 +336,6 @@ struct vxlan_dev {\n #define VXLAN_F_IPV6_LINKLOCAL\t\t0x8000\n #define VXLAN_F_TTL_INHERIT\t\t0x10000\n #define VXLAN_F_VNIFILTER               0x20000\n-#define VXLAN_F_MDB\t\t\t0x40000\n #define VXLAN_F_LOCALBYPASS\t\t0x80000\n #define VXLAN_F_MC_ROUTE\t\t0x100000\n \n"
}

2/1 2026/09/17 06:36 agent patch-evaluator
0m Model:
core

Args:
null

Results:
{
  "EnableConfigs": [
    "VXLAN"
  ],
  "FocusSymbols": [
    "vxlan_changelink",
    "vxlan_xmit",
    "vxlan_xmit_one",
    "vxlan_rcv",
    "vxlan_vnifilter_dump_dev",
    "vxlan_vnilist_update_group",
    "vxlan_mdb_xmit",
    "vxlan_multicast_join"
  ],
  "Reasoning": "The patch refactors the VXLAN virtual network device driver to manage its configuration (`vxlan_config`) dynamically via RCU instead of embedding it directly in `struct vxlan_dev`. It modifies RCU dereferencing across both the packet processing datapath (vxlan_rcv, vxlan_xmit, vxlan_xmit_one) and netlink control path (vxlan_changelink, vnifilter, mdb, and multicast operations). VXLAN is fully reachable in standard virtualized fuzzing environments via netlink and socket operations without dedicated hardware.",
  "WorthFuzzing": true
}

Instruction:
You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.

================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.

- REACHABILITY IS THE PRIMARY GATE:
  Fuzzing can only discover bugs in code that can actually execute in standard virtualized
  environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
  If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
  regardless of whether it adds assertions or complex logic.

- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
  Patch authors routinely label changes as "cleanups", "refactorings", or state
  "No functional change intended". Do NOT take these claims at face value.
  Code refactorings that rearrange logic, introduce helper functions, or alter state management
  in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
  If reachable executable code is modified or refactored, it MUST be fuzzed.

- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
  When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
  BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
  Even if the author believes the invariant always holds, fuzzing is essential to verify whether
  an unusual sequence of operations can violate it.

================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:

- Non-kernel and non-executable changes:
  * Modifications to Documentation/, comments, or spelling fixes.
  * User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
    that do not affect the compiled kernel image (vmlinux) or kernel modules.
  * Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
    that do not alter control flow or data structures.
  * Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
  * Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
    ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
  * Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
    physical PCI hot-unplug or manual sysfs driver unbinding.
  * Code paths exclusive to architectures other than the target architecture.

================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
  * Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
    BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
  * Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
  * Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
  * Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).

================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:

- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
  Do NOT list generic, ubiquitous functions called by almost every program in the corpus
  (including, but not limited to: general memory allocators and deallocators, page fault
  and trap handlers, or core synchronization primitives; this is not an exhaustive list).
  Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
  which severely dilutes fuzzing effort away from the actual changes.

- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
  List functions that specifically implement the logic being added or altered, or direct API entrypoints
  for the subsystem feature under review.

- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
  Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
  distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
  If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
  functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).

================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4").
Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
Target architecture: amd64

For your convenience, here is the diff of the changes:
commit fe645304dc0934987015440d0a8826871ca891f2
Author: syz-cluster <triage@syzkaller.com>
Date:   Thu Sep 17 06:36:03 2026 +0000

    syz-cluster: applied patch under review

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c
index 7a18a469961db..467fbe43b89e9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c
@@ -241,9 +241,16 @@ static bool mlx5e_tc_tun_encap_info_equal_vxlan(struct mlx5e_encap_key *a,
 static int mlx5e_tc_tun_get_remote_ifindex(struct net_device *mirred_dev)
 {
 	const struct vxlan_dev *vxlan = netdev_priv(mirred_dev);
-	const struct vxlan_rdst *dst = &vxlan->default_dst;
+	const struct vxlan_config *cfg;
+	int ifindex = 0;
 
-	return dst->remote_ifindex;
+	rcu_read_lock();
+	cfg = rcu_dereference(vxlan->cfg);
+	if (cfg)
+		ifindex = cfg->remote_ifindex;
+	rcu_read_unlock();
+
+	return ifindex;
 }
 
 struct mlx5e_tc_tunnel vxlan_tunnel = {
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
index 52c2fe3644d4b..21e7b499f3879 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
@@ -59,8 +59,11 @@ static bool mlxsw_sp_nve_vxlan_can_offload(const struct mlxsw_sp_nve *nve,
 					   const struct mlxsw_sp_nve_params *params,
 					   struct netlink_ext_ack *extack)
 {
-	struct vxlan_dev *vxlan = netdev_priv(params->dev);
-	struct vxlan_config *cfg = &vxlan->cfg;
+	const struct vxlan_config *cfg;
+	struct vxlan_dev *vxlan;
+
+	vxlan = netdev_priv(params->dev);
+	cfg = rtnl_dereference(vxlan->cfg);
 
 	if (vxlan_addr_multicast(&cfg->remote_ip)) {
 		NL_SET_ERR_MSG_MOD(extack, "VxLAN: Multicast destination IP is not supported");
@@ -92,6 +95,11 @@ static bool mlxsw_sp_nve_vxlan_can_offload(const struct mlxsw_sp_nve *nve,
 		return false;
 	}
 
+	if (test_bit(VXLAN_DEV_F_MDB, &vxlan->flags)) {
+		NL_SET_ERR_MSG_MOD(extack, "VxLAN: MDB entries are not supported");
+		return false;
+	}
+
 	switch (cfg->saddr.sa.sa_family) {
 	case AF_INET:
 		if (!mlxsw_sp_nve_vxlan_ipv4_flags_check(cfg, extack))
@@ -148,8 +156,11 @@ static void mlxsw_sp_nve_vxlan_config(const struct mlxsw_sp_nve *nve,
 				      const struct mlxsw_sp_nve_params *params,
 				      struct mlxsw_sp_nve_config *config)
 {
-	struct vxlan_dev *vxlan = netdev_priv(params->dev);
-	struct vxlan_config *cfg = &vxlan->cfg;
+	const struct vxlan_config *cfg;
+	struct vxlan_dev *vxlan;
+
+	vxlan = netdev_priv(params->dev);
+	cfg = rtnl_dereference(vxlan->cfg);
 
 	config->type = MLXSW_SP_NVE_TYPE_VXLAN;
 	config->ttl = cfg->ttl;
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index fe45e533a4b2e..de60b698bea98 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -2513,15 +2513,17 @@ mlxsw_sp_bridge_vlan_aware_vxlan_join(struct mlxsw_sp_bridge_device *bridge_devi
 {
 	struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_device->dev);
 	struct vxlan_dev *vxlan = netdev_priv(vxlan_dev);
-	struct mlxsw_sp_nve_params params = {
-		.type = MLXSW_SP_NVE_TYPE_VXLAN,
-		.vni = vxlan->cfg.vni,
-		.dev = vxlan_dev,
-		.ethertype = ethertype,
-	};
+	struct mlxsw_sp_nve_params params;
+	const struct vxlan_config *cfg;
 	struct mlxsw_sp_fid *fid;
 	int err;
 
+	cfg = rtnl_dereference(vxlan->cfg);
+	params.type = MLXSW_SP_NVE_TYPE_VXLAN;
+	params.vni = cfg->vni;
+	params.dev = vxlan_dev;
+	params.ethertype = ethertype;
+
 	/* If the VLAN is 0, we need to find the VLAN that is configured as
 	 * PVID and egress untagged on the bridge port of the VxLAN device.
 	 * It is possible no such VLAN exists
@@ -2704,15 +2706,17 @@ mlxsw_sp_bridge_8021d_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,
 {
 	struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_device->dev);
 	struct vxlan_dev *vxlan = netdev_priv(vxlan_dev);
-	struct mlxsw_sp_nve_params params = {
-		.type = MLXSW_SP_NVE_TYPE_VXLAN,
-		.vni = vxlan->cfg.vni,
-		.dev = vxlan_dev,
-		.ethertype = ETH_P_8021Q,
-	};
+	struct mlxsw_sp_nve_params params;
+	const struct vxlan_config *cfg;
 	struct mlxsw_sp_fid *fid;
 	int err;
 
+	cfg = rtnl_dereference(vxlan->cfg);
+	params.type = MLXSW_SP_NVE_TYPE_VXLAN;
+	params.vni = cfg->vni;
+	params.dev = vxlan_dev;
+	params.ethertype = ETH_P_8021Q;
+
 	fid = mlxsw_sp_fid_8021d_get(mlxsw_sp, bridge_device->dev->ifindex);
 	if (IS_ERR(fid)) {
 		NL_SET_ERR_MSG_MOD(extack, "Failed to create 802.1D FID");
@@ -2933,10 +2937,13 @@ static void __mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp,
 					  const struct net_device *vxlan_dev)
 {
 	struct vxlan_dev *vxlan = netdev_priv(vxlan_dev);
+	const struct vxlan_config *cfg;
 	struct mlxsw_sp_fid *fid;
 
+	cfg = rtnl_dereference(vxlan->cfg);
+
 	/* If the VxLAN device is down, then the FID does not have a VNI */
-	fid = mlxsw_sp_fid_lookup_by_vni(mlxsw_sp, vxlan->cfg.vni);
+	fid = mlxsw_sp_fid_lookup_by_vni(mlxsw_sp, cfg->vni);
 	if (!fid)
 		return;
 
@@ -3029,11 +3036,13 @@ static void mlxsw_sp_fdb_vxlan_call_notifiers(struct net_device *dev,
 	struct switchdev_notifier_vxlan_fdb_info info;
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	enum switchdev_notifier_type type;
+	const struct vxlan_config *cfg;
 
+	cfg = rtnl_dereference(vxlan->cfg);
 	type = adding ? SWITCHDEV_VXLAN_FDB_ADD_TO_BRIDGE :
 			SWITCHDEV_VXLAN_FDB_DEL_TO_BRIDGE;
 	mlxsw_sp_switchdev_addr_vxlan_convert(proto, addr, &info.remote_ip);
-	info.remote_port = vxlan->cfg.dst_port;
+	info.remote_port = cfg->dst_port;
 	info.remote_vni = vni;
 	info.remote_ifindex = 0;
 	ether_addr_copy(info.eth_addr, mac);
@@ -3236,8 +3245,10 @@ __mlxsw_sp_fdb_notify_mac_uc_tunnel_process(struct mlxsw_sp *mlxsw_sp,
 
 	if (adding && netif_is_vxlan(dev)) {
 		struct vxlan_dev *vxlan = netdev_priv(dev);
+		const struct vxlan_config *cfg;
 
-		if (!(vxlan->cfg.flags & VXLAN_F_LEARN))
+		cfg = rtnl_dereference(vxlan->cfg);
+		if (!(cfg->flags & VXLAN_F_LEARN))
 			return -EINVAL;
 	}
 
@@ -3722,9 +3733,11 @@ mlxsw_sp_switchdev_vxlan_work_prepare(struct mlxsw_sp_switchdev_event_work *
 {
 	struct vxlan_dev *vxlan = netdev_priv(switchdev_work->dev);
 	struct switchdev_notifier_vxlan_fdb_info *vxlan_fdb_info;
-	struct vxlan_config *cfg = &vxlan->cfg;
+	const struct vxlan_config *cfg;
 	struct netlink_ext_ack *extack;
 
+	cfg = rcu_dereference_rtnl(vxlan->cfg);
+
 	extack = switchdev_notifier_info_to_extack(info);
 	vxlan_fdb_info = container_of(info,
 				      struct switchdev_notifier_vxlan_fdb_info,
@@ -3851,11 +3864,15 @@ mlxsw_sp_switchdev_vxlan_vlan_add(struct mlxsw_sp *mlxsw_sp,
 				  struct netlink_ext_ack *extack)
 {
 	struct vxlan_dev *vxlan = netdev_priv(vxlan_dev);
-	__be32 vni = vxlan->cfg.vni;
+	const struct vxlan_config *cfg;
 	struct mlxsw_sp_fid *fid;
 	u16 old_vid;
+	__be32 vni;
 	int err;
 
+	cfg = rtnl_dereference(vxlan->cfg);
+	vni = cfg->vni;
+
 	/* We cannot have the same VLAN as PVID and egress untagged on multiple
 	 * VxLAN devices. Note that we get this notification before the VLAN is
 	 * actually added to the bridge's database, so it is not possible for
@@ -3935,12 +3952,16 @@ mlxsw_sp_switchdev_vxlan_vlan_del(struct mlxsw_sp *mlxsw_sp,
 				  const struct net_device *vxlan_dev, u16 vid)
 {
 	struct vxlan_dev *vxlan = netdev_priv(vxlan_dev);
-	__be32 vni = vxlan->cfg.vni;
+	const struct vxlan_config *cfg;
 	struct mlxsw_sp_fid *fid;
+	__be32 vni;
 
 	if (!netif_running(vxlan_dev))
 		return;
 
+	cfg = rtnl_dereference(vxlan->cfg);
+	vni = cfg->vni;
+
 	fid = mlxsw_sp_fid_lookup_by_vni(mlxsw_sp, vni);
 	if (!fid)
 		return;
diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
index 347245cc1de4e..63b707deb7fd0 100644
--- a/drivers/net/vxlan/vxlan_core.c
+++ b/drivers/net/vxlan/vxlan_core.c
@@ -110,20 +110,23 @@ static struct vxlan_dev *vxlan_vs_find_vni(struct vxlan_sock *vs,
 		vni = 0;
 
 	hlist_for_each_entry_rcu(node, vni_head(vs, vni), hlist) {
+		const struct vxlan_config *cfg;
+
 		if (!node->vxlan)
 			continue;
+
+		cfg = rcu_dereference(node->vxlan->cfg);
+
 		vnode = NULL;
-		if (node->vxlan->cfg.flags & VXLAN_F_VNIFILTER) {
+		if (cfg->flags & VXLAN_F_VNIFILTER) {
 			vnode = vxlan_vnifilter_lookup(node->vxlan, vni);
 			if (!vnode)
 				continue;
-		} else if (node->vxlan->default_dst.remote_vni != vni) {
+		} else if (cfg->vni != vni) {
 			continue;
 		}
 
 		if (IS_ENABLED(CONFIG_IPV6)) {
-			const struct vxlan_config *cfg = &node->vxlan->cfg;
-
 			if ((cfg->flags & VXLAN_F_IPV6_LINKLOCAL) &&
 			    cfg->remote_ifindex != ifindex)
 				continue;
@@ -157,6 +160,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
 			  u32 portid, u32 seq, int type, unsigned int flags,
 			  const struct vxlan_rdst *rdst)
 {
+	const struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan->cfg);
 	unsigned long now = jiffies;
 	struct nda_cacheinfo ci;
 	bool send_ip, send_eth;
@@ -216,10 +220,10 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
 			goto nla_put_failure;
 
 		if (rdst->remote_port &&
-		    rdst->remote_port != vxlan->cfg.dst_port &&
+		    rdst->remote_port != cfg->dst_port &&
 		    nla_put_be16(skb, NDA_PORT, rdst->remote_port))
 			goto nla_put_failure;
-		if (rdst->remote_vni != vxlan->default_dst.remote_vni &&
+		if (rdst->remote_vni != cfg->vni &&
 		    nla_put_u32(skb, NDA_VNI, be32_to_cpu(rdst->remote_vni)))
 			goto nla_put_failure;
 		if (rdst->remote_ifindex &&
@@ -227,7 +231,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
 			goto nla_put_failure;
 	}
 
-	if ((vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA) && fdb->key.vni &&
+	if ((cfg->flags & VXLAN_F_COLLECT_METADATA) && fdb->key.vni &&
 	    nla_put_u32(skb, NDA_SRC_VNI,
 			be32_to_cpu(fdb->key.vni)))
 		goto nla_put_failure;
@@ -377,14 +381,15 @@ static void vxlan_fdb_miss(struct vxlan_dev *vxlan, const u8 eth_addr[ETH_ALEN])
 
 /* Look up Ethernet address in forwarding table */
 static struct vxlan_fdb *vxlan_find_mac_rcu(struct vxlan_dev *vxlan,
+					    const struct vxlan_config *cfg,
 					    const u8 *mac, __be32 vni)
 {
 	struct vxlan_fdb_key key;
 
 	memset(&key, 0, sizeof(key));
 	memcpy(key.eth_addr, mac, sizeof(key.eth_addr));
-	if (!(vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA))
-		key.vni = vxlan->default_dst.remote_vni;
+	if (!(cfg->flags & VXLAN_F_COLLECT_METADATA))
+		key.vni = cfg->vni;
 	else
 		key.vni = vni;
 
@@ -393,11 +398,12 @@ static struct vxlan_fdb *vxlan_find_mac_rcu(struct vxlan_dev *vxlan,
 }
 
 static struct vxlan_fdb *vxlan_find_mac_tx(struct vxlan_dev *vxlan,
+					   const struct vxlan_config *cfg,
 					   const u8 *mac, __be32 vni)
 {
 	struct vxlan_fdb *f;
 
-	f = vxlan_find_mac_rcu(vxlan, mac, vni);
+	f = vxlan_find_mac_rcu(vxlan, cfg, mac, vni);
 	if (f) {
 		unsigned long now = jiffies;
 
@@ -416,7 +422,7 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,
 	lockdep_assert_held_once(&vxlan->hash_lock);
 
 	rcu_read_lock();
-	f = vxlan_find_mac_rcu(vxlan, mac, vni);
+	f = vxlan_find_mac_rcu(vxlan, rcu_dereference(vxlan->cfg), mac, vni);
 	rcu_read_unlock();
 
 	return f;
@@ -457,7 +463,7 @@ int vxlan_fdb_find_uc(struct net_device *dev, const u8 *mac, __be32 vni,
 
 	rcu_read_lock();
 
-	f = vxlan_find_mac_rcu(vxlan, eth_addr, vni);
+	f = vxlan_find_mac_rcu(vxlan, rcu_dereference(vxlan->cfg), eth_addr, vni);
 	if (f)
 		rdst = first_remote_rcu(f);
 	if (!rdst) {
@@ -798,6 +804,7 @@ static int vxlan_fdb_nh_update(struct vxlan_dev *vxlan, struct vxlan_fdb *fdb,
 			       u32 nhid, struct netlink_ext_ack *extack)
 {
 	struct nexthop *old_nh = rtnl_dereference(fdb->nh);
+	const struct vxlan_config *cfg;
 	struct nexthop *nh;
 	int err = -EINVAL;
 
@@ -826,7 +833,8 @@ static int vxlan_fdb_nh_update(struct vxlan_dev *vxlan, struct vxlan_fdb *fdb,
 	}
 
 	/* check nexthop group family */
-	switch (vxlan->default_dst.remote_ip.sa.sa_family) {
+	cfg = rtnl_dereference(vxlan->cfg);
+	switch (cfg->remote_ip.sa.sa_family) {
 	case AF_INET:
 		if (!nexthop_has_v4(nh)) {
 			err = -EAFNOSUPPORT;
@@ -863,12 +871,13 @@ int vxlan_fdb_create(struct vxlan_dev *vxlan,
 		     u32 nhid, struct vxlan_fdb **fdb,
 		     struct netlink_ext_ack *extack)
 {
+	const struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan->cfg);
 	struct vxlan_rdst *rd = NULL;
 	struct vxlan_fdb *f;
 	int rc;
 
-	if (vxlan->cfg.addrmax &&
-	    vxlan->addrcnt >= vxlan->cfg.addrmax)
+	if (cfg->addrmax &&
+	    vxlan->addrcnt >= cfg->addrmax)
 		return -ENOSPC;
 
 	netdev_dbg(vxlan->dev, "add %pM -> %pIS\n", mac, ip);
@@ -1154,6 +1163,7 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,
 			   __be32 *vni, u32 *ifindex, u32 *nhid,
 			   struct netlink_ext_ack *extack)
 {
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
 	struct net *net = dev_net(vxlan->dev);
 	int err;
 
@@ -1170,7 +1180,7 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,
 			return err;
 		}
 	} else {
-		union vxlan_addr *remote = &vxlan->default_dst.remote_ip;
+		const union vxlan_addr *remote = &cfg->remote_ip;
 
 		if (remote->sa.sa_family == AF_INET) {
 			ip->sin.sin_addr.s_addr = htonl(INADDR_ANY);
@@ -1190,7 +1200,7 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,
 		}
 		*port = nla_get_be16(tb[NDA_PORT]);
 	} else {
-		*port = vxlan->cfg.dst_port;
+		*port = cfg->dst_port;
 	}
 
 	if (tb[NDA_VNI]) {
@@ -1200,7 +1210,7 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,
 		}
 		*vni = cpu_to_be32(nla_get_u32(tb[NDA_VNI]));
 	} else {
-		*vni = vxlan->default_dst.remote_vni;
+		*vni = cfg->vni;
 	}
 
 	if (tb[NDA_SRC_VNI]) {
@@ -1210,7 +1220,7 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,
 		}
 		*src_vni = cpu_to_be32(nla_get_u32(tb[NDA_SRC_VNI]));
 	} else {
-		*src_vni = vxlan->default_dst.remote_vni;
+		*src_vni = cfg->vni;
 	}
 
 	if (tb[NDA_IFINDEX]) {
@@ -1241,6 +1251,7 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
 			 const unsigned char *addr, u16 vid, u16 flags,
 			 bool *notified, struct netlink_ext_ack *extack)
 {
+	const struct vxlan_config *cfg;
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	/* struct net *net = dev_net(vxlan->dev); */
 	union vxlan_addr ip;
@@ -1268,7 +1279,8 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
 		return -EINVAL;
 	}
 
-	if (vxlan->default_dst.remote_ip.sa.sa_family != ip.sa.sa_family)
+	cfg = rtnl_dereference(vxlan->cfg);
+	if (cfg->remote_ip.sa.sa_family != ip.sa.sa_family)
 		return -EAFNOSUPPORT;
 
 	spin_lock_bh(&vxlan->hash_lock);
@@ -1405,18 +1417,21 @@ static int vxlan_fdb_get(struct sk_buff *skb,
 			 struct netlink_ext_ack *extack)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
+	const struct vxlan_config *cfg;
 	struct vxlan_fdb *f;
 	__be32 vni;
 	int err;
 
+	cfg = rcu_dereference_rtnl(vxlan->cfg);
+
 	if (tb[NDA_VNI])
 		vni = cpu_to_be32(nla_get_u32(tb[NDA_VNI]));
 	else
-		vni = vxlan->default_dst.remote_vni;
+		vni = cfg->vni;
 
 	rcu_read_lock();
 
-	f = vxlan_find_mac_rcu(vxlan, addr, vni);
+	f = vxlan_find_mac_rcu(vxlan, cfg, addr, vni);
 	if (!f) {
 		NL_SET_ERR_MSG(extack, "Fdb entry not found");
 		err = -ENOENT;
@@ -1434,6 +1449,7 @@ static int vxlan_fdb_get(struct sk_buff *skb,
  * and Tunnel endpoint.
  */
 static enum skb_drop_reason vxlan_snoop(struct net_device *dev,
+					const struct vxlan_config *cfg,
 					union vxlan_addr *src_ip,
 					const u8 *src_mac, u32 src_ifindex,
 					__be32 vni)
@@ -1452,7 +1468,7 @@ static enum skb_drop_reason vxlan_snoop(struct net_device *dev,
 		ifindex = src_ifindex;
 #endif
 
-	f = vxlan_find_mac_rcu(vxlan, src_mac, vni);
+	f = vxlan_find_mac_rcu(vxlan, cfg, src_mac, vni);
 	if (likely(f)) {
 		struct vxlan_rdst *rdst = first_remote_rcu(f);
 		unsigned long now = jiffies;
@@ -1488,9 +1504,9 @@ static enum skb_drop_reason vxlan_snoop(struct net_device *dev,
 			vxlan_fdb_update(vxlan, src_mac, src_ip,
 					 NUD_REACHABLE,
 					 NLM_F_EXCL|NLM_F_CREATE,
-					 vxlan->cfg.dst_port,
+					 cfg->dst_port,
 					 vni,
-					 vxlan->default_dst.remote_vni,
+					 cfg->vni,
 					 ifindex, NTF_SELF, 0, true, NULL);
 		spin_unlock(&vxlan->hash_lock);
 	}
@@ -1518,6 +1534,7 @@ static bool __vxlan_sock_release_prep(struct vxlan_sock *vs)
 
 static void vxlan_sock_release(struct vxlan_dev *vxlan)
 {
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
 	struct vxlan_sock *sock4 = rtnl_dereference(vxlan->vn4_sock);
 #if IS_ENABLED(CONFIG_IPV6)
 	struct vxlan_sock *sock6 = rtnl_dereference(vxlan->vn6_sock);
@@ -1527,7 +1544,7 @@ static void vxlan_sock_release(struct vxlan_dev *vxlan)
 
 	RCU_INIT_POINTER(vxlan->vn4_sock, NULL);
 
-	if (vxlan->cfg.flags & VXLAN_F_VNIFILTER)
+	if (cfg->flags & VXLAN_F_VNIFILTER)
 		vxlan_vs_del_vnigrp(vxlan);
 	else
 		vxlan_vs_del_dev(vxlan);
@@ -1598,6 +1615,7 @@ static void vxlan_parse_gbp_hdr(struct sk_buff *skb, u32 vxflags,
 }
 
 static enum skb_drop_reason vxlan_set_mac(struct vxlan_dev *vxlan,
+					  const struct vxlan_config *cfg,
 					  struct vxlan_sock *vs,
 					  struct sk_buff *skb, __be32 vni)
 {
@@ -1623,10 +1641,10 @@ static enum skb_drop_reason vxlan_set_mac(struct vxlan_dev *vxlan,
 #endif
 	}
 
-	if (!(vxlan->cfg.flags & VXLAN_F_LEARN))
+	if (!(cfg->flags & VXLAN_F_LEARN))
 		return SKB_NOT_DROPPED_YET;
 
-	return vxlan_snoop(skb->dev, &saddr, eth_hdr(skb)->h_source,
+	return vxlan_snoop(skb->dev, cfg, &saddr, eth_hdr(skb)->h_source,
 			   ifindex, vni);
 }
 
@@ -1657,18 +1675,21 @@ static bool vxlan_ecn_decapsulate(struct vxlan_sock *vs, void *oiph,
 static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 {
 	struct vxlan_vni_node *vninode = NULL;
-	const struct vxlanhdr *vh;
-	struct vxlan_dev *vxlan;
-	struct vxlan_sock *vs;
-	struct vxlan_metadata _md;
-	struct vxlan_metadata *md = &_md;
 	__be16 protocol = htons(ETH_P_TEB);
+	const struct vxlan_config *cfg;
 	enum skb_drop_reason reason;
+	const struct vxlanhdr *vh;
+	struct vxlan_metadata *md;
+	struct vxlan_metadata _md;
+	struct vxlan_dev *vxlan;
 	bool raw_proto = false;
-	void *oiph;
+	struct vxlan_sock *vs;
 	__be32 vni = 0;
+	void *oiph;
 	int nh;
 
+	md = &_md;
+
 	/* Need UDP and VXLAN header to be present */
 	reason = pskb_may_pull_reason(skb, VXLAN_HLEN);
 	if (reason)
@@ -1696,8 +1717,10 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 		goto drop;
 	}
 
-	if (vh->vx_flags & vxlan->cfg.reserved_bits.vx_flags ||
-	    vh->vx_vni & vxlan->cfg.reserved_bits.vx_vni) {
+	cfg = rcu_dereference(vxlan->cfg);
+
+	if (vh->vx_flags & cfg->reserved_bits.vx_flags ||
+	    vh->vx_vni & cfg->reserved_bits.vx_vni) {
 		/* If the header uses bits besides those enabled by the
 		 * netdevice configuration, treat this as a malformed packet.
 		 * This behavior diverges from VXLAN RFC (RFC7348) which
@@ -1709,12 +1732,12 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 		reason = SKB_DROP_REASON_VXLAN_INVALID_HDR;
 		DEV_STATS_INC(vxlan->dev, rx_frame_errors);
 		DEV_STATS_INC(vxlan->dev, rx_errors);
-		vxlan_vnifilter_count(vxlan, vni, vninode,
+		vxlan_vnifilter_count(vxlan, cfg, vni, vninode,
 				      VXLAN_VNI_STATS_RX_ERRORS, 0);
 		goto drop;
 	}
 
-	if (vxlan->cfg.flags & VXLAN_F_GPE) {
+	if (cfg->flags & VXLAN_F_GPE) {
 		if (!vxlan_parse_gpe_proto(vh, &protocol))
 			goto drop;
 		raw_proto = true;
@@ -1726,8 +1749,8 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 		goto drop;
 	}
 
-	if (vxlan->cfg.flags & VXLAN_F_REMCSUM_RX) {
-		reason = vxlan_remcsum(skb, vxlan->cfg.flags);
+	if (cfg->flags & VXLAN_F_REMCSUM_RX) {
+		reason = vxlan_remcsum(skb, cfg->flags);
 		if (unlikely(reason))
 			goto drop;
 	}
@@ -1752,14 +1775,14 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 		memset(md, 0, sizeof(*md));
 	}
 
-	if (vxlan->cfg.flags & VXLAN_F_GBP)
-		vxlan_parse_gbp_hdr(skb, vxlan->cfg.flags, md);
+	if (cfg->flags & VXLAN_F_GBP)
+		vxlan_parse_gbp_hdr(skb, cfg->flags, md);
 	/* Note that GBP and GPE can never be active together. This is
 	 * ensured in vxlan_dev_configure.
 	 */
 
 	if (!raw_proto) {
-		reason = vxlan_set_mac(vxlan, vs, skb, vni);
+		reason = vxlan_set_mac(vxlan, cfg, vs, skb, vni);
 		if (reason)
 			goto drop;
 	} else {
@@ -1780,7 +1803,7 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 	if (reason) {
 		DEV_STATS_INC(vxlan->dev, rx_length_errors);
 		DEV_STATS_INC(vxlan->dev, rx_errors);
-		vxlan_vnifilter_count(vxlan, vni, vninode,
+		vxlan_vnifilter_count(vxlan, cfg, vni, vninode,
 				      VXLAN_VNI_STATS_RX_ERRORS, 0);
 		goto drop;
 	}
@@ -1792,7 +1815,7 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 		reason = SKB_DROP_REASON_IP_TUNNEL_ECN;
 		DEV_STATS_INC(vxlan->dev, rx_frame_errors);
 		DEV_STATS_INC(vxlan->dev, rx_errors);
-		vxlan_vnifilter_count(vxlan, vni, vninode,
+		vxlan_vnifilter_count(vxlan, cfg, vni, vninode,
 				      VXLAN_VNI_STATS_RX_ERRORS, 0);
 		goto drop;
 	}
@@ -1802,14 +1825,15 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 	if (unlikely(!(vxlan->dev->flags & IFF_UP))) {
 		rcu_read_unlock();
 		dev_dstats_rx_dropped(vxlan->dev);
-		vxlan_vnifilter_count(vxlan, vni, vninode,
+		vxlan_vnifilter_count(vxlan, cfg, vni, vninode,
 				      VXLAN_VNI_STATS_RX_DROPS, 0);
 		reason = SKB_DROP_REASON_DEV_READY;
 		goto drop;
 	}
 
 	dev_dstats_rx_add(vxlan->dev, skb->len);
-	vxlan_vnifilter_count(vxlan, vni, vninode, VXLAN_VNI_STATS_RX, skb->len);
+	vxlan_vnifilter_count(vxlan, cfg, vni, vninode, VXLAN_VNI_STATS_RX,
+			      skb->len);
 	gro_cells_receive(&vxlan->gro_cells, skb);
 
 	rcu_read_unlock();
@@ -1850,7 +1874,8 @@ static int vxlan_err_lookup(struct sock *sk, struct sk_buff *skb)
 	return 0;
 }
 
-static int arp_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
+static int arp_reduce(struct net_device *dev, struct sk_buff *skb,
+		      const struct vxlan_config *cfg, __be32 vni)
 {
 	struct neigh_table *tbl = arp_table(dev_net(dev));
 	struct vxlan_dev *vxlan = netdev_priv(dev);
@@ -1864,7 +1889,7 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
 
 	if (!pskb_network_may_pull(skb, arp_hdr_len(dev))) {
 		dev_dstats_tx_dropped(dev);
-		vxlan_vnifilter_count(vxlan, vni, NULL,
+		vxlan_vnifilter_count(vxlan, cfg, vni, NULL,
 				      VXLAN_VNI_STATS_TX_DROPS, 0);
 		goto out;
 	}
@@ -1905,7 +1930,7 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
 		neigh_ha_snapshot(ha, n, n->dev);
 
 		rcu_read_lock();
-		f = vxlan_find_mac_tx(vxlan, ha, vni);
+		f = vxlan_find_mac_tx(vxlan, cfg, ha, vni);
 		if (f)
 			rdst = first_remote_rcu(f);
 		if (rdst && vxlan_addr_any(&rdst->remote_ip)) {
@@ -1931,11 +1956,11 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
 
 		if (netif_rx(reply) == NET_RX_DROP) {
 			dev_dstats_rx_dropped(dev);
-			vxlan_vnifilter_count(vxlan, vni, NULL,
+			vxlan_vnifilter_count(vxlan, cfg, vni, NULL,
 					      VXLAN_VNI_STATS_RX_DROPS, 0);
 		}
 
-	} else if (vxlan->cfg.flags & VXLAN_F_L3MISS) {
+	} else if (cfg->flags & VXLAN_F_L3MISS) {
 		union vxlan_addr ipa = {
 			.sin.sin_addr.s_addr = tip,
 			.sin.sin_family = AF_INET,
@@ -2043,7 +2068,8 @@ static struct sk_buff *vxlan_na_create(struct sk_buff *request,
 	return reply;
 }
 
-static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
+static int neigh_reduce(struct net_device *dev, struct sk_buff *skb,
+			const struct vxlan_config *cfg, __be32 vni)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	const struct in6_addr *daddr;
@@ -2077,7 +2103,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
 		}
 
 		neigh_ha_snapshot(ha, n, n->dev);
-		f = vxlan_find_mac_tx(vxlan, ha, vni);
+		f = vxlan_find_mac_tx(vxlan, cfg, ha, vni);
 		if (f)
 			rdst = first_remote_rcu(f);
 		if (rdst && vxlan_addr_any(&rdst->remote_ip)) {
@@ -2096,10 +2122,10 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
 
 		if (netif_rx(reply) == NET_RX_DROP) {
 			dev_dstats_rx_dropped(dev);
-			vxlan_vnifilter_count(vxlan, vni, NULL,
+			vxlan_vnifilter_count(vxlan, cfg, vni, NULL,
 					      VXLAN_VNI_STATS_RX_DROPS, 0);
 		}
-	} else if (vxlan->cfg.flags & VXLAN_F_L3MISS) {
+	} else if (cfg->flags & VXLAN_F_L3MISS) {
 		union vxlan_addr ipa = {
 			.sin6.sin6_addr = msg->target,
 			.sin6.sin6_family = AF_INET6,
@@ -2115,9 +2141,9 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
 }
 #endif
 
-static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
+static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb,
+			       const struct vxlan_config *cfg)
 {
-	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct neigh_table *tbl;
 	struct neighbour *n;
 
@@ -2136,7 +2162,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
 		tbl = arp_table(dev_net(dev));
 		pip = ip_hdr(skb);
 		n = neigh_lookup(tbl, &pip->daddr, dev);
-		if (!n && (vxlan->cfg.flags & VXLAN_F_L3MISS)) {
+		if (!n && (cfg->flags & VXLAN_F_L3MISS)) {
 			union vxlan_addr ipa = {
 				.sin.sin_addr.s_addr = pip->daddr,
 				.sin.sin_family = AF_INET,
@@ -2164,7 +2190,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
 		tbl = nd_table(dev_net(dev));
 		pip6 = ipv6_hdr(skb);
 		n = neigh_lookup(tbl, &pip6->daddr, dev);
-		if (!n && (vxlan->cfg.flags & VXLAN_F_L3MISS)) {
+		if (!n && (cfg->flags & VXLAN_F_L3MISS)) {
 			union vxlan_addr ipa = {
 				.sin6.sin6_addr = pip6->daddr,
 				.sin6.sin6_family = AF_INET6,
@@ -2282,20 +2308,28 @@ static int vxlan_build_skb(struct sk_buff *skb, struct dst_entry *dst,
 
 /* Bypass encapsulation if the destination is local */
 static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
-			       struct vxlan_dev *dst_vxlan, __be32 vni,
-			       bool snoop)
+			       struct vxlan_dev *dst_vxlan,
+			       const struct vxlan_config *src_cfg,
+			       __be32 vni, bool snoop)
 {
+	const struct vxlan_config *dst_cfg;
 	union vxlan_addr loopback;
-	union vxlan_addr *remote_ip = &dst_vxlan->default_dst.remote_ip;
 	unsigned int len = skb->len;
-	struct net_device *dev;
+	struct net_device *dev = dst_vxlan->dev;
 
 	skb->pkt_type = PACKET_HOST;
 	skb->encapsulation = 0;
-	skb->dev = dst_vxlan->dev;
+	skb->dev = dev;
 	__skb_pull(skb, skb_network_offset(skb));
 
-	if (remote_ip->sa.sa_family == AF_INET) {
+	rcu_read_lock();
+	dst_cfg = rcu_dereference(dst_vxlan->cfg);
+	if (unlikely(!(dev->flags & IFF_UP))) {
+		kfree_skb_reason(skb, SKB_DROP_REASON_DEV_READY);
+		goto drop;
+	}
+
+	if (dst_cfg->remote_ip.sa.sa_family == AF_INET) {
 		loopback.sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 		loopback.sa.sa_family =  AF_INET;
 #if IS_ENABLED(CONFIG_IPV6)
@@ -2305,27 +2339,20 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
 #endif
 	}
 
-	rcu_read_lock();
-	dev = skb->dev;
-	if (unlikely(!(dev->flags & IFF_UP))) {
-		kfree_skb_reason(skb, SKB_DROP_REASON_DEV_READY);
-		goto drop;
-	}
-
-	if ((dst_vxlan->cfg.flags & VXLAN_F_LEARN) && snoop)
-		vxlan_snoop(dev, &loopback, eth_hdr(skb)->h_source, 0, vni);
+	if ((dst_cfg->flags & VXLAN_F_LEARN) && snoop)
+		vxlan_snoop(dev, dst_cfg, &loopback, eth_hdr(skb)->h_source, 0, vni);
 
 	dev_dstats_tx_add(src_vxlan->dev, len);
-	vxlan_vnifilter_count(src_vxlan, vni, NULL, VXLAN_VNI_STATS_TX, len);
+	vxlan_vnifilter_count(src_vxlan, src_cfg, vni, NULL, VXLAN_VNI_STATS_TX, len);
 
 	if (__netif_rx(skb) == NET_RX_SUCCESS) {
 		dev_dstats_rx_add(dst_vxlan->dev, len);
-		vxlan_vnifilter_count(dst_vxlan, vni, NULL, VXLAN_VNI_STATS_RX,
+		vxlan_vnifilter_count(dst_vxlan, dst_cfg, vni, NULL, VXLAN_VNI_STATS_RX,
 				      len);
 	} else {
 drop:
 		dev_dstats_rx_dropped(dev);
-		vxlan_vnifilter_count(dst_vxlan, vni, NULL,
+		vxlan_vnifilter_count(dst_vxlan, dst_cfg, vni, NULL,
 				      VXLAN_VNI_STATS_RX_DROPS, 0);
 	}
 	rcu_read_unlock();
@@ -2333,6 +2360,7 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
 
 static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev,
 				 struct vxlan_dev *vxlan,
+				 const struct vxlan_config *cfg,
 				 int addr_family,
 				 __be16 dst_port, int dst_ifindex, __be32 vni,
 				 struct dst_entry *dst,
@@ -2348,22 +2376,22 @@ static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev,
 	/* Bypass encapsulation if the destination is local */
 	if (rt_flags & RTCF_LOCAL &&
 	    !(rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) &&
-	    vxlan->cfg.flags & VXLAN_F_LOCALBYPASS) {
+	    cfg->flags & VXLAN_F_LOCALBYPASS) {
 		struct vxlan_dev *dst_vxlan;
 
 		dst_release(dst);
 		dst_vxlan = vxlan_find_vni(vxlan->net, dst_ifindex, vni,
 					   addr_family, dst_port,
-					   vxlan->cfg.flags);
+					   cfg->flags);
 		if (!dst_vxlan) {
 			DEV_STATS_INC(dev, tx_errors);
-			vxlan_vnifilter_count(vxlan, vni, NULL,
+			vxlan_vnifilter_count(vxlan, cfg, vni, NULL,
 					      VXLAN_VNI_STATS_TX_ERRORS, 0);
 			kfree_skb_reason(skb, SKB_DROP_REASON_VXLAN_VNI_NOT_FOUND);
 
 			return -ENOENT;
 		}
-		vxlan_encap_bypass(skb, vxlan, dst_vxlan, vni, true);
+		vxlan_encap_bypass(skb, vxlan, dst_vxlan, cfg, vni, true);
 		return 1;
 	}
 
@@ -2371,30 +2399,35 @@ static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev,
 }
 
 void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
+		    const struct vxlan_config *cfg,
 		    __be32 default_vni, struct vxlan_rdst *rdst, bool did_rsc)
 {
+	unsigned int pkt_len = skb->len;
+	struct vxlan_metadata _md = {};
+	__be16 src_port = 0, dst_port;
+	struct dst_entry *ndst = NULL;
+	enum skb_drop_reason reason;
 	struct dst_cache *dst_cache;
+	const struct iphdr *old_iph;
 	struct ip_tunnel_info *info;
 	struct ip_tunnel_key *pkey;
+	struct vxlan_metadata *md;
 	struct ip_tunnel_key key;
-	struct vxlan_dev *vxlan = netdev_priv(dev);
-	const struct iphdr *old_iph;
-	struct vxlan_metadata _md = {};
-	struct vxlan_metadata *md = &_md;
-	unsigned int pkt_len = skb->len;
-	__be16 src_port = 0, dst_port;
-	struct dst_entry *ndst = NULL;
+	struct vxlan_dev *vxlan;
+	u32 flags = cfg->flags;
+	bool udp_sum = false;
+	bool no_eth_encap;
 	int addr_family;
+	bool use_cache;
+	__be32 vni = 0;
 	__u8 tos, ttl;
 	int ifindex;
 	int err = 0;
-	u32 flags = vxlan->cfg.flags;
-	bool use_cache;
-	bool udp_sum = false;
-	bool xnet = !net_eq(vxlan->net, dev_net(vxlan->dev));
-	enum skb_drop_reason reason;
-	bool no_eth_encap;
-	__be32 vni = 0;
+	bool xnet;
+
+	vxlan = netdev_priv(dev);
+	xnet = !net_eq(vxlan->net, dev_net(vxlan->dev));
+	md = &_md;
 
 	no_eth_encap = flags & VXLAN_F_GPE && skb->protocol != htons(ETH_P_TEB);
 	reason = skb_vlan_inet_prepare(skb, no_eth_encap);
@@ -2414,23 +2447,23 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		if (vxlan_addr_any(&rdst->remote_ip)) {
 			if (did_rsc) {
 				/* short-circuited back to local bridge */
-				vxlan_encap_bypass(skb, vxlan, vxlan,
+				vxlan_encap_bypass(skb, vxlan, vxlan, cfg,
 						   default_vni, true);
 				return;
 			}
 			goto drop;
 		}
 
-		addr_family = vxlan->cfg.saddr.sa.sa_family;
-		dst_port = rdst->remote_port ? rdst->remote_port : vxlan->cfg.dst_port;
+		addr_family = cfg->saddr.sa.sa_family;
+		dst_port = rdst->remote_port ? rdst->remote_port : cfg->dst_port;
 		vni = (rdst->remote_vni) ? : default_vni;
 		ifindex = rdst->remote_ifindex;
 
 		if (addr_family == AF_INET) {
-			key.u.ipv4.src = vxlan->cfg.saddr.sin.sin_addr.s_addr;
+			key.u.ipv4.src = cfg->saddr.sin.sin_addr.s_addr;
 			key.u.ipv4.dst = rdst->remote_ip.sin.sin_addr.s_addr;
 		} else {
-			key.u.ipv6.src = vxlan->cfg.saddr.sin6.sin6_addr;
+			key.u.ipv6.src = cfg->saddr.sin6.sin6_addr;
 			key.u.ipv6.dst = rdst->remote_ip.sin6.sin6_addr;
 		}
 
@@ -2439,11 +2472,11 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		if (flags & VXLAN_F_TTL_INHERIT) {
 			ttl = ip_tunnel_get_ttl(old_iph, skb);
 		} else {
-			ttl = vxlan->cfg.ttl;
+			ttl = cfg->ttl;
 			if (!ttl && vxlan_addr_multicast(&rdst->remote_ip))
 				ttl = 1;
 		}
-		tos = vxlan->cfg.tos;
+		tos = cfg->tos;
 		if (tos == 1)
 			tos = ip_tunnel_get_dsfield(old_iph, skb);
 		if (tos && !info)
@@ -2454,9 +2487,9 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		else
 			udp_sum = !(flags & VXLAN_F_UDP_ZERO_CSUM6_TX);
 #if IS_ENABLED(CONFIG_IPV6)
-		switch (vxlan->cfg.label_policy) {
+		switch (cfg->label_policy) {
 		case VXLAN_LABEL_FIXED:
-			key.label = vxlan->cfg.label;
+			key.label = cfg->label;
 			break;
 		case VXLAN_LABEL_INHERIT:
 			key.label = ip_tunnel_get_flowlabel(old_iph, skb);
@@ -2474,7 +2507,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		}
 		pkey = &info->key;
 		addr_family = ip_tunnel_info_af(info);
-		dst_port = info->key.tp_dst ? : vxlan->cfg.dst_port;
+		dst_port = info->key.tp_dst ? : cfg->dst_port;
 		vni = tunnel_id_to_key32(info->key.tun_id);
 		ifindex = 0;
 		dst_cache = &info->dst_cache;
@@ -2487,8 +2520,8 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		tos = info->key.tos;
 		udp_sum = test_bit(IP_TUNNEL_CSUM_BIT, info->key.tun_flags);
 	}
-	src_port = udp_flow_src_port(dev_net(dev), skb, vxlan->cfg.port_min,
-				     vxlan->cfg.port_max, true);
+	src_port = udp_flow_src_port(dev_net(dev), skb, cfg->port_min,
+				     cfg->port_max, true);
 
 	rcu_read_lock();
 	if (addr_family == AF_INET) {
@@ -2521,15 +2554,15 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 
 		if (!info) {
 			/* Bypass encapsulation if the destination is local */
-			err = encap_bypass_if_local(skb, dev, vxlan, AF_INET,
+			err = encap_bypass_if_local(skb, dev, vxlan, cfg, AF_INET,
 						    dst_port, ifindex, vni,
 						    &rt->dst, rt->rt_flags);
 			if (err)
 				goto out_unlock;
 
-			if (vxlan->cfg.df == VXLAN_DF_SET) {
+			if (cfg->df == VXLAN_DF_SET) {
 				df = htons(IP_DF);
-			} else if (vxlan->cfg.df == VXLAN_DF_INHERIT) {
+			} else if (cfg->df == VXLAN_DF_INHERIT) {
 				struct ethhdr *eth = eth_hdr(skb);
 
 				if (ntohs(eth->h_proto) == ETH_P_IPV6 ||
@@ -2558,7 +2591,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 				unclone->key.u.ipv4.src = pkey->u.ipv4.dst;
 				unclone->key.u.ipv4.dst = saddr;
 			}
-			vxlan_encap_bypass(skb, vxlan, vxlan, vni, false);
+			vxlan_encap_bypass(skb, vxlan, vxlan, cfg, vni, false);
 			dst_release(ndst);
 			goto out_unlock;
 		}
@@ -2608,7 +2641,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		if (!info) {
 			u32 rt6i_flags = dst_rt6_info(ndst)->rt6i_flags;
 
-			err = encap_bypass_if_local(skb, dev, vxlan, AF_INET6,
+			err = encap_bypass_if_local(skb, dev, vxlan, cfg, AF_INET6,
 						    dst_port, ifindex, vni,
 						    ndst, rt6i_flags);
 			if (err)
@@ -2632,7 +2665,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 				unclone->key.u.ipv6.dst = saddr;
 			}
 
-			vxlan_encap_bypass(skb, vxlan, vxlan, vni, false);
+			vxlan_encap_bypass(skb, vxlan, vxlan, cfg, vni, false);
 			dst_release(ndst);
 			goto out_unlock;
 		}
@@ -2653,14 +2686,14 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 				     ip6cb_flags);
 #endif
 	}
-	vxlan_vnifilter_count(vxlan, vni, NULL, VXLAN_VNI_STATS_TX, pkt_len);
+	vxlan_vnifilter_count(vxlan, cfg, vni, NULL, VXLAN_VNI_STATS_TX, pkt_len);
 out_unlock:
 	rcu_read_unlock();
 	return;
 
 drop:
 	dev_dstats_tx_dropped(dev);
-	vxlan_vnifilter_count(vxlan, vni, NULL, VXLAN_VNI_STATS_TX_DROPS, 0);
+	vxlan_vnifilter_count(vxlan, cfg, vni, NULL, VXLAN_VNI_STATS_TX_DROPS, 0);
 	kfree_skb_reason(skb, reason);
 	return;
 
@@ -2672,11 +2705,12 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		DEV_STATS_INC(dev, tx_carrier_errors);
 	dst_release(ndst);
 	DEV_STATS_INC(dev, tx_errors);
-	vxlan_vnifilter_count(vxlan, vni, NULL, VXLAN_VNI_STATS_TX_ERRORS, 0);
+	vxlan_vnifilter_count(vxlan, cfg, vni, NULL, VXLAN_VNI_STATS_TX_ERRORS, 0);
 	kfree_skb_reason(skb, reason);
 }
 
 static void vxlan_xmit_nh(struct sk_buff *skb, struct net_device *dev,
+			  const struct vxlan_config *cfg,
 			  struct vxlan_fdb *f, __be32 vni, bool did_rsc)
 {
 	struct vxlan_rdst nh_rdst;
@@ -2693,7 +2727,7 @@ static void vxlan_xmit_nh(struct sk_buff *skb, struct net_device *dev,
 	do_xmit = vxlan_fdb_nh_path_select(nh, hash, &nh_rdst);
 
 	if (likely(do_xmit))
-		vxlan_xmit_one(skb, dev, vni, &nh_rdst, did_rsc);
+		vxlan_xmit_one(skb, dev, cfg, vni, &nh_rdst, did_rsc);
 	else
 		goto drop;
 
@@ -2701,15 +2735,15 @@ static void vxlan_xmit_nh(struct sk_buff *skb, struct net_device *dev,
 
 drop:
 	dev_dstats_tx_dropped(dev);
-	vxlan_vnifilter_count(netdev_priv(dev), vni, NULL,
+	vxlan_vnifilter_count(netdev_priv(dev), cfg, vni, NULL,
 			      VXLAN_VNI_STATS_TX_DROPS, 0);
 	dev_kfree_skb(skb);
 }
 
 static netdev_tx_t vxlan_xmit_nhid(struct sk_buff *skb, struct net_device *dev,
-				   u32 nhid, __be32 vni)
+				   u32 nhid, __be32 vni,
+				   const struct vxlan_config *cfg)
 {
-	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct vxlan_rdst nh_rdst;
 	struct nexthop *nh;
 	bool do_xmit;
@@ -2727,11 +2761,11 @@ static netdev_tx_t vxlan_xmit_nhid(struct sk_buff *skb, struct net_device *dev,
 	do_xmit = vxlan_fdb_nh_path_select(nh, hash, &nh_rdst);
 	rcu_read_unlock();
 
-	if (vxlan->cfg.saddr.sa.sa_family != nh_rdst.remote_ip.sa.sa_family)
+	if (cfg->saddr.sa.sa_family != nh_rdst.remote_ip.sa.sa_family)
 		goto drop;
 
 	if (likely(do_xmit))
-		vxlan_xmit_one(skb, dev, vni, &nh_rdst, false);
+		vxlan_xmit_one(skb, dev, cfg, vni, &nh_rdst, false);
 	else
 		goto drop;
 
@@ -2739,7 +2773,7 @@ static netdev_tx_t vxlan_xmit_nhid(struct sk_buff *skb, struct net_device *dev,
 
 drop:
 	dev_dstats_tx_dropped(dev);
-	vxlan_vnifilter_count(netdev_priv(dev), vni, NULL,
+	vxlan_vnifilter_count(netdev_priv(dev), cfg, vni, NULL,
 			      VXLAN_VNI_STATS_TX_DROPS, 0);
 	dev_kfree_skb(skb);
 	return NETDEV_TX_OK;
@@ -2756,34 +2790,47 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct vxlan_rdst *rdst, *fdst = NULL;
 	const struct ip_tunnel_info *info;
+	const struct vxlan_config *cfg;
+	__be32 default_vni;
 	struct vxlan_fdb *f;
 	struct ethhdr *eth;
 	__be32 vni = 0;
-	u32 nhid = 0;
 	bool did_rsc;
+	u32 nhid = 0;
+	u32 flags;
+
+	rcu_read_lock();
+	cfg = rcu_dereference(vxlan->cfg);
+	flags = cfg->flags;
+	default_vni = cfg->vni;
 
 	info = skb_tunnel_info(skb);
 
 	skb_reset_mac_header(skb);
 
-	if (vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA) {
+	if (flags & VXLAN_F_COLLECT_METADATA) {
 		if (info && info->mode & IP_TUNNEL_INFO_BRIDGE &&
 		    info->mode & IP_TUNNEL_INFO_TX) {
 			vni = tunnel_id_to_key32(info->key.tun_id);
 			nhid = info->key.nhid;
 		} else {
 			if (info && info->mode & IP_TUNNEL_INFO_TX)
-				vxlan_xmit_one(skb, dev, vni, NULL, false);
+				vxlan_xmit_one(skb, dev, cfg, vni, NULL, false);
 			else
 				kfree_skb_reason(skb, SKB_DROP_REASON_TUNNEL_TXINFO);
+			rcu_read_unlock();
 			return NETDEV_TX_OK;
 		}
 	}
 
-	if (vxlan->cfg.flags & VXLAN_F_PROXY) {
+	if (flags & VXLAN_F_PROXY) {
 		eth = eth_hdr(skb);
-		if (ntohs(eth->h_proto) == ETH_P_ARP)
-			return arp_reduce(dev, skb, vni);
+		if (ntohs(eth->h_proto) == ETH_P_ARP) {
+			netdev_tx_t res = arp_reduce(dev, skb, cfg, vni);
+
+			rcu_read_unlock();
+			return res;
+		}
 #if IS_ENABLED(CONFIG_IPV6)
 		else if (ntohs(eth->h_proto) == ETH_P_IPV6 &&
 			 pskb_network_may_pull(skb, sizeof(struct ipv6hdr) +
@@ -2792,53 +2839,57 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 			struct nd_msg *m = (struct nd_msg *)(ipv6_hdr(skb) + 1);
 
 			if (m->icmph.icmp6_code == 0 &&
-			    m->icmph.icmp6_type == NDISC_NEIGHBOUR_SOLICITATION)
-				return neigh_reduce(dev, skb, vni);
+			    m->icmph.icmp6_type == NDISC_NEIGHBOUR_SOLICITATION) {
+				netdev_tx_t res = neigh_reduce(dev, skb, cfg, vni);
+
+				rcu_read_unlock();
+				return res;
+			}
 		}
 #endif
 	}
 
-	if (nhid)
-		return vxlan_xmit_nhid(skb, dev, nhid, vni);
+	if (nhid) {
+		netdev_tx_t res = vxlan_xmit_nhid(skb, dev, nhid, vni, cfg);
+
+		rcu_read_unlock();
+		return res;
+	}
 
-	if (vxlan->cfg.flags & VXLAN_F_MDB) {
+	if (test_bit(VXLAN_DEV_F_MDB, &vxlan->flags)) {
 		struct vxlan_mdb_entry *mdb_entry;
 
-		rcu_read_lock();
-		mdb_entry = vxlan_mdb_entry_skb_get(vxlan, skb, vni);
+		mdb_entry = vxlan_mdb_entry_skb_get(vxlan, cfg, skb, vni);
 		if (mdb_entry) {
-			netdev_tx_t ret;
+			netdev_tx_t ret = vxlan_mdb_xmit(vxlan, cfg, mdb_entry, skb);
 
-			ret = vxlan_mdb_xmit(vxlan, mdb_entry, skb);
 			rcu_read_unlock();
 			return ret;
 		}
-		rcu_read_unlock();
 	}
 
 	eth = eth_hdr(skb);
-	rcu_read_lock();
-	f = vxlan_find_mac_tx(vxlan, eth->h_dest, vni);
+	f = vxlan_find_mac_tx(vxlan, cfg, eth->h_dest, vni);
 	did_rsc = false;
 
-	if (f && (f->flags & NTF_ROUTER) && (vxlan->cfg.flags & VXLAN_F_RSC) &&
+	if (f && (f->flags & NTF_ROUTER) && (flags & VXLAN_F_RSC) &&
 	    (ntohs(eth->h_proto) == ETH_P_IP ||
 	     ntohs(eth->h_proto) == ETH_P_IPV6)) {
-		did_rsc = route_shortcircuit(dev, skb);
+		did_rsc = route_shortcircuit(dev, skb, cfg);
 		eth = eth_hdr(skb);
 		if (did_rsc)
-			f = vxlan_find_mac_tx(vxlan, eth->h_dest, vni);
+			f = vxlan_find_mac_tx(vxlan, cfg, eth->h_dest, vni);
 	}
 
 	if (f == NULL) {
-		f = vxlan_find_mac_tx(vxlan, all_zeros_mac, vni);
+		f = vxlan_find_mac_tx(vxlan, cfg, all_zeros_mac, vni);
 		if (f == NULL) {
-			if ((vxlan->cfg.flags & VXLAN_F_L2MISS) &&
+			if ((flags & VXLAN_F_L2MISS) &&
 			    !is_multicast_ether_addr(eth->h_dest))
 				vxlan_fdb_miss(vxlan, eth->h_dest);
 
 			dev_dstats_tx_dropped(dev);
-			vxlan_vnifilter_count(vxlan, vni, NULL,
+			vxlan_vnifilter_count(vxlan, cfg, vni, NULL,
 					      VXLAN_VNI_STATS_TX_DROPS, 0);
 			kfree_skb_reason(skb, SKB_DROP_REASON_NO_TX_TARGET);
 			goto out;
@@ -2846,8 +2897,8 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 	}
 
 	if (rcu_access_pointer(f->nh)) {
-		vxlan_xmit_nh(skb, dev, f,
-			      (vni ? : vxlan->default_dst.remote_vni), did_rsc);
+		vxlan_xmit_nh(skb, dev, cfg, f,
+			      (vni ? : default_vni), did_rsc);
 	} else {
 		list_for_each_entry_rcu(rdst, &f->remotes, list) {
 			struct sk_buff *skb1;
@@ -2858,10 +2909,10 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 			}
 			skb1 = skb_clone(skb, GFP_ATOMIC);
 			if (skb1)
-				vxlan_xmit_one(skb1, dev, vni, rdst, did_rsc);
+				vxlan_xmit_one(skb1, dev, cfg, vni, rdst, did_rsc);
 		}
 		if (fdst)
-			vxlan_xmit_one(skb, dev, vni, fdst, did_rsc);
+			vxlan_xmit_one(skb, dev, cfg, vni, fdst, did_rsc);
 		else
 			kfree_skb_reason(skb, SKB_DROP_REASON_NO_TX_TARGET);
 	}
@@ -2876,12 +2927,15 @@ static void vxlan_cleanup(struct timer_list *t)
 {
 	struct vxlan_dev *vxlan = timer_container_of(vxlan, t, age_timer);
 	unsigned long next_timer = jiffies + FDB_AGE_INTERVAL;
+	const struct vxlan_config *cfg;
 	struct vxlan_fdb *f;
 
 	if (!netif_running(vxlan->dev))
 		return;
 
 	rcu_read_lock();
+	cfg = rcu_dereference(vxlan->cfg);
+
 	hlist_for_each_entry_rcu(f, &vxlan->fdb_list, fdb_node) {
 		unsigned long timeout;
 
@@ -2891,7 +2945,7 @@ static void vxlan_cleanup(struct timer_list *t)
 		if (f->flags & NTF_EXT_LEARNED)
 			continue;
 
-		timeout = READ_ONCE(f->updated) + vxlan->cfg.age_interval * HZ;
+		timeout = READ_ONCE(f->updated) + cfg->age_interval * HZ;
 		if (time_before_eq(timeout, jiffies)) {
 			spin_lock(&vxlan->hash_lock);
 			if (!hlist_unhashed(&f->fdb_node)) {
@@ -2923,10 +2977,14 @@ static void vxlan_vs_del_dev(struct vxlan_dev *vxlan)
 static void vxlan_vs_add_dev(struct vxlan_sock *vs, struct vxlan_dev *vxlan,
 			     struct vxlan_dev_node *node)
 {
-	__be32 vni = vxlan->default_dst.remote_vni;
+	const struct vxlan_config *cfg;
+	__be32 vni;
 
 	ASSERT_RTNL();
 
+	cfg = rtnl_dereference(vxlan->cfg);
+	vni = cfg->vni;
+
 	node->vxlan = vxlan;
 	hlist_add_head_rcu(&node->hlist, vni_head(vs, vni));
 }
@@ -2935,13 +2993,16 @@ static void vxlan_vs_add_dev(struct vxlan_sock *vs, struct vxlan_dev *vxlan,
 static int vxlan_init(struct net_device *dev)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
+	const struct vxlan_config *cfg;
 	int err;
 
+	cfg = rtnl_dereference(vxlan->cfg);
+
 	err = rhashtable_init(&vxlan->fdb_hash_tbl, &vxlan_fdb_rht_params);
 	if (err)
 		return err;
 
-	if (vxlan->cfg.flags & VXLAN_F_VNIFILTER) {
+	if (cfg->flags & VXLAN_F_VNIFILTER) {
 		err = vxlan_vnigroup_init(vxlan);
 		if (err)
 			goto err_rhashtable_destroy;
@@ -2961,7 +3022,7 @@ static int vxlan_init(struct net_device *dev)
 err_gro_cells_destroy:
 	gro_cells_destroy(&vxlan->gro_cells);
 err_vnigroup_uninit:
-	if (vxlan->cfg.flags & VXLAN_F_VNIFILTER)
+	if (cfg->flags & VXLAN_F_VNIFILTER)
 		vxlan_vnigroup_uninit(vxlan);
 err_rhashtable_destroy:
 	rhashtable_destroy(&vxlan->fdb_hash_tbl);
@@ -2971,10 +3032,13 @@ static int vxlan_init(struct net_device *dev)
 static void vxlan_uninit(struct net_device *dev)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
+	const struct vxlan_config *cfg;
+
+	cfg = rtnl_dereference(vxlan->cfg);
 
 	vxlan_mdb_fini(vxlan);
 
-	if (vxlan->cfg.flags & VXLAN_F_VNIFILTER)
+	if (cfg->flags & VXLAN_F_VNIFILTER)
 		vxlan_vnigroup_uninit(vxlan);
 
 	gro_cells_destroy(&vxlan->gro_cells);
@@ -2986,6 +3050,7 @@ static void vxlan_uninit(struct net_device *dev)
 static int vxlan_open(struct net_device *dev)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
+	const struct vxlan_config *cfg;
 	int ret;
 
 	ret = vxlan_sock_add(vxlan);
@@ -2998,7 +3063,8 @@ static int vxlan_open(struct net_device *dev)
 		return ret;
 	}
 
-	if (vxlan->cfg.age_interval)
+	cfg = rtnl_dereference(vxlan->cfg);
+	if (cfg->age_interval)
 		mod_timer(&vxlan->age_timer, jiffies + FDB_AGE_INTERVAL);
 
 	return ret;
@@ -3020,8 +3086,10 @@ struct vxlan_fdb_flush_desc {
 static bool vxlan_fdb_is_default_entry(const struct vxlan_fdb *f,
 				       const struct vxlan_dev *vxlan)
 {
+	const struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan->cfg);
+
 	return is_zero_ether_addr(f->key.eth_addr) &&
-	       f->key.vni == vxlan->cfg.vni;
+	       f->key.vni == cfg->vni;
 }
 
 static bool vxlan_fdb_nhid_matches(const struct vxlan_fdb *f, u32 nhid)
@@ -3238,15 +3306,18 @@ static void vxlan_set_multicast_list(struct net_device *dev)
 static int vxlan_change_mtu(struct net_device *dev, int new_mtu)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
-	struct vxlan_rdst *dst = &vxlan->default_dst;
-	struct net_device *lowerdev = __dev_get_by_index(vxlan->net,
-							 dst->remote_ifindex);
+	const struct vxlan_config *cfg;
+	struct net_device *lowerdev;
+
+	cfg = rtnl_dereference(vxlan->cfg);
+
+	lowerdev = __dev_get_by_index(vxlan->net, cfg->remote_ifindex);
 
 	/* This check is different than dev->max_mtu, because it looks at
 	 * the lowerdev->mtu, rather than the static dev->max_mtu
 	 */
 	if (lowerdev) {
-		int max_mtu = lowerdev->mtu - vxlan_headroom(vxlan->cfg.flags);
+		int max_mtu = lowerdev->mtu - vxlan_headroom(cfg->flags);
 		if (new_mtu > max_mtu)
 			return -EINVAL;
 	}
@@ -3259,11 +3330,14 @@ static int vxlan_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct ip_tunnel_info *info = skb_tunnel_info(skb);
+	const struct vxlan_config *cfg;
 	__be16 sport, dport;
 
-	sport = udp_flow_src_port(dev_net(dev), skb, vxlan->cfg.port_min,
-				  vxlan->cfg.port_max, true);
-	dport = info->key.tp_dst ? : vxlan->cfg.dst_port;
+	cfg = rcu_dereference(vxlan->cfg);
+
+	sport = udp_flow_src_port(dev_net(dev), skb, cfg->port_min,
+				  cfg->port_max, true);
+	dport = info->key.tp_dst ? : cfg->dst_port;
 
 	if (ip_tunnel_info_af(info) == AF_INET) {
 		struct vxlan_sock *sock4 = rcu_dereference(vxlan->vn4_sock);
@@ -3373,6 +3447,15 @@ static void vxlan_offload_rx_ports(struct net_device *dev, bool push)
 	}
 }
 
+static void vxlan_free_dev(struct net_device *dev)
+{
+	struct vxlan_dev *vxlan = netdev_priv(dev);
+	struct vxlan_config *cfg = rcu_dereference_protected(vxlan->cfg, 1);
+
+	RCU_INIT_POINTER(vxlan->cfg, NULL);
+	kfree(cfg);
+}
+
 /* Initialize the device structure. */
 static void vxlan_setup(struct net_device *dev)
 {
@@ -3381,6 +3464,8 @@ static void vxlan_setup(struct net_device *dev)
 	eth_hw_addr_random(dev);
 	ether_setup(dev);
 
+	dev->priv_destructor = vxlan_free_dev;
+
 	dev->needs_free_netdev = true;
 	SET_NETDEV_DEVTYPE(dev, &vxlan_type);
 
@@ -3555,9 +3640,11 @@ static int vxlan_get_link_ksettings(struct net_device *dev,
 				    struct ethtool_link_ksettings *cmd)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
-	struct vxlan_rdst *dst = &vxlan->default_dst;
-	struct net_device *lowerdev = __dev_get_by_index(vxlan->net,
-							 dst->remote_ifindex);
+	const struct vxlan_config *cfg;
+	struct net_device *lowerdev;
+
+	cfg = rtnl_dereference(vxlan->cfg);
+	lowerdev = __dev_get_by_index(vxlan->net, cfg->remote_ifindex);
 
 	if (!lowerdev) {
 		cmd->base.duplex = DUPLEX_UNKNOWN;
@@ -3663,21 +3750,22 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, bool ipv6,
 
 static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)
 {
-	bool metadata = vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA;
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
+	bool metadata = cfg->flags & VXLAN_F_COLLECT_METADATA;
 	struct vxlan_sock *vs = NULL;
 	struct vxlan_dev_node *node;
 	int l3mdev_index = 0;
 
 	ASSERT_RTNL();
 
-	if (vxlan->cfg.remote_ifindex)
+	if (cfg->remote_ifindex)
 		l3mdev_index = l3mdev_master_upper_ifindex_by_index(
-			vxlan->net, vxlan->cfg.remote_ifindex);
+			vxlan->net, cfg->remote_ifindex);
 
-	if (!vxlan->cfg.no_share) {
+	if (!cfg->no_share) {
 		rcu_read_lock();
 		vs = vxlan_find_sock(vxlan->net, ipv6 ? AF_INET6 : AF_INET,
-				     vxlan->cfg.dst_port, vxlan->cfg.flags,
+				     cfg->dst_port, cfg->flags,
 				     l3mdev_index);
 		if (vs && !refcount_inc_not_zero(&vs->refcnt)) {
 			rcu_read_unlock();
@@ -3687,7 +3775,7 @@ static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)
 	}
 	if (!vs)
 		vs = vxlan_socket_create(vxlan->net, ipv6,
-					 vxlan->cfg.dst_port, vxlan->cfg.flags,
+					 cfg->dst_port, cfg->flags,
 					 l3mdev_index);
 	if (IS_ERR(vs))
 		return PTR_ERR(vs);
@@ -3702,7 +3790,7 @@ static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)
 		node = &vxlan->hlist4;
 	}
 
-	if (metadata && (vxlan->cfg.flags & VXLAN_F_VNIFILTER))
+	if (metadata && (cfg->flags & VXLAN_F_VNIFILTER))
 		vxlan_vs_add_vnigrp(vxlan, vs, ipv6);
 	else
 		vxlan_vs_add_dev(vs, vxlan, node);
@@ -3712,11 +3800,14 @@ static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)
 
 static int vxlan_sock_add(struct vxlan_dev *vxlan)
 {
-	bool metadata = vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA;
-	bool ipv6 = vxlan->cfg.flags & VXLAN_F_IPV6 || metadata;
-	bool ipv4 = !ipv6 || metadata;
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
+	bool metadata, ipv6, ipv4;
 	int ret = 0;
 
+	metadata = cfg->flags & VXLAN_F_COLLECT_METADATA;
+	ipv6 = (cfg->flags & VXLAN_F_IPV6) || metadata;
+	ipv4 = !ipv6 || metadata;
+
 	RCU_INIT_POINTER(vxlan->vn4_sock, NULL);
 #if IS_ENABLED(CONFIG_IPV6)
 	RCU_INIT_POINTER(vxlan->vn6_sock, NULL);
@@ -3734,28 +3825,33 @@ static int vxlan_sock_add(struct vxlan_dev *vxlan)
 }
 
 int vxlan_vni_in_use(struct net *src_net, struct vxlan_dev *vxlan,
-		     struct vxlan_config *conf, __be32 vni)
+		     const struct vxlan_config *conf, __be32 vni)
 {
 	struct vxlan_net *vn = net_generic(src_net, vxlan_net_id);
 	struct vxlan_dev *tmp;
 
 	list_for_each_entry(tmp, &vn->vxlan_list, next) {
+		const struct vxlan_config *tmp_cfg;
+
 		if (tmp == vxlan)
 			continue;
-		if (tmp->cfg.flags & VXLAN_F_VNIFILTER) {
+
+		tmp_cfg = rtnl_dereference(tmp->cfg);
+
+		if (tmp_cfg->flags & VXLAN_F_VNIFILTER) {
 			if (!vxlan_vnifilter_lookup(tmp, vni))
 				continue;
-		} else if (tmp->cfg.vni != vni) {
+		} else if (tmp_cfg->vni != vni) {
 			continue;
 		}
-		if (tmp->cfg.dst_port != conf->dst_port)
+		if (tmp_cfg->dst_port != conf->dst_port)
 			continue;
-		if ((tmp->cfg.flags & (VXLAN_F_RCV_FLAGS | VXLAN_F_IPV6)) !=
+		if ((tmp_cfg->flags & (VXLAN_F_RCV_FLAGS | VXLAN_F_IPV6)) !=
 		    (conf->flags & (VXLAN_F_RCV_FLAGS | VXLAN_F_IPV6)))
 			continue;
 
 		if ((conf->flags & VXLAN_F_IPV6_LINKLOCAL) &&
-		    tmp->cfg.remote_ifindex != conf->remote_ifindex)
+		    tmp_cfg->remote_ifindex != conf->remote_ifindex)
 			continue;
 
 		return -EEXIST;
@@ -3917,16 +4013,16 @@ static int vxlan_config_validate(struct net *src_net, struct vxlan_config *conf,
 }
 
 static void vxlan_config_apply(struct net_device *dev,
-			       struct vxlan_config *conf,
+			       struct vxlan_config *new_cfg,
 			       struct net_device *lowerdev,
 			       struct net *src_net,
-			       bool changelink)
+			       bool changelink, bool lowerdev_changed)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
-	struct vxlan_rdst *dst = &vxlan->default_dst;
 	unsigned short needed_headroom = ETH_HLEN;
+	struct vxlan_config *old_cfg;
 	int max_mtu = ETH_MAX_MTU;
-	u32 flags = conf->flags;
+	u32 flags = new_cfg->flags;
 
 	if (!changelink) {
 		if (flags & VXLAN_F_GPE)
@@ -3934,19 +4030,13 @@ static void vxlan_config_apply(struct net_device *dev,
 		else
 			vxlan_ether_setup(dev);
 
-		if (conf->mtu)
-			dev->mtu = conf->mtu;
+		if (new_cfg->mtu)
+			dev->mtu = new_cfg->mtu;
 
 		vxlan->net = src_net;
 	}
 
-	dst->remote_vni = conf->vni;
-
-	memcpy(&dst->remote_ip, &conf->remote_ip, sizeof(conf->remote_ip));
-
 	if (lowerdev) {
-		dst->remote_ifindex = conf->remote_ifindex;
-
 		netif_inherit_tso_max(dev, lowerdev);
 
 		needed_headroom = lowerdev->hard_header_len;
@@ -3958,11 +4048,12 @@ static void vxlan_config_apply(struct net_device *dev,
 		if (max_mtu < ETH_MIN_MTU)
 			max_mtu = ETH_MIN_MTU;
 
-		if (!changelink && !conf->mtu)
+		if (!changelink && !new_cfg->mtu)
 			dev->mtu = max_mtu;
 	}
 
-	if (dev->mtu > max_mtu)
+	/* A changelink leaving the lower device alone must not shrink the mtu */
+	if (lowerdev_changed && dev->mtu > max_mtu)
 		dev->mtu = max_mtu;
 
 	if (flags & VXLAN_F_COLLECT_METADATA)
@@ -3970,7 +4061,10 @@ static void vxlan_config_apply(struct net_device *dev,
 	needed_headroom += vxlan_headroom(flags);
 	dev->needed_headroom = needed_headroom;
 
-	memcpy(&vxlan->cfg, conf, sizeof(*conf));
+	old_cfg = rtnl_dereference(vxlan->cfg);
+	rcu_assign_pointer(vxlan->cfg, new_cfg);
+	if (old_cfg)
+		kfree_rcu(old_cfg, rcu);
 }
 
 static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,
@@ -3979,13 +4073,18 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct net_device *lowerdev;
+	struct vxlan_config *new_cfg;
 	int ret;
 
 	ret = vxlan_config_validate(src_net, conf, &lowerdev, vxlan, extack);
 	if (ret)
 		return ret;
 
-	vxlan_config_apply(dev, conf, lowerdev, src_net, false);
+	new_cfg = kmemdup(conf, sizeof(*conf), GFP_KERNEL);
+	if (!new_cfg)
+		return -ENOMEM;
+
+	vxlan_config_apply(dev, new_cfg, lowerdev, src_net, false, true);
 
 	return 0;
 }
@@ -3997,22 +4096,25 @@ static int vxlan_dev_create(struct net *net, struct net_device *dev,
 	struct vxlan_net *vn = net_generic(net, vxlan_net_id);
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct net_device *remote_dev = NULL;
-	struct vxlan_rdst *dst;
+	const struct vxlan_config *cfg;
 	int err;
 
-	dst = &vxlan->default_dst;
 	err = vxlan_dev_configure(net, dev, conf, extack);
 	if (err)
 		return err;
 
+	cfg = rtnl_dereference(vxlan->cfg);
+
 	dev->ethtool_ops = &vxlan_ethtool_ops;
 
 	err = register_netdevice(dev);
-	if (err)
+	if (err) {
+		vxlan_free_dev(dev);
 		return err;
+	}
 
-	if (dst->remote_ifindex) {
-		remote_dev = __dev_get_by_index(net, dst->remote_ifindex);
+	if (cfg->remote_ifindex) {
+		remote_dev = __dev_get_by_index(net, cfg->remote_ifindex);
 		if (!remote_dev) {
 			err = -ENODEV;
 			goto unregister;
@@ -4022,7 +4124,7 @@ static int vxlan_dev_create(struct net *net, struct net_device *dev,
 		if (err)
 			goto unregister;
 
-		dst->remote_dev = remote_dev;
+		vxlan->lowerdev = remote_dev;
 	}
 
 	err = rtnl_configure_link(dev, NULL, 0, NULL);
@@ -4030,16 +4132,18 @@ static int vxlan_dev_create(struct net *net, struct net_device *dev,
 		goto unlink;
 
 	/* create an fdb entry for a valid default destination */
-	if (!vxlan_addr_any(&dst->remote_ip)) {
+	if (!vxlan_addr_any(&cfg->remote_ip)) {
+		union vxlan_addr rip = cfg->remote_ip;
+
 		spin_lock_bh(&vxlan->hash_lock);
 		err = vxlan_fdb_update(vxlan, all_zeros_mac,
-				       &dst->remote_ip,
+				       &rip,
 				       NUD_REACHABLE | NUD_PERMANENT,
 				       NLM_F_EXCL | NLM_F_CREATE,
-				       vxlan->cfg.dst_port,
-				       dst->remote_vni,
-				       dst->remote_vni,
-				       dst->remote_ifindex,
+				       cfg->dst_port,
+				       cfg->vni,
+				       cfg->vni,
+				       cfg->remote_ifindex,
 				       NTF_SELF, 0, true, extack);
 		spin_unlock_bh(&vxlan->hash_lock);
 		if (err)
@@ -4100,8 +4204,12 @@ static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[],
 	memset(conf, 0, sizeof(*conf));
 
 	/* if changelink operation, start with old existing cfg */
-	if (changelink)
-		memcpy(conf, &vxlan->cfg, sizeof(*conf));
+	if (changelink) {
+		const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
+
+		if (cfg)
+			memcpy(conf, cfg, sizeof(*conf));
+	}
 
 	if (data[IFLA_VXLAN_ID]) {
 		__be32 vni = cpu_to_be32(nla_get_u32(data[IFLA_VXLAN_ID]));
@@ -4447,17 +4555,19 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],
 			    struct nlattr *data[],
 			    struct netlink_ext_ack *extack)
 {
+	bool lowerdev_changed, rem_ip_changed, change_igmp;
 	struct vxlan_dev *vxlan = netdev_priv(dev);
-	bool rem_ip_changed, change_igmp;
+	const struct vxlan_config *cfg;
+	struct vxlan_config *new_cfg;
 	struct net_device *lowerdev;
 	struct vxlan_config conf;
-	struct vxlan_rdst *dst;
 	int err;
 
+	cfg = rtnl_dereference(vxlan->cfg);
+
 	if (!rtnl_dev_link_net_capable(dev, vxlan->net))
 		return -EPERM;
 
-	dst = &vxlan->default_dst;
 	err = vxlan_nl2conf(tb, data, dev, &conf, true, extack);
 	if (err)
 		return err;
@@ -4467,75 +4577,94 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],
 	if (err)
 		return err;
 
-	if (dst->remote_dev == lowerdev)
-		lowerdev = NULL;
+	new_cfg = kmemdup(&conf, sizeof(conf), GFP_KERNEL);
+	if (!new_cfg)
+		return -ENOMEM;
 
-	err = netdev_adjacent_change_prepare(dst->remote_dev, lowerdev, dev,
-					     extack);
-	if (err)
-		return err;
+	lowerdev_changed = vxlan->lowerdev != lowerdev;
+	if (lowerdev_changed) {
+		err = netdev_adjacent_change_prepare(vxlan->lowerdev, lowerdev,
+						     dev, extack);
+		if (err) {
+			kfree(new_cfg);
+			return err;
+		}
+	}
 
-	rem_ip_changed = !vxlan_addr_equal(&conf.remote_ip, &dst->remote_ip);
+	rem_ip_changed = !vxlan_addr_equal(&conf.remote_ip, &cfg->remote_ip);
 	change_igmp = vxlan->dev->flags & IFF_UP &&
 		      (rem_ip_changed ||
-		       dst->remote_ifindex != conf.remote_ifindex);
+		       cfg->remote_ifindex != conf.remote_ifindex);
 
 	/* handle default dst entry */
-	if (rem_ip_changed) {
+	if (rem_ip_changed || cfg->remote_ifindex != conf.remote_ifindex) {
 		spin_lock_bh(&vxlan->hash_lock);
 		if (!vxlan_addr_any(&conf.remote_ip)) {
 			err = vxlan_fdb_update(vxlan, all_zeros_mac,
 					       &conf.remote_ip,
 					       NUD_REACHABLE | NUD_PERMANENT,
 					       NLM_F_APPEND | NLM_F_CREATE,
-					       vxlan->cfg.dst_port,
+					       cfg->dst_port,
 					       conf.vni, conf.vni,
 					       conf.remote_ifindex,
 					       NTF_SELF, 0, true, extack);
 			if (err) {
 				spin_unlock_bh(&vxlan->hash_lock);
-				netdev_adjacent_change_abort(dst->remote_dev,
-							     lowerdev, dev);
+				if (lowerdev_changed)
+					netdev_adjacent_change_abort(vxlan->lowerdev,
+								     lowerdev, dev);
+				kfree(new_cfg);
 				return err;
 			}
 		}
-		if (!vxlan_addr_any(&dst->remote_ip))
+		if (!vxlan_addr_any(&cfg->remote_ip))
 			__vxlan_fdb_delete(vxlan, all_zeros_mac,
-					   dst->remote_ip,
-					   vxlan->cfg.dst_port,
-					   dst->remote_vni,
-					   dst->remote_vni,
-					   dst->remote_ifindex,
+					   cfg->remote_ip,
+					   cfg->dst_port,
+					   cfg->vni,
+					   cfg->vni,
+					   cfg->remote_ifindex,
 					   true);
 		spin_unlock_bh(&vxlan->hash_lock);
 
-		/* If vni filtering device, also update fdb entries of
-		 * all vnis that were using default remote ip
+		/* If vni filtering device, also update default fdb entries of
+		 * all vnis
 		 */
-		if (vxlan->cfg.flags & VXLAN_F_VNIFILTER) {
-			err = vxlan_vnilist_update_group(vxlan, &dst->remote_ip,
-							 &conf.remote_ip, extack);
+		if (cfg->flags & VXLAN_F_VNIFILTER) {
+			err = vxlan_vnilist_update_group(vxlan, &cfg->remote_ip,
+							 &conf.remote_ip,
+							 cfg->remote_ifindex,
+							 conf.remote_ifindex,
+							 extack);
 			if (err) {
-				netdev_adjacent_change_abort(dst->remote_dev,
-							     lowerdev, dev);
+				if (lowerdev_changed)
+					netdev_adjacent_change_abort(vxlan->lowerdev,
+								     lowerdev, dev);
+				kfree(new_cfg);
 				return err;
 			}
 		}
 	}
 
-	if (change_igmp && vxlan_addr_multicast(&dst->remote_ip))
+	if (change_igmp && vxlan_addr_multicast(&cfg->remote_ip))
 		err = vxlan_multicast_leave(vxlan);
 
-	if (netif_running(dev) && conf.age_interval != vxlan->cfg.age_interval)
+	if (netif_running(dev) && conf.age_interval != cfg->age_interval)
 		mod_timer(&vxlan->age_timer, jiffies);
 
-	netdev_adjacent_change_commit(dst->remote_dev, lowerdev, dev);
-	if (lowerdev && lowerdev != dst->remote_dev)
-		dst->remote_dev = lowerdev;
-	vxlan_config_apply(dev, &conf, lowerdev, vxlan->net, true);
+	if (lowerdev_changed) {
+		if (lowerdev)
+			netdev_adjacent_change_commit(vxlan->lowerdev, lowerdev,
+						      dev);
+		else
+			netdev_upper_dev_unlink(vxlan->lowerdev, dev);
+		vxlan->lowerdev = lowerdev;
+	}
+	vxlan_config_apply(dev, new_cfg, lowerdev, vxlan->net, true,
+			   lowerdev_changed);
 
 	if (!err && change_igmp &&
-	    vxlan_addr_multicast(&dst->remote_ip))
+	    vxlan_addr_multicast(&new_cfg->remote_ip))
 		err = vxlan_multicast_join(vxlan);
 
 	return err;
@@ -4550,8 +4679,8 @@ static void vxlan_dellink(struct net_device *dev, struct list_head *head)
 
 	list_del(&vxlan->next);
 	unregister_netdevice_queue(dev, head);
-	if (vxlan->default_dst.remote_dev)
-		netdev_upper_dev_unlink(vxlan->default_dst.remote_dev, dev);
+	if (vxlan->lowerdev)
+		netdev_upper_dev_unlink(vxlan->lowerdev, dev);
 }
 
 static size_t vxlan_get_size(const struct net_device *dev)
@@ -4595,110 +4724,114 @@ static size_t vxlan_get_size(const struct net_device *dev)
 static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
 {
 	const struct vxlan_dev *vxlan = netdev_priv(dev);
-	const struct vxlan_rdst *dst = &vxlan->default_dst;
-	struct ifla_vxlan_port_range ports = {
-		.low =  htons(vxlan->cfg.port_min),
-		.high = htons(vxlan->cfg.port_max),
-	};
+	struct ifla_vxlan_port_range ports;
+	const struct vxlan_config *cfg;
+
+	rcu_read_lock();
+	cfg = rcu_dereference(vxlan->cfg);
 
-	if (nla_put_u32(skb, IFLA_VXLAN_ID, be32_to_cpu(dst->remote_vni)))
+	if (nla_put_u32(skb, IFLA_VXLAN_ID, be32_to_cpu(cfg->vni)))
 		goto nla_put_failure;
 
-	if (!vxlan_addr_any(&dst->remote_ip)) {
-		if (dst->remote_ip.sa.sa_family == AF_INET) {
+	if (!vxlan_addr_any(&cfg->remote_ip)) {
+		if (cfg->remote_ip.sa.sa_family == AF_INET) {
 			if (nla_put_in_addr(skb, IFLA_VXLAN_GROUP,
-					    dst->remote_ip.sin.sin_addr.s_addr))
+					    cfg->remote_ip.sin.sin_addr.s_addr))
 				goto nla_put_failure;
 #if IS_ENABLED(CONFIG_IPV6)
 		} else {
 			if (nla_put_in6_addr(skb, IFLA_VXLAN_GROUP6,
-					     &dst->remote_ip.sin6.sin6_addr))
+					     &cfg->remote_ip.sin6.sin6_addr))
 				goto nla_put_failure;
 #endif
 		}
 	}
 
-	if (dst->remote_ifindex && nla_put_u32(skb, IFLA_VXLAN_LINK, dst->remote_ifindex))
+	if (cfg->remote_ifindex && nla_put_u32(skb, IFLA_VXLAN_LINK, cfg->remote_ifindex))
 		goto nla_put_failure;
 
-	if (!vxlan_addr_any(&vxlan->cfg.saddr)) {
-		if (vxlan->cfg.saddr.sa.sa_family == AF_INET) {
+	if (!vxlan_addr_any(&cfg->saddr)) {
+		if (cfg->saddr.sa.sa_family == AF_INET) {
 			if (nla_put_in_addr(skb, IFLA_VXLAN_LOCAL,
-					    vxlan->cfg.saddr.sin.sin_addr.s_addr))
+					    cfg->saddr.sin.sin_addr.s_addr))
 				goto nla_put_failure;
 #if IS_ENABLED(CONFIG_IPV6)
 		} else {
 			if (nla_put_in6_addr(skb, IFLA_VXLAN_LOCAL6,
-					     &vxlan->cfg.saddr.sin6.sin6_addr))
+					     &cfg->saddr.sin6.sin6_addr))
 				goto nla_put_failure;
 #endif
 		}
 	}
 
-	if (nla_put_u8(skb, IFLA_VXLAN_TTL, vxlan->cfg.ttl) ||
+	if (nla_put_u8(skb, IFLA_VXLAN_TTL, cfg->ttl) ||
 	    nla_put_u8(skb, IFLA_VXLAN_TTL_INHERIT,
-		       !!(vxlan->cfg.flags & VXLAN_F_TTL_INHERIT)) ||
-	    nla_put_u8(skb, IFLA_VXLAN_TOS, vxlan->cfg.tos) ||
-	    nla_put_u8(skb, IFLA_VXLAN_DF, vxlan->cfg.df) ||
-	    nla_put_be32(skb, IFLA_VXLAN_LABEL, vxlan->cfg.label) ||
-	    nla_put_u32(skb, IFLA_VXLAN_LABEL_POLICY, vxlan->cfg.label_policy) ||
+		       !!(cfg->flags & VXLAN_F_TTL_INHERIT)) ||
+	    nla_put_u8(skb, IFLA_VXLAN_TOS, cfg->tos) ||
+	    nla_put_u8(skb, IFLA_VXLAN_DF, cfg->df) ||
+	    nla_put_be32(skb, IFLA_VXLAN_LABEL, cfg->label) ||
+	    nla_put_u32(skb, IFLA_VXLAN_LABEL_POLICY, cfg->label_policy) ||
 	    nla_put_u8(skb, IFLA_VXLAN_LEARNING,
-		       !!(vxlan->cfg.flags & VXLAN_F_LEARN)) ||
+		       !!(cfg->flags & VXLAN_F_LEARN)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_PROXY,
-		       !!(vxlan->cfg.flags & VXLAN_F_PROXY)) ||
+		       !!(cfg->flags & VXLAN_F_PROXY)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_RSC,
-		       !!(vxlan->cfg.flags & VXLAN_F_RSC)) ||
+		       !!(cfg->flags & VXLAN_F_RSC)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_L2MISS,
-		       !!(vxlan->cfg.flags & VXLAN_F_L2MISS)) ||
+		       !!(cfg->flags & VXLAN_F_L2MISS)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_L3MISS,
-		       !!(vxlan->cfg.flags & VXLAN_F_L3MISS)) ||
+		       !!(cfg->flags & VXLAN_F_L3MISS)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_COLLECT_METADATA,
-		       !!(vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA)) ||
-	    nla_put_u32(skb, IFLA_VXLAN_AGEING, vxlan->cfg.age_interval) ||
-	    nla_put_u32(skb, IFLA_VXLAN_LIMIT, vxlan->cfg.addrmax) ||
-	    nla_put_be16(skb, IFLA_VXLAN_PORT, vxlan->cfg.dst_port) ||
+		       !!(cfg->flags & VXLAN_F_COLLECT_METADATA)) ||
+	    nla_put_u32(skb, IFLA_VXLAN_AGEING, cfg->age_interval) ||
+	    nla_put_u32(skb, IFLA_VXLAN_LIMIT, cfg->addrmax) ||
+	    nla_put_be16(skb, IFLA_VXLAN_PORT, cfg->dst_port) ||
 	    nla_put_u8(skb, IFLA_VXLAN_UDP_CSUM,
-		       !(vxlan->cfg.flags & VXLAN_F_UDP_ZERO_CSUM_TX)) ||
+		       !(cfg->flags & VXLAN_F_UDP_ZERO_CSUM_TX)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_UDP_ZERO_CSUM6_TX,
-		       !!(vxlan->cfg.flags & VXLAN_F_UDP_ZERO_CSUM6_TX)) ||
+		       !!(cfg->flags & VXLAN_F_UDP_ZERO_CSUM6_TX)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_UDP_ZERO_CSUM6_RX,
-		       !!(vxlan->cfg.flags & VXLAN_F_UDP_ZERO_CSUM6_RX)) ||
+		       !!(cfg->flags & VXLAN_F_UDP_ZERO_CSUM6_RX)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_REMCSUM_TX,
-		       !!(vxlan->cfg.flags & VXLAN_F_REMCSUM_TX)) ||
+		       !!(cfg->flags & VXLAN_F_REMCSUM_TX)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_REMCSUM_RX,
-		       !!(vxlan->cfg.flags & VXLAN_F_REMCSUM_RX)) ||
+		       !!(cfg->flags & VXLAN_F_REMCSUM_RX)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_LOCALBYPASS,
-		       !!(vxlan->cfg.flags & VXLAN_F_LOCALBYPASS)))
+		       !!(cfg->flags & VXLAN_F_LOCALBYPASS)))
 		goto nla_put_failure;
 
+	ports.low = htons(cfg->port_min);
+	ports.high = htons(cfg->port_max);
 	if (nla_put(skb, IFLA_VXLAN_PORT_RANGE, sizeof(ports), &ports))
 		goto nla_put_failure;
 
-	if (vxlan->cfg.flags & VXLAN_F_GBP &&
+	if (cfg->flags & VXLAN_F_GBP &&
 	    nla_put_flag(skb, IFLA_VXLAN_GBP))
 		goto nla_put_failure;
 
-	if (vxlan->cfg.flags & VXLAN_F_GPE &&
+	if (cfg->flags & VXLAN_F_GPE &&
 	    nla_put_flag(skb, IFLA_VXLAN_GPE))
 		goto nla_put_failure;
 
-	if (vxlan->cfg.flags & VXLAN_F_REMCSUM_NOPARTIAL &&
+	if (cfg->flags & VXLAN_F_REMCSUM_NOPARTIAL &&
 	    nla_put_flag(skb, IFLA_VXLAN_REMCSUM_NOPARTIAL))
 		goto nla_put_failure;
 
-	if (vxlan->cfg.flags & VXLAN_F_VNIFILTER &&
+	if (cfg->flags & VXLAN_F_VNIFILTER &&
 	    nla_put_u8(skb, IFLA_VXLAN_VNIFILTER,
-		       !!(vxlan->cfg.flags & VXLAN_F_VNIFILTER)))
+		       !!(cfg->flags & VXLAN_F_VNIFILTER)))
 		goto nla_put_failure;
 
 	if (nla_put(skb, IFLA_VXLAN_RESERVED_BITS,
-		    sizeof(vxlan->cfg.reserved_bits),
-		    &vxlan->cfg.reserved_bits))
+		    sizeof(cfg->reserved_bits),
+		    &cfg->reserved_bits))
 		goto nla_put_failure;
 
+	rcu_read_unlock();
 	return 0;
 
 nla_put_failure:
+	rcu_read_unlock();
 	return -EMSGSIZE;
 }
 
@@ -4731,7 +4864,7 @@ static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn,
 	LIST_HEAD(list_kill);
 
 	list_for_each_entry_safe(vxlan, next, &vn->vxlan_list, next) {
-		struct vxlan_rdst *dst = &vxlan->default_dst;
+		const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
 
 		/* In case we created vxlan device with carrier
 		 * and we loose the carrier due to module unload
@@ -4739,7 +4872,7 @@ static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn,
 		 * cases, it's not necessary and remote_ifindex
 		 * is 0 here, so no matches.
 		 */
-		if (dst->remote_ifindex == dev->ifindex)
+		if (cfg->remote_ifindex == dev->ifindex)
 			vxlan_dellink(vxlan->dev, &list_kill);
 	}
 
@@ -4752,6 +4885,10 @@ static int vxlan_netdevice_event(struct notifier_block *unused,
 	struct net_device *dev = netdev_notifier_info_to_dev(ptr);
 	struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
 
+	if ((event == NETDEV_REGISTER || event == NETDEV_UNREGISTER) &&
+	    netif_is_vxlan(dev))
+		vxlan_vnifilter_seq_inc(dev_net(dev));
+
 	if (event == NETDEV_UNREGISTER)
 		vxlan_handle_lowerdev_unregister(vn, dev);
 	else if (event == NETDEV_UDP_TUNNEL_PUSH_INFO)
diff --git a/drivers/net/vxlan/vxlan_mdb.c b/drivers/net/vxlan/vxlan_mdb.c
index 841f42ffecb9a..c1a0551990555 100644
--- a/drivers/net/vxlan/vxlan_mdb.c
+++ b/drivers/net/vxlan/vxlan_mdb.c
@@ -165,6 +165,7 @@ static int vxlan_mdb_entry_info_fill(const struct vxlan_dev *vxlan,
 				     const struct vxlan_mdb_entry *mdb_entry,
 				     const struct vxlan_mdb_remote *remote)
 {
+	const struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan->cfg);
 	struct vxlan_rdst *rd = rtnl_dereference(remote->rd);
 	struct br_mdb_entry e;
 	struct nlattr *nest;
@@ -189,12 +190,12 @@ static int vxlan_mdb_entry_info_fill(const struct vxlan_dev *vxlan,
 	    vxlan_nla_put_addr(skb, MDBA_MDB_EATTR_DST, &rd->remote_ip))
 		goto nest_err;
 
-	if (rd->remote_port && rd->remote_port != vxlan->cfg.dst_port &&
+	if (rd->remote_port && rd->remote_port != cfg->dst_port &&
 	    nla_put_u16(skb, MDBA_MDB_EATTR_DST_PORT,
 			be16_to_cpu(rd->remote_port)))
 		goto nest_err;
 
-	if (rd->remote_vni != vxlan->default_dst.remote_vni &&
+	if (rd->remote_vni != cfg->vni &&
 	    nla_put_u32(skb, MDBA_MDB_EATTR_VNI, be32_to_cpu(rd->remote_vni)))
 		goto nest_err;
 
@@ -202,7 +203,7 @@ static int vxlan_mdb_entry_info_fill(const struct vxlan_dev *vxlan,
 	    nla_put_u32(skb, MDBA_MDB_EATTR_IFINDEX, rd->remote_ifindex))
 		goto nest_err;
 
-	if ((vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA) &&
+	if ((cfg->flags & VXLAN_F_COLLECT_METADATA) &&
 	    mdb_entry->key.vni && nla_put_u32(skb, MDBA_MDB_EATTR_SRC_VNI,
 					      be32_to_cpu(mdb_entry->key.vni)))
 		goto nest_err;
@@ -613,16 +614,19 @@ static int vxlan_mdb_config_init(struct vxlan_mdb_config *cfg,
 {
 	struct br_mdb_entry *entry = nla_data(tb[MDBA_SET_ENTRY]);
 	struct vxlan_dev *vxlan = netdev_priv(dev);
+	const struct vxlan_config *vcfg;
+
+	vcfg = rtnl_dereference(vxlan->cfg);
 
 	memset(cfg, 0, sizeof(*cfg));
 	cfg->vxlan = vxlan;
-	cfg->group.vni = vxlan->default_dst.remote_vni;
+	cfg->group.vni = vcfg->vni;
 	INIT_LIST_HEAD(&cfg->src_list);
 	cfg->nlflags = nlmsg_flags;
 	cfg->filter_mode = MCAST_EXCLUDE;
 	cfg->rt_protocol = RTPROT_STATIC;
-	cfg->remote_vni = vxlan->default_dst.remote_vni;
-	cfg->remote_port = vxlan->cfg.dst_port;
+	cfg->remote_vni = vcfg->vni;
+	cfg->remote_port = vcfg->dst_port;
 
 	if (entry->ifindex != dev->ifindex) {
 		NL_SET_ERR_MSG_MOD(extack, "Port net device must be the VXLAN net device");
@@ -957,11 +961,12 @@ vxlan_mdb_nlmsg_remote_size(const struct vxlan_dev *vxlan,
 			    const struct vxlan_mdb_entry *mdb_entry,
 			    const struct vxlan_mdb_remote *remote)
 {
+	const struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan->cfg);
 	const struct vxlan_mdb_entry_key *group = &mdb_entry->key;
 	struct vxlan_rdst *rd = rtnl_dereference(remote->rd);
 	size_t nlmsg_size;
 
-		     /* MDBA_MDB_ENTRY_INFO */
+	/* MDBA_MDB_ENTRY_INFO */
 	nlmsg_size = nla_total_size(sizeof(struct br_mdb_entry)) +
 		     /* MDBA_MDB_EATTR_TIMER */
 		     nla_total_size(sizeof(u32));
@@ -978,16 +983,16 @@ vxlan_mdb_nlmsg_remote_size(const struct vxlan_dev *vxlan,
 	/* MDBA_MDB_EATTR_DST */
 	nlmsg_size += nla_total_size(vxlan_addr_size(&rd->remote_ip));
 	/* MDBA_MDB_EATTR_DST_PORT */
-	if (rd->remote_port && rd->remote_port != vxlan->cfg.dst_port)
+	if (rd->remote_port && rd->remote_port != cfg->dst_port)
 		nlmsg_size += nla_total_size(sizeof(u16));
 	/* MDBA_MDB_EATTR_VNI */
-	if (rd->remote_vni != vxlan->default_dst.remote_vni)
+	if (rd->remote_vni != cfg->vni)
 		nlmsg_size += nla_total_size(sizeof(u32));
 	/* MDBA_MDB_EATTR_IFINDEX */
 	if (rd->remote_ifindex)
 		nlmsg_size += nla_total_size(sizeof(u32));
 	/* MDBA_MDB_EATTR_SRC_VNI */
-	if ((vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA) && group->vni)
+	if ((cfg->flags & VXLAN_F_COLLECT_METADATA) && group->vni)
 		nlmsg_size += nla_total_size(sizeof(u32));
 
 	return nlmsg_size;
@@ -1216,7 +1221,7 @@ vxlan_mdb_entry_get(struct vxlan_dev *vxlan,
 		goto err_free_entry;
 
 	if (hlist_is_singular_node(&mdb_entry->mdb_node, &vxlan->mdb_list))
-		vxlan->cfg.flags |= VXLAN_F_MDB;
+		set_bit(VXLAN_DEV_F_MDB, &vxlan->flags);
 
 	return mdb_entry;
 
@@ -1233,7 +1238,7 @@ static void vxlan_mdb_entry_put(struct vxlan_dev *vxlan,
 		return;
 
 	if (hlist_is_singular_node(&mdb_entry->mdb_node, &vxlan->mdb_list))
-		vxlan->cfg.flags &= ~VXLAN_F_MDB;
+		clear_bit(VXLAN_DEV_F_MDB, &vxlan->flags);
 
 	rhashtable_remove_fast(&vxlan->mdb_tbl, &mdb_entry->rhnode,
 			       vxlan_mdb_rht_params);
@@ -1483,11 +1488,13 @@ static int vxlan_mdb_get_parse(struct net_device *dev, struct nlattr *tb[],
 {
 	struct br_mdb_entry *entry = nla_data(tb[MDBA_GET_ENTRY]);
 	struct nlattr *mdbe_attrs[MDBE_ATTR_MAX + 1];
+	const struct vxlan_config *cfg;
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	int err;
 
+	cfg = rtnl_dereference(vxlan->cfg);
 	memset(group, 0, sizeof(*group));
-	group->vni = vxlan->default_dst.remote_vni;
+	group->vni = cfg->vni;
 
 	if (!tb[MDBA_GET_ENTRY_ATTRS]) {
 		vxlan_mdb_group_set(group, entry, NULL);
@@ -1621,6 +1628,7 @@ int vxlan_mdb_get(struct net_device *dev, struct nlattr *tb[], u32 portid,
 }
 
 struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan,
+						const struct vxlan_config *cfg,
 						struct sk_buff *skb,
 						__be32 src_vni)
 {
@@ -1634,8 +1642,8 @@ struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan,
 	/* When not in collect metadata mode, 'src_vni' is zero, but MDB
 	 * entries are stored with the VNI of the VXLAN device.
 	 */
-	if (!(vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA))
-		src_vni = vxlan->default_dst.remote_vni;
+	if (!(cfg->flags & VXLAN_F_COLLECT_METADATA))
+		src_vni = cfg->vni;
 
 	memset(&group, 0, sizeof(group));
 	group.vni = src_vni;
@@ -1700,6 +1708,7 @@ struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan,
 }
 
 netdev_tx_t vxlan_mdb_xmit(struct vxlan_dev *vxlan,
+			   const struct vxlan_config *cfg,
 			   const struct vxlan_mdb_entry *mdb_entry,
 			   struct sk_buff *skb)
 {
@@ -1721,12 +1730,12 @@ netdev_tx_t vxlan_mdb_xmit(struct vxlan_dev *vxlan,
 
 		skb1 = skb_clone(skb, GFP_ATOMIC);
 		if (skb1)
-			vxlan_xmit_one(skb1, vxlan->dev, src_vni,
+			vxlan_xmit_one(skb1, vxlan->dev, cfg, src_vni,
 				       rcu_dereference(remote->rd), false);
 	}
 
 	if (fremote)
-		vxlan_xmit_one(skb, vxlan->dev, src_vni,
+		vxlan_xmit_one(skb, vxlan->dev, cfg, src_vni,
 			       rcu_dereference(fremote->rd), false);
 	else
 		kfree_skb_reason(skb, SKB_DROP_REASON_NO_TX_TARGET);
@@ -1757,7 +1766,7 @@ void vxlan_mdb_fini(struct vxlan_dev *vxlan)
 	struct vxlan_mdb_flush_desc desc = {};
 
 	vxlan_mdb_flush(vxlan, &desc);
-	WARN_ON_ONCE(vxlan->cfg.flags & VXLAN_F_MDB);
+	WARN_ON_ONCE(test_bit(VXLAN_DEV_F_MDB, &vxlan->flags));
 	rhashtable_free_and_destroy(&vxlan->mdb_tbl, vxlan_mdb_check_empty,
 				    NULL);
 }
diff --git a/drivers/net/vxlan/vxlan_multicast.c b/drivers/net/vxlan/vxlan_multicast.c
index 3b75b48dc726d..6fcc4a3673436 100644
--- a/drivers/net/vxlan/vxlan_multicast.c
+++ b/drivers/net/vxlan/vxlan_multicast.c
@@ -14,11 +14,12 @@
 /* Update multicast group membership when first VNI on
  * multicast address is brought up
  */
-int vxlan_igmp_join(struct vxlan_dev *vxlan, union vxlan_addr *rip,
+int vxlan_igmp_join(struct vxlan_dev *vxlan, const union vxlan_addr *rip,
 		    int rifindex)
 {
-	union vxlan_addr *ip = (rip ? : &vxlan->default_dst.remote_ip);
-	int ifindex = (rifindex ? : vxlan->default_dst.remote_ifindex);
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
+	const union vxlan_addr *ip = (rip ? : &cfg->remote_ip);
+	int ifindex = (rifindex ? : cfg->remote_ifindex);
 	int ret = -EINVAL;
 	struct sock *sk;
 
@@ -47,11 +48,12 @@ int vxlan_igmp_join(struct vxlan_dev *vxlan, union vxlan_addr *rip,
 	return ret;
 }
 
-int vxlan_igmp_leave(struct vxlan_dev *vxlan, union vxlan_addr *rip,
+int vxlan_igmp_leave(struct vxlan_dev *vxlan, const union vxlan_addr *rip,
 		     int rifindex)
 {
-	union vxlan_addr *ip = (rip ? : &vxlan->default_dst.remote_ip);
-	int ifindex = (rifindex ? : vxlan->default_dst.remote_ifindex);
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
+	const union vxlan_addr *ip = (rip ? : &cfg->remote_ip);
+	int ifindex = (rifindex ? : cfg->remote_ifindex);
 	int ret = -EINVAL;
 	struct sock *sk;
 
@@ -80,8 +82,8 @@ int vxlan_igmp_leave(struct vxlan_dev *vxlan, union vxlan_addr *rip,
 	return ret;
 }
 
-static bool vxlan_group_used_match(union vxlan_addr *ip, int ifindex,
-				   union vxlan_addr *rip, int rifindex)
+static bool vxlan_group_used_match(const union vxlan_addr *ip, int ifindex,
+				   const union vxlan_addr *rip, int rifindex)
 {
 	if (!vxlan_addr_multicast(rip))
 		return false;
@@ -96,14 +98,16 @@ static bool vxlan_group_used_match(union vxlan_addr *ip, int ifindex,
 }
 
 static bool vxlan_group_used_by_vnifilter(struct vxlan_dev *vxlan,
-					  union vxlan_addr *ip, int ifindex)
+					  const struct vxlan_config *cfg,
+					  const union vxlan_addr *ip,
+					  int ifindex)
 {
 	struct vxlan_vni_group *vg = rtnl_dereference(vxlan->vnigrp);
 	struct vxlan_vni_node *v, *tmp;
 
 	if (vxlan_group_used_match(ip, ifindex,
-				   &vxlan->default_dst.remote_ip,
-				   vxlan->default_dst.remote_ifindex))
+				   &cfg->remote_ip,
+				   cfg->remote_ifindex))
 		return true;
 
 	list_for_each_entry_safe(v, tmp, &vg->vni_list, vlist) {
@@ -112,7 +116,7 @@ static bool vxlan_group_used_by_vnifilter(struct vxlan_dev *vxlan,
 
 		if (vxlan_group_used_match(ip, ifindex,
 					   &v->remote_ip,
-					   vxlan->default_dst.remote_ifindex))
+					   cfg->remote_ifindex))
 			return true;
 	}
 
@@ -121,16 +125,17 @@ static bool vxlan_group_used_by_vnifilter(struct vxlan_dev *vxlan,
 
 /* See if multicast group is already in use by other ID */
 bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,
-		      __be32 vni, union vxlan_addr *rip, int rifindex)
+		      __be32 vni, const union vxlan_addr *rip, int rifindex)
 {
-	union vxlan_addr *ip = (rip ? : &dev->default_dst.remote_ip);
-	int ifindex = (rifindex ? : dev->default_dst.remote_ifindex);
+	const struct vxlan_config *dev_cfg = rtnl_dereference(dev->cfg);
+	const union vxlan_addr *ip = (rip ? : &dev_cfg->remote_ip);
+	int ifindex = (rifindex ? : dev_cfg->remote_ifindex);
 	struct vxlan_dev *vxlan;
 	struct vxlan_sock *sock4;
 #if IS_ENABLED(CONFIG_IPV6)
 	struct vxlan_sock *sock6;
 #endif
-	unsigned short family = dev->default_dst.remote_ip.sa.sa_family;
+	unsigned short family = dev_cfg->remote_ip.sa.sa_family;
 
 	sock4 = rtnl_dereference(dev->vn4_sock);
 
@@ -147,6 +152,8 @@ bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,
 #endif
 
 	list_for_each_entry(vxlan, &vn->vxlan_list, next) {
+		const struct vxlan_config *cfg;
+
 		if (!netif_running(vxlan->dev) || vxlan == dev)
 			continue;
 
@@ -158,13 +165,15 @@ bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,
 		    rtnl_dereference(vxlan->vn6_sock) != sock6)
 			continue;
 #endif
-		if (vxlan->cfg.flags & VXLAN_F_VNIFILTER) {
-			if (!vxlan_group_used_by_vnifilter(vxlan, ip, ifindex))
+		cfg = rtnl_dereference(vxlan->cfg);
+
+		if (cfg->flags & VXLAN_F_VNIFILTER) {
+			if (!vxlan_group_used_by_vnifilter(vxlan, cfg, ip, ifindex))
 				continue;
 		} else {
 			if (!vxlan_group_used_match(ip, ifindex,
-						    &vxlan->default_dst.remote_ip,
-						    vxlan->default_dst.remote_ifindex))
+						    &cfg->remote_ip,
+						    cfg->remote_ifindex))
 				continue;
 		}
 
@@ -174,7 +183,8 @@ bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,
 	return false;
 }
 
-static int vxlan_multicast_join_vnigrp(struct vxlan_dev *vxlan)
+static int vxlan_multicast_join_vnigrp(struct vxlan_dev *vxlan,
+				       const struct vxlan_config *cfg)
 {
 	struct vxlan_vni_group *vg = rtnl_dereference(vxlan->vnigrp);
 	struct vxlan_vni_node *v, *tmp, *vgood = NULL;
@@ -185,7 +195,7 @@ static int vxlan_multicast_join_vnigrp(struct vxlan_dev *vxlan)
 			continue;
 		/* skip if address is same as default address */
 		if (vxlan_addr_equal(&v->remote_ip,
-				     &vxlan->default_dst.remote_ip))
+				     &cfg->remote_ip))
 			continue;
 		ret = vxlan_igmp_join(vxlan, &v->remote_ip, 0);
 		if (ret == -EADDRINUSE)
@@ -200,7 +210,7 @@ static int vxlan_multicast_join_vnigrp(struct vxlan_dev *vxlan)
 			if (!vxlan_addr_multicast(&v->remote_ip))
 				continue;
 			if (vxlan_addr_equal(&v->remote_ip,
-					     &vxlan->default_dst.remote_ip))
+					     &cfg->remote_ip))
 				continue;
 			vxlan_igmp_leave(vxlan, &v->remote_ip, 0);
 			if (v == vgood)
@@ -233,37 +243,39 @@ static int vxlan_multicast_leave_vnigrp(struct vxlan_dev *vxlan)
 
 int vxlan_multicast_join(struct vxlan_dev *vxlan)
 {
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
 	int ret = 0;
 
-	if (vxlan_addr_multicast(&vxlan->default_dst.remote_ip)) {
-		ret = vxlan_igmp_join(vxlan, &vxlan->default_dst.remote_ip,
-				      vxlan->default_dst.remote_ifindex);
+	if (vxlan_addr_multicast(&cfg->remote_ip)) {
+		ret = vxlan_igmp_join(vxlan, &cfg->remote_ip,
+				      cfg->remote_ifindex);
 		if (ret == -EADDRINUSE)
 			ret = 0;
 		if (ret)
 			return ret;
 	}
 
-	if (vxlan->cfg.flags & VXLAN_F_VNIFILTER)
-		return vxlan_multicast_join_vnigrp(vxlan);
+	if (cfg->flags & VXLAN_F_VNIFILTER)
+		return vxlan_multicast_join_vnigrp(vxlan, cfg);
 
 	return 0;
 }
 
 int vxlan_multicast_leave(struct vxlan_dev *vxlan)
 {
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
 	struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id);
 	int ret = 0;
 
-	if (vxlan_addr_multicast(&vxlan->default_dst.remote_ip) &&
+	if (vxlan_addr_multicast(&cfg->remote_ip) &&
 	    !vxlan_group_used(vn, vxlan, 0, NULL, 0)) {
-		ret = vxlan_igmp_leave(vxlan, &vxlan->default_dst.remote_ip,
-				       vxlan->default_dst.remote_ifindex);
+		ret = vxlan_igmp_leave(vxlan, &cfg->remote_ip,
+				       cfg->remote_ifindex);
 		if (ret)
 			return ret;
 	}
 
-	if (vxlan->cfg.flags & VXLAN_F_VNIFILTER)
+	if (cfg->flags & VXLAN_F_VNIFILTER)
 		return vxlan_multicast_leave_vnigrp(vxlan);
 
 	return 0;
diff --git a/drivers/net/vxlan/vxlan_private.h b/drivers/net/vxlan/vxlan_private.h
index b1eec22163608..92d656fc1c751 100644
--- a/drivers/net/vxlan/vxlan_private.h
+++ b/drivers/net/vxlan/vxlan_private.h
@@ -22,6 +22,8 @@ struct vxlan_net {
 	/* sock_list is protected by rtnl lock */
 	struct hlist_head sock_list[PORT_HASH_SIZE];
 	struct notifier_block nexthop_notifier_block;
+	/* Generation counter for RTM_GETTUNNEL dumps */
+	atomic_t vnifilter_seq;
 };
 
 struct vxlan_fdb_key {
@@ -177,6 +179,13 @@ vxlan_vnifilter_lookup(struct vxlan_dev *vxlan, __be32 vni)
 				      vxlan_vni_rht_params);
 }
 
+static inline void vxlan_vnifilter_seq_inc(const struct net *net)
+{
+	struct vxlan_net *vn = net_generic(net, vxlan_net_id);
+
+	atomic_inc(&vn->vnifilter_seq);
+}
+
 /* vxlan_core.c */
 int vxlan_fdb_create(struct vxlan_dev *vxlan,
 		     const u8 *mac, union vxlan_addr *ip,
@@ -195,9 +204,10 @@ int vxlan_fdb_update(struct vxlan_dev *vxlan,
 		     __u32 ifindex, __u16 ndm_flags, u32 nhid,
 		     bool swdev_notify, struct netlink_ext_ack *extack);
 void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
+		    const struct vxlan_config *cfg,
 		    __be32 default_vni, struct vxlan_rdst *rdst, bool did_rsc);
 int vxlan_vni_in_use(struct net *src_net, struct vxlan_dev *vxlan,
-		     struct vxlan_config *conf, __be32 vni);
+		     const struct vxlan_config *conf, __be32 vni);
 
 /* vxlan_vnifilter.c */
 int vxlan_vnigroup_init(struct vxlan_dev *vxlan);
@@ -205,7 +215,8 @@ void vxlan_vnigroup_uninit(struct vxlan_dev *vxlan);
 
 int vxlan_vnifilter_init(void);
 void vxlan_vnifilter_uninit(void);
-void vxlan_vnifilter_count(struct vxlan_dev *vxlan, __be32 vni,
+void vxlan_vnifilter_count(struct vxlan_dev *vxlan,
+			   const struct vxlan_config *cfg, __be32 vni,
 			   struct vxlan_vni_node *vninode,
 			   int type, unsigned int len);
 
@@ -214,8 +225,9 @@ void vxlan_vs_add_vnigrp(struct vxlan_dev *vxlan,
 			 bool ipv6);
 void vxlan_vs_del_vnigrp(struct vxlan_dev *vxlan);
 int vxlan_vnilist_update_group(struct vxlan_dev *vxlan,
-			       union vxlan_addr *old_remote_ip,
-			       union vxlan_addr *new_remote_ip,
+			       const union vxlan_addr *old_remote_ip,
+			       const union vxlan_addr *new_remote_ip,
+			       u32 old_ifindex, u32 new_ifindex,
 			       struct netlink_ext_ack *extack);
 
 
@@ -223,10 +235,10 @@ int vxlan_vnilist_update_group(struct vxlan_dev *vxlan,
 int vxlan_multicast_join(struct vxlan_dev *vxlan);
 int vxlan_multicast_leave(struct vxlan_dev *vxlan);
 bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,
-		      __be32 vni, union vxlan_addr *rip, int rifindex);
-int vxlan_igmp_join(struct vxlan_dev *vxlan, union vxlan_addr *rip,
+		      __be32 vni, const union vxlan_addr *rip, int rifindex);
+int vxlan_igmp_join(struct vxlan_dev *vxlan, const union vxlan_addr *rip,
 		    int rifindex);
-int vxlan_igmp_leave(struct vxlan_dev *vxlan, union vxlan_addr *rip,
+int vxlan_igmp_leave(struct vxlan_dev *vxlan, const union vxlan_addr *rip,
 		     int rifindex);
 
 /* vxlan_mdb.c */
@@ -241,9 +253,11 @@ int vxlan_mdb_del_bulk(struct net_device *dev, struct nlattr *tb[],
 int vxlan_mdb_get(struct net_device *dev, struct nlattr *tb[], u32 portid,
 		  u32 seq, struct netlink_ext_ack *extack);
 struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan,
+						const struct vxlan_config *cfg,
 						struct sk_buff *skb,
 						__be32 src_vni);
 netdev_tx_t vxlan_mdb_xmit(struct vxlan_dev *vxlan,
+			   const struct vxlan_config *cfg,
 			   const struct vxlan_mdb_entry *mdb_entry,
 			   struct sk_buff *skb);
 int vxlan_mdb_init(struct vxlan_dev *vxlan);
diff --git a/drivers/net/vxlan/vxlan_vnifilter.c b/drivers/net/vxlan/vxlan_vnifilter.c
index dd94085e08865..543eaf420f4c2 100644
--- a/drivers/net/vxlan/vxlan_vnifilter.c
+++ b/drivers/net/vxlan/vxlan_vnifilter.c
@@ -171,13 +171,14 @@ static void vxlan_vnifilter_stats_add(struct vxlan_vni_node *vninode,
 	u64_stats_update_end(&pstats->syncp);
 }
 
-void vxlan_vnifilter_count(struct vxlan_dev *vxlan, __be32 vni,
+void vxlan_vnifilter_count(struct vxlan_dev *vxlan,
+			   const struct vxlan_config *cfg, __be32 vni,
 			   struct vxlan_vni_node *vninode,
 			   int type, unsigned int len)
 {
 	struct vxlan_vni_node *vnode;
 
-	if (!(vxlan->cfg.flags & VXLAN_F_VNIFILTER))
+	if (!(cfg->flags & VXLAN_F_VNIFILTER))
 		return;
 
 	if (vninode) {
@@ -333,22 +334,36 @@ static int vxlan_vnifilter_dump_dev(const struct net_device *dev,
 				    struct sk_buff *skb,
 				    struct netlink_callback *cb)
 {
-	struct vxlan_vni_node *tmp, *v, *vbegin = NULL, *vend = NULL;
+	struct vxlan_vni_node *v, *vbegin = NULL, *vend = NULL;
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct tunnel_msg *new_tmsg, *tmsg;
-	int idx = 0, s_idx = cb->args[1];
+	const struct vxlan_config *cfg;
 	struct vxlan_vni_group *vg;
 	struct nlmsghdr *nlh;
+	int idx = 0, s_idx;
 	bool dump_stats;
 	int err = 0;
 
-	if (!(vxlan->cfg.flags & VXLAN_F_VNIFILTER))
+	if (cb->args[2] != dev->ifindex) {
+		cb->args[1] = 0;
+		cb->args[2] = dev->ifindex;
+	}
+	s_idx = cb->args[1];
+
+	cfg = rcu_dereference(vxlan->cfg);
+	if (!(cfg->flags & VXLAN_F_VNIFILTER)) {
+		cb->args[1] = 0;
+		cb->args[2] = 0;
 		return -EINVAL;
+	}
 
 	/* RCU needed because of the vni locking rules (rcu || rtnl) */
 	vg = rcu_dereference(vxlan->vnigrp);
-	if (!vg || !vg->num_vnis)
+	if (!vg || !vg->num_vnis) {
+		cb->args[1] = 0;
+		cb->args[2] = 0;
 		return 0;
+	}
 
 	tmsg = nlmsg_data(cb->nlh);
 	dump_stats = !!(tmsg->flags & TUNNEL_MSG_FLAG_STATS);
@@ -362,7 +377,7 @@ static int vxlan_vnifilter_dump_dev(const struct net_device *dev,
 	new_tmsg->family = PF_BRIDGE;
 	new_tmsg->ifindex = dev->ifindex;
 
-	list_for_each_entry_safe(v, tmp, &vg->vni_list, vlist) {
+	list_for_each_entry_rcu(v, &vg->vni_list, vlist) {
 		if (idx < s_idx) {
 			idx++;
 			continue;
@@ -394,12 +409,26 @@ static int vxlan_vnifilter_dump_dev(const struct net_device *dev,
 	}
 
 	cb->args[1] = err ? idx : 0;
+	cb->args[2] = err ? dev->ifindex : 0;
 
 	nlmsg_end(skb, nlh);
 
+	nl_dump_check_consistent(cb, nlh);
+
 	return err;
 }
 
+static u32 vxlan_vnifilter_base_seq(const struct net *net)
+{
+	const struct vxlan_net *vn = net_generic(net, vxlan_net_id);
+	u32 res = atomic_read(&vn->vnifilter_seq);
+
+	/* Must not return 0 (see nl_dump_check_consistent()) */
+	if (!res)
+		res = 0x80000000;
+	return res;
+}
+
 static int vxlan_vnifilter_dump(struct sk_buff *skb, struct netlink_callback *cb)
 {
 	int idx = 0, err = 0, s_idx = cb->args[0];
@@ -419,6 +448,9 @@ static int vxlan_vnifilter_dump(struct sk_buff *skb, struct netlink_callback *cb
 	}
 
 	rcu_read_lock();
+
+	cb->seq = vxlan_vnifilter_base_seq(net);
+
 	if (tmsg->ifindex) {
 		dev = dev_get_by_index_rcu(net, tmsg->ifindex);
 		if (!dev) {
@@ -471,23 +503,31 @@ static const struct nla_policy vni_filter_policy[VXLAN_VNIFILTER_MAX + 1] = {
 };
 
 static int vxlan_update_default_fdb_entry(struct vxlan_dev *vxlan, __be32 vni,
-					  union vxlan_addr *old_remote_ip,
-					  union vxlan_addr *remote_ip,
+					  const union vxlan_addr *old_remote_ip,
+					  const union vxlan_addr *remote_ip,
+					  u32 old_ifindex, u32 new_ifindex,
 					  struct netlink_ext_ack *extack)
 {
-	struct vxlan_rdst *dst = &vxlan->default_dst;
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
 	int err = 0;
 
+	if (old_remote_ip && remote_ip &&
+	    vxlan_addr_equal(old_remote_ip, remote_ip) &&
+	    old_ifindex == new_ifindex)
+		return 0;
+
 	spin_lock_bh(&vxlan->hash_lock);
 	if (remote_ip && !vxlan_addr_any(remote_ip)) {
+		union vxlan_addr rip = *remote_ip;
+
 		err = vxlan_fdb_update(vxlan, all_zeros_mac,
-				       remote_ip,
+				       &rip,
 				       NUD_REACHABLE | NUD_PERMANENT,
 				       NLM_F_APPEND | NLM_F_CREATE,
-				       vxlan->cfg.dst_port,
+				       cfg->dst_port,
 				       vni,
 				       vni,
-				       dst->remote_ifindex,
+				       new_ifindex,
 				       NTF_SELF, 0, true, extack);
 		if (err) {
 			spin_unlock_bh(&vxlan->hash_lock);
@@ -498,9 +538,9 @@ static int vxlan_update_default_fdb_entry(struct vxlan_dev *vxlan, __be32 vni,
 	if (old_remote_ip && !vxlan_addr_any(old_remote_ip)) {
 		__vxlan_fdb_delete(vxlan, all_zeros_mac,
 				   *old_remote_ip,
-				   vxlan->cfg.dst_port,
+				   cfg->dst_port,
 				   vni, vni,
-				   dst->remote_ifindex,
+				   old_ifindex,
 				   true);
 	}
 	spin_unlock_bh(&vxlan->hash_lock);
@@ -515,8 +555,8 @@ static int vxlan_vni_update_group(struct vxlan_dev *vxlan,
 				  struct netlink_ext_ack *extack)
 {
 	struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id);
-	struct vxlan_rdst *dst = &vxlan->default_dst;
-	union vxlan_addr *newrip = NULL, *oldrip = NULL;
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
+	const union vxlan_addr *newrip = NULL, *oldrip = NULL;
 	union vxlan_addr old_remote_ip;
 	int ret = 0;
 
@@ -528,8 +568,8 @@ static int vxlan_vni_update_group(struct vxlan_dev *vxlan,
 	if (group && !vxlan_addr_any(group)) {
 		newrip = group;
 	} else {
-		if (!vxlan_addr_any(&dst->remote_ip))
-			newrip = &dst->remote_ip;
+		if (!vxlan_addr_any(&cfg->remote_ip))
+			newrip = &cfg->remote_ip;
 	}
 
 	/* if old rip exists, and no newrip,
@@ -546,6 +586,8 @@ static int vxlan_vni_update_group(struct vxlan_dev *vxlan,
 
 	ret = vxlan_update_default_fdb_entry(vxlan, vninode->vni,
 					     oldrip, newrip,
+					     cfg->remote_ifindex,
+					     cfg->remote_ifindex,
 					     extack);
 	if (ret)
 		goto out;
@@ -557,7 +599,7 @@ static int vxlan_vni_update_group(struct vxlan_dev *vxlan,
 		if (vxlan_addr_multicast(&old_remote_ip) &&
 		    !vxlan_group_used(vn, vxlan, vninode->vni,
 				      &old_remote_ip,
-				      vxlan->default_dst.remote_ifindex)) {
+				      cfg->remote_ifindex)) {
 			ret = vxlan_igmp_leave(vxlan, &old_remote_ip,
 					       0);
 			if (ret)
@@ -581,10 +623,12 @@ static int vxlan_vni_update_group(struct vxlan_dev *vxlan,
 }
 
 int vxlan_vnilist_update_group(struct vxlan_dev *vxlan,
-			       union vxlan_addr *old_remote_ip,
-			       union vxlan_addr *new_remote_ip,
+			       const union vxlan_addr *old_remote_ip,
+			       const union vxlan_addr *new_remote_ip,
+			       u32 old_ifindex, u32 new_ifindex,
 			       struct netlink_ext_ack *extack)
 {
+	const union vxlan_addr *oldrip, *newrip;
 	struct list_head *headp, *hpos;
 	struct vxlan_vni_group *vg;
 	struct vxlan_vni_node *vent;
@@ -595,14 +639,24 @@ int vxlan_vnilist_update_group(struct vxlan_dev *vxlan,
 	headp = &vg->vni_list;
 	list_for_each_prev(hpos, headp) {
 		vent = list_entry(hpos, struct vxlan_vni_node, vlist);
+
 		if (vxlan_addr_any(&vent->remote_ip)) {
-			ret = vxlan_update_default_fdb_entry(vxlan, vent->vni,
-							     old_remote_ip,
-							     new_remote_ip,
-							     extack);
-			if (ret)
-				return ret;
+			oldrip = old_remote_ip;
+			newrip = new_remote_ip;
+		} else {
+			/* A vni with its own group keeps it, but its fdb entry
+			 * is still keyed on the device remote_ifindex.
+			 */
+			oldrip = &vent->remote_ip;
+			newrip = &vent->remote_ip;
 		}
+
+		ret = vxlan_update_default_fdb_entry(vxlan, vent->vni,
+						     oldrip, newrip,
+						     old_ifindex, new_ifindex,
+						     extack);
+		if (ret)
+			return ret;
 	}
 
 	return 0;
@@ -612,20 +666,20 @@ static void vxlan_vni_delete_group(struct vxlan_dev *vxlan,
 				   struct vxlan_vni_node *vninode)
 {
 	struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id);
-	struct vxlan_rdst *dst = &vxlan->default_dst;
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
 
 	/* if per vni remote_ip not present, delete the
 	 * default dst remote_ip previously added for this vni
 	 */
 	if (!vxlan_addr_any(&vninode->remote_ip) ||
-	    !vxlan_addr_any(&dst->remote_ip)) {
+	    !vxlan_addr_any(&cfg->remote_ip)) {
 		spin_lock_bh(&vxlan->hash_lock);
 		__vxlan_fdb_delete(vxlan, all_zeros_mac,
 				   (vxlan_addr_any(&vninode->remote_ip) ?
-				   dst->remote_ip : vninode->remote_ip),
-				   vxlan->cfg.dst_port,
+				   cfg->remote_ip : vninode->remote_ip),
+				   cfg->dst_port,
 				   vninode->vni, vninode->vni,
-				   dst->remote_ifindex,
+				   cfg->remote_ifindex,
 				   true);
 		spin_unlock_bh(&vxlan->hash_lock);
 	}
@@ -634,7 +688,7 @@ static void vxlan_vni_delete_group(struct vxlan_dev *vxlan,
 		if (vxlan_addr_multicast(&vninode->remote_ip) &&
 		    !vxlan_group_used(vn, vxlan, vninode->vni,
 				      &vninode->remote_ip,
-				      dst->remote_ifindex)) {
+				      cfg->remote_ifindex)) {
 			vxlan_igmp_leave(vxlan, &vninode->remote_ip, 0);
 		}
 	}
@@ -659,13 +713,16 @@ static int vxlan_vni_update(struct vxlan_dev *vxlan,
 	if (ret)
 		return ret;
 
-	if (*changed)
+	if (*changed) {
+		vxlan_vnifilter_seq_inc(dev_net(vxlan->dev));
 		vxlan_vnifilter_notify(vxlan, vninode, RTM_NEWTUNNEL);
+	}
 
 	return 0;
 }
 
-static void __vxlan_vni_add_list(struct vxlan_vni_group *vg,
+static void __vxlan_vni_add_list(struct vxlan_dev *vxlan,
+				 struct vxlan_vni_group *vg,
 				 struct vxlan_vni_node *v)
 {
 	struct list_head *headp, *hpos;
@@ -681,13 +738,16 @@ static void __vxlan_vni_add_list(struct vxlan_vni_group *vg,
 	}
 	list_add_rcu(&v->vlist, hpos);
 	vg->num_vnis++;
+	vxlan_vnifilter_seq_inc(dev_net(vxlan->dev));
 }
 
-static void __vxlan_vni_del_list(struct vxlan_vni_group *vg,
+static void __vxlan_vni_del_list(struct vxlan_dev *vxlan,
+				 struct vxlan_vni_group *vg,
 				 struct vxlan_vni_node *v)
 {
 	list_del_rcu(&v->vlist);
 	vg->num_vnis--;
+	vxlan_vnifilter_seq_inc(dev_net(vxlan->dev));
 }
 
 static struct vxlan_vni_node *vxlan_vni_alloc(struct vxlan_dev *vxlan,
@@ -723,6 +783,7 @@ static int vxlan_vni_add(struct vxlan_dev *vxlan,
 			 u32 vni, union vxlan_addr *group,
 			 struct netlink_ext_ack *extack)
 {
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
 	struct vxlan_vni_node *vninode;
 	__be32 v = cpu_to_be32(vni);
 	bool changed = false;
@@ -731,7 +792,7 @@ static int vxlan_vni_add(struct vxlan_dev *vxlan,
 	if (vxlan_vnifilter_lookup(vxlan, v))
 		return vxlan_vni_update(vxlan, vg, v, group, &changed, extack);
 
-	err = vxlan_vni_in_use(vxlan->net, vxlan, &vxlan->cfg, v);
+	err = vxlan_vni_in_use(vxlan->net, vxlan, cfg, v);
 	if (err) {
 		NL_SET_ERR_MSG(extack, "VNI in use");
 		return err;
@@ -749,7 +810,7 @@ static int vxlan_vni_add(struct vxlan_dev *vxlan,
 		return err;
 	}
 
-	__vxlan_vni_add_list(vg, vninode);
+	__vxlan_vni_add_list(vxlan, vg, vninode);
 
 	if (vxlan->dev->flags & IFF_UP)
 		vxlan_vs_add_del_vninode(vxlan, vninode, false);
@@ -795,7 +856,7 @@ static int vxlan_vni_del(struct vxlan_dev *vxlan,
 	if (err)
 		goto out;
 
-	__vxlan_vni_del_list(vg, vninode);
+	__vxlan_vni_del_list(vxlan, vg, vninode);
 
 	vxlan_vnifilter_notify(vxlan, vninode, RTM_DELTUNNEL);
 
@@ -844,6 +905,7 @@ static int vxlan_process_vni_filter(struct vxlan_dev *vxlan,
 				    int cmd, struct netlink_ext_ack *extack)
 {
 	struct nlattr *vattrs[VXLAN_VNIFILTER_ENTRY_MAX + 1];
+	const struct vxlan_config *cfg;
 	u32 vni_start = 0, vni_end = 0;
 	union vxlan_addr group;
 	int err;
@@ -881,7 +943,8 @@ static int vxlan_process_vni_filter(struct vxlan_dev *vxlan,
 		memset(&group, 0, sizeof(group));
 	}
 
-	if (vxlan_addr_multicast(&group) && !vxlan->default_dst.remote_ifindex) {
+	cfg = rtnl_dereference(vxlan->cfg);
+	if (vxlan_addr_multicast(&group) && !cfg->remote_ifindex) {
 		NL_SET_ERR_MSG(extack,
 			       "Local interface required for multicast remote group");
 
@@ -909,7 +972,7 @@ void vxlan_vnigroup_uninit(struct vxlan_dev *vxlan)
 #if IS_ENABLED(CONFIG_IPV6)
 		hlist_del_init_rcu(&v->hlist6.hlist);
 #endif
-		__vxlan_vni_del_list(vg, v);
+		__vxlan_vni_del_list(vxlan, vg, v);
 		vxlan_vnifilter_notify(vxlan, v, RTM_DELTUNNEL);
 		call_rcu(&v->rcu, vxlan_vni_node_rcu_free);
 	}
@@ -940,6 +1003,7 @@ static int vxlan_vnifilter_process(struct sk_buff *skb, struct nlmsghdr *nlh,
 				   struct netlink_ext_ack *extack)
 {
 	struct net *net = sock_net(skb->sk);
+	const struct vxlan_config *cfg;
 	struct tunnel_msg *tmsg;
 	struct vxlan_dev *vxlan;
 	struct net_device *dev;
@@ -964,8 +1028,9 @@ static int vxlan_vnifilter_process(struct sk_buff *skb, struct nlmsghdr *nlh,
 	}
 
 	vxlan = netdev_priv(dev);
+	cfg = rtnl_dereference(vxlan->cfg);
 
-	if (!(vxlan->cfg.flags & VXLAN_F_VNIFILTER))
+	if (!(cfg->flags & VXLAN_F_VNIFILTER))
 		return -EOPNOTSUPP;
 
 	nlmsg_for_each_attr_type(attr, VXLAN_VNIFILTER_ENTRY, nlh,
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index 7b82075055237..c3c9f2ccc3d1b 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -204,7 +204,6 @@ struct vxlan_rdst {
 	u8			 offloaded:1;
 	__be32			 remote_vni;
 	u32			 remote_ifindex;
-	struct net_device	 *remote_dev;
 	struct list_head	 list;
 	struct rcu_head		 rcu;
 	struct dst_cache	 dst_cache;
@@ -229,6 +228,7 @@ struct vxlan_config {
 	bool				no_share;
 	enum ifla_vxlan_df		df;
 	struct vxlanhdr			reserved_bits;
+	struct rcu_head			rcu;
 };
 
 enum {
@@ -294,14 +294,15 @@ struct vxlan_dev {
 #endif
 	struct net_device *dev;
 	struct net	  *net;		/* netns for packet i/o */
-	struct vxlan_rdst default_dst;	/* default destination */
+	struct net_device *lowerdev;
 
 	struct timer_list age_timer;
 	spinlock_t	  hash_lock;
 	unsigned int	  addrcnt;
 	struct gro_cells  gro_cells;
+	unsigned long	  flags;
 
-	struct vxlan_config	cfg;
+	struct vxlan_config __rcu	*cfg;
 
 	struct vxlan_vni_group  __rcu *vnigrp;
 
@@ -313,6 +314,10 @@ struct vxlan_dev {
 	unsigned int mdb_seq;
 };
 
+enum vxlan_dev_flags {
+	VXLAN_DEV_F_MDB,
+};
+
 #define VXLAN_F_LEARN			0x01
 #define VXLAN_F_PROXY			0x02
 #define VXLAN_F_RSC			0x04
@@ -331,7 +336,6 @@ struct vxlan_dev {
 #define VXLAN_F_IPV6_LINKLOCAL		0x8000
 #define VXLAN_F_TTL_INHERIT		0x10000
 #define VXLAN_F_VNIFILTER               0x20000
-#define VXLAN_F_MDB			0x40000
 #define VXLAN_F_LOCALBYPASS		0x80000
 #define VXLAN_F_MC_ROUTE		0x100000
 

3/2 2026/09/17 06:36 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 48529
							output: 26
							thoughts: 781
						

Thoughts:
**Analyzing the Syzkaller Fuzzing Patch Series: VXLAN Modifications**

Okay, let's dive into this patch series for syzkaller fuzzing. My initial impression is that this is potentially very interesting based on the diffs alone. I'm seeing changes across a significant number of VXLAN-related files, specifically: `drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c`, `drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c`, `drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c`, and a whole slew of files within `drivers/net/vxlan/`. That's a strong indicator that the core VXLAN driver is getting some serious attention.

Given my understanding of networking, VXLAN being a virtual network device driver (`CONFIG_VXLAN`) makes it easily accessible to fuzzing. Syzkaller can manipulate it through `rtnetlink` commands like `ip link add type vxlan`, `ip link set`, and utilize netlink MDB. I'd expect standard virtualized environments like QEMU to have no issues supporting this setup. This is good news; it's practically tailor-made for syzkaller.

Now, let's break down the VXLAN changes themselves. The refactoring involves:

*   Altering `struct vxlan_config cfg` within `struct vxlan_dev` to a pointer `struct vxlan_config __rcu *cfg`. That immediately grabs my attention – this likely involves RCU (Read-Copy-Update) synchronization.
*   Dynamic allocation of the `cfg` struct using `kmemdup` in `vxlan_dev_configure` and `vxlan_changelink`, and the associated memory management using `kfree_rcu` and `vxlan_free_dev` (again, RCU!). Dynamic memory allocation and RCU always introduce interesting fuzzing vectors.
*   Changing default destination representation – Replacing `default_dst` with `lowerdev` and accessing remote VNI/IP via `cfg`. This suggests a potential shift in how VXLAN handles forwarding and configuration.
*   Splitting `VXLAN_F_MDB` and using `test_bit`, `set_bit`, `clear_bit(VXLAN_DEV_F_MDB, &vxlan->flags)`. This is a classic bit flag manipulation with likely implications for concurrency.
*   RCU dereferencing of `vxlan->cfg` in both datapath (`vxlan_rcv`, `vxlan_xmit`) and control plane (`vxlan_changelink`, `vxlan_fill_info`, etc.). RCU dereferences are always good targets.
*   The addition of `vnifilter_seq` and generation checks. This hints at some sort of versioning or sequence tracking.
*   Finally, the patch includes corresponding changes within the `mlx5` and `mlxsw` drivers for the new VXLAN config layout. This suggests tight integration and further complexity.

Considering all this, is it worth fuzzing? Absolutely! This touches core networking, virtual network driver VXLAN. This touches RCU synchronization, dynamic memory allocation of configs, memory lifetime, pointers, netlink handling, packet transmit/receive handling, FDB handling... This is a goldmine for syzkaller. We're talking about refactoring/restructuring of reachable data structures, RCU dereferences, and state management in the VXLAN core. This fits squarely within Section 3 ("Core Subsystems", "Refactorings and Code Cleanups", "Reachable Drivers and Protocols") of our fuzzing guidelines.

The next step is to verify the configs and FocusSymbols. I'll take a look at the Kconfig file for VXLAN to make sure everything's as expected.



4/2 2026/09/17 06:36 tool grepper
0m Args:
{
  "Expression": "config VXLAN",
  "PathPrefix": "drivers/net"
}

Results:
{
  "Output": "drivers/net/Kconfig=216=config IPVTAP\n--\ndrivers/net/Kconfig-229-\ndrivers/net/Kconfig:230:config VXLAN\ndrivers/net/Kconfig-231-\ttristate \"Virtual eXtensible Local Area Network (VXLAN)\"\n"
}

5/2 2026/09/17 06:36 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 50249
							output: 34
							thoughts: 22
						

Thoughts:
Here's my summary, as if I were thinking these thoughts:

**Examining Network Driver Dependencies**

Okay, let's dive into this. I need to understand the configuration dependencies for a specific network driver, so where do I start? The best place to find that information is in the Kconfig file for the networking subsystem. Specifically, I'm thinking I should look at `drivers/net/Kconfig` to get the full picture. My instincts are telling me to focus around line 230 in that file. That should get me to the right section or at least near it. From there, I can analyze the various `depends on` statements and figure out the exact configuration options this driver relies on. I need to be efficient and find the most pertinent information quickly. I know this file structure pretty well, so this shouldn't take long.



6/2 2026/09/17 06:36 tool read-file
0m Args:
{
  "File": "drivers/net/Kconfig",
  "FirstLine": 230,
  "LineCount": 25
}

Results:
{
  "Contents": " 230:\tconfig VXLAN\n 231:\t\ttristate \"Virtual eXtensible Local Area Network (VXLAN)\"\n 232:\t\tdepends on INET\n 233:\t\tselect NET_UDP_TUNNEL\n 234:\t\tselect GRO_CELLS\n 235:\t\thelp\n 236:\t\t  This allows one to create vxlan virtual interfaces that provide\n 237:\t\t  Layer 2 Networks over Layer 3 Networks. VXLAN is often used\n 238:\t\t  to tunnel virtual network infrastructure in virtualized environments.\n 239:\t\t  For more information see:\n 240:\t\t    http://tools.ietf.org/html/draft-mahalingam-dutt-dcops-vxlan-02\n 241:\t\n 242:\t\t  To compile this driver as a module, choose M here: the module\n 243:\t\t  will be called vxlan.\n 244:\t\n 245:\tconfig GENEVE\n 246:\t\ttristate \"Generic Network Virtualization Encapsulation\"\n 247:\t\tdepends on INET\n 248:\t\tselect NET_UDP_TUNNEL\n 249:\t\tselect GRO_CELLS\n 250:\t\thelp\n 251:\t\t  This allows one to create geneve virtual interfaces that provide\n 252:\t\t  Layer 2 Networks over Layer 3 Networks. GENEVE is often used\n 253:\t\t  to tunnel virtual network infrastructure in virtualized environments.\n 254:\t\t  For more information see:\n"
}

7/2 2026/09/17 06:36 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 50882
							output: 30
							thoughts: 31
						

Thoughts:
Okay, here's my interpretation of those thoughts, summarized from my perspective as a networking expert:

**Investigating VXLAN Configuration Dependencies**

Alright, so `CONFIG_VXLAN` is dependent on `INET`, which makes sense. I need to get a better handle on the entire configuration landscape for VXLAN. My immediate thought is, let's drill down into the `drivers/net/vxlan/Makefile` file. It's the Makefile; so it’s likely to hold the real secrets about conditional compilation and dependencies within that specific VXLAN implementation. I expect to find further configuration options or dependencies listed there that could influence how VXLAN is built and integrated. I need to see what else needs to be considered.



8/2 2026/09/17 06:36 tool grepper
0m Args:
{
  "Expression": "vxlan",
  "PathPrefix": "drivers/net/vxlan/Makefile"
}

Results:
{
  "Output": "drivers/net/vxlan/Makefile-1-#\ndrivers/net/vxlan/Makefile:2:# Makefile for the vxlan driver\ndrivers/net/vxlan/Makefile-3-#\ndrivers/net/vxlan/Makefile-4-\ndrivers/net/vxlan/Makefile:5:obj-$(CONFIG_VXLAN) += vxlan.o\ndrivers/net/vxlan/Makefile-6-\ndrivers/net/vxlan/Makefile:7:vxlan-objs := vxlan_core.o vxlan_multicast.o vxlan_vnifilter.o vxlan_mdb.o\n"
}

9/2 2026/09/17 06:36 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 51242
							output: 28
							thoughts: 102
						

Thoughts:
**My Kernel Module Compilation Checklist**

Okay, so I'm looking at this VXLAN code, and immediately I'm thinking about the build process.  I see that `vxlan_core.o`, `vxlan_multicast.o`, `vxlan_vnifilter.o`, and `vxlan_mdb.o` are all getting built when `CONFIG_VXLAN` is set, which is the expected base configuration.  Given that VXLAN is a networking technology, `INET` is almost certainly a given, and I wouldn't be surprised to see `IPV6` enabled as well, but I need to confirm everything.

Now, before I dig too deep into the code itself, I should make sure I have a complete picture of the dependencies and relevant build configurations. My next step will be a thorough `grep` inside the `drivers/net/vxlan/` directory for any other `CONFIG_` directives that could influence the VXLAN module build. I want to identify any other flags that might affect VXLAN's behavior or dependencies before I get any deeper. I'm after the full context before I start looking at the code itself.



10/2 2026/09/17 06:36 tool grepper
0m Args:
{
  "Expression": "CONFIG_",
  "PathPrefix": "drivers/net/vxlan"
}

Results:
{
  "Output": "drivers/net/vxlan/Makefile-4-\ndrivers/net/vxlan/Makefile:5:obj-$(CONFIG_VXLAN) += vxlan.o\ndrivers/net/vxlan/Makefile-6-\n--\ndrivers/net/vxlan/vxlan_core.c-32-\ndrivers/net/vxlan/vxlan_core.c:33:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-34-#include \u003cnet/ip6_tunnel.h\u003e\n--\ndrivers/net/vxlan/vxlan_core.c=100=static struct vxlan_dev *vxlan_vs_find_vni(struct vxlan_sock *vs,\n--\ndrivers/net/vxlan/vxlan_core.c-128-\ndrivers/net/vxlan/vxlan_core.c:129:\t\tif (IS_ENABLED(CONFIG_IPV6)) {\ndrivers/net/vxlan/vxlan_core.c-130-\t\t\tif ((cfg-\u003eflags \u0026 VXLAN_F_IPV6_LINKLOCAL) \u0026\u0026\n--\ndrivers/net/vxlan/vxlan_core.c=1161=static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_core.c-1187-\t\t\tip-\u003esa.sa_family = AF_INET;\ndrivers/net/vxlan/vxlan_core.c:1188:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-1189-\t\t} else {\n--\ndrivers/net/vxlan/vxlan_core.c=1451=static enum skb_drop_reason vxlan_snoop(struct net_device *dev,\n--\ndrivers/net/vxlan/vxlan_core.c-1464-\ndrivers/net/vxlan/vxlan_core.c:1465:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-1466-\tif (src_ip-\u003esa.sa_family == AF_INET6 \u0026\u0026\n--\ndrivers/net/vxlan/vxlan_core.c=1535=static void vxlan_sock_release(struct vxlan_dev *vxlan)\n--\ndrivers/net/vxlan/vxlan_core.c-1538-\tstruct vxlan_sock *sock4 = rtnl_dereference(vxlan-\u003evn4_sock);\ndrivers/net/vxlan/vxlan_core.c:1539:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-1540-\tstruct vxlan_sock *sock6 = rtnl_dereference(vxlan-\u003evn6_sock);\n--\ndrivers/net/vxlan/vxlan_core.c-1556-\ndrivers/net/vxlan/vxlan_core.c:1557:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-1558-\tif (__vxlan_sock_release_prep(sock6)) {\n--\ndrivers/net/vxlan/vxlan_core.c=1617=static enum skb_drop_reason vxlan_set_mac(struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_core.c-1636-\t\tsaddr.sa.sa_family = AF_INET;\ndrivers/net/vxlan/vxlan_core.c:1637:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-1638-\t} else {\n--\ndrivers/net/vxlan/vxlan_core.c=1651=static bool vxlan_ecn_decapsulate(struct vxlan_sock *vs, void *oiph,\n--\ndrivers/net/vxlan/vxlan_core.c-1657-\t\terr = IP_ECN_decapsulate(oiph, skb);\ndrivers/net/vxlan/vxlan_core.c:1658:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-1659-\telse\n--\ndrivers/net/vxlan/vxlan_core.c=1877=static int arp_reduce(struct net_device *dev, struct sk_buff *skb,\n--\ndrivers/net/vxlan/vxlan_core.c-1975-\ndrivers/net/vxlan/vxlan_core.c:1976:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-1977-static struct sk_buff *vxlan_na_create(struct sk_buff *request,\n--\ndrivers/net/vxlan/vxlan_core.c=2144=static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb,\n--\ndrivers/net/vxlan/vxlan_core.c-2176-\t}\ndrivers/net/vxlan/vxlan_core.c:2177:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-2178-\tcase ETH_P_IPV6:\n--\ndrivers/net/vxlan/vxlan_core.c=2310=static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,\n--\ndrivers/net/vxlan/vxlan_core.c-2334-\t\tloopback.sa.sa_family =  AF_INET;\ndrivers/net/vxlan/vxlan_core.c:2335:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-2336-\t} else {\n--\ndrivers/net/vxlan/vxlan_core.c=2361=static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev,\n--\ndrivers/net/vxlan/vxlan_core.c-2368-{\ndrivers/net/vxlan/vxlan_core.c:2369:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-2370-\t/* IPv6 rt-flags are checked against RTF_LOCAL, but the value of\n--\ndrivers/net/vxlan/vxlan_core.c=2401=void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,\n--\ndrivers/net/vxlan/vxlan_core.c-2488-\t\t\tudp_sum = !(flags \u0026 VXLAN_F_UDP_ZERO_CSUM6_TX);\ndrivers/net/vxlan/vxlan_core.c:2489:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-2490-\t\tswitch (cfg-\u003elabel_policy) {\n--\ndrivers/net/vxlan/vxlan_core.c-2611-\t\t\t\t    ipcb_flags);\ndrivers/net/vxlan/vxlan_core.c:2612:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-2613-\t} else {\n--\ndrivers/net/vxlan/vxlan_core.c=2788=static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)\n--\ndrivers/net/vxlan/vxlan_core.c-2833-\t\t}\ndrivers/net/vxlan/vxlan_core.c:2834:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-2835-\t\telse if (ntohs(eth-\u003eh_proto) == ETH_P_IPV6 \u0026\u0026\n--\ndrivers/net/vxlan/vxlan_core.c=2967=static void vxlan_vs_del_dev(struct vxlan_dev *vxlan)\n--\ndrivers/net/vxlan/vxlan_core.c-2971-\thlist_del_init_rcu(\u0026vxlan-\u003ehlist4.hlist);\ndrivers/net/vxlan/vxlan_core.c:2972:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-2973-\thlist_del_init_rcu(\u0026vxlan-\u003ehlist6.hlist);\n--\ndrivers/net/vxlan/vxlan_core.c=3329=static int vxlan_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)\n--\ndrivers/net/vxlan/vxlan_core.c-3357-\t} else {\ndrivers/net/vxlan/vxlan_core.c:3358:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-3359-\t\tstruct vxlan_sock *sock6 = rcu_dereference(vxlan-\u003evn6_sock);\n--\ndrivers/net/vxlan/vxlan_core.c-3372-\t\tdst_release(ndst);\ndrivers/net/vxlan/vxlan_core.c:3373:#else /* !CONFIG_IPV6 */\ndrivers/net/vxlan/vxlan_core.c-3374-\t\treturn -EPFNOSUPPORT;\n--\ndrivers/net/vxlan/vxlan_core.c=3751=static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)\n--\ndrivers/net/vxlan/vxlan_core.c-3781-\t\treturn PTR_ERR(vs);\ndrivers/net/vxlan/vxlan_core.c:3782:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-3783-\tif (ipv6) {\n--\ndrivers/net/vxlan/vxlan_core.c=3801=static int vxlan_sock_add(struct vxlan_dev *vxlan)\n--\ndrivers/net/vxlan/vxlan_core.c-3811-\tRCU_INIT_POINTER(vxlan-\u003evn4_sock, NULL);\ndrivers/net/vxlan/vxlan_core.c:3812:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-3813-\tRCU_INIT_POINTER(vxlan-\u003evn6_sock, NULL);\n--\ndrivers/net/vxlan/vxlan_core.c=3863=static int vxlan_config_validate(struct net *src_net, struct vxlan_config *conf,\n--\ndrivers/net/vxlan/vxlan_core.c-3905-\tif (conf-\u003esaddr.sa.sa_family == AF_INET6) {\ndrivers/net/vxlan/vxlan_core.c:3906:\t\tif (!IS_ENABLED(CONFIG_IPV6)) {\ndrivers/net/vxlan/vxlan_core.c-3907-\t\t\tNL_SET_ERR_MSG(extack,\n--\ndrivers/net/vxlan/vxlan_core.c-3963-\ndrivers/net/vxlan/vxlan_core.c:3964:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-3965-\t\tif (use_ipv6) {\n--\ndrivers/net/vxlan/vxlan_core.c-3984-\ndrivers/net/vxlan/vxlan_core.c:3985:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-3986-\t\tif (conf-\u003eflags \u0026 VXLAN_F_IPV6_LINKLOCAL) {\n--\ndrivers/net/vxlan/vxlan_core.c=4193=static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[],\n--\ndrivers/net/vxlan/vxlan_core.c-4232-\t} else if (data[IFLA_VXLAN_GROUP6]) {\ndrivers/net/vxlan/vxlan_core.c:4233:\t\tif (!IS_ENABLED(CONFIG_IPV6)) {\ndrivers/net/vxlan/vxlan_core.c-4234-\t\t\tNL_SET_ERR_MSG_ATTR(extack, tb[IFLA_VXLAN_GROUP6], \"IPv6 support not enabled in the kernel\");\n--\ndrivers/net/vxlan/vxlan_core.c-4255-\t} else if (data[IFLA_VXLAN_LOCAL6]) {\ndrivers/net/vxlan/vxlan_core.c:4256:\t\tif (!IS_ENABLED(CONFIG_IPV6)) {\ndrivers/net/vxlan/vxlan_core.c-4257-\t\t\tNL_SET_ERR_MSG_ATTR(extack, tb[IFLA_VXLAN_LOCAL6], \"IPv6 support not enabled in the kernel\");\n--\ndrivers/net/vxlan/vxlan_core.c=4724=static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev)\n--\ndrivers/net/vxlan/vxlan_core.c-4740-\t\t\t\tgoto nla_put_failure;\ndrivers/net/vxlan/vxlan_core.c:4741:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-4742-\t\t} else {\n--\ndrivers/net/vxlan/vxlan_core.c-4757-\t\t\t\tgoto nla_put_failure;\ndrivers/net/vxlan/vxlan_core.c:4758:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_core.c-4759-\t\t} else {\n--\ndrivers/net/vxlan/vxlan_mdb.c=98=static void vxlan_br_mdb_entry_fill(const struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_mdb.c-116-\t\tbreak;\ndrivers/net/vxlan/vxlan_mdb.c:117:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_mdb.c-118-\tcase AF_INET6:\n--\ndrivers/net/vxlan/vxlan_mdb.c=345=static bool vxlan_mdb_is_valid_source(const struct nlattr *attr, __be16 proto,\n--\ndrivers/net/vxlan/vxlan_mdb.c-362-\t\tbreak;\ndrivers/net/vxlan/vxlan_mdb.c:363:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_mdb.c-364-\tcase htons(ETH_P_IPV6): {\n--\ndrivers/net/vxlan/vxlan_mdb.c=391=static void vxlan_mdb_group_set(struct vxlan_mdb_entry_key *group,\n--\ndrivers/net/vxlan/vxlan_mdb.c-399-\t\tbreak;\ndrivers/net/vxlan/vxlan_mdb.c:400:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_mdb.c-401-\tcase htons(ETH_P_IPV6):\n--\ndrivers/net/vxlan/vxlan_mdb.c=1630=struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_mdb.c-1659-\t\tbreak;\ndrivers/net/vxlan/vxlan_mdb.c:1660:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_mdb.c-1661-\tcase htons(ETH_P_IPV6):\n--\ndrivers/net/vxlan/vxlan_mdb.c-1693-\t\tbreak;\ndrivers/net/vxlan/vxlan_mdb.c:1694:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_mdb.c-1695-\tcase htons(ETH_P_IPV6):\n--\ndrivers/net/vxlan/vxlan_multicast.c=17=int vxlan_igmp_join(struct vxlan_dev *vxlan, const union vxlan_addr *rip,\n--\ndrivers/net/vxlan/vxlan_multicast.c-36-\t\trelease_sock(sk);\ndrivers/net/vxlan/vxlan_multicast.c:37:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_multicast.c-38-\t} else {\n--\ndrivers/net/vxlan/vxlan_multicast.c=51=int vxlan_igmp_leave(struct vxlan_dev *vxlan, const union vxlan_addr *rip,\n--\ndrivers/net/vxlan/vxlan_multicast.c-70-\t\trelease_sock(sk);\ndrivers/net/vxlan/vxlan_multicast.c:71:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_multicast.c-72-\t} else {\n--\ndrivers/net/vxlan/vxlan_multicast.c=127=bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,\n--\ndrivers/net/vxlan/vxlan_multicast.c-134-\tstruct vxlan_sock *sock4;\ndrivers/net/vxlan/vxlan_multicast.c:135:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_multicast.c-136-\tstruct vxlan_sock *sock6;\n--\ndrivers/net/vxlan/vxlan_multicast.c-147-\ndrivers/net/vxlan/vxlan_multicast.c:148:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_multicast.c-149-\tsock6 = rtnl_dereference(dev-\u003evn6_sock);\n--\ndrivers/net/vxlan/vxlan_multicast.c-162-\t\t\tcontinue;\ndrivers/net/vxlan/vxlan_multicast.c:163:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_multicast.c-164-\t\tif (family == AF_INET6 \u0026\u0026\n--\ndrivers/net/vxlan/vxlan_private.h=74=static inline struct vxlan_rdst *first_remote_rtnl(struct vxlan_fdb *fdb)\n--\ndrivers/net/vxlan/vxlan_private.h-80-\ndrivers/net/vxlan/vxlan_private.h:81:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_private.h-82-static inline\n--\ndrivers/net/vxlan/vxlan_private.h=118=static inline bool vxlan_addr_is_multicast(const union vxlan_addr *ip)\n--\ndrivers/net/vxlan/vxlan_private.h-125-\ndrivers/net/vxlan/vxlan_private.h:126:#else /* !CONFIG_IPV6 */\ndrivers/net/vxlan/vxlan_private.h-127-\n--\ndrivers/net/vxlan/vxlan_vnifilter.c=39=static void vxlan_vs_add_del_vninode(struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_vnifilter.c-50-\t\t\thlist_del_init_rcu(\u0026v-\u003ehlist4.hlist);\ndrivers/net/vxlan/vxlan_vnifilter.c:51:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_vnifilter.c-52-\t\tif (!hlist_unhashed(\u0026v-\u003ehlist6.hlist))\n--\ndrivers/net/vxlan/vxlan_vnifilter.c-57-\ndrivers/net/vxlan/vxlan_vnifilter.c:58:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_vnifilter.c-59-\tvs = rtnl_dereference(vxlan-\u003evn6_sock);\n--\ndrivers/net/vxlan/vxlan_vnifilter.c=72=void vxlan_vs_add_vnigrp(struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_vnifilter.c-85-\tlist_for_each_entry_safe(v, tmp, \u0026vg-\u003evni_list, vlist) {\ndrivers/net/vxlan/vxlan_vnifilter.c:86:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_vnifilter.c-87-\t\tif (ipv6)\n--\ndrivers/net/vxlan/vxlan_vnifilter.c=97=void vxlan_vs_del_vnigrp(struct vxlan_dev *vxlan)\n--\ndrivers/net/vxlan/vxlan_vnifilter.c-108-\t\thlist_del_init_rcu(\u0026v-\u003ehlist4.hlist);\ndrivers/net/vxlan/vxlan_vnifilter.c:109:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_vnifilter.c-110-\t\thlist_del_init_rcu(\u0026v-\u003ehlist6.hlist);\n--\ndrivers/net/vxlan/vxlan_vnifilter.c=248=static bool vxlan_fill_vni_filter_entry(struct sk_buff *skb,\n--\ndrivers/net/vxlan/vxlan_vnifilter.c-274-\t\t\t\tgoto out_err;\ndrivers/net/vxlan/vxlan_vnifilter.c:275:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_vnifilter.c-276-\t\t} else {\n--\ndrivers/net/vxlan/vxlan_vnifilter.c=753=static struct vxlan_vni_node *vxlan_vni_alloc(struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_vnifilter.c-767-\tvninode-\u003ehlist4.vxlan = vxlan;\ndrivers/net/vxlan/vxlan_vnifilter.c:768:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_vnifilter.c-769-\tvninode-\u003ehlist6.vxlan = vxlan;\n--\ndrivers/net/vxlan/vxlan_vnifilter.c=962=void vxlan_vnigroup_uninit(struct vxlan_dev *vxlan)\n--\ndrivers/net/vxlan/vxlan_vnifilter.c-971-\t\thlist_del_init_rcu(\u0026v-\u003ehlist4.hlist);\ndrivers/net/vxlan/vxlan_vnifilter.c:972:#if IS_ENABLED(CONFIG_IPV6)\ndrivers/net/vxlan/vxlan_vnifilter.c-973-\t\thlist_del_init_rcu(\u0026v-\u003ehlist6.hlist);\n"
}

11/2 2026/09/17 06:36 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 57535
							output: 234
							thoughts: 1801
						

Thoughts:
**VXLAN Fuzzing Assessment**

Okay, let's break this down systematically. My initial assessment is focused on identifying potential fuzzing targets and determining the overall fuzzability of this VXLAN change. The primary configuration here is `CONFIG_VXLAN`, with `CONFIG_IPV6` as an optional dependency, so that's our baseline.

First, I'm checking the relevant functions that have been modified or newly introduced. In the core VXLAN files (`vxlan_core.c`, `vxlan_vnifilter.c`, `vxlan_mdb.c`, and `vxlan_multicast.c`), I've identified a list of functions that seem particularly interesting:

*   `vxlan_changelink`, `vxlan_xmit`, `vxlan_xmit_one`, `vxlan_rcv`, and `vxlan_free_dev` from `vxlan_core.c`
*   `vxlan_vnifilter_dump_dev`, `vxlan_vnifilter_count`, and `vxlan_vnilist_update_group` from `vxlan_vnifilter.c`
*   `vxlan_mdb_xmit`, `vxlan_mdb_entry_skb_get` from `vxlan_mdb.c`
*   `vxlan_multicast_join`, `vxlan_multicast_leave` from `vxlan_multicast.c`

Next, I need to understand whether these functions are potential targets for syzkaller. I'll need to confirm if they are exported or static. After examining the definitions, I've narrowed the list further, focusing on non-static functions, and identified these key entry points:

*   `vxlan_changelink`
*   `vxlan_xmit`
*   `vxlan_xmit_one`
*   `vxlan_rcv`
*   `vxlan_vnifilter_dump_dev`
*   `vxlan_vnilist_update_group`
*   `vxlan_mdb_xmit`

I can confirm that VXLAN functions are not ubiquitous lifecycles or hot-paths; they're very specific to VXLAN devices and packets, which makes them prime targets.

Now, considering the changes introduced by this patch – data structure restructuring (e.g., `cfg` now an RCU-managed pointer), memory management (`kmemdup`, `kfree_rcu`), and the altered RCU locking across the datapaths and netlink interfaces – this is definitely worth fuzzing. It's touching core VXLAN functionality. It's directly reachable through rtnetlink commands in QEMU. The data structure modifications, dynamic memory allocation, and concurrency changes all increase the chances of uncovering interesting bugs.

So, to summarize:

1.  **WorthFuzzing**: Absolutely. This patch is a good target due to substantial code changes, including refactoring, data structure modification, dynamic memory management, and concurrent datapath alterations.

2.  **FocusSymbols**: `vxlan_changelink`, `vxlan_xmit`, `vxlan_xmit_one`, `vxlan_rcv`, `vxlan_vnifilter_dump_dev`, `vxlan_vnilist_update_group`, and `vxlan_mdb_xmit`.

3.  **EnableConfigs**: `VXLAN` (with optional `INET`).

This is a good candidate for fuzzing.



12/2 2026/09/17 06:37 tool set-results
0m Args:
{
  "EnableConfigs": [
    "VXLAN"
  ],
  "FocusSymbols": [
    "vxlan_changelink",
    "vxlan_xmit",
    "vxlan_xmit_one",
    "vxlan_rcv",
    "vxlan_vnifilter_dump_dev",
    "vxlan_vnilist_update_group",
    "vxlan_mdb_xmit",
    "vxlan_multicast_join"
  ],
  "Reasoning": "The patch refactors the VXLAN virtual network device driver to manage its configuration (`vxlan_config`) dynamically via RCU instead of embedding it directly in `struct vxlan_dev`. It modifies RCU dereferencing across both the packet processing datapath (vxlan_rcv, vxlan_xmit, vxlan_xmit_one) and netlink control path (vxlan_changelink, vnifilter, mdb, and multicast operations). VXLAN is fully reachable in standard virtualized fuzzing environments via netlink and socket operations without dedicated hardware.",
  "WorthFuzzing": true
}

Results:
{
  "EnableConfigs": [
    "VXLAN"
  ],
  "FocusSymbols": [
    "vxlan_changelink",
    "vxlan_xmit",
    "vxlan_xmit_one",
    "vxlan_rcv",
    "vxlan_vnifilter_dump_dev",
    "vxlan_vnilist_update_group",
    "vxlan_mdb_xmit",
    "vxlan_multicast_join"
  ],
  "Reasoning": "The patch refactors the VXLAN virtual network device driver to manage its configuration (`vxlan_config`) dynamically via RCU instead of embedding it directly in `struct vxlan_dev`. It modifies RCU dereferencing across both the packet processing datapath (vxlan_rcv, vxlan_xmit, vxlan_xmit_one) and netlink control path (vxlan_changelink, vnifilter, mdb, and multicast operations). VXLAN is fully reachable in standard virtualized fuzzing environments via netlink and socket operations without dedicated hardware.",
  "WorthFuzzing": true
}

13/1 2026/09/17 06:37 action If
5m Args:
{
  "WorthFuzzing": true
}

Results:
null

14/2 2026/09/17 06:37 agent kmsan-evaluator
5m Model:
core

Args:
null

Results:
{
  "KMSANReasoning": "The patch series refactors the VXLAN driver and Mellanox driver offload code by making `vxlan-\u003ecfg` dynamically allocated and RCU-protected (instead of embedded in `struct vxlan_dev`), replacing embedded `default_dst` with direct configuration fields and `lowerdev`, and converting the `VXLAN_F_MDB` flag into a device bitflag.\n\nFrom a memory sanitization perspective:\n1. All allocated instances of `struct vxlan_config` are created via `kmemdup` from a stack `conf` structure that is explicitly zero-initialized via `memset(conf, 0, sizeof(*conf))` in `vxlan_nl2conf`.\n2. Stack structures such as `struct ifla_vxlan_port_range ports` in `vxlan_fill_info` have all fields explicitly assigned without padding (`low` and `high`, 4 bytes total). Similarly, `struct mlxsw_sp_nve_params params` has all fields initialized in `mlxsw_sp_bridge_*_vxlan_join`.\n3. Netlink messages and attributes sent to user space (e.g. in `vxlan_fdb_info`, `vxlan_vnifilter_dump_dev`, `vxlan_fill_info`) remain zero-initialized or explicitly populated as before.\n4. The risks introduced by this refactoring primarily involve RCU dereferencing correctness, pointer lifetime/UAF (covered by KASAN), and synchronization (covered by LOCKDEP).\n\nThere are no uninitialized memory reads or information leak risks that would require a dedicated KMSAN fuzzing session.",
  "NeedsKMSAN": false
}

Instruction:
You are an expert Linux kernel security engineer specializing in kernel memory
error detectors (KASAN and KMSAN). Your job is to review the provided patch series and
determine if the code changes justify spawning a dedicated KMSAN (KernelMemorySanitizer)
fuzzing session in addition to standard KASAN fuzzing.

CRITICAL DISTINCTION BETWEEN KASAN AND KMSAN:
- Standard KASAN kernel builds (upstream-apparmor-kasan.config) already enable
  a comprehensive suite of debugging tools and sanitizers, including KASAN
  (out-of-bounds accesses, use-after-free, double free, invalid free), LOCKDEP
  (locking bugs and deadlocks), UB-sanitizers, and memory corruption checks.
- KMSAN (KernelMemorySanitizer) detects reads of UNINITIALIZED memory (stack, heap,
  or page allocations) and kernel-to-user memory info-leaks.

Rule: THERE IS NO SENSE IN RUNNING A KMSAN SESSION IF A BUG CAN BE CAUGHT BY KASAN,
LOCKDEP, OR OTHER STANDARD BUG DETECTORS.
A dedicated KMSAN fuzzing session incurs significant resource costs. You must ONLY
set NeedsKMSAN=true if the code changes introduce or expose UNINITIALIZED MEMORY risks
that are detected ONLY by KMSAN.

Look holistically at the patch series and surrounding code. Even if no direct
uninitialized field accesses or new buffer allocations are added in the diff itself,
a patch may alter control flow, bounds checking, or data length calculations in ways
that change how the rest of the code operates on existing buffers (e.g. allowing
uninitialized stack/heap memory to be read, copied to user space, or used in control
flow). Do not hesitate to use your code access tools to inspect the surrounding code,
called functions, and callers.

Set NeedsKMSAN=true ONLY IF the patch introduces or modifies:
1. Kernel structures sent to user space (via copy_to_user, put_user, netlink skb
   attributes, ioctl output arguments, socket options, or BPF buffers) where fields
   or structure padding might not be fully initialized/zeroed.
2. Conditional logic or branching that depends on potentially uninitialized variables
   or struct fields.
3. Allocation or initialization of complex data structures where uninitialized fields
   could be read later in reachable code paths.
4. Bounds checks, lengths, or logic in a way that allows surrounding code to access
   uninitialized bytes of existing buffers.

Set NeedsKMSAN=false IF:
- The code changes primarily risk out-of-bounds access, array overflows, NULL pointer
  dereferences, locking deadlocks, or use-after-free bugs (these are already caught
  by KASAN, LOCKDEP, or standard bug detectors).
- All stack/heap structures touched or introduced by the patch are fully zeroed
  or initialized (e.g. using = {0}, memset, kzalloc) before being read or copied.
- The patch does not introduce any risk of uninitialized memory usage or info-leaks.

Use your code access tools to inspect the surrounding code if necessary, then provide
detailed KMSANReasoning contrasting KASAN vs KMSAN applicability for this patch.
Prefer calling several tools at the same time to save round-trips.


Use set-results tool to provide results of the analysis.
It must be called exactly once before the final reply.
Ignore results of this tool.

Prompt:
Target architecture: amd64

For your convenience, here is the diff of the changes:
commit fe645304dc0934987015440d0a8826871ca891f2
Author: syz-cluster <triage@syzkaller.com>
Date:   Thu Sep 17 06:36:03 2026 +0000

    syz-cluster: applied patch under review

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c
index 7a18a469961db..467fbe43b89e9 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c
@@ -241,9 +241,16 @@ static bool mlx5e_tc_tun_encap_info_equal_vxlan(struct mlx5e_encap_key *a,
 static int mlx5e_tc_tun_get_remote_ifindex(struct net_device *mirred_dev)
 {
 	const struct vxlan_dev *vxlan = netdev_priv(mirred_dev);
-	const struct vxlan_rdst *dst = &vxlan->default_dst;
+	const struct vxlan_config *cfg;
+	int ifindex = 0;
 
-	return dst->remote_ifindex;
+	rcu_read_lock();
+	cfg = rcu_dereference(vxlan->cfg);
+	if (cfg)
+		ifindex = cfg->remote_ifindex;
+	rcu_read_unlock();
+
+	return ifindex;
 }
 
 struct mlx5e_tc_tunnel vxlan_tunnel = {
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
index 52c2fe3644d4b..21e7b499f3879 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c
@@ -59,8 +59,11 @@ static bool mlxsw_sp_nve_vxlan_can_offload(const struct mlxsw_sp_nve *nve,
 					   const struct mlxsw_sp_nve_params *params,
 					   struct netlink_ext_ack *extack)
 {
-	struct vxlan_dev *vxlan = netdev_priv(params->dev);
-	struct vxlan_config *cfg = &vxlan->cfg;
+	const struct vxlan_config *cfg;
+	struct vxlan_dev *vxlan;
+
+	vxlan = netdev_priv(params->dev);
+	cfg = rtnl_dereference(vxlan->cfg);
 
 	if (vxlan_addr_multicast(&cfg->remote_ip)) {
 		NL_SET_ERR_MSG_MOD(extack, "VxLAN: Multicast destination IP is not supported");
@@ -92,6 +95,11 @@ static bool mlxsw_sp_nve_vxlan_can_offload(const struct mlxsw_sp_nve *nve,
 		return false;
 	}
 
+	if (test_bit(VXLAN_DEV_F_MDB, &vxlan->flags)) {
+		NL_SET_ERR_MSG_MOD(extack, "VxLAN: MDB entries are not supported");
+		return false;
+	}
+
 	switch (cfg->saddr.sa.sa_family) {
 	case AF_INET:
 		if (!mlxsw_sp_nve_vxlan_ipv4_flags_check(cfg, extack))
@@ -148,8 +156,11 @@ static void mlxsw_sp_nve_vxlan_config(const struct mlxsw_sp_nve *nve,
 				      const struct mlxsw_sp_nve_params *params,
 				      struct mlxsw_sp_nve_config *config)
 {
-	struct vxlan_dev *vxlan = netdev_priv(params->dev);
-	struct vxlan_config *cfg = &vxlan->cfg;
+	const struct vxlan_config *cfg;
+	struct vxlan_dev *vxlan;
+
+	vxlan = netdev_priv(params->dev);
+	cfg = rtnl_dereference(vxlan->cfg);
 
 	config->type = MLXSW_SP_NVE_TYPE_VXLAN;
 	config->ttl = cfg->ttl;
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index fe45e533a4b2e..de60b698bea98 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -2513,15 +2513,17 @@ mlxsw_sp_bridge_vlan_aware_vxlan_join(struct mlxsw_sp_bridge_device *bridge_devi
 {
 	struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_device->dev);
 	struct vxlan_dev *vxlan = netdev_priv(vxlan_dev);
-	struct mlxsw_sp_nve_params params = {
-		.type = MLXSW_SP_NVE_TYPE_VXLAN,
-		.vni = vxlan->cfg.vni,
-		.dev = vxlan_dev,
-		.ethertype = ethertype,
-	};
+	struct mlxsw_sp_nve_params params;
+	const struct vxlan_config *cfg;
 	struct mlxsw_sp_fid *fid;
 	int err;
 
+	cfg = rtnl_dereference(vxlan->cfg);
+	params.type = MLXSW_SP_NVE_TYPE_VXLAN;
+	params.vni = cfg->vni;
+	params.dev = vxlan_dev;
+	params.ethertype = ethertype;
+
 	/* If the VLAN is 0, we need to find the VLAN that is configured as
 	 * PVID and egress untagged on the bridge port of the VxLAN device.
 	 * It is possible no such VLAN exists
@@ -2704,15 +2706,17 @@ mlxsw_sp_bridge_8021d_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,
 {
 	struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_device->dev);
 	struct vxlan_dev *vxlan = netdev_priv(vxlan_dev);
-	struct mlxsw_sp_nve_params params = {
-		.type = MLXSW_SP_NVE_TYPE_VXLAN,
-		.vni = vxlan->cfg.vni,
-		.dev = vxlan_dev,
-		.ethertype = ETH_P_8021Q,
-	};
+	struct mlxsw_sp_nve_params params;
+	const struct vxlan_config *cfg;
 	struct mlxsw_sp_fid *fid;
 	int err;
 
+	cfg = rtnl_dereference(vxlan->cfg);
+	params.type = MLXSW_SP_NVE_TYPE_VXLAN;
+	params.vni = cfg->vni;
+	params.dev = vxlan_dev;
+	params.ethertype = ETH_P_8021Q;
+
 	fid = mlxsw_sp_fid_8021d_get(mlxsw_sp, bridge_device->dev->ifindex);
 	if (IS_ERR(fid)) {
 		NL_SET_ERR_MSG_MOD(extack, "Failed to create 802.1D FID");
@@ -2933,10 +2937,13 @@ static void __mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp,
 					  const struct net_device *vxlan_dev)
 {
 	struct vxlan_dev *vxlan = netdev_priv(vxlan_dev);
+	const struct vxlan_config *cfg;
 	struct mlxsw_sp_fid *fid;
 
+	cfg = rtnl_dereference(vxlan->cfg);
+
 	/* If the VxLAN device is down, then the FID does not have a VNI */
-	fid = mlxsw_sp_fid_lookup_by_vni(mlxsw_sp, vxlan->cfg.vni);
+	fid = mlxsw_sp_fid_lookup_by_vni(mlxsw_sp, cfg->vni);
 	if (!fid)
 		return;
 
@@ -3029,11 +3036,13 @@ static void mlxsw_sp_fdb_vxlan_call_notifiers(struct net_device *dev,
 	struct switchdev_notifier_vxlan_fdb_info info;
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	enum switchdev_notifier_type type;
+	const struct vxlan_config *cfg;
 
+	cfg = rtnl_dereference(vxlan->cfg);
 	type = adding ? SWITCHDEV_VXLAN_FDB_ADD_TO_BRIDGE :
 			SWITCHDEV_VXLAN_FDB_DEL_TO_BRIDGE;
 	mlxsw_sp_switchdev_addr_vxlan_convert(proto, addr, &info.remote_ip);
-	info.remote_port = vxlan->cfg.dst_port;
+	info.remote_port = cfg->dst_port;
 	info.remote_vni = vni;
 	info.remote_ifindex = 0;
 	ether_addr_copy(info.eth_addr, mac);
@@ -3236,8 +3245,10 @@ __mlxsw_sp_fdb_notify_mac_uc_tunnel_process(struct mlxsw_sp *mlxsw_sp,
 
 	if (adding && netif_is_vxlan(dev)) {
 		struct vxlan_dev *vxlan = netdev_priv(dev);
+		const struct vxlan_config *cfg;
 
-		if (!(vxlan->cfg.flags & VXLAN_F_LEARN))
+		cfg = rtnl_dereference(vxlan->cfg);
+		if (!(cfg->flags & VXLAN_F_LEARN))
 			return -EINVAL;
 	}
 
@@ -3722,9 +3733,11 @@ mlxsw_sp_switchdev_vxlan_work_prepare(struct mlxsw_sp_switchdev_event_work *
 {
 	struct vxlan_dev *vxlan = netdev_priv(switchdev_work->dev);
 	struct switchdev_notifier_vxlan_fdb_info *vxlan_fdb_info;
-	struct vxlan_config *cfg = &vxlan->cfg;
+	const struct vxlan_config *cfg;
 	struct netlink_ext_ack *extack;
 
+	cfg = rcu_dereference_rtnl(vxlan->cfg);
+
 	extack = switchdev_notifier_info_to_extack(info);
 	vxlan_fdb_info = container_of(info,
 				      struct switchdev_notifier_vxlan_fdb_info,
@@ -3851,11 +3864,15 @@ mlxsw_sp_switchdev_vxlan_vlan_add(struct mlxsw_sp *mlxsw_sp,
 				  struct netlink_ext_ack *extack)
 {
 	struct vxlan_dev *vxlan = netdev_priv(vxlan_dev);
-	__be32 vni = vxlan->cfg.vni;
+	const struct vxlan_config *cfg;
 	struct mlxsw_sp_fid *fid;
 	u16 old_vid;
+	__be32 vni;
 	int err;
 
+	cfg = rtnl_dereference(vxlan->cfg);
+	vni = cfg->vni;
+
 	/* We cannot have the same VLAN as PVID and egress untagged on multiple
 	 * VxLAN devices. Note that we get this notification before the VLAN is
 	 * actually added to the bridge's database, so it is not possible for
@@ -3935,12 +3952,16 @@ mlxsw_sp_switchdev_vxlan_vlan_del(struct mlxsw_sp *mlxsw_sp,
 				  const struct net_device *vxlan_dev, u16 vid)
 {
 	struct vxlan_dev *vxlan = netdev_priv(vxlan_dev);
-	__be32 vni = vxlan->cfg.vni;
+	const struct vxlan_config *cfg;
 	struct mlxsw_sp_fid *fid;
+	__be32 vni;
 
 	if (!netif_running(vxlan_dev))
 		return;
 
+	cfg = rtnl_dereference(vxlan->cfg);
+	vni = cfg->vni;
+
 	fid = mlxsw_sp_fid_lookup_by_vni(mlxsw_sp, vni);
 	if (!fid)
 		return;
diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
index 347245cc1de4e..63b707deb7fd0 100644
--- a/drivers/net/vxlan/vxlan_core.c
+++ b/drivers/net/vxlan/vxlan_core.c
@@ -110,20 +110,23 @@ static struct vxlan_dev *vxlan_vs_find_vni(struct vxlan_sock *vs,
 		vni = 0;
 
 	hlist_for_each_entry_rcu(node, vni_head(vs, vni), hlist) {
+		const struct vxlan_config *cfg;
+
 		if (!node->vxlan)
 			continue;
+
+		cfg = rcu_dereference(node->vxlan->cfg);
+
 		vnode = NULL;
-		if (node->vxlan->cfg.flags & VXLAN_F_VNIFILTER) {
+		if (cfg->flags & VXLAN_F_VNIFILTER) {
 			vnode = vxlan_vnifilter_lookup(node->vxlan, vni);
 			if (!vnode)
 				continue;
-		} else if (node->vxlan->default_dst.remote_vni != vni) {
+		} else if (cfg->vni != vni) {
 			continue;
 		}
 
 		if (IS_ENABLED(CONFIG_IPV6)) {
-			const struct vxlan_config *cfg = &node->vxlan->cfg;
-
 			if ((cfg->flags & VXLAN_F_IPV6_LINKLOCAL) &&
 			    cfg->remote_ifindex != ifindex)
 				continue;
@@ -157,6 +160,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
 			  u32 portid, u32 seq, int type, unsigned int flags,
 			  const struct vxlan_rdst *rdst)
 {
+	const struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan->cfg);
 	unsigned long now = jiffies;
 	struct nda_cacheinfo ci;
 	bool send_ip, send_eth;
@@ -216,10 +220,10 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
 			goto nla_put_failure;
 
 		if (rdst->remote_port &&
-		    rdst->remote_port != vxlan->cfg.dst_port &&
+		    rdst->remote_port != cfg->dst_port &&
 		    nla_put_be16(skb, NDA_PORT, rdst->remote_port))
 			goto nla_put_failure;
-		if (rdst->remote_vni != vxlan->default_dst.remote_vni &&
+		if (rdst->remote_vni != cfg->vni &&
 		    nla_put_u32(skb, NDA_VNI, be32_to_cpu(rdst->remote_vni)))
 			goto nla_put_failure;
 		if (rdst->remote_ifindex &&
@@ -227,7 +231,7 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,
 			goto nla_put_failure;
 	}
 
-	if ((vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA) && fdb->key.vni &&
+	if ((cfg->flags & VXLAN_F_COLLECT_METADATA) && fdb->key.vni &&
 	    nla_put_u32(skb, NDA_SRC_VNI,
 			be32_to_cpu(fdb->key.vni)))
 		goto nla_put_failure;
@@ -377,14 +381,15 @@ static void vxlan_fdb_miss(struct vxlan_dev *vxlan, const u8 eth_addr[ETH_ALEN])
 
 /* Look up Ethernet address in forwarding table */
 static struct vxlan_fdb *vxlan_find_mac_rcu(struct vxlan_dev *vxlan,
+					    const struct vxlan_config *cfg,
 					    const u8 *mac, __be32 vni)
 {
 	struct vxlan_fdb_key key;
 
 	memset(&key, 0, sizeof(key));
 	memcpy(key.eth_addr, mac, sizeof(key.eth_addr));
-	if (!(vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA))
-		key.vni = vxlan->default_dst.remote_vni;
+	if (!(cfg->flags & VXLAN_F_COLLECT_METADATA))
+		key.vni = cfg->vni;
 	else
 		key.vni = vni;
 
@@ -393,11 +398,12 @@ static struct vxlan_fdb *vxlan_find_mac_rcu(struct vxlan_dev *vxlan,
 }
 
 static struct vxlan_fdb *vxlan_find_mac_tx(struct vxlan_dev *vxlan,
+					   const struct vxlan_config *cfg,
 					   const u8 *mac, __be32 vni)
 {
 	struct vxlan_fdb *f;
 
-	f = vxlan_find_mac_rcu(vxlan, mac, vni);
+	f = vxlan_find_mac_rcu(vxlan, cfg, mac, vni);
 	if (f) {
 		unsigned long now = jiffies;
 
@@ -416,7 +422,7 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,
 	lockdep_assert_held_once(&vxlan->hash_lock);
 
 	rcu_read_lock();
-	f = vxlan_find_mac_rcu(vxlan, mac, vni);
+	f = vxlan_find_mac_rcu(vxlan, rcu_dereference(vxlan->cfg), mac, vni);
 	rcu_read_unlock();
 
 	return f;
@@ -457,7 +463,7 @@ int vxlan_fdb_find_uc(struct net_device *dev, const u8 *mac, __be32 vni,
 
 	rcu_read_lock();
 
-	f = vxlan_find_mac_rcu(vxlan, eth_addr, vni);
+	f = vxlan_find_mac_rcu(vxlan, rcu_dereference(vxlan->cfg), eth_addr, vni);
 	if (f)
 		rdst = first_remote_rcu(f);
 	if (!rdst) {
@@ -798,6 +804,7 @@ static int vxlan_fdb_nh_update(struct vxlan_dev *vxlan, struct vxlan_fdb *fdb,
 			       u32 nhid, struct netlink_ext_ack *extack)
 {
 	struct nexthop *old_nh = rtnl_dereference(fdb->nh);
+	const struct vxlan_config *cfg;
 	struct nexthop *nh;
 	int err = -EINVAL;
 
@@ -826,7 +833,8 @@ static int vxlan_fdb_nh_update(struct vxlan_dev *vxlan, struct vxlan_fdb *fdb,
 	}
 
 	/* check nexthop group family */
-	switch (vxlan->default_dst.remote_ip.sa.sa_family) {
+	cfg = rtnl_dereference(vxlan->cfg);
+	switch (cfg->remote_ip.sa.sa_family) {
 	case AF_INET:
 		if (!nexthop_has_v4(nh)) {
 			err = -EAFNOSUPPORT;
@@ -863,12 +871,13 @@ int vxlan_fdb_create(struct vxlan_dev *vxlan,
 		     u32 nhid, struct vxlan_fdb **fdb,
 		     struct netlink_ext_ack *extack)
 {
+	const struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan->cfg);
 	struct vxlan_rdst *rd = NULL;
 	struct vxlan_fdb *f;
 	int rc;
 
-	if (vxlan->cfg.addrmax &&
-	    vxlan->addrcnt >= vxlan->cfg.addrmax)
+	if (cfg->addrmax &&
+	    vxlan->addrcnt >= cfg->addrmax)
 		return -ENOSPC;
 
 	netdev_dbg(vxlan->dev, "add %pM -> %pIS\n", mac, ip);
@@ -1154,6 +1163,7 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,
 			   __be32 *vni, u32 *ifindex, u32 *nhid,
 			   struct netlink_ext_ack *extack)
 {
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
 	struct net *net = dev_net(vxlan->dev);
 	int err;
 
@@ -1170,7 +1180,7 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,
 			return err;
 		}
 	} else {
-		union vxlan_addr *remote = &vxlan->default_dst.remote_ip;
+		const union vxlan_addr *remote = &cfg->remote_ip;
 
 		if (remote->sa.sa_family == AF_INET) {
 			ip->sin.sin_addr.s_addr = htonl(INADDR_ANY);
@@ -1190,7 +1200,7 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,
 		}
 		*port = nla_get_be16(tb[NDA_PORT]);
 	} else {
-		*port = vxlan->cfg.dst_port;
+		*port = cfg->dst_port;
 	}
 
 	if (tb[NDA_VNI]) {
@@ -1200,7 +1210,7 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,
 		}
 		*vni = cpu_to_be32(nla_get_u32(tb[NDA_VNI]));
 	} else {
-		*vni = vxlan->default_dst.remote_vni;
+		*vni = cfg->vni;
 	}
 
 	if (tb[NDA_SRC_VNI]) {
@@ -1210,7 +1220,7 @@ static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,
 		}
 		*src_vni = cpu_to_be32(nla_get_u32(tb[NDA_SRC_VNI]));
 	} else {
-		*src_vni = vxlan->default_dst.remote_vni;
+		*src_vni = cfg->vni;
 	}
 
 	if (tb[NDA_IFINDEX]) {
@@ -1241,6 +1251,7 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
 			 const unsigned char *addr, u16 vid, u16 flags,
 			 bool *notified, struct netlink_ext_ack *extack)
 {
+	const struct vxlan_config *cfg;
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	/* struct net *net = dev_net(vxlan->dev); */
 	union vxlan_addr ip;
@@ -1268,7 +1279,8 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
 		return -EINVAL;
 	}
 
-	if (vxlan->default_dst.remote_ip.sa.sa_family != ip.sa.sa_family)
+	cfg = rtnl_dereference(vxlan->cfg);
+	if (cfg->remote_ip.sa.sa_family != ip.sa.sa_family)
 		return -EAFNOSUPPORT;
 
 	spin_lock_bh(&vxlan->hash_lock);
@@ -1405,18 +1417,21 @@ static int vxlan_fdb_get(struct sk_buff *skb,
 			 struct netlink_ext_ack *extack)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
+	const struct vxlan_config *cfg;
 	struct vxlan_fdb *f;
 	__be32 vni;
 	int err;
 
+	cfg = rcu_dereference_rtnl(vxlan->cfg);
+
 	if (tb[NDA_VNI])
 		vni = cpu_to_be32(nla_get_u32(tb[NDA_VNI]));
 	else
-		vni = vxlan->default_dst.remote_vni;
+		vni = cfg->vni;
 
 	rcu_read_lock();
 
-	f = vxlan_find_mac_rcu(vxlan, addr, vni);
+	f = vxlan_find_mac_rcu(vxlan, cfg, addr, vni);
 	if (!f) {
 		NL_SET_ERR_MSG(extack, "Fdb entry not found");
 		err = -ENOENT;
@@ -1434,6 +1449,7 @@ static int vxlan_fdb_get(struct sk_buff *skb,
  * and Tunnel endpoint.
  */
 static enum skb_drop_reason vxlan_snoop(struct net_device *dev,
+					const struct vxlan_config *cfg,
 					union vxlan_addr *src_ip,
 					const u8 *src_mac, u32 src_ifindex,
 					__be32 vni)
@@ -1452,7 +1468,7 @@ static enum skb_drop_reason vxlan_snoop(struct net_device *dev,
 		ifindex = src_ifindex;
 #endif
 
-	f = vxlan_find_mac_rcu(vxlan, src_mac, vni);
+	f = vxlan_find_mac_rcu(vxlan, cfg, src_mac, vni);
 	if (likely(f)) {
 		struct vxlan_rdst *rdst = first_remote_rcu(f);
 		unsigned long now = jiffies;
@@ -1488,9 +1504,9 @@ static enum skb_drop_reason vxlan_snoop(struct net_device *dev,
 			vxlan_fdb_update(vxlan, src_mac, src_ip,
 					 NUD_REACHABLE,
 					 NLM_F_EXCL|NLM_F_CREATE,
-					 vxlan->cfg.dst_port,
+					 cfg->dst_port,
 					 vni,
-					 vxlan->default_dst.remote_vni,
+					 cfg->vni,
 					 ifindex, NTF_SELF, 0, true, NULL);
 		spin_unlock(&vxlan->hash_lock);
 	}
@@ -1518,6 +1534,7 @@ static bool __vxlan_sock_release_prep(struct vxlan_sock *vs)
 
 static void vxlan_sock_release(struct vxlan_dev *vxlan)
 {
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
 	struct vxlan_sock *sock4 = rtnl_dereference(vxlan->vn4_sock);
 #if IS_ENABLED(CONFIG_IPV6)
 	struct vxlan_sock *sock6 = rtnl_dereference(vxlan->vn6_sock);
@@ -1527,7 +1544,7 @@ static void vxlan_sock_release(struct vxlan_dev *vxlan)
 
 	RCU_INIT_POINTER(vxlan->vn4_sock, NULL);
 
-	if (vxlan->cfg.flags & VXLAN_F_VNIFILTER)
+	if (cfg->flags & VXLAN_F_VNIFILTER)
 		vxlan_vs_del_vnigrp(vxlan);
 	else
 		vxlan_vs_del_dev(vxlan);
@@ -1598,6 +1615,7 @@ static void vxlan_parse_gbp_hdr(struct sk_buff *skb, u32 vxflags,
 }
 
 static enum skb_drop_reason vxlan_set_mac(struct vxlan_dev *vxlan,
+					  const struct vxlan_config *cfg,
 					  struct vxlan_sock *vs,
 					  struct sk_buff *skb, __be32 vni)
 {
@@ -1623,10 +1641,10 @@ static enum skb_drop_reason vxlan_set_mac(struct vxlan_dev *vxlan,
 #endif
 	}
 
-	if (!(vxlan->cfg.flags & VXLAN_F_LEARN))
+	if (!(cfg->flags & VXLAN_F_LEARN))
 		return SKB_NOT_DROPPED_YET;
 
-	return vxlan_snoop(skb->dev, &saddr, eth_hdr(skb)->h_source,
+	return vxlan_snoop(skb->dev, cfg, &saddr, eth_hdr(skb)->h_source,
 			   ifindex, vni);
 }
 
@@ -1657,18 +1675,21 @@ static bool vxlan_ecn_decapsulate(struct vxlan_sock *vs, void *oiph,
 static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 {
 	struct vxlan_vni_node *vninode = NULL;
-	const struct vxlanhdr *vh;
-	struct vxlan_dev *vxlan;
-	struct vxlan_sock *vs;
-	struct vxlan_metadata _md;
-	struct vxlan_metadata *md = &_md;
 	__be16 protocol = htons(ETH_P_TEB);
+	const struct vxlan_config *cfg;
 	enum skb_drop_reason reason;
+	const struct vxlanhdr *vh;
+	struct vxlan_metadata *md;
+	struct vxlan_metadata _md;
+	struct vxlan_dev *vxlan;
 	bool raw_proto = false;
-	void *oiph;
+	struct vxlan_sock *vs;
 	__be32 vni = 0;
+	void *oiph;
 	int nh;
 
+	md = &_md;
+
 	/* Need UDP and VXLAN header to be present */
 	reason = pskb_may_pull_reason(skb, VXLAN_HLEN);
 	if (reason)
@@ -1696,8 +1717,10 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 		goto drop;
 	}
 
-	if (vh->vx_flags & vxlan->cfg.reserved_bits.vx_flags ||
-	    vh->vx_vni & vxlan->cfg.reserved_bits.vx_vni) {
+	cfg = rcu_dereference(vxlan->cfg);
+
+	if (vh->vx_flags & cfg->reserved_bits.vx_flags ||
+	    vh->vx_vni & cfg->reserved_bits.vx_vni) {
 		/* If the header uses bits besides those enabled by the
 		 * netdevice configuration, treat this as a malformed packet.
 		 * This behavior diverges from VXLAN RFC (RFC7348) which
@@ -1709,12 +1732,12 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 		reason = SKB_DROP_REASON_VXLAN_INVALID_HDR;
 		DEV_STATS_INC(vxlan->dev, rx_frame_errors);
 		DEV_STATS_INC(vxlan->dev, rx_errors);
-		vxlan_vnifilter_count(vxlan, vni, vninode,
+		vxlan_vnifilter_count(vxlan, cfg, vni, vninode,
 				      VXLAN_VNI_STATS_RX_ERRORS, 0);
 		goto drop;
 	}
 
-	if (vxlan->cfg.flags & VXLAN_F_GPE) {
+	if (cfg->flags & VXLAN_F_GPE) {
 		if (!vxlan_parse_gpe_proto(vh, &protocol))
 			goto drop;
 		raw_proto = true;
@@ -1726,8 +1749,8 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 		goto drop;
 	}
 
-	if (vxlan->cfg.flags & VXLAN_F_REMCSUM_RX) {
-		reason = vxlan_remcsum(skb, vxlan->cfg.flags);
+	if (cfg->flags & VXLAN_F_REMCSUM_RX) {
+		reason = vxlan_remcsum(skb, cfg->flags);
 		if (unlikely(reason))
 			goto drop;
 	}
@@ -1752,14 +1775,14 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 		memset(md, 0, sizeof(*md));
 	}
 
-	if (vxlan->cfg.flags & VXLAN_F_GBP)
-		vxlan_parse_gbp_hdr(skb, vxlan->cfg.flags, md);
+	if (cfg->flags & VXLAN_F_GBP)
+		vxlan_parse_gbp_hdr(skb, cfg->flags, md);
 	/* Note that GBP and GPE can never be active together. This is
 	 * ensured in vxlan_dev_configure.
 	 */
 
 	if (!raw_proto) {
-		reason = vxlan_set_mac(vxlan, vs, skb, vni);
+		reason = vxlan_set_mac(vxlan, cfg, vs, skb, vni);
 		if (reason)
 			goto drop;
 	} else {
@@ -1780,7 +1803,7 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 	if (reason) {
 		DEV_STATS_INC(vxlan->dev, rx_length_errors);
 		DEV_STATS_INC(vxlan->dev, rx_errors);
-		vxlan_vnifilter_count(vxlan, vni, vninode,
+		vxlan_vnifilter_count(vxlan, cfg, vni, vninode,
 				      VXLAN_VNI_STATS_RX_ERRORS, 0);
 		goto drop;
 	}
@@ -1792,7 +1815,7 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 		reason = SKB_DROP_REASON_IP_TUNNEL_ECN;
 		DEV_STATS_INC(vxlan->dev, rx_frame_errors);
 		DEV_STATS_INC(vxlan->dev, rx_errors);
-		vxlan_vnifilter_count(vxlan, vni, vninode,
+		vxlan_vnifilter_count(vxlan, cfg, vni, vninode,
 				      VXLAN_VNI_STATS_RX_ERRORS, 0);
 		goto drop;
 	}
@@ -1802,14 +1825,15 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
 	if (unlikely(!(vxlan->dev->flags & IFF_UP))) {
 		rcu_read_unlock();
 		dev_dstats_rx_dropped(vxlan->dev);
-		vxlan_vnifilter_count(vxlan, vni, vninode,
+		vxlan_vnifilter_count(vxlan, cfg, vni, vninode,
 				      VXLAN_VNI_STATS_RX_DROPS, 0);
 		reason = SKB_DROP_REASON_DEV_READY;
 		goto drop;
 	}
 
 	dev_dstats_rx_add(vxlan->dev, skb->len);
-	vxlan_vnifilter_count(vxlan, vni, vninode, VXLAN_VNI_STATS_RX, skb->len);
+	vxlan_vnifilter_count(vxlan, cfg, vni, vninode, VXLAN_VNI_STATS_RX,
+			      skb->len);
 	gro_cells_receive(&vxlan->gro_cells, skb);
 
 	rcu_read_unlock();
@@ -1850,7 +1874,8 @@ static int vxlan_err_lookup(struct sock *sk, struct sk_buff *skb)
 	return 0;
 }
 
-static int arp_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
+static int arp_reduce(struct net_device *dev, struct sk_buff *skb,
+		      const struct vxlan_config *cfg, __be32 vni)
 {
 	struct neigh_table *tbl = arp_table(dev_net(dev));
 	struct vxlan_dev *vxlan = netdev_priv(dev);
@@ -1864,7 +1889,7 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
 
 	if (!pskb_network_may_pull(skb, arp_hdr_len(dev))) {
 		dev_dstats_tx_dropped(dev);
-		vxlan_vnifilter_count(vxlan, vni, NULL,
+		vxlan_vnifilter_count(vxlan, cfg, vni, NULL,
 				      VXLAN_VNI_STATS_TX_DROPS, 0);
 		goto out;
 	}
@@ -1905,7 +1930,7 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
 		neigh_ha_snapshot(ha, n, n->dev);
 
 		rcu_read_lock();
-		f = vxlan_find_mac_tx(vxlan, ha, vni);
+		f = vxlan_find_mac_tx(vxlan, cfg, ha, vni);
 		if (f)
 			rdst = first_remote_rcu(f);
 		if (rdst && vxlan_addr_any(&rdst->remote_ip)) {
@@ -1931,11 +1956,11 @@ static int arp_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
 
 		if (netif_rx(reply) == NET_RX_DROP) {
 			dev_dstats_rx_dropped(dev);
-			vxlan_vnifilter_count(vxlan, vni, NULL,
+			vxlan_vnifilter_count(vxlan, cfg, vni, NULL,
 					      VXLAN_VNI_STATS_RX_DROPS, 0);
 		}
 
-	} else if (vxlan->cfg.flags & VXLAN_F_L3MISS) {
+	} else if (cfg->flags & VXLAN_F_L3MISS) {
 		union vxlan_addr ipa = {
 			.sin.sin_addr.s_addr = tip,
 			.sin.sin_family = AF_INET,
@@ -2043,7 +2068,8 @@ static struct sk_buff *vxlan_na_create(struct sk_buff *request,
 	return reply;
 }
 
-static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
+static int neigh_reduce(struct net_device *dev, struct sk_buff *skb,
+			const struct vxlan_config *cfg, __be32 vni)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	const struct in6_addr *daddr;
@@ -2077,7 +2103,7 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
 		}
 
 		neigh_ha_snapshot(ha, n, n->dev);
-		f = vxlan_find_mac_tx(vxlan, ha, vni);
+		f = vxlan_find_mac_tx(vxlan, cfg, ha, vni);
 		if (f)
 			rdst = first_remote_rcu(f);
 		if (rdst && vxlan_addr_any(&rdst->remote_ip)) {
@@ -2096,10 +2122,10 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
 
 		if (netif_rx(reply) == NET_RX_DROP) {
 			dev_dstats_rx_dropped(dev);
-			vxlan_vnifilter_count(vxlan, vni, NULL,
+			vxlan_vnifilter_count(vxlan, cfg, vni, NULL,
 					      VXLAN_VNI_STATS_RX_DROPS, 0);
 		}
-	} else if (vxlan->cfg.flags & VXLAN_F_L3MISS) {
+	} else if (cfg->flags & VXLAN_F_L3MISS) {
 		union vxlan_addr ipa = {
 			.sin6.sin6_addr = msg->target,
 			.sin6.sin6_family = AF_INET6,
@@ -2115,9 +2141,9 @@ static int neigh_reduce(struct net_device *dev, struct sk_buff *skb, __be32 vni)
 }
 #endif
 
-static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
+static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb,
+			       const struct vxlan_config *cfg)
 {
-	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct neigh_table *tbl;
 	struct neighbour *n;
 
@@ -2136,7 +2162,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
 		tbl = arp_table(dev_net(dev));
 		pip = ip_hdr(skb);
 		n = neigh_lookup(tbl, &pip->daddr, dev);
-		if (!n && (vxlan->cfg.flags & VXLAN_F_L3MISS)) {
+		if (!n && (cfg->flags & VXLAN_F_L3MISS)) {
 			union vxlan_addr ipa = {
 				.sin.sin_addr.s_addr = pip->daddr,
 				.sin.sin_family = AF_INET,
@@ -2164,7 +2190,7 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
 		tbl = nd_table(dev_net(dev));
 		pip6 = ipv6_hdr(skb);
 		n = neigh_lookup(tbl, &pip6->daddr, dev);
-		if (!n && (vxlan->cfg.flags & VXLAN_F_L3MISS)) {
+		if (!n && (cfg->flags & VXLAN_F_L3MISS)) {
 			union vxlan_addr ipa = {
 				.sin6.sin6_addr = pip6->daddr,
 				.sin6.sin6_family = AF_INET6,
@@ -2282,20 +2308,28 @@ static int vxlan_build_skb(struct sk_buff *skb, struct dst_entry *dst,
 
 /* Bypass encapsulation if the destination is local */
 static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
-			       struct vxlan_dev *dst_vxlan, __be32 vni,
-			       bool snoop)
+			       struct vxlan_dev *dst_vxlan,
+			       const struct vxlan_config *src_cfg,
+			       __be32 vni, bool snoop)
 {
+	const struct vxlan_config *dst_cfg;
 	union vxlan_addr loopback;
-	union vxlan_addr *remote_ip = &dst_vxlan->default_dst.remote_ip;
 	unsigned int len = skb->len;
-	struct net_device *dev;
+	struct net_device *dev = dst_vxlan->dev;
 
 	skb->pkt_type = PACKET_HOST;
 	skb->encapsulation = 0;
-	skb->dev = dst_vxlan->dev;
+	skb->dev = dev;
 	__skb_pull(skb, skb_network_offset(skb));
 
-	if (remote_ip->sa.sa_family == AF_INET) {
+	rcu_read_lock();
+	dst_cfg = rcu_dereference(dst_vxlan->cfg);
+	if (unlikely(!(dev->flags & IFF_UP))) {
+		kfree_skb_reason(skb, SKB_DROP_REASON_DEV_READY);
+		goto drop;
+	}
+
+	if (dst_cfg->remote_ip.sa.sa_family == AF_INET) {
 		loopback.sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
 		loopback.sa.sa_family =  AF_INET;
 #if IS_ENABLED(CONFIG_IPV6)
@@ -2305,27 +2339,20 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
 #endif
 	}
 
-	rcu_read_lock();
-	dev = skb->dev;
-	if (unlikely(!(dev->flags & IFF_UP))) {
-		kfree_skb_reason(skb, SKB_DROP_REASON_DEV_READY);
-		goto drop;
-	}
-
-	if ((dst_vxlan->cfg.flags & VXLAN_F_LEARN) && snoop)
-		vxlan_snoop(dev, &loopback, eth_hdr(skb)->h_source, 0, vni);
+	if ((dst_cfg->flags & VXLAN_F_LEARN) && snoop)
+		vxlan_snoop(dev, dst_cfg, &loopback, eth_hdr(skb)->h_source, 0, vni);
 
 	dev_dstats_tx_add(src_vxlan->dev, len);
-	vxlan_vnifilter_count(src_vxlan, vni, NULL, VXLAN_VNI_STATS_TX, len);
+	vxlan_vnifilter_count(src_vxlan, src_cfg, vni, NULL, VXLAN_VNI_STATS_TX, len);
 
 	if (__netif_rx(skb) == NET_RX_SUCCESS) {
 		dev_dstats_rx_add(dst_vxlan->dev, len);
-		vxlan_vnifilter_count(dst_vxlan, vni, NULL, VXLAN_VNI_STATS_RX,
+		vxlan_vnifilter_count(dst_vxlan, dst_cfg, vni, NULL, VXLAN_VNI_STATS_RX,
 				      len);
 	} else {
 drop:
 		dev_dstats_rx_dropped(dev);
-		vxlan_vnifilter_count(dst_vxlan, vni, NULL,
+		vxlan_vnifilter_count(dst_vxlan, dst_cfg, vni, NULL,
 				      VXLAN_VNI_STATS_RX_DROPS, 0);
 	}
 	rcu_read_unlock();
@@ -2333,6 +2360,7 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,
 
 static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev,
 				 struct vxlan_dev *vxlan,
+				 const struct vxlan_config *cfg,
 				 int addr_family,
 				 __be16 dst_port, int dst_ifindex, __be32 vni,
 				 struct dst_entry *dst,
@@ -2348,22 +2376,22 @@ static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev,
 	/* Bypass encapsulation if the destination is local */
 	if (rt_flags & RTCF_LOCAL &&
 	    !(rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) &&
-	    vxlan->cfg.flags & VXLAN_F_LOCALBYPASS) {
+	    cfg->flags & VXLAN_F_LOCALBYPASS) {
 		struct vxlan_dev *dst_vxlan;
 
 		dst_release(dst);
 		dst_vxlan = vxlan_find_vni(vxlan->net, dst_ifindex, vni,
 					   addr_family, dst_port,
-					   vxlan->cfg.flags);
+					   cfg->flags);
 		if (!dst_vxlan) {
 			DEV_STATS_INC(dev, tx_errors);
-			vxlan_vnifilter_count(vxlan, vni, NULL,
+			vxlan_vnifilter_count(vxlan, cfg, vni, NULL,
 					      VXLAN_VNI_STATS_TX_ERRORS, 0);
 			kfree_skb_reason(skb, SKB_DROP_REASON_VXLAN_VNI_NOT_FOUND);
 
 			return -ENOENT;
 		}
-		vxlan_encap_bypass(skb, vxlan, dst_vxlan, vni, true);
+		vxlan_encap_bypass(skb, vxlan, dst_vxlan, cfg, vni, true);
 		return 1;
 	}
 
@@ -2371,30 +2399,35 @@ static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev,
 }
 
 void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
+		    const struct vxlan_config *cfg,
 		    __be32 default_vni, struct vxlan_rdst *rdst, bool did_rsc)
 {
+	unsigned int pkt_len = skb->len;
+	struct vxlan_metadata _md = {};
+	__be16 src_port = 0, dst_port;
+	struct dst_entry *ndst = NULL;
+	enum skb_drop_reason reason;
 	struct dst_cache *dst_cache;
+	const struct iphdr *old_iph;
 	struct ip_tunnel_info *info;
 	struct ip_tunnel_key *pkey;
+	struct vxlan_metadata *md;
 	struct ip_tunnel_key key;
-	struct vxlan_dev *vxlan = netdev_priv(dev);
-	const struct iphdr *old_iph;
-	struct vxlan_metadata _md = {};
-	struct vxlan_metadata *md = &_md;
-	unsigned int pkt_len = skb->len;
-	__be16 src_port = 0, dst_port;
-	struct dst_entry *ndst = NULL;
+	struct vxlan_dev *vxlan;
+	u32 flags = cfg->flags;
+	bool udp_sum = false;
+	bool no_eth_encap;
 	int addr_family;
+	bool use_cache;
+	__be32 vni = 0;
 	__u8 tos, ttl;
 	int ifindex;
 	int err = 0;
-	u32 flags = vxlan->cfg.flags;
-	bool use_cache;
-	bool udp_sum = false;
-	bool xnet = !net_eq(vxlan->net, dev_net(vxlan->dev));
-	enum skb_drop_reason reason;
-	bool no_eth_encap;
-	__be32 vni = 0;
+	bool xnet;
+
+	vxlan = netdev_priv(dev);
+	xnet = !net_eq(vxlan->net, dev_net(vxlan->dev));
+	md = &_md;
 
 	no_eth_encap = flags & VXLAN_F_GPE && skb->protocol != htons(ETH_P_TEB);
 	reason = skb_vlan_inet_prepare(skb, no_eth_encap);
@@ -2414,23 +2447,23 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		if (vxlan_addr_any(&rdst->remote_ip)) {
 			if (did_rsc) {
 				/* short-circuited back to local bridge */
-				vxlan_encap_bypass(skb, vxlan, vxlan,
+				vxlan_encap_bypass(skb, vxlan, vxlan, cfg,
 						   default_vni, true);
 				return;
 			}
 			goto drop;
 		}
 
-		addr_family = vxlan->cfg.saddr.sa.sa_family;
-		dst_port = rdst->remote_port ? rdst->remote_port : vxlan->cfg.dst_port;
+		addr_family = cfg->saddr.sa.sa_family;
+		dst_port = rdst->remote_port ? rdst->remote_port : cfg->dst_port;
 		vni = (rdst->remote_vni) ? : default_vni;
 		ifindex = rdst->remote_ifindex;
 
 		if (addr_family == AF_INET) {
-			key.u.ipv4.src = vxlan->cfg.saddr.sin.sin_addr.s_addr;
+			key.u.ipv4.src = cfg->saddr.sin.sin_addr.s_addr;
 			key.u.ipv4.dst = rdst->remote_ip.sin.sin_addr.s_addr;
 		} else {
-			key.u.ipv6.src = vxlan->cfg.saddr.sin6.sin6_addr;
+			key.u.ipv6.src = cfg->saddr.sin6.sin6_addr;
 			key.u.ipv6.dst = rdst->remote_ip.sin6.sin6_addr;
 		}
 
@@ -2439,11 +2472,11 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		if (flags & VXLAN_F_TTL_INHERIT) {
 			ttl = ip_tunnel_get_ttl(old_iph, skb);
 		} else {
-			ttl = vxlan->cfg.ttl;
+			ttl = cfg->ttl;
 			if (!ttl && vxlan_addr_multicast(&rdst->remote_ip))
 				ttl = 1;
 		}
-		tos = vxlan->cfg.tos;
+		tos = cfg->tos;
 		if (tos == 1)
 			tos = ip_tunnel_get_dsfield(old_iph, skb);
 		if (tos && !info)
@@ -2454,9 +2487,9 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		else
 			udp_sum = !(flags & VXLAN_F_UDP_ZERO_CSUM6_TX);
 #if IS_ENABLED(CONFIG_IPV6)
-		switch (vxlan->cfg.label_policy) {
+		switch (cfg->label_policy) {
 		case VXLAN_LABEL_FIXED:
-			key.label = vxlan->cfg.label;
+			key.label = cfg->label;
 			break;
 		case VXLAN_LABEL_INHERIT:
 			key.label = ip_tunnel_get_flowlabel(old_iph, skb);
@@ -2474,7 +2507,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		}
 		pkey = &info->key;
 		addr_family = ip_tunnel_info_af(info);
-		dst_port = info->key.tp_dst ? : vxlan->cfg.dst_port;
+		dst_port = info->key.tp_dst ? : cfg->dst_port;
 		vni = tunnel_id_to_key32(info->key.tun_id);
 		ifindex = 0;
 		dst_cache = &info->dst_cache;
@@ -2487,8 +2520,8 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		tos = info->key.tos;
 		udp_sum = test_bit(IP_TUNNEL_CSUM_BIT, info->key.tun_flags);
 	}
-	src_port = udp_flow_src_port(dev_net(dev), skb, vxlan->cfg.port_min,
-				     vxlan->cfg.port_max, true);
+	src_port = udp_flow_src_port(dev_net(dev), skb, cfg->port_min,
+				     cfg->port_max, true);
 
 	rcu_read_lock();
 	if (addr_family == AF_INET) {
@@ -2521,15 +2554,15 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 
 		if (!info) {
 			/* Bypass encapsulation if the destination is local */
-			err = encap_bypass_if_local(skb, dev, vxlan, AF_INET,
+			err = encap_bypass_if_local(skb, dev, vxlan, cfg, AF_INET,
 						    dst_port, ifindex, vni,
 						    &rt->dst, rt->rt_flags);
 			if (err)
 				goto out_unlock;
 
-			if (vxlan->cfg.df == VXLAN_DF_SET) {
+			if (cfg->df == VXLAN_DF_SET) {
 				df = htons(IP_DF);
-			} else if (vxlan->cfg.df == VXLAN_DF_INHERIT) {
+			} else if (cfg->df == VXLAN_DF_INHERIT) {
 				struct ethhdr *eth = eth_hdr(skb);
 
 				if (ntohs(eth->h_proto) == ETH_P_IPV6 ||
@@ -2558,7 +2591,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 				unclone->key.u.ipv4.src = pkey->u.ipv4.dst;
 				unclone->key.u.ipv4.dst = saddr;
 			}
-			vxlan_encap_bypass(skb, vxlan, vxlan, vni, false);
+			vxlan_encap_bypass(skb, vxlan, vxlan, cfg, vni, false);
 			dst_release(ndst);
 			goto out_unlock;
 		}
@@ -2608,7 +2641,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		if (!info) {
 			u32 rt6i_flags = dst_rt6_info(ndst)->rt6i_flags;
 
-			err = encap_bypass_if_local(skb, dev, vxlan, AF_INET6,
+			err = encap_bypass_if_local(skb, dev, vxlan, cfg, AF_INET6,
 						    dst_port, ifindex, vni,
 						    ndst, rt6i_flags);
 			if (err)
@@ -2632,7 +2665,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 				unclone->key.u.ipv6.dst = saddr;
 			}
 
-			vxlan_encap_bypass(skb, vxlan, vxlan, vni, false);
+			vxlan_encap_bypass(skb, vxlan, vxlan, cfg, vni, false);
 			dst_release(ndst);
 			goto out_unlock;
 		}
@@ -2653,14 +2686,14 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 				     ip6cb_flags);
 #endif
 	}
-	vxlan_vnifilter_count(vxlan, vni, NULL, VXLAN_VNI_STATS_TX, pkt_len);
+	vxlan_vnifilter_count(vxlan, cfg, vni, NULL, VXLAN_VNI_STATS_TX, pkt_len);
 out_unlock:
 	rcu_read_unlock();
 	return;
 
 drop:
 	dev_dstats_tx_dropped(dev);
-	vxlan_vnifilter_count(vxlan, vni, NULL, VXLAN_VNI_STATS_TX_DROPS, 0);
+	vxlan_vnifilter_count(vxlan, cfg, vni, NULL, VXLAN_VNI_STATS_TX_DROPS, 0);
 	kfree_skb_reason(skb, reason);
 	return;
 
@@ -2672,11 +2705,12 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
 		DEV_STATS_INC(dev, tx_carrier_errors);
 	dst_release(ndst);
 	DEV_STATS_INC(dev, tx_errors);
-	vxlan_vnifilter_count(vxlan, vni, NULL, VXLAN_VNI_STATS_TX_ERRORS, 0);
+	vxlan_vnifilter_count(vxlan, cfg, vni, NULL, VXLAN_VNI_STATS_TX_ERRORS, 0);
 	kfree_skb_reason(skb, reason);
 }
 
 static void vxlan_xmit_nh(struct sk_buff *skb, struct net_device *dev,
+			  const struct vxlan_config *cfg,
 			  struct vxlan_fdb *f, __be32 vni, bool did_rsc)
 {
 	struct vxlan_rdst nh_rdst;
@@ -2693,7 +2727,7 @@ static void vxlan_xmit_nh(struct sk_buff *skb, struct net_device *dev,
 	do_xmit = vxlan_fdb_nh_path_select(nh, hash, &nh_rdst);
 
 	if (likely(do_xmit))
-		vxlan_xmit_one(skb, dev, vni, &nh_rdst, did_rsc);
+		vxlan_xmit_one(skb, dev, cfg, vni, &nh_rdst, did_rsc);
 	else
 		goto drop;
 
@@ -2701,15 +2735,15 @@ static void vxlan_xmit_nh(struct sk_buff *skb, struct net_device *dev,
 
 drop:
 	dev_dstats_tx_dropped(dev);
-	vxlan_vnifilter_count(netdev_priv(dev), vni, NULL,
+	vxlan_vnifilter_count(netdev_priv(dev), cfg, vni, NULL,
 			      VXLAN_VNI_STATS_TX_DROPS, 0);
 	dev_kfree_skb(skb);
 }
 
 static netdev_tx_t vxlan_xmit_nhid(struct sk_buff *skb, struct net_device *dev,
-				   u32 nhid, __be32 vni)
+				   u32 nhid, __be32 vni,
+				   const struct vxlan_config *cfg)
 {
-	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct vxlan_rdst nh_rdst;
 	struct nexthop *nh;
 	bool do_xmit;
@@ -2727,11 +2761,11 @@ static netdev_tx_t vxlan_xmit_nhid(struct sk_buff *skb, struct net_device *dev,
 	do_xmit = vxlan_fdb_nh_path_select(nh, hash, &nh_rdst);
 	rcu_read_unlock();
 
-	if (vxlan->cfg.saddr.sa.sa_family != nh_rdst.remote_ip.sa.sa_family)
+	if (cfg->saddr.sa.sa_family != nh_rdst.remote_ip.sa.sa_family)
 		goto drop;
 
 	if (likely(do_xmit))
-		vxlan_xmit_one(skb, dev, vni, &nh_rdst, false);
+		vxlan_xmit_one(skb, dev, cfg, vni, &nh_rdst, false);
 	else
 		goto drop;
 
@@ -2739,7 +2773,7 @@ static netdev_tx_t vxlan_xmit_nhid(struct sk_buff *skb, struct net_device *dev,
 
 drop:
 	dev_dstats_tx_dropped(dev);
-	vxlan_vnifilter_count(netdev_priv(dev), vni, NULL,
+	vxlan_vnifilter_count(netdev_priv(dev), cfg, vni, NULL,
 			      VXLAN_VNI_STATS_TX_DROPS, 0);
 	dev_kfree_skb(skb);
 	return NETDEV_TX_OK;
@@ -2756,34 +2790,47 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct vxlan_rdst *rdst, *fdst = NULL;
 	const struct ip_tunnel_info *info;
+	const struct vxlan_config *cfg;
+	__be32 default_vni;
 	struct vxlan_fdb *f;
 	struct ethhdr *eth;
 	__be32 vni = 0;
-	u32 nhid = 0;
 	bool did_rsc;
+	u32 nhid = 0;
+	u32 flags;
+
+	rcu_read_lock();
+	cfg = rcu_dereference(vxlan->cfg);
+	flags = cfg->flags;
+	default_vni = cfg->vni;
 
 	info = skb_tunnel_info(skb);
 
 	skb_reset_mac_header(skb);
 
-	if (vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA) {
+	if (flags & VXLAN_F_COLLECT_METADATA) {
 		if (info && info->mode & IP_TUNNEL_INFO_BRIDGE &&
 		    info->mode & IP_TUNNEL_INFO_TX) {
 			vni = tunnel_id_to_key32(info->key.tun_id);
 			nhid = info->key.nhid;
 		} else {
 			if (info && info->mode & IP_TUNNEL_INFO_TX)
-				vxlan_xmit_one(skb, dev, vni, NULL, false);
+				vxlan_xmit_one(skb, dev, cfg, vni, NULL, false);
 			else
 				kfree_skb_reason(skb, SKB_DROP_REASON_TUNNEL_TXINFO);
+			rcu_read_unlock();
 			return NETDEV_TX_OK;
 		}
 	}
 
-	if (vxlan->cfg.flags & VXLAN_F_PROXY) {
+	if (flags & VXLAN_F_PROXY) {
 		eth = eth_hdr(skb);
-		if (ntohs(eth->h_proto) == ETH_P_ARP)
-			return arp_reduce(dev, skb, vni);
+		if (ntohs(eth->h_proto) == ETH_P_ARP) {
+			netdev_tx_t res = arp_reduce(dev, skb, cfg, vni);
+
+			rcu_read_unlock();
+			return res;
+		}
 #if IS_ENABLED(CONFIG_IPV6)
 		else if (ntohs(eth->h_proto) == ETH_P_IPV6 &&
 			 pskb_network_may_pull(skb, sizeof(struct ipv6hdr) +
@@ -2792,53 +2839,57 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 			struct nd_msg *m = (struct nd_msg *)(ipv6_hdr(skb) + 1);
 
 			if (m->icmph.icmp6_code == 0 &&
-			    m->icmph.icmp6_type == NDISC_NEIGHBOUR_SOLICITATION)
-				return neigh_reduce(dev, skb, vni);
+			    m->icmph.icmp6_type == NDISC_NEIGHBOUR_SOLICITATION) {
+				netdev_tx_t res = neigh_reduce(dev, skb, cfg, vni);
+
+				rcu_read_unlock();
+				return res;
+			}
 		}
 #endif
 	}
 
-	if (nhid)
-		return vxlan_xmit_nhid(skb, dev, nhid, vni);
+	if (nhid) {
+		netdev_tx_t res = vxlan_xmit_nhid(skb, dev, nhid, vni, cfg);
+
+		rcu_read_unlock();
+		return res;
+	}
 
-	if (vxlan->cfg.flags & VXLAN_F_MDB) {
+	if (test_bit(VXLAN_DEV_F_MDB, &vxlan->flags)) {
 		struct vxlan_mdb_entry *mdb_entry;
 
-		rcu_read_lock();
-		mdb_entry = vxlan_mdb_entry_skb_get(vxlan, skb, vni);
+		mdb_entry = vxlan_mdb_entry_skb_get(vxlan, cfg, skb, vni);
 		if (mdb_entry) {
-			netdev_tx_t ret;
+			netdev_tx_t ret = vxlan_mdb_xmit(vxlan, cfg, mdb_entry, skb);
 
-			ret = vxlan_mdb_xmit(vxlan, mdb_entry, skb);
 			rcu_read_unlock();
 			return ret;
 		}
-		rcu_read_unlock();
 	}
 
 	eth = eth_hdr(skb);
-	rcu_read_lock();
-	f = vxlan_find_mac_tx(vxlan, eth->h_dest, vni);
+	f = vxlan_find_mac_tx(vxlan, cfg, eth->h_dest, vni);
 	did_rsc = false;
 
-	if (f && (f->flags & NTF_ROUTER) && (vxlan->cfg.flags & VXLAN_F_RSC) &&
+	if (f && (f->flags & NTF_ROUTER) && (flags & VXLAN_F_RSC) &&
 	    (ntohs(eth->h_proto) == ETH_P_IP ||
 	     ntohs(eth->h_proto) == ETH_P_IPV6)) {
-		did_rsc = route_shortcircuit(dev, skb);
+		did_rsc = route_shortcircuit(dev, skb, cfg);
 		eth = eth_hdr(skb);
 		if (did_rsc)
-			f = vxlan_find_mac_tx(vxlan, eth->h_dest, vni);
+			f = vxlan_find_mac_tx(vxlan, cfg, eth->h_dest, vni);
 	}
 
 	if (f == NULL) {
-		f = vxlan_find_mac_tx(vxlan, all_zeros_mac, vni);
+		f = vxlan_find_mac_tx(vxlan, cfg, all_zeros_mac, vni);
 		if (f == NULL) {
-			if ((vxlan->cfg.flags & VXLAN_F_L2MISS) &&
+			if ((flags & VXLAN_F_L2MISS) &&
 			    !is_multicast_ether_addr(eth->h_dest))
 				vxlan_fdb_miss(vxlan, eth->h_dest);
 
 			dev_dstats_tx_dropped(dev);
-			vxlan_vnifilter_count(vxlan, vni, NULL,
+			vxlan_vnifilter_count(vxlan, cfg, vni, NULL,
 					      VXLAN_VNI_STATS_TX_DROPS, 0);
 			kfree_skb_reason(skb, SKB_DROP_REASON_NO_TX_TARGET);
 			goto out;
@@ -2846,8 +2897,8 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 	}
 
 	if (rcu_access_pointer(f->nh)) {
-		vxlan_xmit_nh(skb, dev, f,
-			      (vni ? : vxlan->default_dst.remote_vni), did_rsc);
+		vxlan_xmit_nh(skb, dev, cfg, f,
+			      (vni ? : default_vni), did_rsc);
 	} else {
 		list_for_each_entry_rcu(rdst, &f->remotes, list) {
 			struct sk_buff *skb1;
@@ -2858,10 +2909,10 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 			}
 			skb1 = skb_clone(skb, GFP_ATOMIC);
 			if (skb1)
-				vxlan_xmit_one(skb1, dev, vni, rdst, did_rsc);
+				vxlan_xmit_one(skb1, dev, cfg, vni, rdst, did_rsc);
 		}
 		if (fdst)
-			vxlan_xmit_one(skb, dev, vni, fdst, did_rsc);
+			vxlan_xmit_one(skb, dev, cfg, vni, fdst, did_rsc);
 		else
 			kfree_skb_reason(skb, SKB_DROP_REASON_NO_TX_TARGET);
 	}
@@ -2876,12 +2927,15 @@ static void vxlan_cleanup(struct timer_list *t)
 {
 	struct vxlan_dev *vxlan = timer_container_of(vxlan, t, age_timer);
 	unsigned long next_timer = jiffies + FDB_AGE_INTERVAL;
+	const struct vxlan_config *cfg;
 	struct vxlan_fdb *f;
 
 	if (!netif_running(vxlan->dev))
 		return;
 
 	rcu_read_lock();
+	cfg = rcu_dereference(vxlan->cfg);
+
 	hlist_for_each_entry_rcu(f, &vxlan->fdb_list, fdb_node) {
 		unsigned long timeout;
 
@@ -2891,7 +2945,7 @@ static void vxlan_cleanup(struct timer_list *t)
 		if (f->flags & NTF_EXT_LEARNED)
 			continue;
 
-		timeout = READ_ONCE(f->updated) + vxlan->cfg.age_interval * HZ;
+		timeout = READ_ONCE(f->updated) + cfg->age_interval * HZ;
 		if (time_before_eq(timeout, jiffies)) {
 			spin_lock(&vxlan->hash_lock);
 			if (!hlist_unhashed(&f->fdb_node)) {
@@ -2923,10 +2977,14 @@ static void vxlan_vs_del_dev(struct vxlan_dev *vxlan)
 static void vxlan_vs_add_dev(struct vxlan_sock *vs, struct vxlan_dev *vxlan,
 			     struct vxlan_dev_node *node)
 {
-	__be32 vni = vxlan->default_dst.remote_vni;
+	const struct vxlan_config *cfg;
+	__be32 vni;
 
 	ASSERT_RTNL();
 
+	cfg = rtnl_dereference(vxlan->cfg);
+	vni = cfg->vni;
+
 	node->vxlan = vxlan;
 	hlist_add_head_rcu(&node->hlist, vni_head(vs, vni));
 }
@@ -2935,13 +2993,16 @@ static void vxlan_vs_add_dev(struct vxlan_sock *vs, struct vxlan_dev *vxlan,
 static int vxlan_init(struct net_device *dev)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
+	const struct vxlan_config *cfg;
 	int err;
 
+	cfg = rtnl_dereference(vxlan->cfg);
+
 	err = rhashtable_init(&vxlan->fdb_hash_tbl, &vxlan_fdb_rht_params);
 	if (err)
 		return err;
 
-	if (vxlan->cfg.flags & VXLAN_F_VNIFILTER) {
+	if (cfg->flags & VXLAN_F_VNIFILTER) {
 		err = vxlan_vnigroup_init(vxlan);
 		if (err)
 			goto err_rhashtable_destroy;
@@ -2961,7 +3022,7 @@ static int vxlan_init(struct net_device *dev)
 err_gro_cells_destroy:
 	gro_cells_destroy(&vxlan->gro_cells);
 err_vnigroup_uninit:
-	if (vxlan->cfg.flags & VXLAN_F_VNIFILTER)
+	if (cfg->flags & VXLAN_F_VNIFILTER)
 		vxlan_vnigroup_uninit(vxlan);
 err_rhashtable_destroy:
 	rhashtable_destroy(&vxlan->fdb_hash_tbl);
@@ -2971,10 +3032,13 @@ static int vxlan_init(struct net_device *dev)
 static void vxlan_uninit(struct net_device *dev)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
+	const struct vxlan_config *cfg;
+
+	cfg = rtnl_dereference(vxlan->cfg);
 
 	vxlan_mdb_fini(vxlan);
 
-	if (vxlan->cfg.flags & VXLAN_F_VNIFILTER)
+	if (cfg->flags & VXLAN_F_VNIFILTER)
 		vxlan_vnigroup_uninit(vxlan);
 
 	gro_cells_destroy(&vxlan->gro_cells);
@@ -2986,6 +3050,7 @@ static void vxlan_uninit(struct net_device *dev)
 static int vxlan_open(struct net_device *dev)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
+	const struct vxlan_config *cfg;
 	int ret;
 
 	ret = vxlan_sock_add(vxlan);
@@ -2998,7 +3063,8 @@ static int vxlan_open(struct net_device *dev)
 		return ret;
 	}
 
-	if (vxlan->cfg.age_interval)
+	cfg = rtnl_dereference(vxlan->cfg);
+	if (cfg->age_interval)
 		mod_timer(&vxlan->age_timer, jiffies + FDB_AGE_INTERVAL);
 
 	return ret;
@@ -3020,8 +3086,10 @@ struct vxlan_fdb_flush_desc {
 static bool vxlan_fdb_is_default_entry(const struct vxlan_fdb *f,
 				       const struct vxlan_dev *vxlan)
 {
+	const struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan->cfg);
+
 	return is_zero_ether_addr(f->key.eth_addr) &&
-	       f->key.vni == vxlan->cfg.vni;
+	       f->key.vni == cfg->vni;
 }
 
 static bool vxlan_fdb_nhid_matches(const struct vxlan_fdb *f, u32 nhid)
@@ -3238,15 +3306,18 @@ static void vxlan_set_multicast_list(struct net_device *dev)
 static int vxlan_change_mtu(struct net_device *dev, int new_mtu)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
-	struct vxlan_rdst *dst = &vxlan->default_dst;
-	struct net_device *lowerdev = __dev_get_by_index(vxlan->net,
-							 dst->remote_ifindex);
+	const struct vxlan_config *cfg;
+	struct net_device *lowerdev;
+
+	cfg = rtnl_dereference(vxlan->cfg);
+
+	lowerdev = __dev_get_by_index(vxlan->net, cfg->remote_ifindex);
 
 	/* This check is different than dev->max_mtu, because it looks at
 	 * the lowerdev->mtu, rather than the static dev->max_mtu
 	 */
 	if (lowerdev) {
-		int max_mtu = lowerdev->mtu - vxlan_headroom(vxlan->cfg.flags);
+		int max_mtu = lowerdev->mtu - vxlan_headroom(cfg->flags);
 		if (new_mtu > max_mtu)
 			return -EINVAL;
 	}
@@ -3259,11 +3330,14 @@ static int vxlan_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct ip_tunnel_info *info = skb_tunnel_info(skb);
+	const struct vxlan_config *cfg;
 	__be16 sport, dport;
 
-	sport = udp_flow_src_port(dev_net(dev), skb, vxlan->cfg.port_min,
-				  vxlan->cfg.port_max, true);
-	dport = info->key.tp_dst ? : vxlan->cfg.dst_port;
+	cfg = rcu_dereference(vxlan->cfg);
+
+	sport = udp_flow_src_port(dev_net(dev), skb, cfg->port_min,
+				  cfg->port_max, true);
+	dport = info->key.tp_dst ? : cfg->dst_port;
 
 	if (ip_tunnel_info_af(info) == AF_INET) {
 		struct vxlan_sock *sock4 = rcu_dereference(vxlan->vn4_sock);
@@ -3373,6 +3447,15 @@ static void vxlan_offload_rx_ports(struct net_device *dev, bool push)
 	}
 }
 
+static void vxlan_free_dev(struct net_device *dev)
+{
+	struct vxlan_dev *vxlan = netdev_priv(dev);
+	struct vxlan_config *cfg = rcu_dereference_protected(vxlan->cfg, 1);
+
+	RCU_INIT_POINTER(vxlan->cfg, NULL);
+	kfree(cfg);
+}
+
 /* Initialize the device structure. */
 static void vxlan_setup(struct net_device *dev)
 {
@@ -3381,6 +3464,8 @@ static void vxlan_setup(struct net_device *dev)
 	eth_hw_addr_random(dev);
 	ether_setup(dev);
 
+	dev->priv_destructor = vxlan_free_dev;
+
 	dev->needs_free_netdev = true;
 	SET_NETDEV_DEVTYPE(dev, &vxlan_type);
 
@@ -3555,9 +3640,11 @@ static int vxlan_get_link_ksettings(struct net_device *dev,
 				    struct ethtool_link_ksettings *cmd)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
-	struct vxlan_rdst *dst = &vxlan->default_dst;
-	struct net_device *lowerdev = __dev_get_by_index(vxlan->net,
-							 dst->remote_ifindex);
+	const struct vxlan_config *cfg;
+	struct net_device *lowerdev;
+
+	cfg = rtnl_dereference(vxlan->cfg);
+	lowerdev = __dev_get_by_index(vxlan->net, cfg->remote_ifindex);
 
 	if (!lowerdev) {
 		cmd->base.duplex = DUPLEX_UNKNOWN;
@@ -3663,21 +3750,22 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, bool ipv6,
 
 static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)
 {
-	bool metadata = vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA;
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
+	bool metadata = cfg->flags & VXLAN_F_COLLECT_METADATA;
 	struct vxlan_sock *vs = NULL;
 	struct vxlan_dev_node *node;
 	int l3mdev_index = 0;
 
 	ASSERT_RTNL();
 
-	if (vxlan->cfg.remote_ifindex)
+	if (cfg->remote_ifindex)
 		l3mdev_index = l3mdev_master_upper_ifindex_by_index(
-			vxlan->net, vxlan->cfg.remote_ifindex);
+			vxlan->net, cfg->remote_ifindex);
 
-	if (!vxlan->cfg.no_share) {
+	if (!cfg->no_share) {
 		rcu_read_lock();
 		vs = vxlan_find_sock(vxlan->net, ipv6 ? AF_INET6 : AF_INET,
-				     vxlan->cfg.dst_port, vxlan->cfg.flags,
+				     cfg->dst_port, cfg->flags,
 				     l3mdev_index);
 		if (vs && !refcount_inc_not_zero(&vs->refcnt)) {
 			rcu_read_unlock();
@@ -3687,7 +3775,7 @@ static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)
 	}
 	if (!vs)
 		vs = vxlan_socket_create(vxlan->net, ipv6,
-					 vxlan->cfg.dst_port, vxlan->cfg.flags,
+					 cfg->dst_port, cfg->flags,
 					 l3mdev_index);
 	if (IS_ERR(vs))
 		return PTR_ERR(vs);
@@ -3702,7 +3790,7 @@ static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)
 		node = &vxlan->hlist4;
 	}
 
-	if (metadata && (vxlan->cfg.flags & VXLAN_F_VNIFILTER))
+	if (metadata && (cfg->flags & VXLAN_F_VNIFILTER))
 		vxlan_vs_add_vnigrp(vxlan, vs, ipv6);
 	else
 		vxlan_vs_add_dev(vs, vxlan, node);
@@ -3712,11 +3800,14 @@ static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)
 
 static int vxlan_sock_add(struct vxlan_dev *vxlan)
 {
-	bool metadata = vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA;
-	bool ipv6 = vxlan->cfg.flags & VXLAN_F_IPV6 || metadata;
-	bool ipv4 = !ipv6 || metadata;
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
+	bool metadata, ipv6, ipv4;
 	int ret = 0;
 
+	metadata = cfg->flags & VXLAN_F_COLLECT_METADATA;
+	ipv6 = (cfg->flags & VXLAN_F_IPV6) || metadata;
+	ipv4 = !ipv6 || metadata;
+
 	RCU_INIT_POINTER(vxlan->vn4_sock, NULL);
 #if IS_ENABLED(CONFIG_IPV6)
 	RCU_INIT_POINTER(vxlan->vn6_sock, NULL);
@@ -3734,28 +3825,33 @@ static int vxlan_sock_add(struct vxlan_dev *vxlan)
 }
 
 int vxlan_vni_in_use(struct net *src_net, struct vxlan_dev *vxlan,
-		     struct vxlan_config *conf, __be32 vni)
+		     const struct vxlan_config *conf, __be32 vni)
 {
 	struct vxlan_net *vn = net_generic(src_net, vxlan_net_id);
 	struct vxlan_dev *tmp;
 
 	list_for_each_entry(tmp, &vn->vxlan_list, next) {
+		const struct vxlan_config *tmp_cfg;
+
 		if (tmp == vxlan)
 			continue;
-		if (tmp->cfg.flags & VXLAN_F_VNIFILTER) {
+
+		tmp_cfg = rtnl_dereference(tmp->cfg);
+
+		if (tmp_cfg->flags & VXLAN_F_VNIFILTER) {
 			if (!vxlan_vnifilter_lookup(tmp, vni))
 				continue;
-		} else if (tmp->cfg.vni != vni) {
+		} else if (tmp_cfg->vni != vni) {
 			continue;
 		}
-		if (tmp->cfg.dst_port != conf->dst_port)
+		if (tmp_cfg->dst_port != conf->dst_port)
 			continue;
-		if ((tmp->cfg.flags & (VXLAN_F_RCV_FLAGS | VXLAN_F_IPV6)) !=
+		if ((tmp_cfg->flags & (VXLAN_F_RCV_FLAGS | VXLAN_F_IPV6)) !=
 		    (conf->flags & (VXLAN_F_RCV_FLAGS | VXLAN_F_IPV6)))
 			continue;
 
 		if ((conf->flags & VXLAN_F_IPV6_LINKLOCAL) &&
-		    tmp->cfg.remote_ifindex != conf->remote_ifindex)
+		    tmp_cfg->remote_ifindex != conf->remote_ifindex)
 			continue;
 
 		return -EEXIST;
@@ -3917,16 +4013,16 @@ static int vxlan_config_validate(struct net *src_net, struct vxlan_config *conf,
 }
 
 static void vxlan_config_apply(struct net_device *dev,
-			       struct vxlan_config *conf,
+			       struct vxlan_config *new_cfg,
 			       struct net_device *lowerdev,
 			       struct net *src_net,
-			       bool changelink)
+			       bool changelink, bool lowerdev_changed)
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
-	struct vxlan_rdst *dst = &vxlan->default_dst;
 	unsigned short needed_headroom = ETH_HLEN;
+	struct vxlan_config *old_cfg;
 	int max_mtu = ETH_MAX_MTU;
-	u32 flags = conf->flags;
+	u32 flags = new_cfg->flags;
 
 	if (!changelink) {
 		if (flags & VXLAN_F_GPE)
@@ -3934,19 +4030,13 @@ static void vxlan_config_apply(struct net_device *dev,
 		else
 			vxlan_ether_setup(dev);
 
-		if (conf->mtu)
-			dev->mtu = conf->mtu;
+		if (new_cfg->mtu)
+			dev->mtu = new_cfg->mtu;
 
 		vxlan->net = src_net;
 	}
 
-	dst->remote_vni = conf->vni;
-
-	memcpy(&dst->remote_ip, &conf->remote_ip, sizeof(conf->remote_ip));
-
 	if (lowerdev) {
-		dst->remote_ifindex = conf->remote_ifindex;
-
 		netif_inherit_tso_max(dev, lowerdev);
 
 		needed_headroom = lowerdev->hard_header_len;
@@ -3958,11 +4048,12 @@ static void vxlan_config_apply(struct net_device *dev,
 		if (max_mtu < ETH_MIN_MTU)
 			max_mtu = ETH_MIN_MTU;
 
-		if (!changelink && !conf->mtu)
+		if (!changelink && !new_cfg->mtu)
 			dev->mtu = max_mtu;
 	}
 
-	if (dev->mtu > max_mtu)
+	/* A changelink leaving the lower device alone must not shrink the mtu */
+	if (lowerdev_changed && dev->mtu > max_mtu)
 		dev->mtu = max_mtu;
 
 	if (flags & VXLAN_F_COLLECT_METADATA)
@@ -3970,7 +4061,10 @@ static void vxlan_config_apply(struct net_device *dev,
 	needed_headroom += vxlan_headroom(flags);
 	dev->needed_headroom = needed_headroom;
 
-	memcpy(&vxlan->cfg, conf, sizeof(*conf));
+	old_cfg = rtnl_dereference(vxlan->cfg);
+	rcu_assign_pointer(vxlan->cfg, new_cfg);
+	if (old_cfg)
+		kfree_rcu(old_cfg, rcu);
 }
 
 static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,
@@ -3979,13 +4073,18 @@ static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,
 {
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct net_device *lowerdev;
+	struct vxlan_config *new_cfg;
 	int ret;
 
 	ret = vxlan_config_validate(src_net, conf, &lowerdev, vxlan, extack);
 	if (ret)
 		return ret;
 
-	vxlan_config_apply(dev, conf, lowerdev, src_net, false);
+	new_cfg = kmemdup(conf, sizeof(*conf), GFP_KERNEL);
+	if (!new_cfg)
+		return -ENOMEM;
+
+	vxlan_config_apply(dev, new_cfg, lowerdev, src_net, false, true);
 
 	return 0;
 }
@@ -3997,22 +4096,25 @@ static int vxlan_dev_create(struct net *net, struct net_device *dev,
 	struct vxlan_net *vn = net_generic(net, vxlan_net_id);
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct net_device *remote_dev = NULL;
-	struct vxlan_rdst *dst;
+	const struct vxlan_config *cfg;
 	int err;
 
-	dst = &vxlan->default_dst;
 	err = vxlan_dev_configure(net, dev, conf, extack);
 	if (err)
 		return err;
 
+	cfg = rtnl_dereference(vxlan->cfg);
+
 	dev->ethtool_ops = &vxlan_ethtool_ops;
 
 	err = register_netdevice(dev);
-	if (err)
+	if (err) {
+		vxlan_free_dev(dev);
 		return err;
+	}
 
-	if (dst->remote_ifindex) {
-		remote_dev = __dev_get_by_index(net, dst->remote_ifindex);
+	if (cfg->remote_ifindex) {
+		remote_dev = __dev_get_by_index(net, cfg->remote_ifindex);
 		if (!remote_dev) {
 			err = -ENODEV;
 			goto unregister;
@@ -4022,7 +4124,7 @@ static int vxlan_dev_create(struct net *net, struct net_device *dev,
 		if (err)
 			goto unregister;
 
-		dst->remote_dev = remote_dev;
+		vxlan->lowerdev = remote_dev;
 	}
 
 	err = rtnl_configure_link(dev, NULL, 0, NULL);
@@ -4030,16 +4132,18 @@ static int vxlan_dev_create(struct net *net, struct net_device *dev,
 		goto unlink;
 
 	/* create an fdb entry for a valid default destination */
-	if (!vxlan_addr_any(&dst->remote_ip)) {
+	if (!vxlan_addr_any(&cfg->remote_ip)) {
+		union vxlan_addr rip = cfg->remote_ip;
+
 		spin_lock_bh(&vxlan->hash_lock);
 		err = vxlan_fdb_update(vxlan, all_zeros_mac,
-				       &dst->remote_ip,
+				       &rip,
 				       NUD_REACHABLE | NUD_PERMANENT,
 				       NLM_F_EXCL | NLM_F_CREATE,
-				       vxlan->cfg.dst_port,
-				       dst->remote_vni,
-				       dst->remote_vni,
-				       dst->remote_ifindex,
+				       cfg->dst_port,
+				       cfg->vni,
+				       cfg->vni,
+				       cfg->remote_ifindex,
 				       NTF_SELF, 0, true, extack);
 		spin_unlock_bh(&vxlan->hash_lock);
 		if (err)
@@ -4100,8 +4204,12 @@ static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[],
 	memset(conf, 0, sizeof(*conf));
 
 	/* if changelink operation, start with old existing cfg */
-	if (changelink)
-		memcpy(conf, &vxlan->cfg, sizeof(*conf));
+	if (changelink) {
+		const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
+
+		if (cfg)
+			memcpy(conf, cfg, sizeof(*conf));
+	}
 
 	if (data[IFLA_VXLAN_ID]) {
 		__be32 vni = cpu_to_be32(nla_get_u32(data[IFLA_VXLAN_ID]));
@@ -4447,17 +4555,19 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],
 			    struct nlattr *data[],
 			    struct netlink_ext_ack *extack)
 {
+	bool lowerdev_changed, rem_ip_changed, change_igmp;
 	struct vxlan_dev *vxlan = netdev_priv(dev);
-	bool rem_ip_changed, change_igmp;
+	const struct vxlan_config *cfg;
+	struct vxlan_config *new_cfg;
 	struct net_device *lowerdev;
 	struct vxlan_config conf;
-	struct vxlan_rdst *dst;
 	int err;
 
+	cfg = rtnl_dereference(vxlan->cfg);
+
 	if (!rtnl_dev_link_net_capable(dev, vxlan->net))
 		return -EPERM;
 
-	dst = &vxlan->default_dst;
 	err = vxlan_nl2conf(tb, data, dev, &conf, true, extack);
 	if (err)
 		return err;
@@ -4467,75 +4577,94 @@ static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],
 	if (err)
 		return err;
 
-	if (dst->remote_dev == lowerdev)
-		lowerdev = NULL;
+	new_cfg = kmemdup(&conf, sizeof(conf), GFP_KERNEL);
+	if (!new_cfg)
+		return -ENOMEM;
 
-	err = netdev_adjacent_change_prepare(dst->remote_dev, lowerdev, dev,
-					     extack);
-	if (err)
-		return err;
+	lowerdev_changed = vxlan->lowerdev != lowerdev;
+	if (lowerdev_changed) {
+		err = netdev_adjacent_change_prepare(vxlan->lowerdev, lowerdev,
+						     dev, extack);
+		if (err) {
+			kfree(new_cfg);
+			return err;
+		}
+	}
 
-	rem_ip_changed = !vxlan_addr_equal(&conf.remote_ip, &dst->remote_ip);
+	rem_ip_changed = !vxlan_addr_equal(&conf.remote_ip, &cfg->remote_ip);
 	change_igmp = vxlan->dev->flags & IFF_UP &&
 		      (rem_ip_changed ||
-		       dst->remote_ifindex != conf.remote_ifindex);
+		       cfg->remote_ifindex != conf.remote_ifindex);
 
 	/* handle default dst entry */
-	if (rem_ip_changed) {
+	if (rem_ip_changed || cfg->remote_ifindex != conf.remote_ifindex) {
 		spin_lock_bh(&vxlan->hash_lock);
 		if (!vxlan_addr_any(&conf.remote_ip)) {
 			err = vxlan_fdb_update(vxlan, all_zeros_mac,
 					       &conf.remote_ip,
 					       NUD_REACHABLE | NUD_PERMANENT,
 					       NLM_F_APPEND | NLM_F_CREATE,
-					       vxlan->cfg.dst_port,
+					       cfg->dst_port,
 					       conf.vni, conf.vni,
 					       conf.remote_ifindex,
 					       NTF_SELF, 0, true, extack);
 			if (err) {
 				spin_unlock_bh(&vxlan->hash_lock);
-				netdev_adjacent_change_abort(dst->remote_dev,
-							     lowerdev, dev);
+				if (lowerdev_changed)
+					netdev_adjacent_change_abort(vxlan->lowerdev,
+								     lowerdev, dev);
+				kfree(new_cfg);
 				return err;
 			}
 		}
-		if (!vxlan_addr_any(&dst->remote_ip))
+		if (!vxlan_addr_any(&cfg->remote_ip))
 			__vxlan_fdb_delete(vxlan, all_zeros_mac,
-					   dst->remote_ip,
-					   vxlan->cfg.dst_port,
-					   dst->remote_vni,
-					   dst->remote_vni,
-					   dst->remote_ifindex,
+					   cfg->remote_ip,
+					   cfg->dst_port,
+					   cfg->vni,
+					   cfg->vni,
+					   cfg->remote_ifindex,
 					   true);
 		spin_unlock_bh(&vxlan->hash_lock);
 
-		/* If vni filtering device, also update fdb entries of
-		 * all vnis that were using default remote ip
+		/* If vni filtering device, also update default fdb entries of
+		 * all vnis
 		 */
-		if (vxlan->cfg.flags & VXLAN_F_VNIFILTER) {
-			err = vxlan_vnilist_update_group(vxlan, &dst->remote_ip,
-							 &conf.remote_ip, extack);
+		if (cfg->flags & VXLAN_F_VNIFILTER) {
+			err = vxlan_vnilist_update_group(vxlan, &cfg->remote_ip,
+							 &conf.remote_ip,
+							 cfg->remote_ifindex,
+							 conf.remote_ifindex,
+							 extack);
 			if (err) {
-				netdev_adjacent_change_abort(dst->remote_dev,
-							     lowerdev, dev);
+				if (lowerdev_changed)
+					netdev_adjacent_change_abort(vxlan->lowerdev,
+								     lowerdev, dev);
+				kfree(new_cfg);
 				return err;
 			}
 		}
 	}
 
-	if (change_igmp && vxlan_addr_multicast(&dst->remote_ip))
+	if (change_igmp && vxlan_addr_multicast(&cfg->remote_ip))
 		err = vxlan_multicast_leave(vxlan);
 
-	if (netif_running(dev) && conf.age_interval != vxlan->cfg.age_interval)
+	if (netif_running(dev) && conf.age_interval != cfg->age_interval)
 		mod_timer(&vxlan->age_timer, jiffies);
 
-	netdev_adjacent_change_commit(dst->remote_dev, lowerdev, dev);
-	if (lowerdev && lowerdev != dst->remote_dev)
-		dst->remote_dev = lowerdev;
-	vxlan_config_apply(dev, &conf, lowerdev, vxlan->net, true);
+	if (lowerdev_changed) {
+		if (lowerdev)
+			netdev_adjacent_change_commit(vxlan->lowerdev, lowerdev,
+						      dev);
+		else
+			netdev_upper_dev_unlink(vxlan->lowerdev, dev);
+		vxlan->lowerdev = lowerdev;
+	}
+	vxlan_config_apply(dev, new_cfg, lowerdev, vxlan->net, true,
+			   lowerdev_changed);
 
 	if (!err && change_igmp &&
-	    vxlan_addr_multicast(&dst->remote_ip))
+	    vxlan_addr_multicast(&new_cfg->remote_ip))
 		err = vxlan_multicast_join(vxlan);
 
 	return err;
@@ -4550,8 +4679,8 @@ static void vxlan_dellink(struct net_device *dev, struct list_head *head)
 
 	list_del(&vxlan->next);
 	unregister_netdevice_queue(dev, head);
-	if (vxlan->default_dst.remote_dev)
-		netdev_upper_dev_unlink(vxlan->default_dst.remote_dev, dev);
+	if (vxlan->lowerdev)
+		netdev_upper_dev_unlink(vxlan->lowerdev, dev);
 }
 
 static size_t vxlan_get_size(const struct net_device *dev)
@@ -4595,110 +4724,114 @@ static size_t vxlan_get_size(const struct net_device *dev)
 static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev)
 {
 	const struct vxlan_dev *vxlan = netdev_priv(dev);
-	const struct vxlan_rdst *dst = &vxlan->default_dst;
-	struct ifla_vxlan_port_range ports = {
-		.low =  htons(vxlan->cfg.port_min),
-		.high = htons(vxlan->cfg.port_max),
-	};
+	struct ifla_vxlan_port_range ports;
+	const struct vxlan_config *cfg;
+
+	rcu_read_lock();
+	cfg = rcu_dereference(vxlan->cfg);
 
-	if (nla_put_u32(skb, IFLA_VXLAN_ID, be32_to_cpu(dst->remote_vni)))
+	if (nla_put_u32(skb, IFLA_VXLAN_ID, be32_to_cpu(cfg->vni)))
 		goto nla_put_failure;
 
-	if (!vxlan_addr_any(&dst->remote_ip)) {
-		if (dst->remote_ip.sa.sa_family == AF_INET) {
+	if (!vxlan_addr_any(&cfg->remote_ip)) {
+		if (cfg->remote_ip.sa.sa_family == AF_INET) {
 			if (nla_put_in_addr(skb, IFLA_VXLAN_GROUP,
-					    dst->remote_ip.sin.sin_addr.s_addr))
+					    cfg->remote_ip.sin.sin_addr.s_addr))
 				goto nla_put_failure;
 #if IS_ENABLED(CONFIG_IPV6)
 		} else {
 			if (nla_put_in6_addr(skb, IFLA_VXLAN_GROUP6,
-					     &dst->remote_ip.sin6.sin6_addr))
+					     &cfg->remote_ip.sin6.sin6_addr))
 				goto nla_put_failure;
 #endif
 		}
 	}
 
-	if (dst->remote_ifindex && nla_put_u32(skb, IFLA_VXLAN_LINK, dst->remote_ifindex))
+	if (cfg->remote_ifindex && nla_put_u32(skb, IFLA_VXLAN_LINK, cfg->remote_ifindex))
 		goto nla_put_failure;
 
-	if (!vxlan_addr_any(&vxlan->cfg.saddr)) {
-		if (vxlan->cfg.saddr.sa.sa_family == AF_INET) {
+	if (!vxlan_addr_any(&cfg->saddr)) {
+		if (cfg->saddr.sa.sa_family == AF_INET) {
 			if (nla_put_in_addr(skb, IFLA_VXLAN_LOCAL,
-					    vxlan->cfg.saddr.sin.sin_addr.s_addr))
+					    cfg->saddr.sin.sin_addr.s_addr))
 				goto nla_put_failure;
 #if IS_ENABLED(CONFIG_IPV6)
 		} else {
 			if (nla_put_in6_addr(skb, IFLA_VXLAN_LOCAL6,
-					     &vxlan->cfg.saddr.sin6.sin6_addr))
+					     &cfg->saddr.sin6.sin6_addr))
 				goto nla_put_failure;
 #endif
 		}
 	}
 
-	if (nla_put_u8(skb, IFLA_VXLAN_TTL, vxlan->cfg.ttl) ||
+	if (nla_put_u8(skb, IFLA_VXLAN_TTL, cfg->ttl) ||
 	    nla_put_u8(skb, IFLA_VXLAN_TTL_INHERIT,
-		       !!(vxlan->cfg.flags & VXLAN_F_TTL_INHERIT)) ||
-	    nla_put_u8(skb, IFLA_VXLAN_TOS, vxlan->cfg.tos) ||
-	    nla_put_u8(skb, IFLA_VXLAN_DF, vxlan->cfg.df) ||
-	    nla_put_be32(skb, IFLA_VXLAN_LABEL, vxlan->cfg.label) ||
-	    nla_put_u32(skb, IFLA_VXLAN_LABEL_POLICY, vxlan->cfg.label_policy) ||
+		       !!(cfg->flags & VXLAN_F_TTL_INHERIT)) ||
+	    nla_put_u8(skb, IFLA_VXLAN_TOS, cfg->tos) ||
+	    nla_put_u8(skb, IFLA_VXLAN_DF, cfg->df) ||
+	    nla_put_be32(skb, IFLA_VXLAN_LABEL, cfg->label) ||
+	    nla_put_u32(skb, IFLA_VXLAN_LABEL_POLICY, cfg->label_policy) ||
 	    nla_put_u8(skb, IFLA_VXLAN_LEARNING,
-		       !!(vxlan->cfg.flags & VXLAN_F_LEARN)) ||
+		       !!(cfg->flags & VXLAN_F_LEARN)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_PROXY,
-		       !!(vxlan->cfg.flags & VXLAN_F_PROXY)) ||
+		       !!(cfg->flags & VXLAN_F_PROXY)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_RSC,
-		       !!(vxlan->cfg.flags & VXLAN_F_RSC)) ||
+		       !!(cfg->flags & VXLAN_F_RSC)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_L2MISS,
-		       !!(vxlan->cfg.flags & VXLAN_F_L2MISS)) ||
+		       !!(cfg->flags & VXLAN_F_L2MISS)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_L3MISS,
-		       !!(vxlan->cfg.flags & VXLAN_F_L3MISS)) ||
+		       !!(cfg->flags & VXLAN_F_L3MISS)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_COLLECT_METADATA,
-		       !!(vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA)) ||
-	    nla_put_u32(skb, IFLA_VXLAN_AGEING, vxlan->cfg.age_interval) ||
-	    nla_put_u32(skb, IFLA_VXLAN_LIMIT, vxlan->cfg.addrmax) ||
-	    nla_put_be16(skb, IFLA_VXLAN_PORT, vxlan->cfg.dst_port) ||
+		       !!(cfg->flags & VXLAN_F_COLLECT_METADATA)) ||
+	    nla_put_u32(skb, IFLA_VXLAN_AGEING, cfg->age_interval) ||
+	    nla_put_u32(skb, IFLA_VXLAN_LIMIT, cfg->addrmax) ||
+	    nla_put_be16(skb, IFLA_VXLAN_PORT, cfg->dst_port) ||
 	    nla_put_u8(skb, IFLA_VXLAN_UDP_CSUM,
-		       !(vxlan->cfg.flags & VXLAN_F_UDP_ZERO_CSUM_TX)) ||
+		       !(cfg->flags & VXLAN_F_UDP_ZERO_CSUM_TX)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_UDP_ZERO_CSUM6_TX,
-		       !!(vxlan->cfg.flags & VXLAN_F_UDP_ZERO_CSUM6_TX)) ||
+		       !!(cfg->flags & VXLAN_F_UDP_ZERO_CSUM6_TX)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_UDP_ZERO_CSUM6_RX,
-		       !!(vxlan->cfg.flags & VXLAN_F_UDP_ZERO_CSUM6_RX)) ||
+		       !!(cfg->flags & VXLAN_F_UDP_ZERO_CSUM6_RX)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_REMCSUM_TX,
-		       !!(vxlan->cfg.flags & VXLAN_F_REMCSUM_TX)) ||
+		       !!(cfg->flags & VXLAN_F_REMCSUM_TX)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_REMCSUM_RX,
-		       !!(vxlan->cfg.flags & VXLAN_F_REMCSUM_RX)) ||
+		       !!(cfg->flags & VXLAN_F_REMCSUM_RX)) ||
 	    nla_put_u8(skb, IFLA_VXLAN_LOCALBYPASS,
-		       !!(vxlan->cfg.flags & VXLAN_F_LOCALBYPASS)))
+		       !!(cfg->flags & VXLAN_F_LOCALBYPASS)))
 		goto nla_put_failure;
 
+	ports.low = htons(cfg->port_min);
+	ports.high = htons(cfg->port_max);
 	if (nla_put(skb, IFLA_VXLAN_PORT_RANGE, sizeof(ports), &ports))
 		goto nla_put_failure;
 
-	if (vxlan->cfg.flags & VXLAN_F_GBP &&
+	if (cfg->flags & VXLAN_F_GBP &&
 	    nla_put_flag(skb, IFLA_VXLAN_GBP))
 		goto nla_put_failure;
 
-	if (vxlan->cfg.flags & VXLAN_F_GPE &&
+	if (cfg->flags & VXLAN_F_GPE &&
 	    nla_put_flag(skb, IFLA_VXLAN_GPE))
 		goto nla_put_failure;
 
-	if (vxlan->cfg.flags & VXLAN_F_REMCSUM_NOPARTIAL &&
+	if (cfg->flags & VXLAN_F_REMCSUM_NOPARTIAL &&
 	    nla_put_flag(skb, IFLA_VXLAN_REMCSUM_NOPARTIAL))
 		goto nla_put_failure;
 
-	if (vxlan->cfg.flags & VXLAN_F_VNIFILTER &&
+	if (cfg->flags & VXLAN_F_VNIFILTER &&
 	    nla_put_u8(skb, IFLA_VXLAN_VNIFILTER,
-		       !!(vxlan->cfg.flags & VXLAN_F_VNIFILTER)))
+		       !!(cfg->flags & VXLAN_F_VNIFILTER)))
 		goto nla_put_failure;
 
 	if (nla_put(skb, IFLA_VXLAN_RESERVED_BITS,
-		    sizeof(vxlan->cfg.reserved_bits),
-		    &vxlan->cfg.reserved_bits))
+		    sizeof(cfg->reserved_bits),
+		    &cfg->reserved_bits))
 		goto nla_put_failure;
 
+	rcu_read_unlock();
 	return 0;
 
 nla_put_failure:
+	rcu_read_unlock();
 	return -EMSGSIZE;
 }
 
@@ -4731,7 +4864,7 @@ static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn,
 	LIST_HEAD(list_kill);
 
 	list_for_each_entry_safe(vxlan, next, &vn->vxlan_list, next) {
-		struct vxlan_rdst *dst = &vxlan->default_dst;
+		const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
 
 		/* In case we created vxlan device with carrier
 		 * and we loose the carrier due to module unload
@@ -4739,7 +4872,7 @@ static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn,
 		 * cases, it's not necessary and remote_ifindex
 		 * is 0 here, so no matches.
 		 */
-		if (dst->remote_ifindex == dev->ifindex)
+		if (cfg->remote_ifindex == dev->ifindex)
 			vxlan_dellink(vxlan->dev, &list_kill);
 	}
 
@@ -4752,6 +4885,10 @@ static int vxlan_netdevice_event(struct notifier_block *unused,
 	struct net_device *dev = netdev_notifier_info_to_dev(ptr);
 	struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
 
+	if ((event == NETDEV_REGISTER || event == NETDEV_UNREGISTER) &&
+	    netif_is_vxlan(dev))
+		vxlan_vnifilter_seq_inc(dev_net(dev));
+
 	if (event == NETDEV_UNREGISTER)
 		vxlan_handle_lowerdev_unregister(vn, dev);
 	else if (event == NETDEV_UDP_TUNNEL_PUSH_INFO)
diff --git a/drivers/net/vxlan/vxlan_mdb.c b/drivers/net/vxlan/vxlan_mdb.c
index 841f42ffecb9a..c1a0551990555 100644
--- a/drivers/net/vxlan/vxlan_mdb.c
+++ b/drivers/net/vxlan/vxlan_mdb.c
@@ -165,6 +165,7 @@ static int vxlan_mdb_entry_info_fill(const struct vxlan_dev *vxlan,
 				     const struct vxlan_mdb_entry *mdb_entry,
 				     const struct vxlan_mdb_remote *remote)
 {
+	const struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan->cfg);
 	struct vxlan_rdst *rd = rtnl_dereference(remote->rd);
 	struct br_mdb_entry e;
 	struct nlattr *nest;
@@ -189,12 +190,12 @@ static int vxlan_mdb_entry_info_fill(const struct vxlan_dev *vxlan,
 	    vxlan_nla_put_addr(skb, MDBA_MDB_EATTR_DST, &rd->remote_ip))
 		goto nest_err;
 
-	if (rd->remote_port && rd->remote_port != vxlan->cfg.dst_port &&
+	if (rd->remote_port && rd->remote_port != cfg->dst_port &&
 	    nla_put_u16(skb, MDBA_MDB_EATTR_DST_PORT,
 			be16_to_cpu(rd->remote_port)))
 		goto nest_err;
 
-	if (rd->remote_vni != vxlan->default_dst.remote_vni &&
+	if (rd->remote_vni != cfg->vni &&
 	    nla_put_u32(skb, MDBA_MDB_EATTR_VNI, be32_to_cpu(rd->remote_vni)))
 		goto nest_err;
 
@@ -202,7 +203,7 @@ static int vxlan_mdb_entry_info_fill(const struct vxlan_dev *vxlan,
 	    nla_put_u32(skb, MDBA_MDB_EATTR_IFINDEX, rd->remote_ifindex))
 		goto nest_err;
 
-	if ((vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA) &&
+	if ((cfg->flags & VXLAN_F_COLLECT_METADATA) &&
 	    mdb_entry->key.vni && nla_put_u32(skb, MDBA_MDB_EATTR_SRC_VNI,
 					      be32_to_cpu(mdb_entry->key.vni)))
 		goto nest_err;
@@ -613,16 +614,19 @@ static int vxlan_mdb_config_init(struct vxlan_mdb_config *cfg,
 {
 	struct br_mdb_entry *entry = nla_data(tb[MDBA_SET_ENTRY]);
 	struct vxlan_dev *vxlan = netdev_priv(dev);
+	const struct vxlan_config *vcfg;
+
+	vcfg = rtnl_dereference(vxlan->cfg);
 
 	memset(cfg, 0, sizeof(*cfg));
 	cfg->vxlan = vxlan;
-	cfg->group.vni = vxlan->default_dst.remote_vni;
+	cfg->group.vni = vcfg->vni;
 	INIT_LIST_HEAD(&cfg->src_list);
 	cfg->nlflags = nlmsg_flags;
 	cfg->filter_mode = MCAST_EXCLUDE;
 	cfg->rt_protocol = RTPROT_STATIC;
-	cfg->remote_vni = vxlan->default_dst.remote_vni;
-	cfg->remote_port = vxlan->cfg.dst_port;
+	cfg->remote_vni = vcfg->vni;
+	cfg->remote_port = vcfg->dst_port;
 
 	if (entry->ifindex != dev->ifindex) {
 		NL_SET_ERR_MSG_MOD(extack, "Port net device must be the VXLAN net device");
@@ -957,11 +961,12 @@ vxlan_mdb_nlmsg_remote_size(const struct vxlan_dev *vxlan,
 			    const struct vxlan_mdb_entry *mdb_entry,
 			    const struct vxlan_mdb_remote *remote)
 {
+	const struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan->cfg);
 	const struct vxlan_mdb_entry_key *group = &mdb_entry->key;
 	struct vxlan_rdst *rd = rtnl_dereference(remote->rd);
 	size_t nlmsg_size;
 
-		     /* MDBA_MDB_ENTRY_INFO */
+	/* MDBA_MDB_ENTRY_INFO */
 	nlmsg_size = nla_total_size(sizeof(struct br_mdb_entry)) +
 		     /* MDBA_MDB_EATTR_TIMER */
 		     nla_total_size(sizeof(u32));
@@ -978,16 +983,16 @@ vxlan_mdb_nlmsg_remote_size(const struct vxlan_dev *vxlan,
 	/* MDBA_MDB_EATTR_DST */
 	nlmsg_size += nla_total_size(vxlan_addr_size(&rd->remote_ip));
 	/* MDBA_MDB_EATTR_DST_PORT */
-	if (rd->remote_port && rd->remote_port != vxlan->cfg.dst_port)
+	if (rd->remote_port && rd->remote_port != cfg->dst_port)
 		nlmsg_size += nla_total_size(sizeof(u16));
 	/* MDBA_MDB_EATTR_VNI */
-	if (rd->remote_vni != vxlan->default_dst.remote_vni)
+	if (rd->remote_vni != cfg->vni)
 		nlmsg_size += nla_total_size(sizeof(u32));
 	/* MDBA_MDB_EATTR_IFINDEX */
 	if (rd->remote_ifindex)
 		nlmsg_size += nla_total_size(sizeof(u32));
 	/* MDBA_MDB_EATTR_SRC_VNI */
-	if ((vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA) && group->vni)
+	if ((cfg->flags & VXLAN_F_COLLECT_METADATA) && group->vni)
 		nlmsg_size += nla_total_size(sizeof(u32));
 
 	return nlmsg_size;
@@ -1216,7 +1221,7 @@ vxlan_mdb_entry_get(struct vxlan_dev *vxlan,
 		goto err_free_entry;
 
 	if (hlist_is_singular_node(&mdb_entry->mdb_node, &vxlan->mdb_list))
-		vxlan->cfg.flags |= VXLAN_F_MDB;
+		set_bit(VXLAN_DEV_F_MDB, &vxlan->flags);
 
 	return mdb_entry;
 
@@ -1233,7 +1238,7 @@ static void vxlan_mdb_entry_put(struct vxlan_dev *vxlan,
 		return;
 
 	if (hlist_is_singular_node(&mdb_entry->mdb_node, &vxlan->mdb_list))
-		vxlan->cfg.flags &= ~VXLAN_F_MDB;
+		clear_bit(VXLAN_DEV_F_MDB, &vxlan->flags);
 
 	rhashtable_remove_fast(&vxlan->mdb_tbl, &mdb_entry->rhnode,
 			       vxlan_mdb_rht_params);
@@ -1483,11 +1488,13 @@ static int vxlan_mdb_get_parse(struct net_device *dev, struct nlattr *tb[],
 {
 	struct br_mdb_entry *entry = nla_data(tb[MDBA_GET_ENTRY]);
 	struct nlattr *mdbe_attrs[MDBE_ATTR_MAX + 1];
+	const struct vxlan_config *cfg;
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	int err;
 
+	cfg = rtnl_dereference(vxlan->cfg);
 	memset(group, 0, sizeof(*group));
-	group->vni = vxlan->default_dst.remote_vni;
+	group->vni = cfg->vni;
 
 	if (!tb[MDBA_GET_ENTRY_ATTRS]) {
 		vxlan_mdb_group_set(group, entry, NULL);
@@ -1621,6 +1628,7 @@ int vxlan_mdb_get(struct net_device *dev, struct nlattr *tb[], u32 portid,
 }
 
 struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan,
+						const struct vxlan_config *cfg,
 						struct sk_buff *skb,
 						__be32 src_vni)
 {
@@ -1634,8 +1642,8 @@ struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan,
 	/* When not in collect metadata mode, 'src_vni' is zero, but MDB
 	 * entries are stored with the VNI of the VXLAN device.
 	 */
-	if (!(vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA))
-		src_vni = vxlan->default_dst.remote_vni;
+	if (!(cfg->flags & VXLAN_F_COLLECT_METADATA))
+		src_vni = cfg->vni;
 
 	memset(&group, 0, sizeof(group));
 	group.vni = src_vni;
@@ -1700,6 +1708,7 @@ struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan,
 }
 
 netdev_tx_t vxlan_mdb_xmit(struct vxlan_dev *vxlan,
+			   const struct vxlan_config *cfg,
 			   const struct vxlan_mdb_entry *mdb_entry,
 			   struct sk_buff *skb)
 {
@@ -1721,12 +1730,12 @@ netdev_tx_t vxlan_mdb_xmit(struct vxlan_dev *vxlan,
 
 		skb1 = skb_clone(skb, GFP_ATOMIC);
 		if (skb1)
-			vxlan_xmit_one(skb1, vxlan->dev, src_vni,
+			vxlan_xmit_one(skb1, vxlan->dev, cfg, src_vni,
 				       rcu_dereference(remote->rd), false);
 	}
 
 	if (fremote)
-		vxlan_xmit_one(skb, vxlan->dev, src_vni,
+		vxlan_xmit_one(skb, vxlan->dev, cfg, src_vni,
 			       rcu_dereference(fremote->rd), false);
 	else
 		kfree_skb_reason(skb, SKB_DROP_REASON_NO_TX_TARGET);
@@ -1757,7 +1766,7 @@ void vxlan_mdb_fini(struct vxlan_dev *vxlan)
 	struct vxlan_mdb_flush_desc desc = {};
 
 	vxlan_mdb_flush(vxlan, &desc);
-	WARN_ON_ONCE(vxlan->cfg.flags & VXLAN_F_MDB);
+	WARN_ON_ONCE(test_bit(VXLAN_DEV_F_MDB, &vxlan->flags));
 	rhashtable_free_and_destroy(&vxlan->mdb_tbl, vxlan_mdb_check_empty,
 				    NULL);
 }
diff --git a/drivers/net/vxlan/vxlan_multicast.c b/drivers/net/vxlan/vxlan_multicast.c
index 3b75b48dc726d..6fcc4a3673436 100644
--- a/drivers/net/vxlan/vxlan_multicast.c
+++ b/drivers/net/vxlan/vxlan_multicast.c
@@ -14,11 +14,12 @@
 /* Update multicast group membership when first VNI on
  * multicast address is brought up
  */
-int vxlan_igmp_join(struct vxlan_dev *vxlan, union vxlan_addr *rip,
+int vxlan_igmp_join(struct vxlan_dev *vxlan, const union vxlan_addr *rip,
 		    int rifindex)
 {
-	union vxlan_addr *ip = (rip ? : &vxlan->default_dst.remote_ip);
-	int ifindex = (rifindex ? : vxlan->default_dst.remote_ifindex);
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
+	const union vxlan_addr *ip = (rip ? : &cfg->remote_ip);
+	int ifindex = (rifindex ? : cfg->remote_ifindex);
 	int ret = -EINVAL;
 	struct sock *sk;
 
@@ -47,11 +48,12 @@ int vxlan_igmp_join(struct vxlan_dev *vxlan, union vxlan_addr *rip,
 	return ret;
 }
 
-int vxlan_igmp_leave(struct vxlan_dev *vxlan, union vxlan_addr *rip,
+int vxlan_igmp_leave(struct vxlan_dev *vxlan, const union vxlan_addr *rip,
 		     int rifindex)
 {
-	union vxlan_addr *ip = (rip ? : &vxlan->default_dst.remote_ip);
-	int ifindex = (rifindex ? : vxlan->default_dst.remote_ifindex);
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
+	const union vxlan_addr *ip = (rip ? : &cfg->remote_ip);
+	int ifindex = (rifindex ? : cfg->remote_ifindex);
 	int ret = -EINVAL;
 	struct sock *sk;
 
@@ -80,8 +82,8 @@ int vxlan_igmp_leave(struct vxlan_dev *vxlan, union vxlan_addr *rip,
 	return ret;
 }
 
-static bool vxlan_group_used_match(union vxlan_addr *ip, int ifindex,
-				   union vxlan_addr *rip, int rifindex)
+static bool vxlan_group_used_match(const union vxlan_addr *ip, int ifindex,
+				   const union vxlan_addr *rip, int rifindex)
 {
 	if (!vxlan_addr_multicast(rip))
 		return false;
@@ -96,14 +98,16 @@ static bool vxlan_group_used_match(union vxlan_addr *ip, int ifindex,
 }
 
 static bool vxlan_group_used_by_vnifilter(struct vxlan_dev *vxlan,
-					  union vxlan_addr *ip, int ifindex)
+					  const struct vxlan_config *cfg,
+					  const union vxlan_addr *ip,
+					  int ifindex)
 {
 	struct vxlan_vni_group *vg = rtnl_dereference(vxlan->vnigrp);
 	struct vxlan_vni_node *v, *tmp;
 
 	if (vxlan_group_used_match(ip, ifindex,
-				   &vxlan->default_dst.remote_ip,
-				   vxlan->default_dst.remote_ifindex))
+				   &cfg->remote_ip,
+				   cfg->remote_ifindex))
 		return true;
 
 	list_for_each_entry_safe(v, tmp, &vg->vni_list, vlist) {
@@ -112,7 +116,7 @@ static bool vxlan_group_used_by_vnifilter(struct vxlan_dev *vxlan,
 
 		if (vxlan_group_used_match(ip, ifindex,
 					   &v->remote_ip,
-					   vxlan->default_dst.remote_ifindex))
+					   cfg->remote_ifindex))
 			return true;
 	}
 
@@ -121,16 +125,17 @@ static bool vxlan_group_used_by_vnifilter(struct vxlan_dev *vxlan,
 
 /* See if multicast group is already in use by other ID */
 bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,
-		      __be32 vni, union vxlan_addr *rip, int rifindex)
+		      __be32 vni, const union vxlan_addr *rip, int rifindex)
 {
-	union vxlan_addr *ip = (rip ? : &dev->default_dst.remote_ip);
-	int ifindex = (rifindex ? : dev->default_dst.remote_ifindex);
+	const struct vxlan_config *dev_cfg = rtnl_dereference(dev->cfg);
+	const union vxlan_addr *ip = (rip ? : &dev_cfg->remote_ip);
+	int ifindex = (rifindex ? : dev_cfg->remote_ifindex);
 	struct vxlan_dev *vxlan;
 	struct vxlan_sock *sock4;
 #if IS_ENABLED(CONFIG_IPV6)
 	struct vxlan_sock *sock6;
 #endif
-	unsigned short family = dev->default_dst.remote_ip.sa.sa_family;
+	unsigned short family = dev_cfg->remote_ip.sa.sa_family;
 
 	sock4 = rtnl_dereference(dev->vn4_sock);
 
@@ -147,6 +152,8 @@ bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,
 #endif
 
 	list_for_each_entry(vxlan, &vn->vxlan_list, next) {
+		const struct vxlan_config *cfg;
+
 		if (!netif_running(vxlan->dev) || vxlan == dev)
 			continue;
 
@@ -158,13 +165,15 @@ bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,
 		    rtnl_dereference(vxlan->vn6_sock) != sock6)
 			continue;
 #endif
-		if (vxlan->cfg.flags & VXLAN_F_VNIFILTER) {
-			if (!vxlan_group_used_by_vnifilter(vxlan, ip, ifindex))
+		cfg = rtnl_dereference(vxlan->cfg);
+
+		if (cfg->flags & VXLAN_F_VNIFILTER) {
+			if (!vxlan_group_used_by_vnifilter(vxlan, cfg, ip, ifindex))
 				continue;
 		} else {
 			if (!vxlan_group_used_match(ip, ifindex,
-						    &vxlan->default_dst.remote_ip,
-						    vxlan->default_dst.remote_ifindex))
+						    &cfg->remote_ip,
+						    cfg->remote_ifindex))
 				continue;
 		}
 
@@ -174,7 +183,8 @@ bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,
 	return false;
 }
 
-static int vxlan_multicast_join_vnigrp(struct vxlan_dev *vxlan)
+static int vxlan_multicast_join_vnigrp(struct vxlan_dev *vxlan,
+				       const struct vxlan_config *cfg)
 {
 	struct vxlan_vni_group *vg = rtnl_dereference(vxlan->vnigrp);
 	struct vxlan_vni_node *v, *tmp, *vgood = NULL;
@@ -185,7 +195,7 @@ static int vxlan_multicast_join_vnigrp(struct vxlan_dev *vxlan)
 			continue;
 		/* skip if address is same as default address */
 		if (vxlan_addr_equal(&v->remote_ip,
-				     &vxlan->default_dst.remote_ip))
+				     &cfg->remote_ip))
 			continue;
 		ret = vxlan_igmp_join(vxlan, &v->remote_ip, 0);
 		if (ret == -EADDRINUSE)
@@ -200,7 +210,7 @@ static int vxlan_multicast_join_vnigrp(struct vxlan_dev *vxlan)
 			if (!vxlan_addr_multicast(&v->remote_ip))
 				continue;
 			if (vxlan_addr_equal(&v->remote_ip,
-					     &vxlan->default_dst.remote_ip))
+					     &cfg->remote_ip))
 				continue;
 			vxlan_igmp_leave(vxlan, &v->remote_ip, 0);
 			if (v == vgood)
@@ -233,37 +243,39 @@ static int vxlan_multicast_leave_vnigrp(struct vxlan_dev *vxlan)
 
 int vxlan_multicast_join(struct vxlan_dev *vxlan)
 {
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
 	int ret = 0;
 
-	if (vxlan_addr_multicast(&vxlan->default_dst.remote_ip)) {
-		ret = vxlan_igmp_join(vxlan, &vxlan->default_dst.remote_ip,
-				      vxlan->default_dst.remote_ifindex);
+	if (vxlan_addr_multicast(&cfg->remote_ip)) {
+		ret = vxlan_igmp_join(vxlan, &cfg->remote_ip,
+				      cfg->remote_ifindex);
 		if (ret == -EADDRINUSE)
 			ret = 0;
 		if (ret)
 			return ret;
 	}
 
-	if (vxlan->cfg.flags & VXLAN_F_VNIFILTER)
-		return vxlan_multicast_join_vnigrp(vxlan);
+	if (cfg->flags & VXLAN_F_VNIFILTER)
+		return vxlan_multicast_join_vnigrp(vxlan, cfg);
 
 	return 0;
 }
 
 int vxlan_multicast_leave(struct vxlan_dev *vxlan)
 {
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
 	struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id);
 	int ret = 0;
 
-	if (vxlan_addr_multicast(&vxlan->default_dst.remote_ip) &&
+	if (vxlan_addr_multicast(&cfg->remote_ip) &&
 	    !vxlan_group_used(vn, vxlan, 0, NULL, 0)) {
-		ret = vxlan_igmp_leave(vxlan, &vxlan->default_dst.remote_ip,
-				       vxlan->default_dst.remote_ifindex);
+		ret = vxlan_igmp_leave(vxlan, &cfg->remote_ip,
+				       cfg->remote_ifindex);
 		if (ret)
 			return ret;
 	}
 
-	if (vxlan->cfg.flags & VXLAN_F_VNIFILTER)
+	if (cfg->flags & VXLAN_F_VNIFILTER)
 		return vxlan_multicast_leave_vnigrp(vxlan);
 
 	return 0;
diff --git a/drivers/net/vxlan/vxlan_private.h b/drivers/net/vxlan/vxlan_private.h
index b1eec22163608..92d656fc1c751 100644
--- a/drivers/net/vxlan/vxlan_private.h
+++ b/drivers/net/vxlan/vxlan_private.h
@@ -22,6 +22,8 @@ struct vxlan_net {
 	/* sock_list is protected by rtnl lock */
 	struct hlist_head sock_list[PORT_HASH_SIZE];
 	struct notifier_block nexthop_notifier_block;
+	/* Generation counter for RTM_GETTUNNEL dumps */
+	atomic_t vnifilter_seq;
 };
 
 struct vxlan_fdb_key {
@@ -177,6 +179,13 @@ vxlan_vnifilter_lookup(struct vxlan_dev *vxlan, __be32 vni)
 				      vxlan_vni_rht_params);
 }
 
+static inline void vxlan_vnifilter_seq_inc(const struct net *net)
+{
+	struct vxlan_net *vn = net_generic(net, vxlan_net_id);
+
+	atomic_inc(&vn->vnifilter_seq);
+}
+
 /* vxlan_core.c */
 int vxlan_fdb_create(struct vxlan_dev *vxlan,
 		     const u8 *mac, union vxlan_addr *ip,
@@ -195,9 +204,10 @@ int vxlan_fdb_update(struct vxlan_dev *vxlan,
 		     __u32 ifindex, __u16 ndm_flags, u32 nhid,
 		     bool swdev_notify, struct netlink_ext_ack *extack);
 void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
+		    const struct vxlan_config *cfg,
 		    __be32 default_vni, struct vxlan_rdst *rdst, bool did_rsc);
 int vxlan_vni_in_use(struct net *src_net, struct vxlan_dev *vxlan,
-		     struct vxlan_config *conf, __be32 vni);
+		     const struct vxlan_config *conf, __be32 vni);
 
 /* vxlan_vnifilter.c */
 int vxlan_vnigroup_init(struct vxlan_dev *vxlan);
@@ -205,7 +215,8 @@ void vxlan_vnigroup_uninit(struct vxlan_dev *vxlan);
 
 int vxlan_vnifilter_init(void);
 void vxlan_vnifilter_uninit(void);
-void vxlan_vnifilter_count(struct vxlan_dev *vxlan, __be32 vni,
+void vxlan_vnifilter_count(struct vxlan_dev *vxlan,
+			   const struct vxlan_config *cfg, __be32 vni,
 			   struct vxlan_vni_node *vninode,
 			   int type, unsigned int len);
 
@@ -214,8 +225,9 @@ void vxlan_vs_add_vnigrp(struct vxlan_dev *vxlan,
 			 bool ipv6);
 void vxlan_vs_del_vnigrp(struct vxlan_dev *vxlan);
 int vxlan_vnilist_update_group(struct vxlan_dev *vxlan,
-			       union vxlan_addr *old_remote_ip,
-			       union vxlan_addr *new_remote_ip,
+			       const union vxlan_addr *old_remote_ip,
+			       const union vxlan_addr *new_remote_ip,
+			       u32 old_ifindex, u32 new_ifindex,
 			       struct netlink_ext_ack *extack);
 
 
@@ -223,10 +235,10 @@ int vxlan_vnilist_update_group(struct vxlan_dev *vxlan,
 int vxlan_multicast_join(struct vxlan_dev *vxlan);
 int vxlan_multicast_leave(struct vxlan_dev *vxlan);
 bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,
-		      __be32 vni, union vxlan_addr *rip, int rifindex);
-int vxlan_igmp_join(struct vxlan_dev *vxlan, union vxlan_addr *rip,
+		      __be32 vni, const union vxlan_addr *rip, int rifindex);
+int vxlan_igmp_join(struct vxlan_dev *vxlan, const union vxlan_addr *rip,
 		    int rifindex);
-int vxlan_igmp_leave(struct vxlan_dev *vxlan, union vxlan_addr *rip,
+int vxlan_igmp_leave(struct vxlan_dev *vxlan, const union vxlan_addr *rip,
 		     int rifindex);
 
 /* vxlan_mdb.c */
@@ -241,9 +253,11 @@ int vxlan_mdb_del_bulk(struct net_device *dev, struct nlattr *tb[],
 int vxlan_mdb_get(struct net_device *dev, struct nlattr *tb[], u32 portid,
 		  u32 seq, struct netlink_ext_ack *extack);
 struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan,
+						const struct vxlan_config *cfg,
 						struct sk_buff *skb,
 						__be32 src_vni);
 netdev_tx_t vxlan_mdb_xmit(struct vxlan_dev *vxlan,
+			   const struct vxlan_config *cfg,
 			   const struct vxlan_mdb_entry *mdb_entry,
 			   struct sk_buff *skb);
 int vxlan_mdb_init(struct vxlan_dev *vxlan);
diff --git a/drivers/net/vxlan/vxlan_vnifilter.c b/drivers/net/vxlan/vxlan_vnifilter.c
index dd94085e08865..543eaf420f4c2 100644
--- a/drivers/net/vxlan/vxlan_vnifilter.c
+++ b/drivers/net/vxlan/vxlan_vnifilter.c
@@ -171,13 +171,14 @@ static void vxlan_vnifilter_stats_add(struct vxlan_vni_node *vninode,
 	u64_stats_update_end(&pstats->syncp);
 }
 
-void vxlan_vnifilter_count(struct vxlan_dev *vxlan, __be32 vni,
+void vxlan_vnifilter_count(struct vxlan_dev *vxlan,
+			   const struct vxlan_config *cfg, __be32 vni,
 			   struct vxlan_vni_node *vninode,
 			   int type, unsigned int len)
 {
 	struct vxlan_vni_node *vnode;
 
-	if (!(vxlan->cfg.flags & VXLAN_F_VNIFILTER))
+	if (!(cfg->flags & VXLAN_F_VNIFILTER))
 		return;
 
 	if (vninode) {
@@ -333,22 +334,36 @@ static int vxlan_vnifilter_dump_dev(const struct net_device *dev,
 				    struct sk_buff *skb,
 				    struct netlink_callback *cb)
 {
-	struct vxlan_vni_node *tmp, *v, *vbegin = NULL, *vend = NULL;
+	struct vxlan_vni_node *v, *vbegin = NULL, *vend = NULL;
 	struct vxlan_dev *vxlan = netdev_priv(dev);
 	struct tunnel_msg *new_tmsg, *tmsg;
-	int idx = 0, s_idx = cb->args[1];
+	const struct vxlan_config *cfg;
 	struct vxlan_vni_group *vg;
 	struct nlmsghdr *nlh;
+	int idx = 0, s_idx;
 	bool dump_stats;
 	int err = 0;
 
-	if (!(vxlan->cfg.flags & VXLAN_F_VNIFILTER))
+	if (cb->args[2] != dev->ifindex) {
+		cb->args[1] = 0;
+		cb->args[2] = dev->ifindex;
+	}
+	s_idx = cb->args[1];
+
+	cfg = rcu_dereference(vxlan->cfg);
+	if (!(cfg->flags & VXLAN_F_VNIFILTER)) {
+		cb->args[1] = 0;
+		cb->args[2] = 0;
 		return -EINVAL;
+	}
 
 	/* RCU needed because of the vni locking rules (rcu || rtnl) */
 	vg = rcu_dereference(vxlan->vnigrp);
-	if (!vg || !vg->num_vnis)
+	if (!vg || !vg->num_vnis) {
+		cb->args[1] = 0;
+		cb->args[2] = 0;
 		return 0;
+	}
 
 	tmsg = nlmsg_data(cb->nlh);
 	dump_stats = !!(tmsg->flags & TUNNEL_MSG_FLAG_STATS);
@@ -362,7 +377,7 @@ static int vxlan_vnifilter_dump_dev(const struct net_device *dev,
 	new_tmsg->family = PF_BRIDGE;
 	new_tmsg->ifindex = dev->ifindex;
 
-	list_for_each_entry_safe(v, tmp, &vg->vni_list, vlist) {
+	list_for_each_entry_rcu(v, &vg->vni_list, vlist) {
 		if (idx < s_idx) {
 			idx++;
 			continue;
@@ -394,12 +409,26 @@ static int vxlan_vnifilter_dump_dev(const struct net_device *dev,
 	}
 
 	cb->args[1] = err ? idx : 0;
+	cb->args[2] = err ? dev->ifindex : 0;
 
 	nlmsg_end(skb, nlh);
 
+	nl_dump_check_consistent(cb, nlh);
+
 	return err;
 }
 
+static u32 vxlan_vnifilter_base_seq(const struct net *net)
+{
+	const struct vxlan_net *vn = net_generic(net, vxlan_net_id);
+	u32 res = atomic_read(&vn->vnifilter_seq);
+
+	/* Must not return 0 (see nl_dump_check_consistent()) */
+	if (!res)
+		res = 0x80000000;
+	return res;
+}
+
 static int vxlan_vnifilter_dump(struct sk_buff *skb, struct netlink_callback *cb)
 {
 	int idx = 0, err = 0, s_idx = cb->args[0];
@@ -419,6 +448,9 @@ static int vxlan_vnifilter_dump(struct sk_buff *skb, struct netlink_callback *cb
 	}
 
 	rcu_read_lock();
+
+	cb->seq = vxlan_vnifilter_base_seq(net);
+
 	if (tmsg->ifindex) {
 		dev = dev_get_by_index_rcu(net, tmsg->ifindex);
 		if (!dev) {
@@ -471,23 +503,31 @@ static const struct nla_policy vni_filter_policy[VXLAN_VNIFILTER_MAX + 1] = {
 };
 
 static int vxlan_update_default_fdb_entry(struct vxlan_dev *vxlan, __be32 vni,
-					  union vxlan_addr *old_remote_ip,
-					  union vxlan_addr *remote_ip,
+					  const union vxlan_addr *old_remote_ip,
+					  const union vxlan_addr *remote_ip,
+					  u32 old_ifindex, u32 new_ifindex,
 					  struct netlink_ext_ack *extack)
 {
-	struct vxlan_rdst *dst = &vxlan->default_dst;
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
 	int err = 0;
 
+	if (old_remote_ip && remote_ip &&
+	    vxlan_addr_equal(old_remote_ip, remote_ip) &&
+	    old_ifindex == new_ifindex)
+		return 0;
+
 	spin_lock_bh(&vxlan->hash_lock);
 	if (remote_ip && !vxlan_addr_any(remote_ip)) {
+		union vxlan_addr rip = *remote_ip;
+
 		err = vxlan_fdb_update(vxlan, all_zeros_mac,
-				       remote_ip,
+				       &rip,
 				       NUD_REACHABLE | NUD_PERMANENT,
 				       NLM_F_APPEND | NLM_F_CREATE,
-				       vxlan->cfg.dst_port,
+				       cfg->dst_port,
 				       vni,
 				       vni,
-				       dst->remote_ifindex,
+				       new_ifindex,
 				       NTF_SELF, 0, true, extack);
 		if (err) {
 			spin_unlock_bh(&vxlan->hash_lock);
@@ -498,9 +538,9 @@ static int vxlan_update_default_fdb_entry(struct vxlan_dev *vxlan, __be32 vni,
 	if (old_remote_ip && !vxlan_addr_any(old_remote_ip)) {
 		__vxlan_fdb_delete(vxlan, all_zeros_mac,
 				   *old_remote_ip,
-				   vxlan->cfg.dst_port,
+				   cfg->dst_port,
 				   vni, vni,
-				   dst->remote_ifindex,
+				   old_ifindex,
 				   true);
 	}
 	spin_unlock_bh(&vxlan->hash_lock);
@@ -515,8 +555,8 @@ static int vxlan_vni_update_group(struct vxlan_dev *vxlan,
 				  struct netlink_ext_ack *extack)
 {
 	struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id);
-	struct vxlan_rdst *dst = &vxlan->default_dst;
-	union vxlan_addr *newrip = NULL, *oldrip = NULL;
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
+	const union vxlan_addr *newrip = NULL, *oldrip = NULL;
 	union vxlan_addr old_remote_ip;
 	int ret = 0;
 
@@ -528,8 +568,8 @@ static int vxlan_vni_update_group(struct vxlan_dev *vxlan,
 	if (group && !vxlan_addr_any(group)) {
 		newrip = group;
 	} else {
-		if (!vxlan_addr_any(&dst->remote_ip))
-			newrip = &dst->remote_ip;
+		if (!vxlan_addr_any(&cfg->remote_ip))
+			newrip = &cfg->remote_ip;
 	}
 
 	/* if old rip exists, and no newrip,
@@ -546,6 +586,8 @@ static int vxlan_vni_update_group(struct vxlan_dev *vxlan,
 
 	ret = vxlan_update_default_fdb_entry(vxlan, vninode->vni,
 					     oldrip, newrip,
+					     cfg->remote_ifindex,
+					     cfg->remote_ifindex,
 					     extack);
 	if (ret)
 		goto out;
@@ -557,7 +599,7 @@ static int vxlan_vni_update_group(struct vxlan_dev *vxlan,
 		if (vxlan_addr_multicast(&old_remote_ip) &&
 		    !vxlan_group_used(vn, vxlan, vninode->vni,
 				      &old_remote_ip,
-				      vxlan->default_dst.remote_ifindex)) {
+				      cfg->remote_ifindex)) {
 			ret = vxlan_igmp_leave(vxlan, &old_remote_ip,
 					       0);
 			if (ret)
@@ -581,10 +623,12 @@ static int vxlan_vni_update_group(struct vxlan_dev *vxlan,
 }
 
 int vxlan_vnilist_update_group(struct vxlan_dev *vxlan,
-			       union vxlan_addr *old_remote_ip,
-			       union vxlan_addr *new_remote_ip,
+			       const union vxlan_addr *old_remote_ip,
+			       const union vxlan_addr *new_remote_ip,
+			       u32 old_ifindex, u32 new_ifindex,
 			       struct netlink_ext_ack *extack)
 {
+	const union vxlan_addr *oldrip, *newrip;
 	struct list_head *headp, *hpos;
 	struct vxlan_vni_group *vg;
 	struct vxlan_vni_node *vent;
@@ -595,14 +639,24 @@ int vxlan_vnilist_update_group(struct vxlan_dev *vxlan,
 	headp = &vg->vni_list;
 	list_for_each_prev(hpos, headp) {
 		vent = list_entry(hpos, struct vxlan_vni_node, vlist);
+
 		if (vxlan_addr_any(&vent->remote_ip)) {
-			ret = vxlan_update_default_fdb_entry(vxlan, vent->vni,
-							     old_remote_ip,
-							     new_remote_ip,
-							     extack);
-			if (ret)
-				return ret;
+			oldrip = old_remote_ip;
+			newrip = new_remote_ip;
+		} else {
+			/* A vni with its own group keeps it, but its fdb entry
+			 * is still keyed on the device remote_ifindex.
+			 */
+			oldrip = &vent->remote_ip;
+			newrip = &vent->remote_ip;
 		}
+
+		ret = vxlan_update_default_fdb_entry(vxlan, vent->vni,
+						     oldrip, newrip,
+						     old_ifindex, new_ifindex,
+						     extack);
+		if (ret)
+			return ret;
 	}
 
 	return 0;
@@ -612,20 +666,20 @@ static void vxlan_vni_delete_group(struct vxlan_dev *vxlan,
 				   struct vxlan_vni_node *vninode)
 {
 	struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id);
-	struct vxlan_rdst *dst = &vxlan->default_dst;
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
 
 	/* if per vni remote_ip not present, delete the
 	 * default dst remote_ip previously added for this vni
 	 */
 	if (!vxlan_addr_any(&vninode->remote_ip) ||
-	    !vxlan_addr_any(&dst->remote_ip)) {
+	    !vxlan_addr_any(&cfg->remote_ip)) {
 		spin_lock_bh(&vxlan->hash_lock);
 		__vxlan_fdb_delete(vxlan, all_zeros_mac,
 				   (vxlan_addr_any(&vninode->remote_ip) ?
-				   dst->remote_ip : vninode->remote_ip),
-				   vxlan->cfg.dst_port,
+				   cfg->remote_ip : vninode->remote_ip),
+				   cfg->dst_port,
 				   vninode->vni, vninode->vni,
-				   dst->remote_ifindex,
+				   cfg->remote_ifindex,
 				   true);
 		spin_unlock_bh(&vxlan->hash_lock);
 	}
@@ -634,7 +688,7 @@ static void vxlan_vni_delete_group(struct vxlan_dev *vxlan,
 		if (vxlan_addr_multicast(&vninode->remote_ip) &&
 		    !vxlan_group_used(vn, vxlan, vninode->vni,
 				      &vninode->remote_ip,
-				      dst->remote_ifindex)) {
+				      cfg->remote_ifindex)) {
 			vxlan_igmp_leave(vxlan, &vninode->remote_ip, 0);
 		}
 	}
@@ -659,13 +713,16 @@ static int vxlan_vni_update(struct vxlan_dev *vxlan,
 	if (ret)
 		return ret;
 
-	if (*changed)
+	if (*changed) {
+		vxlan_vnifilter_seq_inc(dev_net(vxlan->dev));
 		vxlan_vnifilter_notify(vxlan, vninode, RTM_NEWTUNNEL);
+	}
 
 	return 0;
 }
 
-static void __vxlan_vni_add_list(struct vxlan_vni_group *vg,
+static void __vxlan_vni_add_list(struct vxlan_dev *vxlan,
+				 struct vxlan_vni_group *vg,
 				 struct vxlan_vni_node *v)
 {
 	struct list_head *headp, *hpos;
@@ -681,13 +738,16 @@ static void __vxlan_vni_add_list(struct vxlan_vni_group *vg,
 	}
 	list_add_rcu(&v->vlist, hpos);
 	vg->num_vnis++;
+	vxlan_vnifilter_seq_inc(dev_net(vxlan->dev));
 }
 
-static void __vxlan_vni_del_list(struct vxlan_vni_group *vg,
+static void __vxlan_vni_del_list(struct vxlan_dev *vxlan,
+				 struct vxlan_vni_group *vg,
 				 struct vxlan_vni_node *v)
 {
 	list_del_rcu(&v->vlist);
 	vg->num_vnis--;
+	vxlan_vnifilter_seq_inc(dev_net(vxlan->dev));
 }
 
 static struct vxlan_vni_node *vxlan_vni_alloc(struct vxlan_dev *vxlan,
@@ -723,6 +783,7 @@ static int vxlan_vni_add(struct vxlan_dev *vxlan,
 			 u32 vni, union vxlan_addr *group,
 			 struct netlink_ext_ack *extack)
 {
+	const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);
 	struct vxlan_vni_node *vninode;
 	__be32 v = cpu_to_be32(vni);
 	bool changed = false;
@@ -731,7 +792,7 @@ static int vxlan_vni_add(struct vxlan_dev *vxlan,
 	if (vxlan_vnifilter_lookup(vxlan, v))
 		return vxlan_vni_update(vxlan, vg, v, group, &changed, extack);
 
-	err = vxlan_vni_in_use(vxlan->net, vxlan, &vxlan->cfg, v);
+	err = vxlan_vni_in_use(vxlan->net, vxlan, cfg, v);
 	if (err) {
 		NL_SET_ERR_MSG(extack, "VNI in use");
 		return err;
@@ -749,7 +810,7 @@ static int vxlan_vni_add(struct vxlan_dev *vxlan,
 		return err;
 	}
 
-	__vxlan_vni_add_list(vg, vninode);
+	__vxlan_vni_add_list(vxlan, vg, vninode);
 
 	if (vxlan->dev->flags & IFF_UP)
 		vxlan_vs_add_del_vninode(vxlan, vninode, false);
@@ -795,7 +856,7 @@ static int vxlan_vni_del(struct vxlan_dev *vxlan,
 	if (err)
 		goto out;
 
-	__vxlan_vni_del_list(vg, vninode);
+	__vxlan_vni_del_list(vxlan, vg, vninode);
 
 	vxlan_vnifilter_notify(vxlan, vninode, RTM_DELTUNNEL);
 
@@ -844,6 +905,7 @@ static int vxlan_process_vni_filter(struct vxlan_dev *vxlan,
 				    int cmd, struct netlink_ext_ack *extack)
 {
 	struct nlattr *vattrs[VXLAN_VNIFILTER_ENTRY_MAX + 1];
+	const struct vxlan_config *cfg;
 	u32 vni_start = 0, vni_end = 0;
 	union vxlan_addr group;
 	int err;
@@ -881,7 +943,8 @@ static int vxlan_process_vni_filter(struct vxlan_dev *vxlan,
 		memset(&group, 0, sizeof(group));
 	}
 
-	if (vxlan_addr_multicast(&group) && !vxlan->default_dst.remote_ifindex) {
+	cfg = rtnl_dereference(vxlan->cfg);
+	if (vxlan_addr_multicast(&group) && !cfg->remote_ifindex) {
 		NL_SET_ERR_MSG(extack,
 			       "Local interface required for multicast remote group");
 
@@ -909,7 +972,7 @@ void vxlan_vnigroup_uninit(struct vxlan_dev *vxlan)
 #if IS_ENABLED(CONFIG_IPV6)
 		hlist_del_init_rcu(&v->hlist6.hlist);
 #endif
-		__vxlan_vni_del_list(vg, v);
+		__vxlan_vni_del_list(vxlan, vg, v);
 		vxlan_vnifilter_notify(vxlan, v, RTM_DELTUNNEL);
 		call_rcu(&v->rcu, vxlan_vni_node_rcu_free);
 	}
@@ -940,6 +1003,7 @@ static int vxlan_vnifilter_process(struct sk_buff *skb, struct nlmsghdr *nlh,
 				   struct netlink_ext_ack *extack)
 {
 	struct net *net = sock_net(skb->sk);
+	const struct vxlan_config *cfg;
 	struct tunnel_msg *tmsg;
 	struct vxlan_dev *vxlan;
 	struct net_device *dev;
@@ -964,8 +1028,9 @@ static int vxlan_vnifilter_process(struct sk_buff *skb, struct nlmsghdr *nlh,
 	}
 
 	vxlan = netdev_priv(dev);
+	cfg = rtnl_dereference(vxlan->cfg);
 
-	if (!(vxlan->cfg.flags & VXLAN_F_VNIFILTER))
+	if (!(cfg->flags & VXLAN_F_VNIFILTER))
 		return -EOPNOTSUPP;
 
 	nlmsg_for_each_attr_type(attr, VXLAN_VNIFILTER_ENTRY, nlh,
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index 7b82075055237..c3c9f2ccc3d1b 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -204,7 +204,6 @@ struct vxlan_rdst {
 	u8			 offloaded:1;
 	__be32			 remote_vni;
 	u32			 remote_ifindex;
-	struct net_device	 *remote_dev;
 	struct list_head	 list;
 	struct rcu_head		 rcu;
 	struct dst_cache	 dst_cache;
@@ -229,6 +228,7 @@ struct vxlan_config {
 	bool				no_share;
 	enum ifla_vxlan_df		df;
 	struct vxlanhdr			reserved_bits;
+	struct rcu_head			rcu;
 };
 
 enum {
@@ -294,14 +294,15 @@ struct vxlan_dev {
 #endif
 	struct net_device *dev;
 	struct net	  *net;		/* netns for packet i/o */
-	struct vxlan_rdst default_dst;	/* default destination */
+	struct net_device *lowerdev;
 
 	struct timer_list age_timer;
 	spinlock_t	  hash_lock;
 	unsigned int	  addrcnt;
 	struct gro_cells  gro_cells;
+	unsigned long	  flags;
 
-	struct vxlan_config	cfg;
+	struct vxlan_config __rcu	*cfg;
 
 	struct vxlan_vni_group  __rcu *vnigrp;
 
@@ -313,6 +314,10 @@ struct vxlan_dev {
 	unsigned int mdb_seq;
 };
 
+enum vxlan_dev_flags {
+	VXLAN_DEV_F_MDB,
+};
+
 #define VXLAN_F_LEARN			0x01
 #define VXLAN_F_PROXY			0x02
 #define VXLAN_F_RSC			0x04
@@ -331,7 +336,6 @@ struct vxlan_dev {
 #define VXLAN_F_IPV6_LINKLOCAL		0x8000
 #define VXLAN_F_TTL_INHERIT		0x10000
 #define VXLAN_F_VNIFILTER               0x20000
-#define VXLAN_F_MDB			0x40000
 #define VXLAN_F_LOCALBYPASS		0x80000
 #define VXLAN_F_MC_ROUTE		0x100000
 

15/3 2026/09/17 06:37 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 47741
							output: 25
							thoughts: 1192
						

Thoughts:
**KMSAN Evaluation: Uninitialized Memory Risk Assessment**

Okay, the task is clear: evaluate this patch for potential uninitialized memory usage, specifically to decide if a KMSAN fuzzing session is warranted. Let's dig in.

First glance at the changes: the structure `vxlan_dev` is getting a makeover. `default_dst` is gone, `cfg` is now a `__rcu` pointer, `cfg.flags` is being replaced with a dedicated `flags` field, and `default_dst.remote_dev` is now `vxlan->lowerdev`.  The code is being updated to use RCU for accessing `vxlan->cfg`, which is the key.

So, how is `vxlan->cfg` allocated and freed?  I'm seeing `kmemdup` used in both `vxlan_dev_configure` and `vxlan_changelink` to create `new_cfg`. `conf` is used as source parameter in `kmemdup`. Looking at `vxlan_nl2conf`, `conf` is zeroed out before use. In `vxlan_free_dev`, we have `rcu_dereference` to get the config and `kfree` to free it.  `vxlan_config_apply` uses `rcu_assign_pointer` to make the update and `kfree_rcu` to free the old config. This seems generally safe from a memory management perspective.

However, hold on... let's check the code path in `mlxsw/spectrum_switchdev.c`, specifically those `mlxsw_sp_bridge_vlan_aware_vxlan_join` and `mlxsw_sp_bridge_8021d_vxlan_join` functions.

AHA! I've spotted something. The original version initializes `params` inline. The new patch defines `struct mlxsw_sp_nve_params params;` without initialization. This looks like a classic uninitialized memory problem! The fields are assigned individual values via `cfg = rtnl_dereference(vxlan->cfg);`.

I need to confirm the use of `params` elsewhere but I think this is enough to trigger a KMSAN fuzzing session. The `params` struct is now potentially being used with garbage data. Time to investigate what's in `struct mlxsw_sp_nve_params` and how it's used to confirm this.



16/3 2026/09/17 06:37 tool grepper
0m Args:
{
  "Expression": "struct mlxsw_sp_nve_params"
}

Results:
{
  "Output": "drivers/net/ethernet/mellanox/mlxsw/spectrum.h=1352=extern const struct mlxsw_sp_mr_tcam_ops mlxsw_sp2_mr_tcam_ops;\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum.h-1354-/* spectrum_nve.c */\ndrivers/net/ethernet/mellanox/mlxsw/spectrum.h:1355:struct mlxsw_sp_nve_params {\ndrivers/net/ethernet/mellanox/mlxsw/spectrum.h-1356-\tenum mlxsw_sp_nve_type type;\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum.h=1387=int mlxsw_sp_nve_fid_enable(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_fid *fid,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum.h:1388:\t\t\t    struct mlxsw_sp_nve_params *params,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum.h-1389-\t\t\t    struct netlink_ext_ack *extack);\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c=935=int mlxsw_sp_nve_fid_enable(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_fid *fid,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c:936:\t\t\t    struct mlxsw_sp_nve_params *params,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c-937-\t\t\t    struct netlink_ext_ack *extack)\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve.h=36=struct mlxsw_sp_nve_ops {\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve.h-38-\tbool (*can_offload)(const struct mlxsw_sp_nve *nve,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve.h:39:\t\t\t    const struct mlxsw_sp_nve_params *params,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve.h-40-\t\t\t    struct netlink_ext_ack *extack);\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve.h-41-\tvoid (*nve_config)(const struct mlxsw_sp_nve *nve,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve.h:42:\t\t\t   const struct mlxsw_sp_nve_params *params,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve.h-43-\t\t\t   struct mlxsw_sp_nve_config *config);\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c=58=static bool mlxsw_sp_nve_vxlan_can_offload(const struct mlxsw_sp_nve *nve,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c:59:\t\t\t\t\t   const struct mlxsw_sp_nve_params *params,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c-60-\t\t\t\t\t   struct netlink_ext_ack *extack)\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c=127=static bool mlxsw_sp1_nve_vxlan_can_offload(const struct mlxsw_sp_nve *nve,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c:128:\t\t\t\t\t    const struct mlxsw_sp_nve_params *params,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c-129-\t\t\t\t\t    struct netlink_ext_ack *extack)\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c=155=static void mlxsw_sp_nve_vxlan_config(const struct mlxsw_sp_nve *nve,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c:156:\t\t\t\t      const struct mlxsw_sp_nve_params *params,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c-157-\t\t\t\t      struct mlxsw_sp_nve_config *config)\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=2509=mlxsw_sp_bridge_vlan_aware_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-2515-\tstruct vxlan_dev *vxlan = netdev_priv(vxlan_dev);\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:2516:\tstruct mlxsw_sp_nve_params params;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-2517-\tconst struct vxlan_config *cfg;\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=2703=mlxsw_sp_bridge_8021d_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-2708-\tstruct vxlan_dev *vxlan = netdev_priv(vxlan_dev);\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:2709:\tstruct mlxsw_sp_nve_params params;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-2710-\tconst struct vxlan_config *cfg;\n"
}

17/3 2026/09/17 06:37 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 51068
							output: 46
							thoughts: 20
						

Thoughts:
Here's my thought process, as requested:

**Deconstructing `mlxsw_sp_nve_params`**

Okay, so I need to get a handle on `struct mlxsw_sp_nve_params`. My first instinct is always to go back to the source and *really* nail down the definition. I need to understand this structure inside and out before I can reason about its role in the greater scheme. What does it actually *contain*? What fields are there, and what do they represent in the context of the MLXSW switch platform? What are the types, what potential ranges and limitations am I dealing with? I'm thinking about the implications of each member – bandwidth restrictions, addressing, encapsulation, everything. Need to make sure I don't miss any subtleties. Gotta be thorough. Time to crack open the documentation and the headers.



18/3 2026/09/17 06:37 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/mellanox/mlxsw/spectrum.h",
  "FirstLine": 1354,
  "LineCount": 20
}

Results:
{
  "Contents": "1354:\t/* spectrum_nve.c */\n1355:\tstruct mlxsw_sp_nve_params {\n1356:\t\tenum mlxsw_sp_nve_type type;\n1357:\t\t__be32 vni;\n1358:\t\tconst struct net_device *dev;\n1359:\t\tu16 ethertype;\n1360:\t};\n1361:\t\n1362:\textern const struct mlxsw_sp_nve_ops *mlxsw_sp1_nve_ops_arr[];\n1363:\textern const struct mlxsw_sp_nve_ops *mlxsw_sp2_nve_ops_arr[];\n1364:\t\n1365:\tint mlxsw_sp_nve_learned_ip_resolve(struct mlxsw_sp *mlxsw_sp, u32 uip,\n1366:\t\t\t\t\t    enum mlxsw_sp_l3proto proto,\n1367:\t\t\t\t\t    union mlxsw_sp_l3addr *addr);\n1368:\tint mlxsw_sp_nve_flood_ip_add(struct mlxsw_sp *mlxsw_sp,\n1369:\t\t\t\t      struct mlxsw_sp_fid *fid,\n1370:\t\t\t\t      enum mlxsw_sp_l3proto proto,\n1371:\t\t\t\t      union mlxsw_sp_l3addr *addr);\n1372:\tvoid mlxsw_sp_nve_flood_ip_del(struct mlxsw_sp *mlxsw_sp,\n1373:\t\t\t\t       struct mlxsw_sp_fid *fid,\n"
}

19/3 2026/09/17 06:37 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 51746
							output: 39
							thoughts: 250
						

Thoughts:
**My Initial Assessment of the NVE Parameters**

Okay, so I'm looking at this `struct mlxsw_sp_nve_params`. I see it has `type`, `vni`, `dev`, and `ethertype` fields. Good, straightforward. And in `mlxsw_sp_bridge_vlan_aware_vxlan_join`, it *looks* like all four are initialized before being used. That's a relief; proper initialization is critical.

But, hang on a second... what about padding? I need to verify how these fields are actually laid out in memory. Let me see... `type` is an enum, so 4 bytes. `vni` is a `__be32`, also 4 bytes. `dev` is a pointer to `net_device`, so 8 bytes. And `ethertype` is a `u16`, just 2 bytes. That leaves 6 bytes of padding at the end of the structure. I always need to be aware of padding – it can cause issues if not handled properly.

The key question is: Is this `params` struct ever copied anywhere, either to userspace or to the hardware? I *need* to be sure that the padding is taken into account and handled correctly. I should double check all usages of the `params` struct. I have to make sure that no unintended memory copies can corrupt important data or cause alignment issues. Time to investigate further and track down every instance where this struct is used.



20/3 2026/09/17 06:37 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "params",
  "PathPrefix": "drivers/net/ethernet/mellanox/mlxsw/spectrum_nve"
}

Results:
{
  "error": "no matches"
}

21/3 2026/09/17 06:37 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 52367
							output: 45
							thoughts: 26
						

Thoughts:
Here's my take on the thought process, as if it were my own:

**Diving into the Mellanox NVE Code**

Okay, time to get my hands dirty. Let's start by digging into `drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c`. I need to understand how the Spectrum switch handles Network Virtualization Edge (NVE) functionality. This file is probably the core of the implementation. I'm expecting to find the key data structures and functions related to tunnel setup, packet encapsulation/decapsulation, and potentially, some of the policy enforcement mechanisms specific to this platform. I'll be looking for clues on how they're handling things like VXLAN, NVGRE, or potentially something even more custom. My initial focus will be on identifying the major control flow paths – the entry points for packet processing and any interrupt handlers that might be involved. I'm also hoping to see how this integrates with the broader Mellanox driver architecture; I'll need to understand the interfaces used for offloading and hardware-accelerated operations. Knowing this is the first step toward getting my head around this particular subsystem.



22/3 2026/09/17 06:37 tool grepper
0m Args:
{
  "Expression": "mlxsw_sp_nve_fid_enable",
  "PathPrefix": "drivers/net/ethernet/mellanox/mlxsw/"
}

Results:
{
  "Output": "drivers/net/ethernet/mellanox/mlxsw/spectrum.h=1385=void mlxsw_sp_nve_ipv6_addr_map_del(struct mlxsw_sp *mlxsw_sp, const char *mac,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum.h-1386-\t\t\t\t    u16 fid_index);\ndrivers/net/ethernet/mellanox/mlxsw/spectrum.h:1387:int mlxsw_sp_nve_fid_enable(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_fid *fid,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum.h-1388-\t\t\t    struct mlxsw_sp_nve_params *params,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c=919=static void mlxsw_sp_nve_ipv6_addr_flush_by_fid(struct mlxsw_sp *mlxsw_sp,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c-934-\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c:935:int mlxsw_sp_nve_fid_enable(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_fid *fid,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c-936-\t\t\t    struct mlxsw_sp_nve_params *params,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=2509=mlxsw_sp_bridge_vlan_aware_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-2548-\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:2549:\terr = mlxsw_sp_nve_fid_enable(mlxsw_sp, fid, \u0026params, extack);\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-2550-\tif (err)\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=2703=mlxsw_sp_bridge_8021d_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-2731-\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:2732:\terr = mlxsw_sp_nve_fid_enable(mlxsw_sp, fid, \u0026params, extack);\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-2733-\tif (err)\n"
}

23/3 2026/09/17 06:37 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 53442
							output: 48
							thoughts: 40
						

Thoughts:
Here's my summary, as if I were thinking these thoughts:

**Diving into the Mellanox NVE FID Enable Function**

Okay, time to get my hands dirty. I need to understand how this NVE FID feature is being enabled within the Mellanox driver. Specifically, I'm going to jump into the `drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c` file and zero in on the `mlxsw_sp_nve_fid_enable` function. I already know the architecture pretty well, but I need to understand how this specific feature has been integrated. I anticipate this will reveal key aspects of the FID configuration process. Hopefully, it is well-commented and easy to follow. Knowing Mellanox, I’m also going to keep an eye out for any potential optimizations or, dare I say, complexities in their implementation. This is going to give me the information I need. Let's see what we've got.



24/3 2026/09/17 06:37 tool read-file
0m Args:
{
  "File": "drivers/net/ethernet/mellanox/mlxsw/spectrum_nve.c",
  "FirstLine": 935,
  "LineCount": 40
}

Results:
{
  "Contents": " 935:\tint mlxsw_sp_nve_fid_enable(struct mlxsw_sp *mlxsw_sp, struct mlxsw_sp_fid *fid,\n 936:\t\t\t\t    struct mlxsw_sp_nve_params *params,\n 937:\t\t\t\t    struct netlink_ext_ack *extack)\n 938:\t{\n 939:\t\tstruct mlxsw_sp_nve *nve = mlxsw_sp-\u003enve;\n 940:\t\tconst struct mlxsw_sp_nve_ops *ops;\n 941:\t\tstruct mlxsw_sp_nve_config config;\n 942:\t\tint err;\n 943:\t\n 944:\t\tops = nve-\u003enve_ops_arr[params-\u003etype];\n 945:\t\n 946:\t\tif (!ops-\u003ecan_offload(nve, params, extack))\n 947:\t\t\treturn -EINVAL;\n 948:\t\n 949:\t\tmemset(\u0026config, 0, sizeof(config));\n 950:\t\tops-\u003enve_config(nve, params, \u0026config);\n 951:\t\tif (nve-\u003enum_nve_tunnels \u0026\u0026\n 952:\t\t    memcmp(\u0026config, \u0026nve-\u003econfig, sizeof(config))) {\n 953:\t\t\tNL_SET_ERR_MSG_MOD(extack, \"Conflicting NVE tunnels configuration\");\n 954:\t\t\treturn -EINVAL;\n 955:\t\t}\n 956:\t\n 957:\t\terr = mlxsw_sp_nve_tunnel_init(mlxsw_sp, \u0026config);\n 958:\t\tif (err) {\n 959:\t\t\tNL_SET_ERR_MSG_MOD(extack, \"Failed to initialize NVE tunnel\");\n 960:\t\t\treturn err;\n 961:\t\t}\n 962:\t\n 963:\t\terr = mlxsw_sp_fid_vni_set(fid, params-\u003etype, params-\u003evni,\n 964:\t\t\t\t\t   params-\u003edev-\u003eifindex);\n 965:\t\tif (err) {\n 966:\t\t\tNL_SET_ERR_MSG_MOD(extack, \"Failed to set VNI on FID\");\n 967:\t\t\tgoto err_fid_vni_set;\n 968:\t\t}\n 969:\t\n 970:\t\terr = ops-\u003efdb_replay(params-\u003edev, params-\u003evni, extack);\n 971:\t\tif (err)\n 972:\t\t\tgoto err_fdb_replay;\n 973:\t\n 974:\t\treturn 0;\n"
}

25/3 2026/09/17 06:37 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 54435
							output: 24
							thoughts: 564
						

Thoughts:
**Analyzing VXLAN Parameter Usage and Serialization**

Okay, let's break this down. My initial observation is focused on how the `params` struct is utilized. I'm seeing a consistent pattern of access: `params->type`, `params->dev` (used within functions like `can_offload` and `nve_config`), `params->vni`, `params->dev->ifindex`, and within fdb replay `params->dev`, `params->vni`. Notably, none of the padding within `params` appears to be read or copied.

Now, my attention is drawn to the serialization of data to userspace, specifically within the `vxlan_fill_info` function. Let's dig into `drivers/net/vxlan/vxlan_core.c` and take a look. I'm focusing on how VXLAN configuration data is passed out.

I've got `vxlan_fill_info` open, and I'm examining how it handles the `struct ifla_vxlan_port_range` structure. I see the code is trying to populate this structure with port range information. I'm noticing a change in the code from the previous version, where the `ports` struct was initialized directly, to the current state where it's populated field by field. I'm specifically looking at how `port_min` and `port_max` are handled in `struct ifla_vxlan_port_range ports;`

Wait a second...I need to double-check something. What's the definition of `struct ifla_vxlan_port_range`? I need to make sure I understand the complete structure before I can fully evaluate the potential implications of this code. Time to look up its definition!



26/3 2026/09/17 06:37 tool grepper
0m Args:
{
  "Expression": "struct ifla_vxlan_port_range"
}

Results:
{
  "Output": "drivers/net/vxlan/vxlan_core.c=3527=static const struct nla_policy vxlan_policy[IFLA_VXLAN_MAX + 1] = {\n--\ndrivers/net/vxlan/vxlan_core.c-3540-\t[IFLA_VXLAN_LIMIT]\t= { .type = NLA_U32 },\ndrivers/net/vxlan/vxlan_core.c:3541:\t[IFLA_VXLAN_PORT_RANGE] = { .len  = sizeof(struct ifla_vxlan_port_range) },\ndrivers/net/vxlan/vxlan_core.c-3542-\t[IFLA_VXLAN_PROXY]\t= { .type = NLA_U8 },\n--\ndrivers/net/vxlan/vxlan_core.c=3565=static int vxlan_validate(struct nlattr *tb[], struct nlattr *data[],\n--\ndrivers/net/vxlan/vxlan_core.c-3608-\tif (data[IFLA_VXLAN_PORT_RANGE]) {\ndrivers/net/vxlan/vxlan_core.c:3609:\t\tconst struct ifla_vxlan_port_range *p\ndrivers/net/vxlan/vxlan_core.c-3610-\t\t\t= nla_data(data[IFLA_VXLAN_PORT_RANGE]);\n--\ndrivers/net/vxlan/vxlan_core.c=4193=static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[],\n--\ndrivers/net/vxlan/vxlan_core.c-4359-\t\tif (!changelink) {\ndrivers/net/vxlan/vxlan_core.c:4360:\t\t\tconst struct ifla_vxlan_port_range *p\ndrivers/net/vxlan/vxlan_core.c-4361-\t\t\t\t= nla_data(data[IFLA_VXLAN_PORT_RANGE]);\n--\ndrivers/net/vxlan/vxlan_core.c=4686=static size_t vxlan_get_size(const struct net_device *dev)\n--\ndrivers/net/vxlan/vxlan_core.c-4713-\t\t/* IFLA_VXLAN_PORT_RANGE */\ndrivers/net/vxlan/vxlan_core.c:4714:\t\tnla_total_size(sizeof(struct ifla_vxlan_port_range)) +\ndrivers/net/vxlan/vxlan_core.c-4715-\t\tnla_total_size(0) + /* IFLA_VXLAN_GBP */\n--\ndrivers/net/vxlan/vxlan_core.c=4724=static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev)\n--\ndrivers/net/vxlan/vxlan_core.c-4726-\tconst struct vxlan_dev *vxlan = netdev_priv(dev);\ndrivers/net/vxlan/vxlan_core.c:4727:\tstruct ifla_vxlan_port_range ports;\ndrivers/net/vxlan/vxlan_core.c-4728-\tconst struct vxlan_config *cfg;\n--\ninclude/uapi/linux/if_link.h=1431=enum {\n--\ninclude/uapi/linux/if_link.h-1470-\ninclude/uapi/linux/if_link.h:1471:struct ifla_vxlan_port_range {\ninclude/uapi/linux/if_link.h-1472-\t__be16\tlow;\n--\ntools/include/uapi/linux/if_link.h=1365=enum {\n--\ntools/include/uapi/linux/if_link.h-1402-\ntools/include/uapi/linux/if_link.h:1403:struct ifla_vxlan_port_range {\ntools/include/uapi/linux/if_link.h-1404-\t__be16\tlow;\n"
}

27/3 2026/09/17 06:37 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 56409
							output: 41
							thoughts: 26
						

Thoughts:
Here's my attempt at summarizing the thought process, tailored for an expert audience:

**Diving into if_link.h for Link Layer Info**

Okay, so I'm trying to figure out something related to network interface configuration, and my gut feeling is that the relevant definitions and structures are probably in `include/uapi/linux/if_link.h`. I've been down this path a few times, so I'm pretty familiar with the general layout of the kernel headers. Based on past experience with this file, the core definitions for link attributes and operations are typically around the if_link family. Given the problem I'm trying to solve and what I recall, line 1471 is the prime location to start my investigation. It's likely that a structure or enum related to the feature or attribute is defined here and I am going to find what I am looking for in that spot. So let's head over there and take a look.



28/3 2026/09/17 06:38 tool read-file
0m Args:
{
  "File": "include/uapi/linux/if_link.h",
  "FirstLine": 1468,
  "LineCount": 12
}

Results:
{
  "Contents": "1468:\t};\n1469:\t#define IFLA_VXLAN_MAX\t(__IFLA_VXLAN_MAX - 1)\n1470:\t\n1471:\tstruct ifla_vxlan_port_range {\n1472:\t\t__be16\tlow;\n1473:\t\t__be16\thigh;\n1474:\t};\n1475:\t\n1476:\tenum ifla_vxlan_df {\n1477:\t\tVXLAN_DF_UNSET = 0,\n1478:\t\tVXLAN_DF_SET,\n1479:\t\tVXLAN_DF_INHERIT,\n"
}

29/3 2026/09/17 06:38 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 56863
							output: 33
							thoughts: 199
						

Thoughts:
**My Analysis of the VXLAN Port Range Structure**

Okay, so `struct ifla_vxlan_port_range` is pretty straightforward. It's a simple little structure: two 16-bit unsigned integers, `low` and `high`, totaling just 4 bytes. That's easy enough to manage. No unexpected padding to worry about, thankfully – everything's packed nice and tight. The code clearly assigns the values for `low` and `high` using `htons` to ensure proper byte order and then uses `nla_put` to place this structure into the Netlink message. So far, so good, this seems like a perfectly reasonable way to handle the port range configuration.

But hold on a second... just because it *looks* clean doesn't mean it *is* clean. I need to be absolutely sure about the context of this. Let me quickly jump over to `vxlan_dev_configure` and `vxlan_dev_create` – I need to track down exactly how the `conf` struct that contains `cfg` actually *gets* populated. Where does the port range configuration come from in the first place? Gotta trace back to its source to see if there's any potential for issues. Gotta keep the context in mind, and that means a deeper dive into the surrounding code.



30/3 2026/09/17 06:38 tool grepper
0m Args:
{
  "Expression": "vxlan_dev_configure",
  "PathPrefix": "drivers/net/vxlan/"
}

Results:
{
  "Output": "drivers/net/vxlan/vxlan_core.c=1675=static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)\n--\ndrivers/net/vxlan/vxlan_core.c-1780-\t/* Note that GBP and GPE can never be active together. This is\ndrivers/net/vxlan/vxlan_core.c:1781:\t * ensured in vxlan_dev_configure.\ndrivers/net/vxlan/vxlan_core.c-1782-\t */\n--\ndrivers/net/vxlan/vxlan_core.c=4015=static void vxlan_config_apply(struct net_device *dev,\n--\ndrivers/net/vxlan/vxlan_core.c-4069-\ndrivers/net/vxlan/vxlan_core.c:4070:static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,\ndrivers/net/vxlan/vxlan_core.c-4071-\t\t\t       struct vxlan_config *conf,\n--\ndrivers/net/vxlan/vxlan_core.c=4092=static int vxlan_dev_create(struct net *net, struct net_device *dev,\n--\ndrivers/net/vxlan/vxlan_core.c-4101-\ndrivers/net/vxlan/vxlan_core.c:4102:\terr = vxlan_dev_configure(net, dev, conf, extack);\ndrivers/net/vxlan/vxlan_core.c-4103-\tif (err)\n"
}

31/3 2026/09/17 06:38 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 57782
							output: 33
							thoughts: 23
						

Thoughts:
Okay, here's my attempt at summarizing those thoughts from a first-person, expert perspective, focusing on the implied investigation.

**Delving into VXLAN Device Creation and Configuration**

Right, let's get down to brass tacks. My initial thought process is pretty straightforward: I need to understand the control flow surrounding the creation and configuration of VXLAN devices. So, I need to know precisely which functions or modules are calling `vxlan_dev_create` and `vxlan_dev_configure`. This is where the real work begins because I need to trace and understand the interaction of different software components. Knowing who's calling these functions is the key to figuring out how the VXLAN infrastructure is being managed. Are we talking about user space applications making direct system calls, or is this happening within a kernel module? Are there multiple points of entry, or a more consolidated approach? From that understanding I can then infer details about the larger system.



32/3 2026/09/17 06:38 tool grepper
0m Args:
{
  "Expression": "vxlan_dev_create",
  "PathPrefix": "drivers/net/vxlan/"
}

Results:
{
  "Output": "drivers/net/vxlan/vxlan_core.c=4070=static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,\n--\ndrivers/net/vxlan/vxlan_core.c-4091-\ndrivers/net/vxlan/vxlan_core.c:4092:static int vxlan_dev_create(struct net *net, struct net_device *dev,\ndrivers/net/vxlan/vxlan_core.c-4093-\t\t\t    struct vxlan_config *conf,\n--\ndrivers/net/vxlan/vxlan_core.c=4537=static int vxlan_newlink(struct net_device *dev,\n--\ndrivers/net/vxlan/vxlan_core.c-4550-\ndrivers/net/vxlan/vxlan_core.c:4551:\treturn vxlan_dev_create(link_net, dev, \u0026conf, extack);\ndrivers/net/vxlan/vxlan_core.c-4552-}\n"
}

33/3 2026/09/17 06:38 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 58303
							output: 42
							thoughts: 20
						

Thoughts:
Here's my summary, as though I'm thinking through this process:

**Diving into VXLAN Configuration**

Okay, so I need to understand the initialization of the `conf` variable within the `vxlan_newlink` function. I know this code pretty well, so I'm going to jump right to that function. Let's start there. I'll need to remember to look at the surrounding code to figure out how `conf` is used after it's initialized. But first, let's see how it starts.



34/3 2026/09/17 06:38 tool read-file
0m Args:
{
  "File": "drivers/net/vxlan/vxlan_core.c",
  "FirstLine": 4535,
  "LineCount": 25
}

Results:
{
  "Contents": "4535:\t}\n4536:\t\n4537:\tstatic int vxlan_newlink(struct net_device *dev,\n4538:\t\t\t\t struct rtnl_newlink_params *params,\n4539:\t\t\t\t struct netlink_ext_ack *extack)\n4540:\t{\n4541:\t\tstruct net *link_net = rtnl_newlink_link_net(params);\n4542:\t\tstruct nlattr **data = params-\u003edata;\n4543:\t\tstruct nlattr **tb = params-\u003etb;\n4544:\t\tstruct vxlan_config conf;\n4545:\t\tint err;\n4546:\t\n4547:\t\terr = vxlan_nl2conf(tb, data, dev, \u0026conf, false, extack);\n4548:\t\tif (err)\n4549:\t\t\treturn err;\n4550:\t\n4551:\t\treturn vxlan_dev_create(link_net, dev, \u0026conf, extack);\n4552:\t}\n4553:\t\n4554:\tstatic int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],\n4555:\t\t\t\t    struct nlattr *data[],\n4556:\t\t\t\t    struct netlink_ext_ack *extack)\n4557:\t{\n4558:\t\tbool lowerdev_changed, rem_ip_changed, change_igmp;\n4559:\t\tstruct vxlan_dev *vxlan = netdev_priv(dev);\n"
}

35/3 2026/09/17 06:38 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 58882
							output: 20
							thoughts: 137
						

Thoughts:
**Initial Configuration State and Potential Pitfalls**

Okay, so `vxlan_nl2conf` begins by zeroing out the entire `conf` structure using `memset`. That's a standard initialization step, making sure everything starts clean. I understand why they do that; it's good practice to avoid garbage data and ensure a known starting point.

Now, here's where my expert eye hones in. When `kmemdup` is called to create a copy, either with `kmemdup(conf, sizeof(*conf), GFP_KERNEL);` or `kmemdup(&conf, sizeof(conf), GFP_KERNEL);`, it's copying from that zeroed `conf` structure. This initial zeroing can have both positive and negative effects depending on the code that later modifies the conf structure.

My concern is that if there are any other call sites, other than the ones defined within the `vxlan_core.c` file that calls `vxlan_dev_configure`, this zeroing out behavior might be creating a subtle problem somewhere else, especially in the context of network configuration where it is really important to maintain state. I need to make sure this is not an issue.

Therefore, it's time to check for additional callers of `vxlan_dev_configure`. Let's see if there are any other places where this function is used and if so, whether the context of those calls could influence this zeroing-out behavior. I need to know where all the interactions occur!



36/3 2026/09/17 06:38 tool grepper
0m Args:
{
  "Expression": "vxlan_dev_configure"
}

Results:
{
  "Output": "drivers/net/vxlan/vxlan_core.c=1675=static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)\n--\ndrivers/net/vxlan/vxlan_core.c-1780-\t/* Note that GBP and GPE can never be active together. This is\ndrivers/net/vxlan/vxlan_core.c:1781:\t * ensured in vxlan_dev_configure.\ndrivers/net/vxlan/vxlan_core.c-1782-\t */\n--\ndrivers/net/vxlan/vxlan_core.c=4015=static void vxlan_config_apply(struct net_device *dev,\n--\ndrivers/net/vxlan/vxlan_core.c-4069-\ndrivers/net/vxlan/vxlan_core.c:4070:static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,\ndrivers/net/vxlan/vxlan_core.c-4071-\t\t\t       struct vxlan_config *conf,\n--\ndrivers/net/vxlan/vxlan_core.c=4092=static int vxlan_dev_create(struct net *net, struct net_device *dev,\n--\ndrivers/net/vxlan/vxlan_core.c-4101-\ndrivers/net/vxlan/vxlan_core.c:4102:\terr = vxlan_dev_configure(net, dev, conf, extack);\ndrivers/net/vxlan/vxlan_core.c-4103-\tif (err)\n"
}

37/3 2026/09/17 06:38 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 59761
							output: 42
							thoughts: 1911
						

Thoughts:
**Analyzing VXLAN Configuration and Data Structures**

Okay, let's break this down. My initial focus was on the relationships between `vxlan_dev_create`, `vxlan_dev_configure`, and `vxlan_newlink`. I see that `vxlan_dev_configure` is only called by `vxlan_dev_create`, which itself is only called by `vxlan_newlink`. That's a clean initial picture.

Then, the code pointed me to `mlx5e_tc_tun_get_remote_ifindex`. I quickly check how `cfg` is accessed there. The function uses `rcu_read_lock` and `rcu_dereference`, which is safe. It initialized `ifindex = 0` and this value is safely returned if the configuration is not available.

Next, I jumped to `vxlan_fdb_info`. Here, `rcu_dereference_rtnl` is used. This requires careful consideration regarding when `vxlan->cfg` could be NULL. I realize from `vxlan_setup` and `vxlan_dev_create`, that `vxlan->cfg` is initialized to NULL and becomes non-NULL only after `vxlan_dev_configure` is called. It will only be NULL again during `vxlan_free_dev`, so while the device is registered, the configuration should always be valid.

Moving on, I need to understand `vxlan_update_default_fdb_entry`.  The most important line is `const struct vxlan_config *cfg = rtnl_dereference(vxlan->cfg);`. I'll keep this in mind as I inspect the code. I am curious about the `remote_ip`. Why copy the `remote_ip` value using `rip = *remote_ip;`. It's only copied to make it a non-const pointer, required by `vxlan_fdb_update`. The `remote_ip` parameter comes from fully initialized structures, such as `cfg->remote_ip`, `conf.remote_ip` or `vent->remote_ip`.

Now, let's explore `vxlan_vnifilter_dump_dev` and `vxlan_vnifilter_dump`. I need to understand how the `cb->args` in `netlink_callback` are initialized. Thankfully, the netlink core zeroes these arguments when starting the dump.

Finally, I got curious about `vxlan_xmit_one` and the use of the `key` variable. Let's trace how the `key` variable is initialized and used.



38/3 2026/09/17 06:38 tool read-file
0m Args:
{
  "File": "drivers/net/vxlan/vxlan_core.c",
  "FirstLine": 2420,
  "LineCount": 80
}

Results:
{
  "Contents": "2420:\t\tint addr_family;\n2421:\t\tbool use_cache;\n2422:\t\t__be32 vni = 0;\n2423:\t\t__u8 tos, ttl;\n2424:\t\tint ifindex;\n2425:\t\tint err = 0;\n2426:\t\tbool xnet;\n2427:\t\n2428:\t\tvxlan = netdev_priv(dev);\n2429:\t\txnet = !net_eq(vxlan-\u003enet, dev_net(vxlan-\u003edev));\n2430:\t\tmd = \u0026_md;\n2431:\t\n2432:\t\tno_eth_encap = flags \u0026 VXLAN_F_GPE \u0026\u0026 skb-\u003eprotocol != htons(ETH_P_TEB);\n2433:\t\treason = skb_vlan_inet_prepare(skb, no_eth_encap);\n2434:\t\tif (reason)\n2435:\t\t\tgoto drop;\n2436:\t\n2437:\t\treason = SKB_DROP_REASON_NOT_SPECIFIED;\n2438:\t\told_iph = ip_hdr(skb);\n2439:\t\n2440:\t\tinfo = skb_tunnel_info(skb);\n2441:\t\tuse_cache = ip_tunnel_dst_cache_usable(skb, info);\n2442:\t\n2443:\t\tif (rdst) {\n2444:\t\t\tmemset(\u0026key, 0, sizeof(key));\n2445:\t\t\tpkey = \u0026key;\n2446:\t\n2447:\t\t\tif (vxlan_addr_any(\u0026rdst-\u003eremote_ip)) {\n2448:\t\t\t\tif (did_rsc) {\n2449:\t\t\t\t\t/* short-circuited back to local bridge */\n2450:\t\t\t\t\tvxlan_encap_bypass(skb, vxlan, vxlan, cfg,\n2451:\t\t\t\t\t\t\t   default_vni, true);\n2452:\t\t\t\t\treturn;\n2453:\t\t\t\t}\n2454:\t\t\t\tgoto drop;\n2455:\t\t\t}\n2456:\t\n2457:\t\t\taddr_family = cfg-\u003esaddr.sa.sa_family;\n2458:\t\t\tdst_port = rdst-\u003eremote_port ? rdst-\u003eremote_port : cfg-\u003edst_port;\n2459:\t\t\tvni = (rdst-\u003eremote_vni) ? : default_vni;\n2460:\t\t\tifindex = rdst-\u003eremote_ifindex;\n2461:\t\n2462:\t\t\tif (addr_family == AF_INET) {\n2463:\t\t\t\tkey.u.ipv4.src = cfg-\u003esaddr.sin.sin_addr.s_addr;\n2464:\t\t\t\tkey.u.ipv4.dst = rdst-\u003eremote_ip.sin.sin_addr.s_addr;\n2465:\t\t\t} else {\n2466:\t\t\t\tkey.u.ipv6.src = cfg-\u003esaddr.sin6.sin6_addr;\n2467:\t\t\t\tkey.u.ipv6.dst = rdst-\u003eremote_ip.sin6.sin6_addr;\n2468:\t\t\t}\n2469:\t\n2470:\t\t\tdst_cache = \u0026rdst-\u003edst_cache;\n2471:\t\t\tmd-\u003egbp = skb-\u003emark;\n2472:\t\t\tif (flags \u0026 VXLAN_F_TTL_INHERIT) {\n2473:\t\t\t\tttl = ip_tunnel_get_ttl(old_iph, skb);\n2474:\t\t\t} else {\n2475:\t\t\t\tttl = cfg-\u003ettl;\n2476:\t\t\t\tif (!ttl \u0026\u0026 vxlan_addr_multicast(\u0026rdst-\u003eremote_ip))\n2477:\t\t\t\t\tttl = 1;\n2478:\t\t\t}\n2479:\t\t\ttos = cfg-\u003etos;\n2480:\t\t\tif (tos == 1)\n2481:\t\t\t\ttos = ip_tunnel_get_dsfield(old_iph, skb);\n2482:\t\t\tif (tos \u0026\u0026 !info)\n2483:\t\t\t\tuse_cache = false;\n2484:\t\n2485:\t\t\tif (addr_family == AF_INET)\n2486:\t\t\t\tudp_sum = !(flags \u0026 VXLAN_F_UDP_ZERO_CSUM_TX);\n2487:\t\t\telse\n2488:\t\t\t\tudp_sum = !(flags \u0026 VXLAN_F_UDP_ZERO_CSUM6_TX);\n2489:\t#if IS_ENABLED(CONFIG_IPV6)\n2490:\t\t\tswitch (cfg-\u003elabel_policy) {\n2491:\t\t\tcase VXLAN_LABEL_FIXED:\n2492:\t\t\t\tkey.label = cfg-\u003elabel;\n2493:\t\t\t\tbreak;\n2494:\t\t\tcase VXLAN_LABEL_INHERIT:\n2495:\t\t\t\tkey.label = ip_tunnel_get_flowlabel(old_iph, skb);\n2496:\t\t\t\tbreak;\n2497:\t\t\tdefault:\n2498:\t\t\t\tDEBUG_NET_WARN_ON_ONCE(1);\n2499:\t\t\t\tgoto drop;\n"
}

39/3 2026/09/17 06:38 llm kmsan-evaluator
1m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 63588
							output: 41
							thoughts: 858
						

Thoughts:
**Analyzing Potential Uninitialized Memory in VXLAN Code**

Okay, let's break this down. First, I was reviewing the code and focused on a specific area. I zeroed in on line 2444 with `memset(&key, 0, sizeof(key));` and its related conditional block. It's clear that the `key` variable is only used when `rdst` is not null and is *immediately* zeroed in that case. No changes there, it was already present. We can rule out the immediate surrounding code as a source of any uninitialized reads, which is the immediate focus.

Next, I looked at `vxlan_fdb_parse`. I see the introduction of `cfg`, a pointer to `vxlan->cfg`.  Importantly, the code now uses `cfg->remote_ip` instead of directly accessing `vxlan->default_dst.remote_ip`. It seems like this change would not introduce any uninitialized memory conditions. The code handles the `remote_ip` field in a safe way and this looks good.

I then moved to `vxlan_fdb_find_uc`. Within it, I found the call to `vxlan_find_mac_rcu`. `vxlan_find_mac_rcu` shows `key` is `memset` to zero at the beginning. Okay, that looks fine. This pattern is safe.

Then, I looked at the calling function `vxlan_find_mac`, which locks and calls `vxlan_find_mac_rcu` and unlocks. No issues identified here either.

I think I should check the function `vxlan_fdb_info` and the surrounding code, just to make sure I haven't missed anything. I'll need to look at it in `drivers/net/vxlan/vxlan_core.c`.



40/3 2026/09/17 06:39 tool read-file
0m Args:
{
  "File": "drivers/net/vxlan/vxlan_core.c",
  "FirstLine": 155,
  "LineCount": 85
}

Results:
{
  "Contents": " 155:\t}\n 156:\t\n 157:\t/* Fill in neighbour message in skbuff. */\n 158:\tstatic int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,\n 159:\t\t\t\t  const struct vxlan_fdb *fdb,\n 160:\t\t\t\t  u32 portid, u32 seq, int type, unsigned int flags,\n 161:\t\t\t\t  const struct vxlan_rdst *rdst)\n 162:\t{\n 163:\t\tconst struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan-\u003ecfg);\n 164:\t\tunsigned long now = jiffies;\n 165:\t\tstruct nda_cacheinfo ci;\n 166:\t\tbool send_ip, send_eth;\n 167:\t\tstruct nlmsghdr *nlh;\n 168:\t\tstruct nexthop *nh;\n 169:\t\tstruct ndmsg *ndm;\n 170:\t\tint nh_family;\n 171:\t\tu32 nh_id;\n 172:\t\n 173:\t\tnlh = nlmsg_put(skb, portid, seq, type, sizeof(*ndm), flags);\n 174:\t\tif (nlh == NULL)\n 175:\t\t\treturn -EMSGSIZE;\n 176:\t\n 177:\t\tndm = nlmsg_data(nlh);\n 178:\t\tmemset(ndm, 0, sizeof(*ndm));\n 179:\t\n 180:\t\tsend_eth = send_ip = true;\n 181:\t\n 182:\t\trcu_read_lock();\n 183:\t\tnh = rcu_dereference(fdb-\u003enh);\n 184:\t\tif (nh) {\n 185:\t\t\tnh_family = nexthop_get_family(nh);\n 186:\t\t\tnh_id = nh-\u003eid;\n 187:\t\t}\n 188:\t\trcu_read_unlock();\n 189:\t\n 190:\t\tif (type == RTM_GETNEIGH) {\n 191:\t\t\tif (rdst) {\n 192:\t\t\t\tsend_ip = !vxlan_addr_any(\u0026rdst-\u003eremote_ip);\n 193:\t\t\t\tndm-\u003endm_family = send_ip ? rdst-\u003eremote_ip.sa.sa_family : AF_INET;\n 194:\t\t\t} else if (nh) {\n 195:\t\t\t\tndm-\u003endm_family = nh_family;\n 196:\t\t\t}\n 197:\t\t\tsend_eth = !is_zero_ether_addr(fdb-\u003ekey.eth_addr);\n 198:\t\t} else\n 199:\t\t\tndm-\u003endm_family\t= AF_BRIDGE;\n 200:\t\tndm-\u003endm_state = fdb-\u003estate;\n 201:\t\tndm-\u003endm_ifindex = vxlan-\u003edev-\u003eifindex;\n 202:\t\tndm-\u003endm_flags = fdb-\u003eflags;\n 203:\t\tif (rdst \u0026\u0026 rdst-\u003eoffloaded)\n 204:\t\t\tndm-\u003endm_flags |= NTF_OFFLOADED;\n 205:\t\tndm-\u003endm_type = RTN_UNICAST;\n 206:\t\n 207:\t\tif (!net_eq(dev_net(vxlan-\u003edev), vxlan-\u003enet) \u0026\u0026\n 208:\t\t    nla_put_s32(skb, NDA_LINK_NETNSID,\n 209:\t\t\t\tpeernet2id(dev_net(vxlan-\u003edev), vxlan-\u003enet)))\n 210:\t\t\tgoto nla_put_failure;\n 211:\t\n 212:\t\tif (send_eth \u0026\u0026 nla_put(skb, NDA_LLADDR, ETH_ALEN, \u0026fdb-\u003ekey.eth_addr))\n 213:\t\t\tgoto nla_put_failure;\n 214:\t\tif (nh) {\n 215:\t\t\tif (nla_put_u32(skb, NDA_NH_ID, nh_id))\n 216:\t\t\t\tgoto nla_put_failure;\n 217:\t\t} else if (rdst) {\n 218:\t\t\tif (send_ip \u0026\u0026 vxlan_nla_put_addr(skb, NDA_DST,\n 219:\t\t\t\t\t\t\t  \u0026rdst-\u003eremote_ip))\n 220:\t\t\t\tgoto nla_put_failure;\n 221:\t\n 222:\t\t\tif (rdst-\u003eremote_port \u0026\u0026\n 223:\t\t\t    rdst-\u003eremote_port != cfg-\u003edst_port \u0026\u0026\n 224:\t\t\t    nla_put_be16(skb, NDA_PORT, rdst-\u003eremote_port))\n 225:\t\t\t\tgoto nla_put_failure;\n 226:\t\t\tif (rdst-\u003eremote_vni != cfg-\u003evni \u0026\u0026\n 227:\t\t\t    nla_put_u32(skb, NDA_VNI, be32_to_cpu(rdst-\u003eremote_vni)))\n 228:\t\t\t\tgoto nla_put_failure;\n 229:\t\t\tif (rdst-\u003eremote_ifindex \u0026\u0026\n 230:\t\t\t    nla_put_u32(skb, NDA_IFINDEX, rdst-\u003eremote_ifindex))\n 231:\t\t\t\tgoto nla_put_failure;\n 232:\t\t}\n 233:\t\n 234:\t\tif ((cfg-\u003eflags \u0026 VXLAN_F_COLLECT_METADATA) \u0026\u0026 fdb-\u003ekey.vni \u0026\u0026\n 235:\t\t    nla_put_u32(skb, NDA_SRC_VNI,\n 236:\t\t\t\tbe32_to_cpu(fdb-\u003ekey.vni)))\n 237:\t\t\tgoto nla_put_failure;\n 238:\t\n 239:\t\tci.ndm_used\t = jiffies_to_clock_t(now - READ_ONCE(fdb-\u003eused));\n"
}

41/3 2026/09/17 06:39 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 66445
							output: 44
							thoughts: 1087
						

Thoughts:
**Analyzing VXLAN VNIFilter Dump Function**

Okay, let's break down this code. I'm focusing on the `vxlan_vnifilter_dump_dev` function, specifically how it handles dumping VNI filter information. The first function `vxlan_mdb_entry_info_fill` was straightforward; it was just addressing inconsistencies in using the configuration.

In `vxlan_vnifilter_dump_dev`, the core logic resides within a `list_for_each_entry_rcu` loop, iterating through VNI nodes. It seems like the primary goal here is to construct netlink messages (`new_tmsg`, `nlh`) containing information about each VNI filter. I notice that the `netlink_callback` `cb` is used to maintain state between calls to the function, which is fairly standard.

I see that `new_tmsg` is populated with various VNI attributes within the loop. The `nlh` is built and the VNI's attributes and flags are added to a nested attribute section using `nla_nest_start` and `nla_nest_end`. The data's added to a nested attribute which seems appropriate.

The function handles the `TUNNEL_MSG_FLAG_STATS` flag, indicating whether statistics should be included in the dump. Crucially, the function seems to be designed to handle large VNI lists by resuming the dump from where it left off. The `cb->args[1]` and `cb->args[2]` variables appear to be used for this purpose. I am looking for the usage of these arguments and how state is maintained and restored.

The function returns the appropriate error code. Finally, the function seems to be checking if the dump is consistent. I need to make sure this is accurate. Overall, the function appears to be a well-structured and efficient mechanism for retrieving and transmitting VXLAN VNI filter data.



42/3 2026/09/17 06:39 tool read-file
0m Args:
{
  "File": "drivers/net/vxlan/vxlan_vnifilter.c",
  "FirstLine": 360,
  "LineCount": 45
}

Results:
{
  "Contents": " 360:\t\t/* RCU needed because of the vni locking rules (rcu || rtnl) */\n 361:\t\tvg = rcu_dereference(vxlan-\u003evnigrp);\n 362:\t\tif (!vg || !vg-\u003enum_vnis) {\n 363:\t\t\tcb-\u003eargs[1] = 0;\n 364:\t\t\tcb-\u003eargs[2] = 0;\n 365:\t\t\treturn 0;\n 366:\t\t}\n 367:\t\n 368:\t\ttmsg = nlmsg_data(cb-\u003enlh);\n 369:\t\tdump_stats = !!(tmsg-\u003eflags \u0026 TUNNEL_MSG_FLAG_STATS);\n 370:\t\n 371:\t\tnlh = nlmsg_put(skb, NETLINK_CB(cb-\u003eskb).portid, cb-\u003enlh-\u003enlmsg_seq,\n 372:\t\t\t\tRTM_NEWTUNNEL, sizeof(*new_tmsg), NLM_F_MULTI);\n 373:\t\tif (!nlh)\n 374:\t\t\treturn -EMSGSIZE;\n 375:\t\tnew_tmsg = nlmsg_data(nlh);\n 376:\t\tmemset(new_tmsg, 0, sizeof(*new_tmsg));\n 377:\t\tnew_tmsg-\u003efamily = PF_BRIDGE;\n 378:\t\tnew_tmsg-\u003eifindex = dev-\u003eifindex;\n 379:\t\n 380:\t\tlist_for_each_entry_rcu(v, \u0026vg-\u003evni_list, vlist) {\n 381:\t\t\tif (idx \u003c s_idx) {\n 382:\t\t\t\tidx++;\n 383:\t\t\t\tcontinue;\n 384:\t\t\t}\n 385:\t\t\tif (!vbegin) {\n 386:\t\t\t\tvbegin = v;\n 387:\t\t\t\tvend = v;\n 388:\t\t\t\tcontinue;\n 389:\t\t\t}\n 390:\t\t\tif (!dump_stats \u0026\u0026 vnirange(vend, v) == 1 \u0026\u0026\n 391:\t\t\t    vxlan_addr_equal(\u0026v-\u003eremote_ip, \u0026vend-\u003eremote_ip)) {\n 392:\t\t\t\tgoto update_end;\n 393:\t\t\t} else {\n 394:\t\t\t\tif (!vxlan_fill_vni_filter_entry(skb, vbegin, vend,\n 395:\t\t\t\t\t\t\t\t dump_stats)) {\n 396:\t\t\t\t\terr = -EMSGSIZE;\n 397:\t\t\t\t\tbreak;\n 398:\t\t\t\t}\n 399:\t\t\t\tidx += vnirange(vbegin, vend) + 1;\n 400:\t\t\t\tvbegin = v;\n 401:\t\t\t}\n 402:\tupdate_end:\n 403:\t\t\tvend = v;\n 404:\t\t}\n"
}

43/3 2026/09/17 06:39 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 68710
							output: 33
							thoughts: 230
						

Thoughts:
**Initial Thoughts on VXLAN VNI Filter Sequence**

Okay, so I've just zeroed out `new_tmsg` with `memset`, as expected. But a nagging thought is tickling the back of my mind. What about the sequence number related to the VXLAN VNI filter? I need to make sure I'm handling that correctly. Let's see... ah, right, there's `vxlan_vnifilter_base_seq()`. It retrieves the sequence number from a `struct vxlan_net` instance specific to the network namespace. Specifically `atomic_read(&vn->vnifilter_seq)`.

Aha, and the code explicitly addresses the potential issue of a zero return – it enforces a minimum value of `0x80000000` to prevent inconsistencies when dumping this data. Excellent. Now, where is this `atomic_t vnifilter_seq` defined? It's inside the `struct vxlan_net`. I need to refresh my memory on the lifecycle of a `struct vxlan_net` instance. When and how is that allocated? Let me go back and investigate the `vxlan_net_id` or `pernet_operations` to refresh my memory on that instantiation.



44/3 2026/09/17 06:40 tool grepper
0m Args:
{
  "Expression": "vxlan_net_ops",
  "PathPrefix": "drivers/net/vxlan/"
}

Results:
{
  "Output": "drivers/net/vxlan/vxlan_core.c=5095=static void __net_exit vxlan_exit_net(struct net *net)\n--\ndrivers/net/vxlan/vxlan_core.c-5103-\ndrivers/net/vxlan/vxlan_core.c:5104:static struct pernet_operations vxlan_net_ops = {\ndrivers/net/vxlan/vxlan_core.c-5105-\t.init = vxlan_init_net,\n--\ndrivers/net/vxlan/vxlan_core.c=5112=static int __init vxlan_init_module(void)\n--\ndrivers/net/vxlan/vxlan_core.c-5115-\ndrivers/net/vxlan/vxlan_core.c:5116:\trc = register_pernet_subsys(\u0026vxlan_net_ops);\ndrivers/net/vxlan/vxlan_core.c-5117-\tif (rc)\n--\ndrivers/net/vxlan/vxlan_core.c-5143-out2:\ndrivers/net/vxlan/vxlan_core.c:5144:\tunregister_pernet_subsys(\u0026vxlan_net_ops);\ndrivers/net/vxlan/vxlan_core.c-5145-out1:\n--\ndrivers/net/vxlan/vxlan_core.c=5150=static void __exit vxlan_cleanup_module(void)\n--\ndrivers/net/vxlan/vxlan_core.c-5155-\tunregister_netdevice_notifier(\u0026vxlan_notifier_block);\ndrivers/net/vxlan/vxlan_core.c:5156:\tunregister_pernet_subsys(\u0026vxlan_net_ops);\ndrivers/net/vxlan/vxlan_core.c-5157-\t/* rcu_barrier() is called by netns */\n"
}

45/3 2026/09/17 06:40 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 69725
							output: 33
							thoughts: 12
						

Thoughts:
Okay, here's my attempt at summarizing that thought process, tailored for an expert audience:

**Examining `vxlan_init_net`**

Right, let's dive into this. The initial thought, of course, is to scrutinize `vxlan_init_net`. I need to understand exactly how the VxLAN network is being brought up and configured at the network level. This function is the cornerstone, the starting point. I'm going to be looking for the standard initialization patterns here, but also any custom or platform-specific behaviors. Specifically, I'm thinking:

*   What resources are being allocated? Are we seeing any unexpected memory consumption or potential leaks during this phase?
*   How is the VxLAN interface being tied to the underlying network devices? Are we using standard networking stack calls, or something more specialized? I need to understand the interface bindings.
*   Are there any assumptions about the underlying network configuration here? Could this initialization be sensitive to specific routing setups or VLAN configurations? I need to rule out configuration dependencies.
*   How are the VxLAN parameters (VNI, multicast groups, etc.) being handled? Are there any potential conflicts or inconsistencies in how they are set and validated? I need to understand this parameters handling.
*   Is there any early error handling or sanity checking here? Are critical initializations being guarded against failures? I need to check the error handling.

The goal is to build a mental map of what `vxlan_init_net` is doing at a low level, so I can predict its behavior and how it will interact with the rest of the network stack. I anticipate this will be a quick check, but it's essential for any debugging or understanding of the network.



46/3 2026/09/17 06:41 tool grepper
0m Args:
{
  "Expression": "vxlan_init_net",
  "PathPrefix": "drivers/net/vxlan/"
}

Results:
{
  "Output": "drivers/net/vxlan/vxlan_core.c=5042=static int vxlan_nexthop_event(struct notifier_block *nb,\n--\ndrivers/net/vxlan/vxlan_core.c-5059-\ndrivers/net/vxlan/vxlan_core.c:5060:static __net_init int vxlan_init_net(struct net *net)\ndrivers/net/vxlan/vxlan_core.c-5061-{\n--\ndrivers/net/vxlan/vxlan_core.c=5104=static struct pernet_operations vxlan_net_ops = {\ndrivers/net/vxlan/vxlan_core.c:5105:\t.init = vxlan_init_net,\ndrivers/net/vxlan/vxlan_core.c-5106-\t.exit_rtnl = vxlan_exit_rtnl,\n"
}

47/3 2026/09/17 06:41 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 70365
							output: 42
							thoughts: 12
						

Thoughts:
Okay, let's dive into `vxlan_init_net`. I need to get a clear understanding of how VXLAN is initialized at the network namespace level. Given my expertise, I'm already anticipating certain aspects – I'll be looking for things like memory allocation for data structures, registration of netlink handlers if applicable, potentially some interface configuration, and, of course, the general hooking into the networking stack. I’ll expect to see initialization of any per-netns structures used to manage VXLAN tunnel endpoints. Are they allocating resources? Initializing locks for concurrent access? Setting up defaults? I want to see how they're handling errors and what assumptions are being made about the underlying network configuration. I also need to understand any dependencies this initialization has on other parts of the network stack. Specifically, I'm thinking about things like bridging or routing components. I’ll also be searching for any calls to `register_pernet_device` or similar functions, as that would be key to how the VXLAN subsystem integrates within a network namespace. This will tell me a lot about the VXLAN initialization process.



48/3 2026/09/17 06:41 tool read-file
0m Args:
{
  "File": "drivers/net/vxlan/vxlan_core.c",
  "FirstLine": 5060,
  "LineCount": 35
}

Results:
{
  "Contents": "5060:\tstatic __net_init int vxlan_init_net(struct net *net)\n5061:\t{\n5062:\t\tstruct vxlan_net *vn = net_generic(net, vxlan_net_id);\n5063:\t\tunsigned int h;\n5064:\t\n5065:\t\tINIT_LIST_HEAD(\u0026vn-\u003evxlan_list);\n5066:\t\tvn-\u003enexthop_notifier_block.notifier_call = vxlan_nexthop_event;\n5067:\t\n5068:\t\tfor (h = 0; h \u003c PORT_HASH_SIZE; ++h)\n5069:\t\t\tINIT_HLIST_HEAD(\u0026vn-\u003esock_list[h]);\n5070:\t\n5071:\t\treturn register_nexthop_notifier(net, \u0026vn-\u003enexthop_notifier_block,\n5072:\t\t\t\t\t\t NULL);\n5073:\t}\n5074:\t\n5075:\tstatic void __net_exit vxlan_destroy_tunnels(struct vxlan_net *vn,\n5076:\t\t\t\t\t\t     struct list_head *dev_to_kill)\n5077:\t{\n5078:\t\tstruct vxlan_dev *vxlan, *next;\n5079:\t\n5080:\t\tlist_for_each_entry_safe(vxlan, next, \u0026vn-\u003evxlan_list, next)\n5081:\t\t\tvxlan_dellink(vxlan-\u003edev, dev_to_kill);\n5082:\t}\n5083:\t\n5084:\tstatic void __net_exit vxlan_exit_rtnl(struct net *net,\n5085:\t\t\t\t\t       struct list_head *dev_to_kill)\n5086:\t{\n5087:\t\tstruct vxlan_net *vn = net_generic(net, vxlan_net_id);\n5088:\t\n5089:\t\tASSERT_RTNL_NET(net);\n5090:\t\n5091:\t\t__unregister_nexthop_notifier(net, \u0026vn-\u003enexthop_notifier_block);\n5092:\t\tvxlan_destroy_tunnels(vn, dev_to_kill);\n5093:\t}\n5094:\t\n"
}

49/3 2026/09/17 06:41 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 71237
							output: 35
							thoughts: 1328
						

Thoughts:
**Analyzing VXLAN Metadata Initialization and FDB Updates**

Okay, so I'm digging into this VXLAN code, specifically looking at how metadata is handled and where potential initialization issues could be lurking. First, I noticed that the Pernet memory, allocated via `net_generic`, is zero-initialized using `kzalloc`. This means the `vn->vnifilter_seq` is initialized to 0, which seems straightforward.

Then, my attention was immediately drawn to the `vxlan_metadata` struct and its usage in `vxlan_rcv` and `vxlan_xmit_one`. Initially, I saw a declaration `struct vxlan_metadata _md;` followed by `struct vxlan_metadata *md = &_md;`. However, the code was changed to declare the pointer `md` and the struct `_md` separately. More importantly, in `vxlan_rcv` within `vxlan_core.c`, there's conditional logic: If the `VXLAN_F_COLLECT_METADATA` flag is set, `md` gets assigned to `ip_tunnel_info_opts(&tun_dst->u.tun_info)`, which presumably contains some pre-existing metadata. If the flag isn't set, `md` is pointed to the stack-allocated `_md`, and then `memset` is used to zero it out, ensuring a clean slate. That's good, so the stack allocated md is always cleared before being used. The crucial part here is that when the metadata flag is not set the stack allocated metadata is zeroed, while the if statement does not clear the `tun_dst->u.tun_info` data.

Then, there's a call to `vxlan_parse_gbp_hdr` with the `md` pointer, meaning this metadata is always initialized before use.

Next, I shifted my focus to `vxlan_fdb_update`. I needed to understand the contexts in which this function is called. I found it's called in `vxlan_snoop`, `vxlan_dev_create`, `vxlan_changelink`, and `vxlan_update_default_fdb_entry`. In each of these cases, the code appears to be passing initialized structs and valid arguments to `vxlan_fdb_update`. So, from what I can see here, I see no concerns.



50/3 2026/09/17 06:41 tool grepper
0m Args:
{
  "Expression": "int vxlan_fdb_update",
  "PathPrefix": "drivers/net/vxlan/"
}

Results:
{
  "Output": "drivers/net/vxlan/vxlan_core.c=972=static void vxlan_dst_free(struct rcu_head *head)\n--\ndrivers/net/vxlan/vxlan_core.c-979-\ndrivers/net/vxlan/vxlan_core.c:980:static int vxlan_fdb_update_existing(struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_core.c-981-\t\t\t\t     union vxlan_addr *ip,\n--\ndrivers/net/vxlan/vxlan_core.c-1084-\ndrivers/net/vxlan/vxlan_core.c:1085:static int vxlan_fdb_update_create(struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_core.c-1086-\t\t\t\t   const u8 *mac, union vxlan_addr *ip,\n--\ndrivers/net/vxlan/vxlan_core.c-1120-/* Add new entry to forwarding table -- assumes lock held */\ndrivers/net/vxlan/vxlan_core.c:1121:int vxlan_fdb_update(struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_core.c-1122-\t\t     const u8 *mac, union vxlan_addr *ip,\n--\ndrivers/net/vxlan/vxlan_private.h=196=int __vxlan_fdb_delete(struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_private.h-199-\t\t       u32 ifindex, bool swdev_notify);\ndrivers/net/vxlan/vxlan_private.h:200:int vxlan_fdb_update(struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_private.h-201-\t\t     const u8 *mac, union vxlan_addr *ip,\n"
}

51/3 2026/09/17 06:41 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 73601
							output: 27
							thoughts: 540
						

Thoughts:
**My Assessment of VXLAN FDB Operations**

Okay, let's dive into these VXLAN FDB functions. I'm taking a look at `vxlan_fdb_create` and `vxlan_fdb_update_create` (though the latter isn't explicitly shown, the context suggests I'm considering it), specifically focusing on how they handle address limits and FDB entries. The `vxlan_fdb_create` function immediately grabs the configuration, and that `cfg->addrmax` check is the key. It's a simple, but crucial, safeguard to prevent the FDB from exploding if someone misconfigures the system or a malicious actor attempts an attack. I'm noting the check against `vxlan->addrcnt` – it indicates this function is responsible for incrementing the address count, which is as expected.

Now, let's pivot to `mlxsw_sp_fdb_vxlan_call_notifiers`. This function is interesting because it's responsible for informing other parts of the system about FDB changes. I see the `switchdev_notifier_vxlan_fdb_info` struct being used and immediately I'm thinking about the information being passed along. `mlxsw_sp_switchdev_addr_vxlan_convert` is called - I will need to check what is returned from that.

My primary concern here is initialization and completeness of `info`. It's a common area for subtle bugs to creep in. Let me review the struct's definition and ensure that every field I expect to be set *is* being set. Based on this snippet, fields like `remote_ip`, `remote_port`, `remote_vni`, and `eth_addr` *appear* to be populated, but I want to make sure I'm not missing anything. I need to confirm the assignment to `info.remote_ifindex` is correct. The assumption that the index is `0` might be okay *in this particular context*, but I want to verify if this has potential to mask a larger problem. Specifically, the definition should spell out the semantics of all of the parameters. I will need to review the callers and the callee. Is there a case where it should be something different? I also need to make sure the types are what I expect. Any inconsistencies there could lead to crashes or data corruption.



52/3 2026/09/17 06:41 tool grepper
0m Args:
{
  "Expression": "struct switchdev_notifier_vxlan_fdb_info"
}

Results:
{
  "Output": "drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=3030=static void mlxsw_sp_fdb_vxlan_call_notifiers(struct net_device *dev,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3035-{\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:3036:\tstruct switchdev_notifier_vxlan_fdb_info info;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3037-\tstruct vxlan_dev *vxlan = netdev_priv(dev);\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=3412=struct mlxsw_sp_switchdev_event_work {\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3416-\t\tstruct switchdev_notifier_fdb_info fdb_info;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:3417:\t\tstruct switchdev_notifier_vxlan_fdb_info vxlan_fdb_info;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3418-\t};\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=3424=mlxsw_sp_switchdev_bridge_vxlan_fdb_event(struct mlxsw_sp *mlxsw_sp,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3428-{\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:3429:\tstruct switchdev_notifier_vxlan_fdb_info vxlan_fdb_info;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3430-\tstruct switchdev_notifier_fdb_info *fdb_info;\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=3576=mlxsw_sp_switchdev_vxlan_fdb_add(struct mlxsw_sp *mlxsw_sp,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3579-{\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:3580:\tstruct switchdev_notifier_vxlan_fdb_info *vxlan_fdb_info;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3581-\tstruct mlxsw_sp_bridge_device *bridge_device;\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=3648=mlxsw_sp_switchdev_vxlan_fdb_del(struct mlxsw_sp *mlxsw_sp,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3651-{\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:3652:\tstruct switchdev_notifier_vxlan_fdb_info *vxlan_fdb_info;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3653-\tstruct mlxsw_sp_bridge_device *bridge_device;\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=3730=mlxsw_sp_switchdev_vxlan_work_prepare(struct mlxsw_sp_switchdev_event_work *\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3734-\tstruct vxlan_dev *vxlan = netdev_priv(switchdev_work-\u003edev);\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:3735:\tstruct switchdev_notifier_vxlan_fdb_info *vxlan_fdb_info;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3736-\tconst struct vxlan_config *cfg;\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3742-\tvxlan_fdb_info = container_of(info,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:3743:\t\t\t\t      struct switchdev_notifier_vxlan_fdb_info,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3744-\t\t\t\t      info);\n--\ndrivers/net/vxlan/vxlan_core.c=292=static void vxlan_fdb_switchdev_notifier_info(const struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_core.c-295-\t\t\t    struct netlink_ext_ack *extack,\ndrivers/net/vxlan/vxlan_core.c:296:\t\t\t    struct switchdev_notifier_vxlan_fdb_info *fdb_info)\ndrivers/net/vxlan/vxlan_core.c-297-{\n--\ndrivers/net/vxlan/vxlan_core.c=310=static int vxlan_fdb_switchdev_call_notifiers(struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_core.c-315-{\ndrivers/net/vxlan/vxlan_core.c:316:\tstruct switchdev_notifier_vxlan_fdb_info info;\ndrivers/net/vxlan/vxlan_core.c-317-\tenum switchdev_notifier_type notifier_type;\n--\ndrivers/net/vxlan/vxlan_core.c=449=int vxlan_fdb_find_uc(struct net_device *dev, const u8 *mac, __be32 vni,\ndrivers/net/vxlan/vxlan_core.c:450:\t\t      struct switchdev_notifier_vxlan_fdb_info *fdb_info)\ndrivers/net/vxlan/vxlan_core.c-451-{\n--\ndrivers/net/vxlan/vxlan_core.c=482=static int vxlan_fdb_notify_one(struct notifier_block *nb,\n--\ndrivers/net/vxlan/vxlan_core.c-487-{\ndrivers/net/vxlan/vxlan_core.c:488:\tstruct switchdev_notifier_vxlan_fdb_info fdb_info;\ndrivers/net/vxlan/vxlan_core.c-489-\tint rc;\n--\ndrivers/net/vxlan/vxlan_core.c=4907=vxlan_fdb_offloaded_set(struct net_device *dev,\ndrivers/net/vxlan/vxlan_core.c:4908:\t\t\tstruct switchdev_notifier_vxlan_fdb_info *fdb_info)\ndrivers/net/vxlan/vxlan_core.c-4909-{\n--\ndrivers/net/vxlan/vxlan_core.c=4934=vxlan_fdb_external_learn_add(struct net_device *dev,\ndrivers/net/vxlan/vxlan_core.c:4935:\t\t\t     struct switchdev_notifier_vxlan_fdb_info *fdb_info)\ndrivers/net/vxlan/vxlan_core.c-4936-{\n--\ndrivers/net/vxlan/vxlan_core.c=4959=vxlan_fdb_external_learn_del(struct net_device *dev,\ndrivers/net/vxlan/vxlan_core.c:4960:\t\t\t     struct switchdev_notifier_vxlan_fdb_info *fdb_info)\ndrivers/net/vxlan/vxlan_core.c-4961-{\n--\ndrivers/net/vxlan/vxlan_core.c=4985=static int vxlan_switchdev_event(struct notifier_block *unused,\n--\ndrivers/net/vxlan/vxlan_core.c-4988-\tstruct net_device *dev = switchdev_notifier_info_to_dev(ptr);\ndrivers/net/vxlan/vxlan_core.c:4989:\tstruct switchdev_notifier_vxlan_fdb_info *fdb_info;\ndrivers/net/vxlan/vxlan_core.c-4990-\tint err = 0;\n--\ninclude/net/vxlan.h=488=static inline bool netif_is_vxlan(const struct net_device *dev)\n--\ninclude/net/vxlan.h-493-\ninclude/net/vxlan.h:494:struct switchdev_notifier_vxlan_fdb_info {\ninclude/net/vxlan.h-495-\tstruct switchdev_notifier_info info; /* must be first */\n--\ninclude/net/vxlan.h=507=int vxlan_fdb_find_uc(struct net_device *dev, const u8 *mac, __be32 vni,\ninclude/net/vxlan.h:508:\t\t      struct switchdev_notifier_vxlan_fdb_info *fdb_info);\ninclude/net/vxlan.h-509-int vxlan_fdb_replay(const struct net_device *dev, __be32 vni,\n--\ninclude/net/vxlan.h=516=vxlan_fdb_find_uc(struct net_device *dev, const u8 *mac, __be32 vni,\ninclude/net/vxlan.h:517:\t\t  struct switchdev_notifier_vxlan_fdb_info *fdb_info)\ninclude/net/vxlan.h-518-{\n"
}

53/3 2026/09/17 06:41 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 77152
							output: 41
							thoughts: 415
						

Thoughts:
**Analyzing the VXLAN Configuration Changes**

Okay, let's break this down. In `mlxsw_sp_fdb_vxlan_call_notifiers`, I see that the `struct switchdev_notifier_vxlan_fdb_info info;` was already defined. The patch, as far as I can see, is just modifying how `info.remote_port` is being populated. It looks like it's shifting from directly accessing `vxlan->cfg.dst_port` to using `cfg->dst_port`. Pretty straightforward so far, nothing alarming.

Now, let's examine `mlxsw_sp_switchdev_vxlan_work_prepare`. Ah, here's the core of the change. It appears we're switching from a direct pointer to the vxlan config (`struct vxlan_config *cfg = &vxlan->cfg;`) to using `rcu_dereference_rtnl(vxlan->cfg)` to get a constant pointer (`const struct vxlan_config *cfg;`). So, pointer access is being replaced, but not an unusual pattern. We are clearly making sure that we are operating in a proper RTNL-safe manner, which is good.

Finally, to be thorough, I should look at `vxlan_fdb_switchdev_notifier_info` to make sure the patch didn't introduce any subtle regressions. I'll read through that function to ensure it isn't directly interacting with `vxlan->cfg` in a way that might be affected by these changes, or that the patch itself modified in an unexpected manner. Time to go dig in `drivers/net/vxlan/vxlan_core.c` and see what's going on there.



54/3 2026/09/17 06:41 tool read-file
0m Args:
{
  "File": "drivers/net/vxlan/vxlan_core.c",
  "FirstLine": 290,
  "LineCount": 35
}

Results:
{
  "Contents": " 290:\t}\n 291:\t\n 292:\tstatic void vxlan_fdb_switchdev_notifier_info(const struct vxlan_dev *vxlan,\n 293:\t\t\t\t    const struct vxlan_fdb *fdb,\n 294:\t\t\t\t    const struct vxlan_rdst *rd,\n 295:\t\t\t\t    struct netlink_ext_ack *extack,\n 296:\t\t\t\t    struct switchdev_notifier_vxlan_fdb_info *fdb_info)\n 297:\t{\n 298:\t\tfdb_info-\u003einfo.dev = vxlan-\u003edev;\n 299:\t\tfdb_info-\u003einfo.extack = extack;\n 300:\t\tfdb_info-\u003eremote_ip = rd-\u003eremote_ip;\n 301:\t\tfdb_info-\u003eremote_port = rd-\u003eremote_port;\n 302:\t\tfdb_info-\u003eremote_vni = rd-\u003eremote_vni;\n 303:\t\tfdb_info-\u003eremote_ifindex = rd-\u003eremote_ifindex;\n 304:\t\tmemcpy(fdb_info-\u003eeth_addr, fdb-\u003ekey.eth_addr, ETH_ALEN);\n 305:\t\tfdb_info-\u003evni = fdb-\u003ekey.vni;\n 306:\t\tfdb_info-\u003eoffloaded = rd-\u003eoffloaded;\n 307:\t\tfdb_info-\u003eadded_by_user = fdb-\u003eflags \u0026 NTF_VXLAN_ADDED_BY_USER;\n 308:\t}\n 309:\t\n 310:\tstatic int vxlan_fdb_switchdev_call_notifiers(struct vxlan_dev *vxlan,\n 311:\t\t\t\t\t\t      struct vxlan_fdb *fdb,\n 312:\t\t\t\t\t\t      struct vxlan_rdst *rd,\n 313:\t\t\t\t\t\t      bool adding,\n 314:\t\t\t\t\t\t      struct netlink_ext_ack *extack)\n 315:\t{\n 316:\t\tstruct switchdev_notifier_vxlan_fdb_info info;\n 317:\t\tenum switchdev_notifier_type notifier_type;\n 318:\t\tint ret;\n 319:\t\n 320:\t\tif (WARN_ON(!rd))\n 321:\t\t\treturn 0;\n 322:\t\n 323:\t\tnotifier_type = adding ? SWITCHDEV_VXLAN_FDB_ADD_TO_DEVICE\n 324:\t\t\t\t       : SWITCHDEV_VXLAN_FDB_DEL_TO_DEVICE;\n"
}

55/3 2026/09/17 06:41 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 78632
							output: 19
							thoughts: 54
						

Thoughts:
**Investigating `struct vxlan_config` Usage**

Okay, so I need to get a handle on how `struct vxlan_config` is being utilized throughout this codebase. My initial thought is to comprehensively examine its initializations and allocations. It's crucial to understand where these structures are created and populated, because that helps to inform me how it's being managed, modified, and eventually freed. That in turn, will give me context to any issues the user has.

Therefore, the most direct approach is a full code search. I'll execute a search for the literal string `struct vxlan_config` across the entire codebase. This should pinpoint all the locations where the struct is defined, declared, initialized, or allocated. The results of this search will provide the foundation for a more detailed analysis, allowing me to trace its usage patterns and dependencies.



56/3 2026/09/17 06:41 tool grepper
0m Args:
{
  "Expression": "struct vxlan_config"
}

Results:
{
  "Output": "drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c=241=static int mlx5e_tc_tun_get_remote_ifindex(struct net_device *mirred_dev)\n--\ndrivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c-243-\tconst struct vxlan_dev *vxlan = netdev_priv(mirred_dev);\ndrivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c:244:\tconst struct vxlan_config *cfg;\ndrivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_vxlan.c-245-\tint ifindex = 0;\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c-20-\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c:21:static bool mlxsw_sp_nve_vxlan_ipv4_flags_check(const struct vxlan_config *cfg,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c-22-\t\t\t\t\t\tstruct netlink_ext_ack *extack)\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c-36-\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c:37:static bool mlxsw_sp_nve_vxlan_ipv6_flags_check(const struct vxlan_config *cfg,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c-38-\t\t\t\t\t\tstruct netlink_ext_ack *extack)\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c=58=static bool mlxsw_sp_nve_vxlan_can_offload(const struct mlxsw_sp_nve *nve,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c-61-{\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c:62:\tconst struct vxlan_config *cfg;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c-63-\tstruct vxlan_dev *vxlan;\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c=139=static void\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c:140:mlxsw_sp_nve_vxlan_ul_proto_sip_config(const struct vxlan_config *cfg,\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c-141-\t\t\t\t       struct mlxsw_sp_nve_config *config)\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c=155=static void mlxsw_sp_nve_vxlan_config(const struct mlxsw_sp_nve *nve,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c-158-{\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c:159:\tconst struct vxlan_config *cfg;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_nve_vxlan.c-160-\tstruct vxlan_dev *vxlan;\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=2509=mlxsw_sp_bridge_vlan_aware_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-2516-\tstruct mlxsw_sp_nve_params params;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:2517:\tconst struct vxlan_config *cfg;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-2518-\tstruct mlxsw_sp_fid *fid;\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=2703=mlxsw_sp_bridge_8021d_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-2709-\tstruct mlxsw_sp_nve_params params;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:2710:\tconst struct vxlan_config *cfg;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-2711-\tstruct mlxsw_sp_fid *fid;\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=2936=static void __mlxsw_sp_bridge_vxlan_leave(struct mlxsw_sp *mlxsw_sp,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-2939-\tstruct vxlan_dev *vxlan = netdev_priv(vxlan_dev);\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:2940:\tconst struct vxlan_config *cfg;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-2941-\tstruct mlxsw_sp_fid *fid;\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=3030=static void mlxsw_sp_fdb_vxlan_call_notifiers(struct net_device *dev,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3038-\tenum switchdev_notifier_type type;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:3039:\tconst struct vxlan_config *cfg;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3040-\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=3216=__mlxsw_sp_fdb_notify_mac_uc_tunnel_process(struct mlxsw_sp *mlxsw_sp,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3247-\t\tstruct vxlan_dev *vxlan = netdev_priv(dev);\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:3248:\t\tconst struct vxlan_config *cfg;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3249-\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=3730=mlxsw_sp_switchdev_vxlan_work_prepare(struct mlxsw_sp_switchdev_event_work *\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3735-\tstruct switchdev_notifier_vxlan_fdb_info *vxlan_fdb_info;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:3736:\tconst struct vxlan_config *cfg;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3737-\tstruct netlink_ext_ack *extack;\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=3860=mlxsw_sp_switchdev_vxlan_vlan_add(struct mlxsw_sp *mlxsw_sp,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3866-\tstruct vxlan_dev *vxlan = netdev_priv(vxlan_dev);\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:3867:\tconst struct vxlan_config *cfg;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3868-\tstruct mlxsw_sp_fid *fid;\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c=3950=mlxsw_sp_switchdev_vxlan_vlan_del(struct mlxsw_sp *mlxsw_sp,\n--\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3954-\tstruct vxlan_dev *vxlan = netdev_priv(vxlan_dev);\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c:3955:\tconst struct vxlan_config *cfg;\ndrivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c-3956-\tstruct mlxsw_sp_fid *fid;\n--\ndrivers/net/vxlan/vxlan_core.c=100=static struct vxlan_dev *vxlan_vs_find_vni(struct vxlan_sock *vs,\n--\ndrivers/net/vxlan/vxlan_core.c-112-\thlist_for_each_entry_rcu(node, vni_head(vs, vni), hlist) {\ndrivers/net/vxlan/vxlan_core.c:113:\t\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c-114-\n--\ndrivers/net/vxlan/vxlan_core.c=158=static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_core.c-162-{\ndrivers/net/vxlan/vxlan_core.c:163:\tconst struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_core.c-164-\tunsigned long now = jiffies;\n--\ndrivers/net/vxlan/vxlan_core.c=383=static struct vxlan_fdb *vxlan_find_mac_rcu(struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_core.c:384:\t\t\t\t\t    const struct vxlan_config *cfg,\ndrivers/net/vxlan/vxlan_core.c-385-\t\t\t\t\t    const u8 *mac, __be32 vni)\n--\ndrivers/net/vxlan/vxlan_core.c=400=static struct vxlan_fdb *vxlan_find_mac_tx(struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_core.c:401:\t\t\t\t\t   const struct vxlan_config *cfg,\ndrivers/net/vxlan/vxlan_core.c-402-\t\t\t\t\t   const u8 *mac, __be32 vni)\n--\ndrivers/net/vxlan/vxlan_core.c=803=static int vxlan_fdb_nh_update(struct vxlan_dev *vxlan, struct vxlan_fdb *fdb,\n--\ndrivers/net/vxlan/vxlan_core.c-806-\tstruct nexthop *old_nh = rtnl_dereference(fdb-\u003enh);\ndrivers/net/vxlan/vxlan_core.c:807:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c-808-\tstruct nexthop *nh;\n--\ndrivers/net/vxlan/vxlan_core.c=867=int vxlan_fdb_create(struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_core.c-873-{\ndrivers/net/vxlan/vxlan_core.c:874:\tconst struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_core.c-875-\tstruct vxlan_rdst *rd = NULL;\n--\ndrivers/net/vxlan/vxlan_core.c=1161=static int vxlan_fdb_parse(struct nlattr *tb[], struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_core.c-1165-{\ndrivers/net/vxlan/vxlan_core.c:1166:\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_core.c-1167-\tstruct net *net = dev_net(vxlan-\u003edev);\n--\ndrivers/net/vxlan/vxlan_core.c=1249=static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],\n--\ndrivers/net/vxlan/vxlan_core.c-1253-{\ndrivers/net/vxlan/vxlan_core.c:1254:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c-1255-\tstruct vxlan_dev *vxlan = netdev_priv(dev);\n--\ndrivers/net/vxlan/vxlan_core.c=1412=static int vxlan_fdb_get(struct sk_buff *skb,\n--\ndrivers/net/vxlan/vxlan_core.c-1419-\tstruct vxlan_dev *vxlan = netdev_priv(dev);\ndrivers/net/vxlan/vxlan_core.c:1420:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c-1421-\tstruct vxlan_fdb *f;\n--\ndrivers/net/vxlan/vxlan_core.c=1451=static enum skb_drop_reason vxlan_snoop(struct net_device *dev,\ndrivers/net/vxlan/vxlan_core.c:1452:\t\t\t\t\tconst struct vxlan_config *cfg,\ndrivers/net/vxlan/vxlan_core.c-1453-\t\t\t\t\tunion vxlan_addr *src_ip,\n--\ndrivers/net/vxlan/vxlan_core.c=1535=static void vxlan_sock_release(struct vxlan_dev *vxlan)\ndrivers/net/vxlan/vxlan_core.c-1536-{\ndrivers/net/vxlan/vxlan_core.c:1537:\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_core.c-1538-\tstruct vxlan_sock *sock4 = rtnl_dereference(vxlan-\u003evn4_sock);\n--\ndrivers/net/vxlan/vxlan_core.c=1617=static enum skb_drop_reason vxlan_set_mac(struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_core.c:1618:\t\t\t\t\t  const struct vxlan_config *cfg,\ndrivers/net/vxlan/vxlan_core.c-1619-\t\t\t\t\t  struct vxlan_sock *vs,\n--\ndrivers/net/vxlan/vxlan_core.c=1675=static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)\n--\ndrivers/net/vxlan/vxlan_core.c-1678-\t__be16 protocol = htons(ETH_P_TEB);\ndrivers/net/vxlan/vxlan_core.c:1679:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c-1680-\tenum skb_drop_reason reason;\n--\ndrivers/net/vxlan/vxlan_core.c=1877=static int arp_reduce(struct net_device *dev, struct sk_buff *skb,\ndrivers/net/vxlan/vxlan_core.c:1878:\t\t      const struct vxlan_config *cfg, __be32 vni)\ndrivers/net/vxlan/vxlan_core.c-1879-{\n--\ndrivers/net/vxlan/vxlan_core.c=2071=static int neigh_reduce(struct net_device *dev, struct sk_buff *skb,\ndrivers/net/vxlan/vxlan_core.c:2072:\t\t\tconst struct vxlan_config *cfg, __be32 vni)\ndrivers/net/vxlan/vxlan_core.c-2073-{\n--\ndrivers/net/vxlan/vxlan_core.c=2144=static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb,\ndrivers/net/vxlan/vxlan_core.c:2145:\t\t\t       const struct vxlan_config *cfg)\ndrivers/net/vxlan/vxlan_core.c-2146-{\n--\ndrivers/net/vxlan/vxlan_core.c=2310=static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan,\ndrivers/net/vxlan/vxlan_core.c-2311-\t\t\t       struct vxlan_dev *dst_vxlan,\ndrivers/net/vxlan/vxlan_core.c:2312:\t\t\t       const struct vxlan_config *src_cfg,\ndrivers/net/vxlan/vxlan_core.c-2313-\t\t\t       __be32 vni, bool snoop)\ndrivers/net/vxlan/vxlan_core.c-2314-{\ndrivers/net/vxlan/vxlan_core.c:2315:\tconst struct vxlan_config *dst_cfg;\ndrivers/net/vxlan/vxlan_core.c-2316-\tunion vxlan_addr loopback;\n--\ndrivers/net/vxlan/vxlan_core.c=2361=static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev,\ndrivers/net/vxlan/vxlan_core.c-2362-\t\t\t\t struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_core.c:2363:\t\t\t\t const struct vxlan_config *cfg,\ndrivers/net/vxlan/vxlan_core.c-2364-\t\t\t\t int addr_family,\n--\ndrivers/net/vxlan/vxlan_core.c=2401=void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,\ndrivers/net/vxlan/vxlan_core.c:2402:\t\t    const struct vxlan_config *cfg,\ndrivers/net/vxlan/vxlan_core.c-2403-\t\t    __be32 default_vni, struct vxlan_rdst *rdst, bool did_rsc)\n--\ndrivers/net/vxlan/vxlan_core.c=2712=static void vxlan_xmit_nh(struct sk_buff *skb, struct net_device *dev,\ndrivers/net/vxlan/vxlan_core.c:2713:\t\t\t  const struct vxlan_config *cfg,\ndrivers/net/vxlan/vxlan_core.c-2714-\t\t\t  struct vxlan_fdb *f, __be32 vni, bool did_rsc)\n--\ndrivers/net/vxlan/vxlan_core.c=2743=static netdev_tx_t vxlan_xmit_nhid(struct sk_buff *skb, struct net_device *dev,\ndrivers/net/vxlan/vxlan_core.c-2744-\t\t\t\t   u32 nhid, __be32 vni,\ndrivers/net/vxlan/vxlan_core.c:2745:\t\t\t\t   const struct vxlan_config *cfg)\ndrivers/net/vxlan/vxlan_core.c-2746-{\n--\ndrivers/net/vxlan/vxlan_core.c=2788=static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)\n--\ndrivers/net/vxlan/vxlan_core.c-2792-\tconst struct ip_tunnel_info *info;\ndrivers/net/vxlan/vxlan_core.c:2793:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c-2794-\t__be32 default_vni;\n--\ndrivers/net/vxlan/vxlan_core.c=2926=static void vxlan_cleanup(struct timer_list *t)\n--\ndrivers/net/vxlan/vxlan_core.c-2929-\tunsigned long next_timer = jiffies + FDB_AGE_INTERVAL;\ndrivers/net/vxlan/vxlan_core.c:2930:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c-2931-\tstruct vxlan_fdb *f;\n--\ndrivers/net/vxlan/vxlan_core.c=2977=static void vxlan_vs_add_dev(struct vxlan_sock *vs, struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_core.c-2979-{\ndrivers/net/vxlan/vxlan_core.c:2980:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c-2981-\t__be32 vni;\n--\ndrivers/net/vxlan/vxlan_core.c=2993=static int vxlan_init(struct net_device *dev)\n--\ndrivers/net/vxlan/vxlan_core.c-2995-\tstruct vxlan_dev *vxlan = netdev_priv(dev);\ndrivers/net/vxlan/vxlan_core.c:2996:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c-2997-\tint err;\n--\ndrivers/net/vxlan/vxlan_core.c=3032=static void vxlan_uninit(struct net_device *dev)\n--\ndrivers/net/vxlan/vxlan_core.c-3034-\tstruct vxlan_dev *vxlan = netdev_priv(dev);\ndrivers/net/vxlan/vxlan_core.c:3035:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c-3036-\n--\ndrivers/net/vxlan/vxlan_core.c=3050=static int vxlan_open(struct net_device *dev)\n--\ndrivers/net/vxlan/vxlan_core.c-3052-\tstruct vxlan_dev *vxlan = netdev_priv(dev);\ndrivers/net/vxlan/vxlan_core.c:3053:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c-3054-\tint ret;\n--\ndrivers/net/vxlan/vxlan_core.c=3086=static bool vxlan_fdb_is_default_entry(const struct vxlan_fdb *f,\n--\ndrivers/net/vxlan/vxlan_core.c-3088-{\ndrivers/net/vxlan/vxlan_core.c:3089:\tconst struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_core.c-3090-\n--\ndrivers/net/vxlan/vxlan_core.c=3306=static int vxlan_change_mtu(struct net_device *dev, int new_mtu)\n--\ndrivers/net/vxlan/vxlan_core.c-3308-\tstruct vxlan_dev *vxlan = netdev_priv(dev);\ndrivers/net/vxlan/vxlan_core.c:3309:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c-3310-\tstruct net_device *lowerdev;\n--\ndrivers/net/vxlan/vxlan_core.c=3329=static int vxlan_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)\n--\ndrivers/net/vxlan/vxlan_core.c-3332-\tstruct ip_tunnel_info *info = skb_tunnel_info(skb);\ndrivers/net/vxlan/vxlan_core.c:3333:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c-3334-\t__be16 sport, dport;\n--\ndrivers/net/vxlan/vxlan_core.c=3450=static void vxlan_free_dev(struct net_device *dev)\n--\ndrivers/net/vxlan/vxlan_core.c-3452-\tstruct vxlan_dev *vxlan = netdev_priv(dev);\ndrivers/net/vxlan/vxlan_core.c:3453:\tstruct vxlan_config *cfg = rcu_dereference_protected(vxlan-\u003ecfg, 1);\ndrivers/net/vxlan/vxlan_core.c-3454-\n--\ndrivers/net/vxlan/vxlan_core.c=3639=static int vxlan_get_link_ksettings(struct net_device *dev,\n--\ndrivers/net/vxlan/vxlan_core.c-3642-\tstruct vxlan_dev *vxlan = netdev_priv(dev);\ndrivers/net/vxlan/vxlan_core.c:3643:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c-3644-\tstruct net_device *lowerdev;\n--\ndrivers/net/vxlan/vxlan_core.c=3751=static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)\ndrivers/net/vxlan/vxlan_core.c-3752-{\ndrivers/net/vxlan/vxlan_core.c:3753:\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_core.c-3754-\tbool metadata = cfg-\u003eflags \u0026 VXLAN_F_COLLECT_METADATA;\n--\ndrivers/net/vxlan/vxlan_core.c=3801=static int vxlan_sock_add(struct vxlan_dev *vxlan)\ndrivers/net/vxlan/vxlan_core.c-3802-{\ndrivers/net/vxlan/vxlan_core.c:3803:\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_core.c-3804-\tbool metadata, ipv6, ipv4;\n--\ndrivers/net/vxlan/vxlan_core.c=3827=int vxlan_vni_in_use(struct net *src_net, struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_core.c:3828:\t\t     const struct vxlan_config *conf, __be32 vni)\ndrivers/net/vxlan/vxlan_core.c-3829-{\n--\ndrivers/net/vxlan/vxlan_core.c-3833-\tlist_for_each_entry(tmp, \u0026vn-\u003evxlan_list, next) {\ndrivers/net/vxlan/vxlan_core.c:3834:\t\tconst struct vxlan_config *tmp_cfg;\ndrivers/net/vxlan/vxlan_core.c-3835-\n--\ndrivers/net/vxlan/vxlan_core.c-3862-\ndrivers/net/vxlan/vxlan_core.c:3863:static int vxlan_config_validate(struct net *src_net, struct vxlan_config *conf,\ndrivers/net/vxlan/vxlan_core.c-3864-\t\t\t\t struct net_device **lower,\n--\ndrivers/net/vxlan/vxlan_core.c=4015=static void vxlan_config_apply(struct net_device *dev,\ndrivers/net/vxlan/vxlan_core.c:4016:\t\t\t       struct vxlan_config *new_cfg,\ndrivers/net/vxlan/vxlan_core.c-4017-\t\t\t       struct net_device *lowerdev,\n--\ndrivers/net/vxlan/vxlan_core.c-4022-\tunsigned short needed_headroom = ETH_HLEN;\ndrivers/net/vxlan/vxlan_core.c:4023:\tstruct vxlan_config *old_cfg;\ndrivers/net/vxlan/vxlan_core.c-4024-\tint max_mtu = ETH_MAX_MTU;\n--\ndrivers/net/vxlan/vxlan_core.c=4070=static int vxlan_dev_configure(struct net *src_net, struct net_device *dev,\ndrivers/net/vxlan/vxlan_core.c:4071:\t\t\t       struct vxlan_config *conf,\ndrivers/net/vxlan/vxlan_core.c-4072-\t\t\t       struct netlink_ext_ack *extack)\n--\ndrivers/net/vxlan/vxlan_core.c-4075-\tstruct net_device *lowerdev;\ndrivers/net/vxlan/vxlan_core.c:4076:\tstruct vxlan_config *new_cfg;\ndrivers/net/vxlan/vxlan_core.c-4077-\tint ret;\n--\ndrivers/net/vxlan/vxlan_core.c=4092=static int vxlan_dev_create(struct net *net, struct net_device *dev,\ndrivers/net/vxlan/vxlan_core.c:4093:\t\t\t    struct vxlan_config *conf,\ndrivers/net/vxlan/vxlan_core.c-4094-\t\t\t    struct netlink_ext_ack *extack)\n--\ndrivers/net/vxlan/vxlan_core.c-4098-\tstruct net_device *remote_dev = NULL;\ndrivers/net/vxlan/vxlan_core.c:4099:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c-4100-\tint err;\n--\ndrivers/net/vxlan/vxlan_core.c-4165-/* Set/clear flags based on attribute */\ndrivers/net/vxlan/vxlan_core.c:4166:static int vxlan_nl2flag(struct vxlan_config *conf, struct nlattr *tb[],\ndrivers/net/vxlan/vxlan_core.c-4167-\t\t\t  int attrtype, unsigned long mask, bool changelink,\n--\ndrivers/net/vxlan/vxlan_core.c=4193=static int vxlan_nl2conf(struct nlattr *tb[], struct nlattr *data[],\ndrivers/net/vxlan/vxlan_core.c:4194:\t\t\t struct net_device *dev, struct vxlan_config *conf,\ndrivers/net/vxlan/vxlan_core.c-4195-\t\t\t bool changelink, struct netlink_ext_ack *extack)\n--\ndrivers/net/vxlan/vxlan_core.c-4207-\tif (changelink) {\ndrivers/net/vxlan/vxlan_core.c:4208:\t\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_core.c-4209-\n--\ndrivers/net/vxlan/vxlan_core.c=4537=static int vxlan_newlink(struct net_device *dev,\n--\ndrivers/net/vxlan/vxlan_core.c-4543-\tstruct nlattr **tb = params-\u003etb;\ndrivers/net/vxlan/vxlan_core.c:4544:\tstruct vxlan_config conf;\ndrivers/net/vxlan/vxlan_core.c-4545-\tint err;\n--\ndrivers/net/vxlan/vxlan_core.c=4554=static int vxlan_changelink(struct net_device *dev, struct nlattr *tb[],\n--\ndrivers/net/vxlan/vxlan_core.c-4559-\tstruct vxlan_dev *vxlan = netdev_priv(dev);\ndrivers/net/vxlan/vxlan_core.c:4560:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c:4561:\tstruct vxlan_config *new_cfg;\ndrivers/net/vxlan/vxlan_core.c-4562-\tstruct net_device *lowerdev;\ndrivers/net/vxlan/vxlan_core.c:4563:\tstruct vxlan_config conf;\ndrivers/net/vxlan/vxlan_core.c-4564-\tint err;\n--\ndrivers/net/vxlan/vxlan_core.c=4724=static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev)\n--\ndrivers/net/vxlan/vxlan_core.c-4727-\tstruct ifla_vxlan_port_range ports;\ndrivers/net/vxlan/vxlan_core.c:4728:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_core.c-4729-\n--\ndrivers/net/vxlan/vxlan_core.c=4860=static void vxlan_handle_lowerdev_unregister(struct vxlan_net *vn,\n--\ndrivers/net/vxlan/vxlan_core.c-4866-\tlist_for_each_entry_safe(vxlan, next, \u0026vn-\u003evxlan_list, next) {\ndrivers/net/vxlan/vxlan_core.c:4867:\t\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_core.c-4868-\n--\ndrivers/net/vxlan/vxlan_mdb.c=163=static int vxlan_mdb_entry_info_fill(const struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_mdb.c-167-{\ndrivers/net/vxlan/vxlan_mdb.c:168:\tconst struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_mdb.c-169-\tstruct vxlan_rdst *rd = rtnl_dereference(remote-\u003erd);\n--\ndrivers/net/vxlan/vxlan_mdb.c=610=static int vxlan_mdb_config_init(struct vxlan_mdb_config *cfg,\n--\ndrivers/net/vxlan/vxlan_mdb.c-616-\tstruct vxlan_dev *vxlan = netdev_priv(dev);\ndrivers/net/vxlan/vxlan_mdb.c:617:\tconst struct vxlan_config *vcfg;\ndrivers/net/vxlan/vxlan_mdb.c-618-\n--\ndrivers/net/vxlan/vxlan_mdb.c=960=vxlan_mdb_nlmsg_remote_size(const struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_mdb.c-963-{\ndrivers/net/vxlan/vxlan_mdb.c:964:\tconst struct vxlan_config *cfg = rcu_dereference_rtnl(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_mdb.c-965-\tconst struct vxlan_mdb_entry_key *group = \u0026mdb_entry-\u003ekey;\n--\ndrivers/net/vxlan/vxlan_mdb.c=1485=static int vxlan_mdb_get_parse(struct net_device *dev, struct nlattr *tb[],\n--\ndrivers/net/vxlan/vxlan_mdb.c-1490-\tstruct nlattr *mdbe_attrs[MDBE_ATTR_MAX + 1];\ndrivers/net/vxlan/vxlan_mdb.c:1491:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_mdb.c-1492-\tstruct vxlan_dev *vxlan = netdev_priv(dev);\n--\ndrivers/net/vxlan/vxlan_mdb.c=1630=struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_mdb.c:1631:\t\t\t\t\t\tconst struct vxlan_config *cfg,\ndrivers/net/vxlan/vxlan_mdb.c-1632-\t\t\t\t\t\tstruct sk_buff *skb,\n--\ndrivers/net/vxlan/vxlan_mdb.c=1710=netdev_tx_t vxlan_mdb_xmit(struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_mdb.c:1711:\t\t\t   const struct vxlan_config *cfg,\ndrivers/net/vxlan/vxlan_mdb.c-1712-\t\t\t   const struct vxlan_mdb_entry *mdb_entry,\n--\ndrivers/net/vxlan/vxlan_multicast.c=17=int vxlan_igmp_join(struct vxlan_dev *vxlan, const union vxlan_addr *rip,\n--\ndrivers/net/vxlan/vxlan_multicast.c-19-{\ndrivers/net/vxlan/vxlan_multicast.c:20:\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_multicast.c-21-\tconst union vxlan_addr *ip = (rip ? : \u0026cfg-\u003eremote_ip);\n--\ndrivers/net/vxlan/vxlan_multicast.c=51=int vxlan_igmp_leave(struct vxlan_dev *vxlan, const union vxlan_addr *rip,\n--\ndrivers/net/vxlan/vxlan_multicast.c-53-{\ndrivers/net/vxlan/vxlan_multicast.c:54:\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_multicast.c-55-\tconst union vxlan_addr *ip = (rip ? : \u0026cfg-\u003eremote_ip);\n--\ndrivers/net/vxlan/vxlan_multicast.c=100=static bool vxlan_group_used_by_vnifilter(struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_multicast.c:101:\t\t\t\t\t  const struct vxlan_config *cfg,\ndrivers/net/vxlan/vxlan_multicast.c-102-\t\t\t\t\t  const union vxlan_addr *ip,\n--\ndrivers/net/vxlan/vxlan_multicast.c=127=bool vxlan_group_used(struct vxlan_net *vn, struct vxlan_dev *dev,\n--\ndrivers/net/vxlan/vxlan_multicast.c-129-{\ndrivers/net/vxlan/vxlan_multicast.c:130:\tconst struct vxlan_config *dev_cfg = rtnl_dereference(dev-\u003ecfg);\ndrivers/net/vxlan/vxlan_multicast.c-131-\tconst union vxlan_addr *ip = (rip ? : \u0026dev_cfg-\u003eremote_ip);\n--\ndrivers/net/vxlan/vxlan_multicast.c-154-\tlist_for_each_entry(vxlan, \u0026vn-\u003evxlan_list, next) {\ndrivers/net/vxlan/vxlan_multicast.c:155:\t\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_multicast.c-156-\n--\ndrivers/net/vxlan/vxlan_multicast.c=186=static int vxlan_multicast_join_vnigrp(struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_multicast.c:187:\t\t\t\t       const struct vxlan_config *cfg)\ndrivers/net/vxlan/vxlan_multicast.c-188-{\n--\ndrivers/net/vxlan/vxlan_multicast.c=244=int vxlan_multicast_join(struct vxlan_dev *vxlan)\ndrivers/net/vxlan/vxlan_multicast.c-245-{\ndrivers/net/vxlan/vxlan_multicast.c:246:\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_multicast.c-247-\tint ret = 0;\n--\ndrivers/net/vxlan/vxlan_multicast.c=264=int vxlan_multicast_leave(struct vxlan_dev *vxlan)\ndrivers/net/vxlan/vxlan_multicast.c-265-{\ndrivers/net/vxlan/vxlan_multicast.c:266:\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_multicast.c-267-\tstruct vxlan_net *vn = net_generic(vxlan-\u003enet, vxlan_net_id);\n--\ndrivers/net/vxlan/vxlan_private.h=206=void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,\ndrivers/net/vxlan/vxlan_private.h:207:\t\t    const struct vxlan_config *cfg,\ndrivers/net/vxlan/vxlan_private.h-208-\t\t    __be32 default_vni, struct vxlan_rdst *rdst, bool did_rsc);\ndrivers/net/vxlan/vxlan_private.h=209=int vxlan_vni_in_use(struct net *src_net, struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_private.h:210:\t\t     const struct vxlan_config *conf, __be32 vni);\ndrivers/net/vxlan/vxlan_private.h-211-\n--\ndrivers/net/vxlan/vxlan_private.h=218=void vxlan_vnifilter_count(struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_private.h:219:\t\t\t   const struct vxlan_config *cfg, __be32 vni,\ndrivers/net/vxlan/vxlan_private.h-220-\t\t\t   struct vxlan_vni_node *vninode,\n--\ndrivers/net/vxlan/vxlan_private.h=255=struct vxlan_mdb_entry *vxlan_mdb_entry_skb_get(struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_private.h:256:\t\t\t\t\t\tconst struct vxlan_config *cfg,\ndrivers/net/vxlan/vxlan_private.h-257-\t\t\t\t\t\tstruct sk_buff *skb,\n--\ndrivers/net/vxlan/vxlan_private.h=259=netdev_tx_t vxlan_mdb_xmit(struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_private.h:260:\t\t\t   const struct vxlan_config *cfg,\ndrivers/net/vxlan/vxlan_private.h-261-\t\t\t   const struct vxlan_mdb_entry *mdb_entry,\n--\ndrivers/net/vxlan/vxlan_vnifilter.c=174=void vxlan_vnifilter_count(struct vxlan_dev *vxlan,\ndrivers/net/vxlan/vxlan_vnifilter.c:175:\t\t\t   const struct vxlan_config *cfg, __be32 vni,\ndrivers/net/vxlan/vxlan_vnifilter.c-176-\t\t\t   struct vxlan_vni_node *vninode,\n--\ndrivers/net/vxlan/vxlan_vnifilter.c=333=static int vxlan_vnifilter_dump_dev(const struct net_device *dev,\n--\ndrivers/net/vxlan/vxlan_vnifilter.c-339-\tstruct tunnel_msg *new_tmsg, *tmsg;\ndrivers/net/vxlan/vxlan_vnifilter.c:340:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_vnifilter.c-341-\tstruct vxlan_vni_group *vg;\n--\ndrivers/net/vxlan/vxlan_vnifilter.c=505=static int vxlan_update_default_fdb_entry(struct vxlan_dev *vxlan, __be32 vni,\n--\ndrivers/net/vxlan/vxlan_vnifilter.c-510-{\ndrivers/net/vxlan/vxlan_vnifilter.c:511:\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_vnifilter.c-512-\tint err = 0;\n--\ndrivers/net/vxlan/vxlan_vnifilter.c=551=static int vxlan_vni_update_group(struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_vnifilter.c-557-\tstruct vxlan_net *vn = net_generic(vxlan-\u003enet, vxlan_net_id);\ndrivers/net/vxlan/vxlan_vnifilter.c:558:\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_vnifilter.c-559-\tconst union vxlan_addr *newrip = NULL, *oldrip = NULL;\n--\ndrivers/net/vxlan/vxlan_vnifilter.c=665=static void vxlan_vni_delete_group(struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_vnifilter.c-668-\tstruct vxlan_net *vn = net_generic(vxlan-\u003enet, vxlan_net_id);\ndrivers/net/vxlan/vxlan_vnifilter.c:669:\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_vnifilter.c-670-\n--\ndrivers/net/vxlan/vxlan_vnifilter.c=781=static int vxlan_vni_add(struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_vnifilter.c-785-{\ndrivers/net/vxlan/vxlan_vnifilter.c:786:\tconst struct vxlan_config *cfg = rtnl_dereference(vxlan-\u003ecfg);\ndrivers/net/vxlan/vxlan_vnifilter.c-787-\tstruct vxlan_vni_node *vninode;\n--\ndrivers/net/vxlan/vxlan_vnifilter.c=903=static int vxlan_process_vni_filter(struct vxlan_dev *vxlan,\n--\ndrivers/net/vxlan/vxlan_vnifilter.c-907-\tstruct nlattr *vattrs[VXLAN_VNIFILTER_ENTRY_MAX + 1];\ndrivers/net/vxlan/vxlan_vnifilter.c:908:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_vnifilter.c-909-\tu32 vni_start = 0, vni_end = 0;\n--\ndrivers/net/vxlan/vxlan_vnifilter.c=1002=static int vxlan_vnifilter_process(struct sk_buff *skb, struct nlmsghdr *nlh,\n--\ndrivers/net/vxlan/vxlan_vnifilter.c-1005-\tstruct net *net = sock_net(skb-\u003esk);\ndrivers/net/vxlan/vxlan_vnifilter.c:1006:\tconst struct vxlan_config *cfg;\ndrivers/net/vxlan/vxlan_vnifilter.c-1007-\tstruct tunnel_msg *tmsg;\n--\ninclude/net/vxlan.h=201=struct vxlan_rdst {\n--\ninclude/net/vxlan.h-211-\ninclude/net/vxlan.h:212:struct vxlan_config {\ninclude/net/vxlan.h-213-\tunion vxlan_addr\t\tremote_ip;\n--\ninclude/net/vxlan.h=285=struct vxlan_dev {\n--\ninclude/net/vxlan.h-304-\ninclude/net/vxlan.h:305:\tstruct vxlan_config __rcu\t*cfg;\ninclude/net/vxlan.h-306-\n"
}

57/3 2026/09/17 06:41 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 91369
							output: 373
							thoughts: 1394
						

Thoughts:
**KMSAN Assessment: vxlan Config Dynamic Allocation**

Okay, let's break this down. We've changed how `struct vxlan_config` is handled within `struct vxlan_dev`, moving to dynamic allocation using `kmemdup` and RCU protection. This means we're now accessing it via `rcu_dereference` and `rtnl_dereference`. Crucially, `conf`, which is the source for this dynamic allocation, is *always* zeroed out via `memset` in `vxlan_nl2conf`.

Now, we need to determine if `NeedsKMSAN=true` is appropriate. Remember the rule: KMSAN is for catching *uninitialized* memory issues that KASAN et al. *won't* catch. Running a KMSAN session is costly.

Let's methodically go through the KMSAN criteria:

1.  **Kernel structures to userspace:** We check every place where information leaves the kernel:
    *   In `vxlan_fill_info`, `struct ifla_vxlan_port_range` is explicitly populated, and is only 4 bytes with no padding, so no potential issue.
    *   `vxlan_vnifilter_dump_dev` uses `nlmsg_data(nlh)` which is cleared with `memset` and all attributes are initialized.
    *   In `vxlan_fdb_info` `ndm` is `memset` to zero.
2.  **Conditional logic and uninitialized variables:** We look for control flow dependent on potentially uninitialized variables:
    *   We confirm the initialization of `ifindex` in `mlx5e_tc_tun_get_remote_ifindex`, and ensure that all fields of `params` are initialized in `mlxsw_sp_bridge_vlan_aware_vxlan_join` & `mlxsw_sp_bridge_8021d_vxlan_join`.
    *   In `vxlan_xmit_one`, we observe that `_md = {}` is an empty initializer and that `key` is `memset` when `rdst` is present, `pkey` points to `info->key` otherwise.
    *   In `vxlan_vnilist_update_group` `oldrip` and `newrip` are assigned in both branches of the conditional.
    *   In `vxlan_update_default_fdb_entry` the remote ip union is initialized from a valid pointer.
3.  **Complex data structure initialization:** The critical aspect here is `vxlan->cfg`. We are assured that it comes from a `memset`-ed `conf` and is allocated via `kmemdup`. The containing `vxlan_dev` is allocated via `alloc_netdev_mqs`, which uses `kzalloc`. So, all clear.
4.  **Concurrency:** The primary change is the RCU protection. The patch focuses on safe concurrent configuration updates. Potential issues here are about RCU lifetimes, UAF, or dereferencing a NULL pointer. However, *these* are all covered by standard KASAN/LOCKDEP/kernel debugging.

Therefore, because there are no uninitialized memory risks or potential info-leaks, `NeedsKMSAN=false`. The risk here are classic memory safety issues that are easily picked up by regular bug detectors.



58/3 2026/09/17 06:42 tool set-results
0m Args:
{
  "KMSANReasoning": "The patch series refactors the VXLAN driver and Mellanox driver offload code by making `vxlan-\u003ecfg` dynamically allocated and RCU-protected (instead of embedded in `struct vxlan_dev`), replacing embedded `default_dst` with direct configuration fields and `lowerdev`, and converting the `VXLAN_F_MDB` flag into a device bitflag.\n\nFrom a memory sanitization perspective:\n1. All allocated instances of `struct vxlan_config` are created via `kmemdup` from a stack `conf` structure that is explicitly zero-initialized via `memset(conf, 0, sizeof(*conf))` in `vxlan_nl2conf`.\n2. Stack structures such as `struct ifla_vxlan_port_range ports` in `vxlan_fill_info` have all fields explicitly assigned without padding (`low` and `high`, 4 bytes total). Similarly, `struct mlxsw_sp_nve_params params` has all fields initialized in `mlxsw_sp_bridge_*_vxlan_join`.\n3. Netlink messages and attributes sent to user space (e.g. in `vxlan_fdb_info`, `vxlan_vnifilter_dump_dev`, `vxlan_fill_info`) remain zero-initialized or explicitly populated as before.\n4. The risks introduced by this refactoring primarily involve RCU dereferencing correctness, pointer lifetime/UAF (covered by KASAN), and synchronization (covered by LOCKDEP).\n\nThere are no uninitialized memory reads or information leak risks that would require a dedicated KMSAN fuzzing session.",
  "NeedsKMSAN": false
}

Results:
{
  "KMSANReasoning": "The patch series refactors the VXLAN driver and Mellanox driver offload code by making `vxlan-\u003ecfg` dynamically allocated and RCU-protected (instead of embedded in `struct vxlan_dev`), replacing embedded `default_dst` with direct configuration fields and `lowerdev`, and converting the `VXLAN_F_MDB` flag into a device bitflag.\n\nFrom a memory sanitization perspective:\n1. All allocated instances of `struct vxlan_config` are created via `kmemdup` from a stack `conf` structure that is explicitly zero-initialized via `memset(conf, 0, sizeof(*conf))` in `vxlan_nl2conf`.\n2. Stack structures such as `struct ifla_vxlan_port_range ports` in `vxlan_fill_info` have all fields explicitly assigned without padding (`low` and `high`, 4 bytes total). Similarly, `struct mlxsw_sp_nve_params params` has all fields initialized in `mlxsw_sp_bridge_*_vxlan_join`.\n3. Netlink messages and attributes sent to user space (e.g. in `vxlan_fdb_info`, `vxlan_vnifilter_dump_dev`, `vxlan_fill_info`) remain zero-initialized or explicitly populated as before.\n4. The risks introduced by this refactoring primarily involve RCU dereferencing correctness, pointer lifetime/UAF (covered by KASAN), and synchronization (covered by LOCKDEP).\n\nThere are no uninitialized memory reads or information leak risks that would require a dedicated KMSAN fuzzing session.",
  "NeedsKMSAN": false
}

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)