Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp588127ybk; Wed, 13 May 2020 07:56:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkuHeZckWwbhy8AH6rTMy2Pvx1GLEBE7GL2RliHlIPE9rKqsW4IHvSv6RA6aHnjP9Q7Ypi X-Received: by 2002:a50:9e2c:: with SMTP id z41mr15706ede.193.1589381807069; Wed, 13 May 2020 07:56:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589381807; cv=none; d=google.com; s=arc-20160816; b=y5owKpD04Z7ruiN5aDG4SQ3CP5Ksx4eiXPSN5nOwUkJDRyTFKCSWTFfsKJqlZ2ysO8 OnSN58sY0HiZiNmpsw3gxBzhwa02Vq5XJhV5YYpuEK4lC2DynPq+noyT4+UeQRIA9Y4M UvcpLjpjubPqihHZP6gUwJCrPNBYpcPrn3YanT0+kBgJ9NcYQOcXoFL/SdNf/btytnRi b/DVwXxhQHA/9eVI4md8n4omEBLstG2xcbKmg930EkUurqBklE19/uGL70kuzDF0HCVI Rtl73aE3Tql/QUjACeSbwceHh22G6/9l7stbOGHsjyB6P2Rxai8PXYnvKv0Qzz2aJbwA 8PxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :mime-version:dkim-signature; bh=Ag7d1R4oU70+Y1dGMwgHYVRH8OdiIM2rnBAshx67Csg=; b=yjRLEubgQwTrRd+G3H5w46m9Nj66lPNUW2jcm1mQPb0kOmxSfsfearZQ9i1enwW5zB OJsUkKpGYIoFQvXJ+fWgoBTIQgCz4iaD6rRdghwUeyIAiXiv7QtURa63gFZ4IGcUPj9X rzzn8fWeFp/dSkoVEPQewdeQWtHFv/P3hCIeeu870X4s99aIRVoLGDiUXXQvMCIB7r6N x1w6eqZW5YNRgp4Pqpn+G25+96yCsIr+9ge0krgDM6Q7NJX7F5NNFd8DedHj4dVdcV92 HUU1iWGHmCrbnqlR/tf3ZNB9e1cfnjoDFgTAWHOaBhpfGDlaGRZ8GrphdpEZuk7N1lAG dMNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="NM/ixUgQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t10si6536843edw.408.2020.05.13.07.56.23; Wed, 13 May 2020 07:56:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="NM/ixUgQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389058AbgEMOwa (ORCPT + 99 others); Wed, 13 May 2020 10:52:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728345AbgEMOw3 (ORCPT ); Wed, 13 May 2020 10:52:29 -0400 Received: from mail-yb1-xb44.google.com (mail-yb1-xb44.google.com [IPv6:2607:f8b0:4864:20::b44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46882C061A0C; Wed, 13 May 2020 07:52:28 -0700 (PDT) Received: by mail-yb1-xb44.google.com with SMTP id x18so8957868ybq.8; Wed, 13 May 2020 07:52:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=Ag7d1R4oU70+Y1dGMwgHYVRH8OdiIM2rnBAshx67Csg=; b=NM/ixUgQ77MwmVFv32i2dIj/4IHwxgmq5ZhM4IPdxDPNFw/Xyrqmhv/4AiPJMIVHri bHd4lqQWVL2Fd+P9oILIYjifQsnNF5G1cce5p06vNKHKHg0qFCEw7oxP2E7Ev+BgkNpa onpn6Fj5kHqGbvJwXRhoHESFqrO0b21QLDOXSHIL6Q92VBuJUDMm7ciuumQyG56c+BEr ndmkEJ5YwHkwRg9W3x8Rtq67T+l9DEVjv5Zn6lojDZ70dhluhGwDFiPTrqBNgqsS6+bo dbPkeiCmQOy0Qax0+QaRnOqWevOHbh5P8NlXTv/VgguH21TdLBNf5enXG+Fc2rcD1Xmr D4kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=Ag7d1R4oU70+Y1dGMwgHYVRH8OdiIM2rnBAshx67Csg=; b=Vy0+CoQwsbYzLBmY763cvyp8ICWL3u28aZgmvLL+glZok4OqS9sfUOAAtn/pwxQn9J z8NZCkMx9PtonXIq/P1xpqfOFL8xLS3T3hqOjIdlYI5VzlICxE/i0U8qEgWpy6YPDGGB Jb3ZtY/VcTvONhjMikLM39IQtCfaex66rqoyj3ty9/0ygHpA0TLV5HOOymSKVeKDfEQY TYzry055zMlyKVrKWUolX81uhp8j0adGUlGv9Ykcf+f4i0bHavZ25hfk6FDGs2YpdpoV 1qPqWFAL+1TpHCFB+lg4UV6lLRX7nip9oWWEumqqt8/oW610vu9ALHM3dCIxQxoKC/98 ShhA== X-Gm-Message-State: AOAM530xMKOxVdK4GNaxaszkZBGPoXsqf9H/4eW8VmZf4MYeK6JOy99R 7t3tgugpLeogqxtHrJMxLBQRqLyPnJEojfVyaMc= X-Received: by 2002:a25:2e50:: with SMTP id b16mr19372364ybn.346.1589381547494; Wed, 13 May 2020 07:52:27 -0700 (PDT) MIME-Version: 1.0 From: Jonas Falkevik Date: Wed, 13 May 2020 16:52:16 +0200 Message-ID: Subject: [PATCH] sctp: check assoc before SCTP_ADDR_{MADE_PRIM,ADDED} event To: Vlad Yasevich , Neil Horman , Marcelo Ricardo Leitner , "David S. Miller" , Jakub Kicinski , linux-sctp@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Xin Long Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Do not generate SCTP_ADDR_{MADE_PRIM,ADDED} events for SCTP_FUTURE_ASSOC assocs. These events are described in rfc6458#section-6.1 SCTP_PEER_ADDR_CHANGE: This tag indicates that an address that is part of an existing association has experienced a change of state (e.g., a failure or return to service of the reachability of an endpoint via a specific transport address). Signed-off-by: Jonas Falkevik --- net/sctp/associola.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 437079a4883d..0c5dd295f9b8 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c @@ -432,8 +432,10 @@ void sctp_assoc_set_primary(struct sctp_association *asoc, changeover = 1 ; asoc->peer.primary_path = transport; - sctp_ulpevent_nofity_peer_addr_change(transport, - SCTP_ADDR_MADE_PRIM, 0); + if (sctp_assoc2id(asoc) != SCTP_FUTURE_ASSOC) + sctp_ulpevent_nofity_peer_addr_change(transport, + SCTP_ADDR_MADE_PRIM, + 0); /* Set a default msg_name for events. */ memcpy(&asoc->peer.primary_addr, &transport->ipaddr, @@ -714,7 +716,10 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc, list_add_tail_rcu(&peer->transports, &asoc->peer.transport_addr_list); asoc->peer.transport_count++; - sctp_ulpevent_nofity_peer_addr_change(peer, SCTP_ADDR_ADDED, 0); + if (sctp_assoc2id(asoc) != SCTP_FUTURE_ASSOC) + sctp_ulpevent_nofity_peer_addr_change(peer, + SCTP_ADDR_ADDED, + 0); /* If we do not yet have a primary path, set one. */ if (!asoc->peer.primary_path) { -- 2.25.3