From patchwork Tue May 17 07:05:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taehee Yoo X-Patchwork-Id: 12851996 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03DB4C433F5 for ; Tue, 17 May 2022 07:05:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233715AbiEQHFs (ORCPT ); Tue, 17 May 2022 03:05:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229568AbiEQHFn (ORCPT ); Tue, 17 May 2022 03:05:43 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D04E25C4E for ; Tue, 17 May 2022 00:05:40 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id oe17-20020a17090b395100b001df77d29587so1590308pjb.2 for ; Tue, 17 May 2022 00:05:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2IXKhup4oktin7HECj9TPItc3ND78JIvXDX7qg+RJ8s=; b=Dy2xWtEcowzYkBIOqbwhaCgQXMy7m9WSC3l8DUYci+0Bjo7xtcUBT6oM7+RFS4vpWM QQfYT4opsYBoEglonO1KcNe4dC82obVVGFYXwWm9aOBkqSxEOVYAZyxj1BIPHRlCyiCl mQXggwCMwb9X4yLh5I3H3tfVlVHrwRg645M6MOkR2arq0fszuQ6mEIEBSzoc38YwhbK2 lJtpEfog0iS0cH1XgkLkAagpY3XB0tY5MzvsIGZv7oYebMuLELvxYh8pGSuyqsy4mMd1 MMOdXjOdjAU5wSWS5OZolFZ095QtpGC2VgoxmhvByhQ895FoZT0hTmCLJ9insCpYnk0u uh2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2IXKhup4oktin7HECj9TPItc3ND78JIvXDX7qg+RJ8s=; b=e5ee9pQWlvUm0F3rqN6H8TYbOlsE7UseTpo6cI82Xex+BKImWqtlObyIqWZVb5BR/y lqSpSmHZDDYC7T7pJx8rT6ua4Q7NozX3CUku9KdJaSA/Goq7V5TBTIOhp2ZGi+9CUxDX k+y23M435QXhsY9SQWdi1gyRTwnc4ynPHtud+dOM55NxfEBhuHiwvbsV7fFY/Q/V+aCh 7ToV9Ev1lSzsn+yz5zpMmWQbFNkFBGdqHabK9VXnsyHrXxExOVS126mWiRwZCrxnOM6U BRQd/q7u25nzcuxehrvrNDOVbetUtqsyMD4GNBOk9yLYM73GbEzr4JpYDy/SkkiXwzl1 sCiA== X-Gm-Message-State: AOAM533FSEdPeF/tfacei/WCOz5c2RM7XlDdCDcSik4ovO2b74ExqVIM wHKIvKLJR66AZcoQKRZvk5k= X-Google-Smtp-Source: ABdhPJww3E6F8B3DN+el0TGr+sshSpfHeIOQZvrPMUdM4JmVrHqPL5ATqugTcQLsD9x8XIvIhPpPzA== X-Received: by 2002:a17:902:f0d1:b0:15e:dfcc:fda3 with SMTP id v17-20020a170902f0d100b0015edfccfda3mr20861434pla.93.1652771139690; Tue, 17 May 2022 00:05:39 -0700 (PDT) Received: from localhost.localdomain ([182.213.254.91]) by smtp.gmail.com with ESMTPSA id y23-20020a17090264d700b001619b38701bsm1680886pli.72.2022.05.17.00.05.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 00:05:38 -0700 (PDT) From: Taehee Yoo To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: ap420073@gmail.com Subject: [PATCH net v2 1/2] amt: fix gateway mode stuck Date: Tue, 17 May 2022 07:05:26 +0000 Message-Id: <20220517070527.10591-2-ap420073@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220517070527.10591-1-ap420073@gmail.com> References: <20220517070527.10591-1-ap420073@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org If a gateway can not receive any response to requests from a relay, gateway resets status from SENT_REQUEST to INIT and variable about a relay as well. And then it should start the full establish step from sending a discovery message and receiving advertisement message. But, after failure in amt_req_work() it continues sending a request message step with flushed(invalid) relay information and sets SENT_REQUEST. So, a gateway can't be established with a relay. In order to avoid this situation, it stops sending the request message step if it fails. Fixes: cbc21dc1cfe9 ("amt: add data plane of amt interface") Signed-off-by: Taehee Yoo --- v2: - Separate patch. drivers/net/amt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/amt.c b/drivers/net/amt.c index 10455c9b9da0..2b4ce3869f08 100644 --- a/drivers/net/amt.c +++ b/drivers/net/amt.c @@ -943,7 +943,7 @@ static void amt_req_work(struct work_struct *work) if (amt->status < AMT_STATUS_RECEIVED_ADVERTISEMENT) goto out; - if (amt->req_cnt++ > AMT_MAX_REQ_COUNT) { + if (amt->req_cnt > AMT_MAX_REQ_COUNT) { netdev_dbg(amt->dev, "Gateway is not ready"); amt->qi = AMT_INIT_REQ_TIMEOUT; amt->ready4 = false; @@ -951,13 +951,15 @@ static void amt_req_work(struct work_struct *work) amt->remote_ip = 0; __amt_update_gw_status(amt, AMT_STATUS_INIT, false); amt->req_cnt = 0; + goto out; } spin_unlock_bh(&amt->lock); amt_send_request(amt, false); amt_send_request(amt, true); - amt_update_gw_status(amt, AMT_STATUS_SENT_REQUEST, true); spin_lock_bh(&amt->lock); + __amt_update_gw_status(amt, AMT_STATUS_SENT_REQUEST, true); + amt->req_cnt++; out: exp = min_t(u32, (1 * (1 << amt->req_cnt)), AMT_MAX_REQ_TIMEOUT); mod_delayed_work(amt_wq, &amt->req_wq, msecs_to_jiffies(exp * 1000)); From patchwork Tue May 17 07:05:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taehee Yoo X-Patchwork-Id: 12851997 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F491C433EF for ; Tue, 17 May 2022 07:05:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234740AbiEQHFt (ORCPT ); Tue, 17 May 2022 03:05:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233790AbiEQHFo (ORCPT ); Tue, 17 May 2022 03:05:44 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2877EB9D for ; Tue, 17 May 2022 00:05:43 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id n8so16570174plh.1 for ; Tue, 17 May 2022 00:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WYJ4z7YHxeW73d4SCA9PbTBn7gV3Fnj9cuo6Jt6lL9Y=; b=b9SRA64jUBEP/H955g6Z9gR4qHu3isD2yCmErvWvnbRj90J+YQ6E39LE2qWg+BgfYc x4hRibF0pWkomixJGLkUx54FjhvT9VowwiI3rnSgQ85ZgtHiBl0LgNMiBjfWbwswyaWt 0cs8BlvBqydt8j0xo+8rU9kemirKlD/L6ocFdJYJIm+gxf7sWBWVaeZ5AOeLhwz08Bt7 2lefcmehEK7yEOOJmG56kdanMpcAbRkOA20eLsirgAG0tPykLCfcR7yCeqZnD8hFFAWK mqy2x9yC0MJ/clrt6mZUzc/EgZAhYwdURpIKjIqypGFIrCa/HJCeuwSKDhxocf2N+Vgr YfbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WYJ4z7YHxeW73d4SCA9PbTBn7gV3Fnj9cuo6Jt6lL9Y=; b=nz/udu7I0ziUj3hPorrHCo//3LaUC3tRt4cxnZkZ5IjnvSDGmTxyrUuyjz6d4QptRj T/hNRewZu3jyNd3PvJUle4LS5N4KAPR3FrAdQwPTDUCGSnLjahiFzxzC9pkyKrkNRB28 pEoO3cAVKul0CayfcUYWPtWiTefDO7uHY3JKUNu+T1RWsnH3yNJBf+BcafRIuOO5fnzX Thwzpe5x+afaYfTSIVTrDZqeboIhNuDUBZFK/1PNInUPTKfB4atJsqjz5CRQC+f0ifeP HYpKACnY/t77MiTKfRVgcJ+tQRs1b5o/DF+ajr5Nq+rTfPwnvBQKidWzAohO10BN4Bzi KEEw== X-Gm-Message-State: AOAM532NyrCraHI46PZGtYSntR3pCe8/6mS3BDsaGnSBJsQ97w1KJ2NO wvW+tUmcJJv+RmBPoHAYXvc= X-Google-Smtp-Source: ABdhPJxsYslzfYKdk+fPDBwSxFhn+gcTc1v2KzvNfaT4FPLN4AXd1tIYNLhIMvbIIkIW02fGalwDxA== X-Received: by 2002:a17:90a:4a03:b0:1df:4583:cb26 with SMTP id e3-20020a17090a4a0300b001df4583cb26mr10969150pjh.173.1652771142649; Tue, 17 May 2022 00:05:42 -0700 (PDT) Received: from localhost.localdomain ([182.213.254.91]) by smtp.gmail.com with ESMTPSA id y23-20020a17090264d700b001619b38701bsm1680886pli.72.2022.05.17.00.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 00:05:41 -0700 (PDT) From: Taehee Yoo To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@google.com, netdev@vger.kernel.org Cc: ap420073@gmail.com Subject: [PATCH net v2 2/2] amt: do not skip remaining handling of advertisement message Date: Tue, 17 May 2022 07:05:27 +0000 Message-Id: <20220517070527.10591-3-ap420073@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220517070527.10591-1-ap420073@gmail.com> References: <20220517070527.10591-1-ap420073@gmail.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org When a gateway receives an advertisement message, it extracts relay information and then it should be deleted. But the advertisement handler doesn't do that. So, after amt_advertisement_handler(), that message should not be skipped remaining handling. Fixes: cbc21dc1cfe9 ("amt: add data plane of amt interface") Signed-off-by: Taehee Yoo --- v2: - Separate patch drivers/net/amt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/amt.c b/drivers/net/amt.c index 2b4ce3869f08..6ce2ecd07640 100644 --- a/drivers/net/amt.c +++ b/drivers/net/amt.c @@ -2698,9 +2698,10 @@ static int amt_rcv(struct sock *sk, struct sk_buff *skb) err = true; goto drop; } - if (amt_advertisement_handler(amt, skb)) + err = amt_advertisement_handler(amt, skb); + if (err) amt->dev->stats.rx_dropped++; - goto out; + break; case AMT_MSG_MULTICAST_DATA: if (iph->saddr != amt->remote_ip) { netdev_dbg(amt->dev, "Invalid Relay IP\n");