When the dev has been downed or goes downing, it should not
add dynamic fdb entry for the dev.
Signed-off-by: Litao Jiao <[email protected]>
---
drivers/net/vxlan.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index d76dfed..3b45fe4 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1125,11 +1125,13 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
if (vxlan->default_dst.remote_ip.sa.sa_family != ip.sa.sa_family)
return -EAFNOSUPPORT;
+ err = -EINVAL;
spin_lock_bh(&vxlan->hash_lock);
- err = vxlan_fdb_update(vxlan, addr, &ip, ndm->ndm_state, flags,
- port, src_vni, vni, ifindex,
- ndm->ndm_flags | NTF_VXLAN_ADDED_BY_USER,
- true, extack);
+ if (netif_running(dev) || (ndm->ndm_state & NUD_PERMANENT))
+ err = vxlan_fdb_update(vxlan, addr, &ip, ndm->ndm_state, flags,
+ port, src_vni, vni, ifindex,
+ ndm->ndm_flags | NTF_VXLAN_ADDED_BY_USER,
+ true, extack);
spin_unlock_bh(&vxlan->hash_lock);
return err;
--
1.9.1
On Sat, Apr 13, 2019 at 2:52 AM Litao Jiao <[email protected]> wrote:
>
> When the dev has been downed or goes downing, it should not
> add dynamic fdb entry for the dev.
>
> Signed-off-by: Litao Jiao <[email protected]>
> ---
This will break existing users. netif_running check is already there
for dynamically learnt entries.
Why do you need it here ?. none of the ndo_fdb_add handlers check for
link state.
> drivers/net/vxlan.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
> index d76dfed..3b45fe4 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -1125,11 +1125,13 @@ static int vxlan_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
> if (vxlan->default_dst.remote_ip.sa.sa_family != ip.sa.sa_family)
> return -EAFNOSUPPORT;
>
> + err = -EINVAL;
> spin_lock_bh(&vxlan->hash_lock);
> - err = vxlan_fdb_update(vxlan, addr, &ip, ndm->ndm_state, flags,
> - port, src_vni, vni, ifindex,
> - ndm->ndm_flags | NTF_VXLAN_ADDED_BY_USER,
> - true, extack);
> + if (netif_running(dev) || (ndm->ndm_state & NUD_PERMANENT))
> + err = vxlan_fdb_update(vxlan, addr, &ip, ndm->ndm_state, flags,
> + port, src_vni, vni, ifindex,
> + ndm->ndm_flags | NTF_VXLAN_ADDED_BY_USER,
> + true, extack);
> spin_unlock_bh(&vxlan->hash_lock);
>
> return err;
> --
> 1.9.1
>
>
>