From patchwork Fri Apr 23 10:24:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianguo Wu X-Patchwork-Id: 12220075 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AF5BC433ED for ; Fri, 23 Apr 2021 10:25:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BBACE61445 for ; Fri, 23 Apr 2021 10:25:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241755AbhDWKZp (ORCPT ); Fri, 23 Apr 2021 06:25:45 -0400 Received: from m12-13.163.com ([220.181.12.13]:40440 "EHLO m12-13.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229772AbhDWKZp (ORCPT ); Fri, 23 Apr 2021 06:25:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Message-ID:Date:MIME-Version; bh=hMSco Sc2xZJcH1iewGr5fwLPxpCzOba5NZSJk7J1L+0=; b=OjqysXP3R8+eE0NAwSIdH yU5hb2K2Tvu/VLf/rXDjhePllnJZoSeeq5KjIqcyuN5+TNY9cnE2oiw6gVja1zAq SsjvgljsNM035YTwWmRurIYE7hjfgYgdWLGqM0wenC0W0gynPzOYHpcApU1X6IbF OviNPt+FIIeFMDKmNFuT7Q= Received: from [192.168.15.51] (unknown [120.36.226.89]) by smtp9 (Coremail) with SMTP id DcCowAAnnYlxoIJg_wgNHQ--.5066S2; Fri, 23 Apr 2021 18:24:50 +0800 (CST) To: netdev@vger.kernel.org Cc: mptcp@lists.linux.dev, Paolo Abeni , dsahern@kernel.org From: Jianguo Wu Subject: [PATCH iproute2] mptcp: make sure flag signal is set when add addr with port Message-ID: Date: Fri, 23 Apr 2021 18:24:50 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 X-CM-TRANSID: DcCowAAnnYlxoIJg_wgNHQ--.5066S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7GF18Cr1fCrWDXrW3Zw1fWFg_yoW3uFbEka y29w4vgrZxuw17Cr1jkr1rWryFvryxXw40gwnavF9xCwnYy3y7XF4DJas7WwnFka9IgF45 WwnFyrnayr18KjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUYgSdDUUUUU== X-Originating-IP: [120.36.226.89] X-CM-SenderInfo: 5zxmxt5qjx0iiqw6il2tof0z/xtbB9wJ9kF2MYnuyGwAAs5 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com From: Jianguo Wu When add address with port, it is mean to send an ADD_ADDR to remote, so it must have flag signal set. Fixes: 42fbca91cd61 ("mptcp: add support for port based endpoint") Signed-off-by: Jianguo Wu Acked-by: Matthieu Baerts --- ip/ipmptcp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ip/ipmptcp.c b/ip/ipmptcp.c index 5f490f0..44af723 100644 --- a/ip/ipmptcp.c +++ b/ip/ipmptcp.c @@ -143,6 +143,9 @@ static int mptcp_parse_opt(int argc, char **argv, struct nlmsghdr *n, if (!id_set && !adding) missarg("ID"); + if (port && !(flags & MPTCP_PM_ADDR_FLAG_SIGNAL)) + invarg("flags must have signal when using port", "port"); + attr_addr = addattr_nest(n, MPTCP_BUFLEN, MPTCP_PM_ATTR_ADDR | NLA_F_NESTED); if (id_set)