Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp363430yba; Sat, 13 Apr 2019 03:01:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoz5V5aeGDDtQVAYJbd2q6d1P3Xs5+24KWui70ErYkOCZ4fIXiyPkJ1URSxT8BVD/wdBtF X-Received: by 2002:a63:9dc4:: with SMTP id i187mr54856635pgd.259.1555149663133; Sat, 13 Apr 2019 03:01:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555149663; cv=none; d=google.com; s=arc-20160816; b=iSk9I/XgX4mNIzv51vmQ++81goqo+EZ5aLYwqpbQUBPULqmWIwVxvOocOtRbvOypA/ WB0S7IY/FKnL7NyizKkg6gtukY8iMLBAHFIDsy9sVABonYwoaTZtR3RS6aWQM1CeOPr9 bHqVb+pOiGFR3XlP4y6b6xcS75HRiCZuJ1R8Y+VpOeka6gCZKAOkfB/ccROMsuK9HUf5 kpQ3dVOwvDvRZtslUFnV6O74Fd+rfmTkqEu/lz6F+GQlPufYyMvUPKrEcnnCMU54mMil 1+WSeR02NUTZw/xBU8sJrt7bqUar/jVCiLYrEe0njic73yCCCTcGqrA0IN72GP/gphiK lkXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=7gV5Y55/4vQICslQhqhNBFbU83TOItTbrGE5F/aKqyE=; b=MPVfFtwwv3yOHWZoybfJWCMaG94clvtuihf9u5w6E6ROgx5MLEGCMm9i/3qqe2YPMX P8JcxAhMfEx0+5DyMPD/rljTPNYOfGXepn/2mubThfScW0f3iHIDPe02NspIPipahS3E XyOT2arwGHm2bnmPaks8Xa/Lu49JZibGqzeeNsUeRBxHugsVEZhlQjRE7T9MNDJXM2e5 kKsvmiH06ESopJ6Cu+/BXgRG/gLjgD15aiORJyYsrnwS1yspkLECdk/Yh/lAphZI6/vV +9WRRmgS44YxZnVZ22S4qx0jgQQuzQJW83h+AF8kGg9a3q23ey93qS0Mea/KtJ9uPBVo 2sEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l18si39074875pgk.289.2019.04.13.03.00.46; Sat, 13 Apr 2019 03:01:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727050AbfDMKAD (ORCPT + 99 others); Sat, 13 Apr 2019 06:00:03 -0400 Received: from lucky1.263xmail.com ([211.157.147.133]:38666 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726175AbfDMKAD (ORCPT ); Sat, 13 Apr 2019 06:00:03 -0400 X-Greylist: delayed 457 seconds by postgrey-1.27 at vger.kernel.org; Sat, 13 Apr 2019 06:00:02 EDT Received: from jiaolitao?raisecom.com (unknown [192.168.167.201]) by lucky1.263xmail.com (Postfix) with ESMTP id 70B0F571AA; Sat, 13 Apr 2019 17:52:18 +0800 (CST) X-263anti-spam: KSV:0;BIG:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ADDR-CHECKED: 0 X-ABS-CHECKED: 0 X-SKE-CHECKED: 0 X-SPAM-CHECKED: 4 X-ANTISPAM-LEVEL: 2 Received: from localhost.localdomain (unknown [36.106.21.149]) by smtp.263.net (postfix) whith ESMTP id P18443T140378703386368S1555149129851949_; Sat, 13 Apr 2019 17:52:17 +0800 (CST) X-UNIQUE-TAG: <072f6e018e707cc40dde5741654fad3e> X-RL-SENDER: jiaolitao@raisecom.com X-SENDER: 006714@raisecom.com X-LOGIN-NAME: jiaolitao@raisecom.com X-FST-TO: davem@davemloft.net X-SENDER-IP: 36.106.21.149 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 From: Litao Jiao To: davem@davemloft.net Cc: petrm@mellanox.com, idosch@mellanox.com, roopa@cumulusnetworks.com, sbrivio@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jiaolitao@raisecom.com Subject: [PATCH] vxlan: do not add dynamic fdb entry when the dev has been downed Date: Sat, 13 Apr 2019 17:51:52 +0800 Message-Id: <1555149112-14115-1-git-send-email-jiaolitao@raisecom.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When the dev has been downed or goes downing, it should not add dynamic fdb entry for the dev. Signed-off-by: Litao Jiao --- 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