Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp936064ybx; Tue, 5 Nov 2019 07:48:50 -0800 (PST) X-Google-Smtp-Source: APXvYqzQN2vPmjCvF7MvQu44S6wCiVNJU3gL/eZMvMHdAbxIDIOma5E8vrRWSle1nkgqzGmr1QaX X-Received: by 2002:a05:6402:783:: with SMTP id d3mr20521853edy.180.1572968930262; Tue, 05 Nov 2019 07:48:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572968930; cv=none; d=google.com; s=arc-20160816; b=nv/BU0Jloh0Ak36Qly5pQIZLgdS8iXMaC2Am6lxq7b4q5ROjW2+oIq9GB4H3Lx7SSD aI3qc0QoO7l8oE1vsxLPtHEfeueoVG11/qeqDlbtEWSVc1P/jo3t4/9gjL6xKo2Pb1fb wgjoycDVEr3mPHKcC/bYmlTIZ2sOr1rVXkOXjK1WdA5776zJuvudV1jUyo3BBxD3INNv IyWCF/XeYdlhr43ZxL6K71Z1AXTDiVd59buCFsQB6W6DUKZDqwlYHeDoM2AhBB3bDReO TZ/e0aW8v1ueaKN1la/lgOJGpRFDd/aBa6P7p31pPfkdHJmwIUJQ/F6AXfHhd2fe4lXx kshQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject:reply-to :dkim-signature; bh=/3v/iFLkEBuwQFFCYnjZhKit30wFqd9RVcimAk+a9Vg=; b=Lp2VxfDnmxgC7vSAun9XQWuw8hdXWwA0yT55FoE/6/xact/XwFZwF5jApb6M9N1Zth CkYhgf38lPKvN2AkkRbwALNzj6JV4i56M8pkFGC96t3kYH36UGEZFBu5NjsJdev8B/1L wTc1f6RXNORzrS6IvhmF2amGM3kSWnIlc4N3D7mUxWyxo5lKFaDuO2p0sEiCp/jhabtd 3bzKKqpd6W97xXAjHe0p9kUN882uAkSsZvNdgUGVsnS7QFNDRjrzfea7mW8fgiKNXMZ/ Xqf2CMoIMXELq7dFZTyjkFb3iIvJKtS9oNuGcxIP3AYzrk5VcsngiwyuGBsgl7D5N2T6 ux1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@6wind.com header.s=google header.b=hLBHSDw2; 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 q3si10959355eju.247.2019.11.05.07.48.26; Tue, 05 Nov 2019 07:48:50 -0800 (PST) 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; dkim=pass header.i=@6wind.com header.s=google header.b=hLBHSDw2; 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 S2389934AbfKEPrs (ORCPT + 99 others); Tue, 5 Nov 2019 10:47:48 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:35202 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389399AbfKEPrs (ORCPT ); Tue, 5 Nov 2019 10:47:48 -0500 Received: by mail-wm1-f65.google.com with SMTP id 8so13681091wmo.0 for ; Tue, 05 Nov 2019 07:47:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=reply-to:subject:to:cc:references:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/3v/iFLkEBuwQFFCYnjZhKit30wFqd9RVcimAk+a9Vg=; b=hLBHSDw2JMN1+e779q/nRjHLfQRZaAmvjg+ByHa5eAd0LRxl9pklZ2nJKbWbdHwEGp tjVEt+F37m33S0/FsbY/J5CgNlfZFJOVQloxykjLXTeIps/L9FUI3JvpmHX1DJsID5Q5 slzRQ0e+sTO8M1nOrMVRuvxDeqxWnR8BHG6I5+Tmi1KAVbSi+rCnrFhEZZFMjZZQrhUx 7zeNvah37WNj1n9gUQ6MnWUqWYNtRyNYr6I7Y+NDyP9rTrJLcqXU4IK3Sc/isvfmwxpv T/UVFVdImJYhfkD83mqE4aaXt4ohZU9ugQ8HasYkuggFf0O+7SV/L9Zy8Q5tEYKtb4es 94wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=/3v/iFLkEBuwQFFCYnjZhKit30wFqd9RVcimAk+a9Vg=; b=a0Y7rbW1STVBPMeQp4XDlg70Yr6M9i9nYfmhBJMK9iCsXgRtm4WsT8tqyvkLYoy8eG 71ttgdx30FqjcXeZxYQi/dkco2W1L8t7/lo30KZmwBL9ztnpf1R4GBgzOKHzYJ6piqsI bnRcfWjdIqL/JNmx8BmLooswv7+fb2wL83RQxCsoFWw2kqAsWoVUlzjRFjtj79ABB9vU NTuEOYc0Qa8vDV9372sb8IUmZzuRqc5Izv4apK5sMqb4hjoh6fRzLw54/iXUFGON9skj vgrsh5GUFmLsgjwbMe9mWRG7KTEUNz78Gx5avAkTZLjLvl3hWbXTuBZqL73jwtTeOWPX oE7w== X-Gm-Message-State: APjAAAUodAHbSeo4bFcjGrESGUhsjUDZpTGWP6lHhE/T2g/paJmF9UXU bJY04f+0p/lbkTKVy5MBZTeG4A== X-Received: by 2002:a7b:c1ca:: with SMTP id a10mr444576wmj.161.1572968866212; Tue, 05 Nov 2019 07:47:46 -0800 (PST) Received: from ?IPv6:2a01:e35:8b63:dc30:f096:9925:304a:fd2a? ([2a01:e35:8b63:dc30:f096:9925:304a:fd2a]) by smtp.gmail.com with ESMTPSA id 16sm238178wmf.0.2019.11.05.07.47.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Nov 2019 07:47:45 -0800 (PST) Reply-To: nicolas.dichtel@6wind.com Subject: Re: [PATCH 4/5] net: ipv4: allow setting address on interface outside current namespace To: Jonas Bonn , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: davem@davemloft.net References: <20191105081112.16656-1-jonas@norrbonn.se> <20191105081112.16656-5-jonas@norrbonn.se> From: Nicolas Dichtel Organization: 6WIND Message-ID: Date: Tue, 5 Nov 2019 16:47:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191105081112.16656-5-jonas@norrbonn.se> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 05/11/2019 à 09:11, Jonas Bonn a écrit : > This patch allows an interface outside of the current namespace to be > selected when setting a new IPv4 address for a device. This uses the > IFA_TARGET_NETNSID attribute to select the namespace in which to search > for the interface to act upon. > > Signed-off-by: Jonas Bonn > --- [snip] > @@ -945,10 +961,11 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, > > if (ret < 0) { > inet_free_ifa(ifa); > - return ret; > + err = ret; > + goto out; > } > } > - return __inet_insert_ifa(ifa, nlh, NETLINK_CB(skb).portid, > + err = __inet_insert_ifa(ifa, nlh, NETLINK_CB(skb).portid, > extack); if (err < 0) goto out; ? else err is set to 0 later. > } else { > u32 new_metric = ifa->ifa_rt_priority; > @@ -956,8 +973,10 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, > inet_free_ifa(ifa); > > if (nlh->nlmsg_flags & NLM_F_EXCL || > - !(nlh->nlmsg_flags & NLM_F_REPLACE)) > - return -EEXIST; > + !(nlh->nlmsg_flags & NLM_F_REPLACE)) { > + err = -EEXIST; > + goto out; > + } > ifa = ifa_existing; > > if (ifa->ifa_rt_priority != new_metric) { > @@ -971,7 +990,14 @@ static int inet_rtm_newaddr(struct sk_buff *skb, struct nlmsghdr *nlh, > &check_lifetime_work, 0); > rtmsg_ifa(RTM_NEWADDR, ifa, nlh, NETLINK_CB(skb).portid); > } > - return 0; > + > + err = 0; here. Regards, Nicolas