From patchwork Wed Mar 6 15:51:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13584241 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 131581353F2 for ; Wed, 6 Mar 2024 15:51:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709740312; cv=none; b=Iw7ra+9PulYXZZlDJRiok/2J06fKQYNWo7ugSrA9r3p2V7Zm/7ltgvoBR0g/vU1MfWSPP1pDF0c4SkJbh54UnlCXSzxgwiHtznwI7/WRQfbq7Sd71TNMLX1tHSzXgrTisiLHMorID1/4oAeVWlpCaw5SD3eF+VjiF6cCqIVOZZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709740312; c=relaxed/simple; bh=QFviBCwTdGRWMdR6Q+xSjnHDS1Y26oh3bLkFh80uLVM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=XVrg5u0lyAkIh9D83udyzTNlrg1jzm6gLI18BW+z0X95+Sv1NGD4p/ltI1102/nb12W19z3rb6mIIcjb0pdT7zWFuSiOAXurgxBgT5fSoEz2kA9qRaYi9xdVpcxNhw41WsdANmz9sldX5IocOhR9PhLCTRSSjlnvWwi52YMPp84= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Y+wAwPv5; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Y+wAwPv5" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dc6b26845cdso10635281276.3 for ; Wed, 06 Mar 2024 07:51:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709740310; x=1710345110; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=eVP64IBeM1VaaMu2g21hHAgyqyOij3r2jk6pCcQqVPE=; b=Y+wAwPv5M4STUZrvemcAJje1tae5M5nGN/EiGObDS5xk707T9Bnk8IsSaWUB1XhiUS IaLuZdZp79nmoRAanA1nxt7zVLR4rualAOfjF7uwZM8PR6JC75HwTkriDKl49h0WOxj2 0SH82NeX46LT0EQz4WmIE0wLneI5hlcAgBF5UjCoa8ybZYgbJToL5moqR/zAF/sjkQY8 6MKB2W+kNdvGZqq1rVn6Qe6lapL5xxnPCGWnRX8JQpf5hflvZ6VLNOrsT3S69ThggshK PcL3m5XqzUvt+2C1sxJdinCVe/M0LnH9R0Q8gOEenifIHx/KQXtf4eYt5GtGMpvIJdz6 kzJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709740310; x=1710345110; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=eVP64IBeM1VaaMu2g21hHAgyqyOij3r2jk6pCcQqVPE=; b=X0Sw5FFQsqXJLHMPgane//usGay5+/1egFoohbXstQWWRcZueZAef6CXHAP9Lcof0U O21g29XeCejUJT9plSrURLIT0LPvd39NNsO0JsYH3mLAvN+HplWEo5+fp7yQMB6IOl4D vLqHStLpZuQxm3I3GHHTkFJ5BwuixzmYuCrKx0nrHFpNb2Jmpjjh7irElt2J0c7wtFVf qZ54fY+7mWQ0rV7y40MgyU/loVlJjGcmGUkCtd5p3t+RbxMjD+ltwz7tHlIVPVA/uX/R K/5uIRKYVVZ3g1KtzOHchgs1UhuorHwYiUR7w1KZjG5gKmZ0XyCv3r9MAwNqOXl2mjkI S3/w== X-Forwarded-Encrypted: i=1; AJvYcCUofeE2yG+95Nz1PjQIHg0+LaDf5SuNCkOfVplUGDyDSRwSr1vjQnja2P4bcUB4hEJ8RCECFA2lEnJWav2RBrIg87luT3YO X-Gm-Message-State: AOJu0YxQSOB1yWLd5Be43BEGKMOjGBrc59iwjG9oFB5m9KVoD1rmV9KB UjGqwHcDLqghIc28osAJRs3heNq+adKpW7QUz9vzHxD6lPMCq9oLIYh844NH55juCbt1DXwKoV3 ttSKDKC68Xg== X-Google-Smtp-Source: AGHT+IFZPRATpWxdApYO5ESFKLCFN6UE4wD8NrL/IsFWejRVHfldXU9EgAIrTi+nwhEb2em1DvYYtj3yUoP98A== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:395a]) (user=edumazet job=sendgmr) by 2002:a05:6902:1004:b0:dc2:3441:897f with SMTP id w4-20020a056902100400b00dc23441897fmr3740370ybt.6.1709740310125; Wed, 06 Mar 2024 07:51:50 -0800 (PST) Date: Wed, 6 Mar 2024 15:51:41 +0000 In-Reply-To: <20240306155144.870421-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240306155144.870421-1-edumazet@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240306155144.870421-2-edumazet@google.com> Subject: [PATCH net-next 1/4] ipv6: make inet6_fill_ifaddr() lockless From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: David Ahern , netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: kuba@kernel.org Make inet6_fill_ifaddr() lockless, and add approriate annotations on ifa->tstamp, ifa->valid_lft, ifa->preferred_lft, ifa->ifa_proto and ifa->rt_priority. Also constify 2nd argument of inet6_fill_ifaddr(), inet6_fill_ifmcaddr() and inet6_fill_ifacaddr(). Signed-off-by: Eric Dumazet Acked-by: David Ahern --- net/ipv6/addrconf.c | 66 +++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 2f84e6ecf19f48602cadb47bc378c9b5a1cdbf65..480a1f9492b590bb13008cede5ea7dc9c422af67 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -2730,7 +2730,7 @@ int addrconf_prefix_rcv_add_addr(struct net *net, struct net_device *dev, if (update_lft) { ifp->valid_lft = valid_lft; ifp->prefered_lft = prefered_lft; - ifp->tstamp = now; + WRITE_ONCE(ifp->tstamp, now); flags = ifp->flags; ifp->flags &= ~IFA_F_DEPRECATED; spin_unlock_bh(&ifp->lock); @@ -4898,13 +4898,13 @@ static int inet6_addr_modify(struct net *net, struct inet6_ifaddr *ifp, IFA_F_HOMEADDRESS | IFA_F_MANAGETEMPADDR | IFA_F_NOPREFIXROUTE); ifp->flags |= cfg->ifa_flags; - ifp->tstamp = jiffies; - ifp->valid_lft = cfg->valid_lft; - ifp->prefered_lft = cfg->preferred_lft; - ifp->ifa_proto = cfg->ifa_proto; + WRITE_ONCE(ifp->tstamp, jiffies); + WRITE_ONCE(ifp->valid_lft, cfg->valid_lft); + WRITE_ONCE(ifp->prefered_lft, cfg->preferred_lft); + WRITE_ONCE(ifp->ifa_proto, cfg->ifa_proto); if (cfg->rt_priority && cfg->rt_priority != ifp->rt_priority) - ifp->rt_priority = cfg->rt_priority; + WRITE_ONCE(ifp->rt_priority, cfg->rt_priority); if (new_peer) ifp->peer_addr = *cfg->peer_pfx; @@ -5125,17 +5125,21 @@ struct inet6_fill_args { enum addr_type_t type; }; -static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, +static int inet6_fill_ifaddr(struct sk_buff *skb, + const struct inet6_ifaddr *ifa, struct inet6_fill_args *args) { - struct nlmsghdr *nlh; + struct nlmsghdr *nlh; u32 preferred, valid; + u32 flags, priority; + u8 proto; nlh = nlmsg_put(skb, args->portid, args->seq, args->event, sizeof(struct ifaddrmsg), args->flags); if (!nlh) return -EMSGSIZE; + flags = READ_ONCE(ifa->flags); put_ifaddrmsg(nlh, ifa->prefix_len, ifa->flags, rt_scope(ifa->scope), ifa->idev->dev->ifindex); @@ -5143,13 +5147,14 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, nla_put_s32(skb, IFA_TARGET_NETNSID, args->netnsid)) goto error; - spin_lock_bh(&ifa->lock); - if (!((ifa->flags&IFA_F_PERMANENT) && - (ifa->prefered_lft == INFINITY_LIFE_TIME))) { - preferred = ifa->prefered_lft; - valid = ifa->valid_lft; + preferred = READ_ONCE(ifa->prefered_lft); + valid = READ_ONCE(ifa->valid_lft); + + if (!((flags & IFA_F_PERMANENT) && + (preferred == INFINITY_LIFE_TIME))) { if (preferred != INFINITY_LIFE_TIME) { - long tval = (jiffies - ifa->tstamp)/HZ; + long tval = (jiffies - READ_ONCE(ifa->tstamp)) / HZ; + if (preferred > tval) preferred -= tval; else @@ -5165,28 +5170,29 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, preferred = INFINITY_LIFE_TIME; valid = INFINITY_LIFE_TIME; } - spin_unlock_bh(&ifa->lock); if (!ipv6_addr_any(&ifa->peer_addr)) { if (nla_put_in6_addr(skb, IFA_LOCAL, &ifa->addr) < 0 || nla_put_in6_addr(skb, IFA_ADDRESS, &ifa->peer_addr) < 0) goto error; - } else + } else { if (nla_put_in6_addr(skb, IFA_ADDRESS, &ifa->addr) < 0) goto error; + } - if (ifa->rt_priority && - nla_put_u32(skb, IFA_RT_PRIORITY, ifa->rt_priority)) + priority = READ_ONCE(ifa->rt_priority); + if (priority && nla_put_u32(skb, IFA_RT_PRIORITY, priority)) goto error; - if (put_cacheinfo(skb, ifa->cstamp, ifa->tstamp, preferred, valid) < 0) + if (put_cacheinfo(skb, ifa->cstamp, READ_ONCE(ifa->tstamp), + preferred, valid) < 0) goto error; - if (nla_put_u32(skb, IFA_FLAGS, ifa->flags) < 0) + if (nla_put_u32(skb, IFA_FLAGS, flags) < 0) goto error; - if (ifa->ifa_proto && - nla_put_u8(skb, IFA_PROTO, ifa->ifa_proto)) + proto = READ_ONCE(ifa->ifa_proto); + if (proto && nla_put_u8(skb, IFA_PROTO, proto)) goto error; nlmsg_end(skb, nlh); @@ -5197,12 +5203,13 @@ static int inet6_fill_ifaddr(struct sk_buff *skb, struct inet6_ifaddr *ifa, return -EMSGSIZE; } -static int inet6_fill_ifmcaddr(struct sk_buff *skb, struct ifmcaddr6 *ifmca, +static int inet6_fill_ifmcaddr(struct sk_buff *skb, + const struct ifmcaddr6 *ifmca, struct inet6_fill_args *args) { - struct nlmsghdr *nlh; - u8 scope = RT_SCOPE_UNIVERSE; int ifindex = ifmca->idev->dev->ifindex; + u8 scope = RT_SCOPE_UNIVERSE; + struct nlmsghdr *nlh; if (ipv6_addr_scope(&ifmca->mca_addr) & IFA_SITE) scope = RT_SCOPE_SITE; @@ -5220,7 +5227,7 @@ static int inet6_fill_ifmcaddr(struct sk_buff *skb, struct ifmcaddr6 *ifmca, put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex); if (nla_put_in6_addr(skb, IFA_MULTICAST, &ifmca->mca_addr) < 0 || - put_cacheinfo(skb, ifmca->mca_cstamp, ifmca->mca_tstamp, + put_cacheinfo(skb, ifmca->mca_cstamp, READ_ONCE(ifmca->mca_tstamp), INFINITY_LIFE_TIME, INFINITY_LIFE_TIME) < 0) { nlmsg_cancel(skb, nlh); return -EMSGSIZE; @@ -5230,13 +5237,14 @@ static int inet6_fill_ifmcaddr(struct sk_buff *skb, struct ifmcaddr6 *ifmca, return 0; } -static int inet6_fill_ifacaddr(struct sk_buff *skb, struct ifacaddr6 *ifaca, +static int inet6_fill_ifacaddr(struct sk_buff *skb, + const struct ifacaddr6 *ifaca, struct inet6_fill_args *args) { struct net_device *dev = fib6_info_nh_dev(ifaca->aca_rt); int ifindex = dev ? dev->ifindex : 1; - struct nlmsghdr *nlh; u8 scope = RT_SCOPE_UNIVERSE; + struct nlmsghdr *nlh; if (ipv6_addr_scope(&ifaca->aca_addr) & IFA_SITE) scope = RT_SCOPE_SITE; @@ -5254,7 +5262,7 @@ static int inet6_fill_ifacaddr(struct sk_buff *skb, struct ifacaddr6 *ifaca, put_ifaddrmsg(nlh, 128, IFA_F_PERMANENT, scope, ifindex); if (nla_put_in6_addr(skb, IFA_ANYCAST, &ifaca->aca_addr) < 0 || - put_cacheinfo(skb, ifaca->aca_cstamp, ifaca->aca_tstamp, + put_cacheinfo(skb, ifaca->aca_cstamp, READ_ONCE(ifaca->aca_tstamp), INFINITY_LIFE_TIME, INFINITY_LIFE_TIME) < 0) { nlmsg_cancel(skb, nlh); return -EMSGSIZE; From patchwork Wed Mar 6 15:51:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13584242 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qk1-f201.google.com (mail-qk1-f201.google.com [209.85.222.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0CD5A13541D for ; Wed, 6 Mar 2024 15:51:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709740314; cv=none; b=XAiyEL/5W/G6zhFrZRGmU9DOlXxp8IeSm55YPBjtW6tQCWMM4g15vylLU4CRrHTCYMbVnz+Em2LAyQaLt3j8mi+F/BWN8fpaITpDXiF9Jez3yXB+wJMGJrDqC+AFGk6mERUwLkHSX4uTel++VU82PyfQe4Hb3wYtp7t6DRjjwEs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709740314; c=relaxed/simple; bh=kycNMe6DHXFljknm328aMoj2S+mDUf8/A9vURyt59Ic=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=OZo3Eum6fWsb2RH6wCNI45yayIdccv3qaXRkp0V/KYbFtUjuW1UN6ynX44nEqvHjiH8pARmtSd9bup87jJGwE41B0eLmQDoiCj3Hkq0GcT1UCFeTZchr8ps6Lf7xb8ChgcRbb10XVAjd/3NsGGcPxzysFAs/MSA7ChbrQvZkijY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=fQmKltRF; arc=none smtp.client-ip=209.85.222.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="fQmKltRF" Received: by mail-qk1-f201.google.com with SMTP id af79cd13be357-78319f64126so1089698185a.3 for ; Wed, 06 Mar 2024 07:51:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709740312; x=1710345112; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=iMuCxi2AjOBoZJJyj4jdPqG4tTm6Xd7RX/AlbU4n310=; b=fQmKltRFXqUz1AvFishp1XqeLZGuCqx80sAVhUR+rVffsmRuUOjB3X/xrZyuxnsq8V N4qqqDTterz1N3ooqCSgOXdkoZ3ULX+eNDlPLua7ttZL9c7WWIeXl+/yJVHqTKiHWNoO AZSgsw0OYZoaJv4VEXehNL/F9mXPH89qpQFmZljydbB1mnm/PZ0U9SOmsh6VXUZWO5FP 0nbTwOJyHXHrHiGPYqzH7YrOmmggW8ElExces/FHkgSkZoLS8Pi+3rK7zz3lYxsVU8uH XLbZPOATQ5etlSxoU091ws6axut76ZrVw7/k52MxiUFte55Qia6spspkC9RPrQgPMsvF shCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709740312; x=1710345112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iMuCxi2AjOBoZJJyj4jdPqG4tTm6Xd7RX/AlbU4n310=; b=G+YNT7UoyXkFji2Ra9Fu3JRawvWxhpY0EwdjNMtEeFfP7i4lvzP1gyT/7Y3AZA911W a6DVpLdCftEHzYap57Wp6EhoZkRke1AnklToTwGcCT0SfbDK7s+wiBDtZwCS4pAtIJy3 0X8VtvPoYc/4LoMCotORBRnMBuM8AOyMUrZ5TnLzB0HckRjoD/klyIbI6khGqhS2lYD9 VVScVRWKHxFJqojS7LdZLFdMkNBg1l+7rYL6RJ2lDOg1ynQIbD61TJ+XAt3TAy81Rojt FFT3uhF5XJD9Zg8K03ISuXMAUJI1BMPLKUw9t4jbccdppySjNrSGRXzH2ysUNnjt6ueu naaA== X-Forwarded-Encrypted: i=1; AJvYcCXS1VywcpQdl1561yTstjXEb9h0638CTMcbYkWp2wFKMhBx2RassAvdJ9zmvyu7/9F7cviegnHVTXoSdB2BvHATZHS77NIs X-Gm-Message-State: AOJu0YyLN83K6NGRVPyrdVsvrHGg1USShIYTZrELaeVmlMfyQKjKY3lE wKuE8uvH1wYpercDm3qM/liuRmzFcK+zb5OAARaVYDWn1P8KyARS9J2DwJnzcq/X/2FUXHWpFS9 AVuQxgnBgkA== X-Google-Smtp-Source: AGHT+IHHG505VJ+V/xBdbImUMtoGWtEdNIqIBcE5HGqtwkAu3jHud/ZJOeKrGBx/8GJE5+W3b+KQMW5u7oEtTg== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:395a]) (user=edumazet job=sendgmr) by 2002:a05:620a:4055:b0:787:d1aa:58b9 with SMTP id i21-20020a05620a405500b00787d1aa58b9mr67577qko.5.1709740311948; Wed, 06 Mar 2024 07:51:51 -0800 (PST) Date: Wed, 6 Mar 2024 15:51:42 +0000 In-Reply-To: <20240306155144.870421-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240306155144.870421-1-edumazet@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240306155144.870421-3-edumazet@google.com> Subject: [PATCH net-next 2/4] ipv6: make in6_dump_addrs() lockless From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: David Ahern , netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: kuba@kernel.org in6_dump_addrs() is called with RCU protection. There is no need holding idev->lock to iterate through unicast addresses. Signed-off-by: Eric Dumazet --- net/ipv6/addrconf.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 480a1f9492b590bb13008cede5ea7dc9c422af67..f063a718893d989bc3362416a6b49ed14bb4c4ea 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -5273,23 +5273,22 @@ static int inet6_fill_ifacaddr(struct sk_buff *skb, } /* called with rcu_read_lock() */ -static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb, +static int in6_dump_addrs(const struct inet6_dev *idev, struct sk_buff *skb, struct netlink_callback *cb, int s_ip_idx, struct inet6_fill_args *fillargs) { - struct ifmcaddr6 *ifmca; - struct ifacaddr6 *ifaca; + const struct ifmcaddr6 *ifmca; + const struct ifacaddr6 *ifaca; int ip_idx = 0; int err = 1; - read_lock_bh(&idev->lock); switch (fillargs->type) { case UNICAST_ADDR: { - struct inet6_ifaddr *ifa; + const struct inet6_ifaddr *ifa; fillargs->event = RTM_NEWADDR; /* unicast address incl. temp addr */ - list_for_each_entry(ifa, &idev->addr_list, if_list) { + list_for_each_entry_rcu(ifa, &idev->addr_list, if_list) { if (ip_idx < s_ip_idx) goto next; err = inet6_fill_ifaddr(skb, ifa, fillargs); @@ -5302,7 +5301,6 @@ static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb, break; } case MULTICAST_ADDR: - read_unlock_bh(&idev->lock); fillargs->event = RTM_GETMULTICAST; /* multicast address */ @@ -5315,7 +5313,6 @@ static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb, if (err < 0) break; } - read_lock_bh(&idev->lock); break; case ANYCAST_ADDR: fillargs->event = RTM_GETANYCAST; @@ -5332,7 +5329,6 @@ static int in6_dump_addrs(struct inet6_dev *idev, struct sk_buff *skb, default: break; } - read_unlock_bh(&idev->lock); cb->args[2] = ip_idx; return err; } From patchwork Wed Mar 6 15:51:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13584243 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 433491353F2 for ; Wed, 6 Mar 2024 15:51:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709740315; cv=none; b=gweDdQw/bhIoMpMIfAJWuzwsTaNJa6105U0T2asfTOF0hRapPVJlU1Sm7E9VjgMP2mm6v+sLvDt+pXD7CVfYqF+7yX8q31Gr7GemiC+jiVwwRtOHqqfw9UH6PfVmEz1IKQBsevrcHTQQidD4ZDKyZit0upOuTgjDkl1q7ugoqoI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709740315; c=relaxed/simple; bh=cxKSgnoL35xm6pqOfKpuLcoFp3pjlT63iTrUrhoZzRY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=G8GVHcVu2F2tbmxvTKeoWjJlry1nu0Pi34rg2OUzYjsUDLgPZTK86LWXGwXeyHus8Ofz3PUf6VQ6H/kDPi9e7l4sp2ThYZ2VC8qqng1fK2sR//Oc2iVwZ0Xp9pLS2aDgTsJhVL0REbsJylpqBq6QXbls/83Bpby+mZlh/zMKh78= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=wx8Zc5nK; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="wx8Zc5nK" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc74ac7d015so8520298276.0 for ; Wed, 06 Mar 2024 07:51:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709740313; x=1710345113; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=oNDzUBZKfUxoD5l3LUyv6FaIwoO+eA5F+4pgiz61cB0=; b=wx8Zc5nKr7mGcwUEpvL+PgTnyfuuTfptvVaYMrHMZEHiYrmod3l73OvuGspnmp5x2B o4rFcwi+jH0KDFoKTQmOrkc55P4ySdO7TWRSUtBJaqvv7jWeeiWrmKhRgrZd265wyNs8 t8g34ViBa976QeMPRlp7iKkXSr7Fe91VsLqCDVjSe/WQU7ZTsEB3wxvXGof5V+fLCPNK 9BjZ1hv4qbYIiREY7F2/pcXxCFQKSyhC9RzwhMiUDyPgZCjuTmpzounV2y7o0IdzWagO Wsgpc53Q+eWXZchArnVXwWuC67ec4++vDzcTk6faB5Qav+Fiwh/PVbg53IQkD7q5TgQF xFYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709740313; x=1710345113; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oNDzUBZKfUxoD5l3LUyv6FaIwoO+eA5F+4pgiz61cB0=; b=SM5LbZecqj4tvuPrsVabzrU3qGI+gkF9ey2TBSyx4zinDIUgBWJqkkkl+V3yYA4R0o mNEgPmY9IsOM8RObIHdhj15e6ieHJdi173s50+ARk4DAM+mihbBHdz4XrRn59DUbOcsR B8k8JHxErt3oOajqVyU/Pt2n7LYIk+Nz0QyCP0ncxG5R/A41Iotupm0zy57idJPHmgKZ MaA846tXGCA2v/3QDkZ1grtiFff7iXaJJ+50T4vlvXhf8leiW0h2IIf+Md+ZX47GPhni LyVHh8HczFpUGkShL9EugRCAiZXZrmKVd5QD5FpEFieXKVPpFVSo9yM3oGsmpPsJn6E8 5M2Q== X-Forwarded-Encrypted: i=1; AJvYcCXPxCCarv3o4PnjtFOFGnC57i0fTc5nHgNZ/avoic2n+2Rqskzn/sP3k/4WKzSeP5THAvTFQvM+UMclAMnjUjRpCkWZaB8J X-Gm-Message-State: AOJu0YyeuU5we0UfoRahGbmHx0dZDIqYa/IGoop2SHsU5O2MjYDxhxOp HD5lRMMnY11mHzpw4SkcPANBbEPXWgHEQL7xhqTaMU88AkQTXyperpz0ss4upRISxWhGTksPuF9 e+TCw0+pD6A== X-Google-Smtp-Source: AGHT+IH9ga0bt2H74hMBnJZDfFzl+mTfcmVHwuOEQNom6u29FrgQSEShwjgNLtaL2NN14dzJaS6G+kyqObwabA== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:395a]) (user=edumazet job=sendgmr) by 2002:a05:6902:1082:b0:dce:30f5:6bc5 with SMTP id v2-20020a056902108200b00dce30f56bc5mr652377ybu.4.1709740313558; Wed, 06 Mar 2024 07:51:53 -0800 (PST) Date: Wed, 6 Mar 2024 15:51:43 +0000 In-Reply-To: <20240306155144.870421-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240306155144.870421-1-edumazet@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240306155144.870421-4-edumazet@google.com> Subject: [PATCH net-next 3/4] ipv6: use xa_array iterator to implement inet6_dump_addr() From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: David Ahern , netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: kuba@kernel.org inet6_dump_addr() can use the new xa_array iterator for better scalability. Make it ready for RCU-only protection. RTNL use is removed in the following patch. Also properly return 0 at the end of a dump to avoid and extra recvmsg() to get NLMSG_DONE. Signed-off-by: Eric Dumazet --- net/ipv6/addrconf.c | 79 +++++++++++++++++---------------------------- 1 file changed, 30 insertions(+), 49 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index f063a718893d989bc3362416a6b49ed14bb4c4ea..82ba44a23bd7434e93e8a847f38cc72d8ce228a8 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -717,7 +717,7 @@ static int inet6_netconf_get_devconf(struct sk_buff *in_skb, static u32 inet6_base_seq(const struct net *net) { u32 res = atomic_read(&net->ipv6.dev_addr_genid) + - net->dev_base_seq; + READ_ONCE(net->dev_base_seq); /* Must not return 0 (see nl_dump_check_consistent()). * Chose a value far away from 0. @@ -5274,13 +5274,13 @@ static int inet6_fill_ifacaddr(struct sk_buff *skb, /* called with rcu_read_lock() */ static int in6_dump_addrs(const struct inet6_dev *idev, struct sk_buff *skb, - struct netlink_callback *cb, int s_ip_idx, + struct netlink_callback *cb, int *s_ip_idx, struct inet6_fill_args *fillargs) { const struct ifmcaddr6 *ifmca; const struct ifacaddr6 *ifaca; int ip_idx = 0; - int err = 1; + int err = 0; switch (fillargs->type) { case UNICAST_ADDR: { @@ -5289,7 +5289,7 @@ static int in6_dump_addrs(const struct inet6_dev *idev, struct sk_buff *skb, /* unicast address incl. temp addr */ list_for_each_entry_rcu(ifa, &idev->addr_list, if_list) { - if (ip_idx < s_ip_idx) + if (ip_idx < *s_ip_idx) goto next; err = inet6_fill_ifaddr(skb, ifa, fillargs); if (err < 0) @@ -5307,7 +5307,7 @@ static int in6_dump_addrs(const struct inet6_dev *idev, struct sk_buff *skb, for (ifmca = rcu_dereference(idev->mc_list); ifmca; ifmca = rcu_dereference(ifmca->next), ip_idx++) { - if (ip_idx < s_ip_idx) + if (ip_idx < *s_ip_idx) continue; err = inet6_fill_ifmcaddr(skb, ifmca, fillargs); if (err < 0) @@ -5319,7 +5319,7 @@ static int in6_dump_addrs(const struct inet6_dev *idev, struct sk_buff *skb, /* anycast address */ for (ifaca = rcu_dereference(idev->ac_list); ifaca; ifaca = rcu_dereference(ifaca->aca_next), ip_idx++) { - if (ip_idx < s_ip_idx) + if (ip_idx < *s_ip_idx) continue; err = inet6_fill_ifacaddr(skb, ifaca, fillargs); if (err < 0) @@ -5329,7 +5329,7 @@ static int in6_dump_addrs(const struct inet6_dev *idev, struct sk_buff *skb, default: break; } - cb->args[2] = ip_idx; + *s_ip_idx = err ? ip_idx : 0; return err; } @@ -5392,6 +5392,7 @@ static int inet6_valid_dump_ifaddr_req(const struct nlmsghdr *nlh, static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, enum addr_type_t type) { + struct net *tgt_net = sock_net(skb->sk); const struct nlmsghdr *nlh = cb->nlh; struct inet6_fill_args fillargs = { .portid = NETLINK_CB(cb->skb).portid, @@ -5400,72 +5401,52 @@ static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb, .netnsid = -1, .type = type, }; - struct net *tgt_net = sock_net(skb->sk); - int idx, s_idx, s_ip_idx; - int h, s_h; + struct { + unsigned long ifindex; + int ip_idx; + } *ctx = (void *)cb->ctx; struct net_device *dev; struct inet6_dev *idev; - struct hlist_head *head; int err = 0; - s_h = cb->args[0]; - s_idx = idx = cb->args[1]; - s_ip_idx = cb->args[2]; - rcu_read_lock(); if (cb->strict_check) { err = inet6_valid_dump_ifaddr_req(nlh, &fillargs, &tgt_net, skb->sk, cb); if (err < 0) - goto put_tgt_net; + goto done; err = 0; if (fillargs.ifindex) { - dev = __dev_get_by_index(tgt_net, fillargs.ifindex); - if (!dev) { - err = -ENODEV; - goto put_tgt_net; - } + err = -ENODEV; + dev = dev_get_by_index_rcu(tgt_net, fillargs.ifindex); + if (!dev) + goto done; idev = __in6_dev_get(dev); - if (idev) { - err = in6_dump_addrs(idev, skb, cb, s_ip_idx, + if (idev) + err = in6_dump_addrs(idev, skb, cb, + &ctx->ip_idx, &fillargs); - if (err > 0) - err = 0; - } - goto put_tgt_net; + goto done; } } cb->seq = inet6_base_seq(tgt_net); - for (h = s_h; h < NETDEV_HASHENTRIES; h++, s_idx = 0) { - idx = 0; - head = &tgt_net->dev_index_head[h]; - hlist_for_each_entry_rcu(dev, head, index_hlist) { - if (idx < s_idx) - goto cont; - if (h > s_h || idx > s_idx) - s_ip_idx = 0; - idev = __in6_dev_get(dev); - if (!idev) - goto cont; - - if (in6_dump_addrs(idev, skb, cb, s_ip_idx, - &fillargs) < 0) - goto done; -cont: - idx++; - } + for_each_netdev_dump(tgt_net, dev, ctx->ifindex) { + idev = __in6_dev_get(dev); + if (!idev) + continue; + err = in6_dump_addrs(idev, skb, cb, &ctx->ip_idx, + &fillargs); + if (err < 0) + goto done; } done: - cb->args[0] = h; - cb->args[1] = idx; -put_tgt_net: rcu_read_unlock(); if (fillargs.netnsid >= 0) put_net(tgt_net); - return skb->len ? : err; + return err; } static int inet6_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb) From patchwork Wed Mar 6 15:51:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 13584244 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0914E135415 for ; Wed, 6 Mar 2024 15:51:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709740317; cv=none; b=Xh5UFN3Fx431CP32+T4mS65OcxjjTmofEdp9isAxYuX2QDrJN24tycshkz0XEvhNtSc0U8rvhBtzP5mvVfU6BCHMS/6VYEupQJrPSK3Kll1u0khc+pouCRELC03fMCkMoVE9xzzuKYwbSVsM0RExSLFGNElhk13wCzjeZOGr63c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709740317; c=relaxed/simple; bh=FR0dKKQuF46zhdu8kuXkuJY++IVUQ4CHf0B59f9t5as=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=s6+8v7nSfGJfYtrVa8rBHkE2tPxX+o0ngzKNlTbzMKndeFbVdx4Ax1dw9O+2U5jVzq5vvYE3D+GWrWU2T3nS6nBQhjjYFqXBXSLcX359FO47OU2t2JSvciuO7j6TXsf7PTno2B21zX7GJQ/KS4++qdhRcwvIZ2sNFUDKkr/n05U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=I7Oueypm; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--edumazet.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="I7Oueypm" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6092bf785d7so21133677b3.0 for ; Wed, 06 Mar 2024 07:51:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709740315; x=1710345115; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=vjzeD8eTJa/7w1oHCjeATVvNohpTtFWC2/sFOcAke9o=; b=I7OueypmLxfCiryUUNU0U7dOznVelFhYEevbvVGFEYzdn+17Uvs/3lOop4NQITlXrz axFW/Wuyv2iIVVE5hZL0I+Ry+0dCp/b3s3ir9p4tHVI/x6Rm3uHJX3WUz/pUO3V9bFk4 Oy330L47SNBOrg/lERFH8asct29NAWfghIcVR0CTDT2Dd8ima7rLDns5XBualFGd4SxT LYJ36NAQVqPQXu0qQyrufXhWhNzcSRt1rqipArqHyaI1f9OYA9t+wq4N93d63vuHS+b7 ppqFXQQXdOAzaehL4YtHWu3ww3w4NgRG1tRehqpvxuYjbmkF+nJAparEn/5cyn1ARv3z dWTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709740315; x=1710345115; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vjzeD8eTJa/7w1oHCjeATVvNohpTtFWC2/sFOcAke9o=; b=GrHPZGTh1iNL95Myn1sbUp+Bo6gNoSpCZ7Vln4FpkIc3aHCVPhcoNc8csUtjW3MwlC uyTlX+W+VA9fsC9eZR0ieTA6byq1hPCSq3fG28573bD+aVHmaJ8K8a2jgK3y4uBx4RY+ oYN/SJZY3aZHHfsqtZG4rWuc89GdkqncxoQSbWN6vIuAWyDaGo23tpshz345bQTJeDZd kxKFqhKyFq1VugFPJRr3ZsZ2AIJ2V0dbTvahldkUSnvj2+l+6smkVuqTEsCe/tw8X1Ew Eufg72CfgEbFbxDli2TFwbMGal8iX+3yVaya48F6hb9yF+EmhedRTX23tWc2iVEcIKQ0 lp3A== X-Forwarded-Encrypted: i=1; AJvYcCUhAYHF1RfHOf/aw7q14yyic93SRLk76/RBbQbdMhlSkeF/TzZLGbnrrfMLB9dmfI/C38wAJ36S0eA7P9WaLsxB4P+of8BB X-Gm-Message-State: AOJu0Yx2tKYiCZloZbJqqvmxCeydbhrRAdvkoUk1oxmtoV419+/xa2sT 4Zjj2Yf40IUY2XeinvYE4CxuW3e+JPMrmIoUOrszEuucGtYSYVdL37/5lS34KI+vJfG88MznuSL 2Qxf925kU6g== X-Google-Smtp-Source: AGHT+IFbbVeZBU9i2bvMdywE7dyIxh4QtpE24FcKCICPMQU9n4qxSyHZp7Objde1kxm3FtnITrKabZv+h53oCw== X-Received: from edumazet1.c.googlers.com ([fda3:e722:ac3:cc00:2b:7d90:c0a8:395a]) (user=edumazet job=sendgmr) by 2002:a05:6902:705:b0:dcd:b431:7f5b with SMTP id k5-20020a056902070500b00dcdb4317f5bmr3828933ybt.0.1709740315110; Wed, 06 Mar 2024 07:51:55 -0800 (PST) Date: Wed, 6 Mar 2024 15:51:44 +0000 In-Reply-To: <20240306155144.870421-1-edumazet@google.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240306155144.870421-1-edumazet@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240306155144.870421-5-edumazet@google.com> Subject: [PATCH net-next 4/4] ipv6: remove RTNL protection from inet6_dump_addr() From: Eric Dumazet To: "David S . Miller" , Jakub Kicinski , Paolo Abeni Cc: David Ahern , netdev@vger.kernel.org, eric.dumazet@gmail.com, Eric Dumazet X-Patchwork-Delegate: kuba@kernel.org We can now remove RTNL acquisition while running inet6_dump_addr(), inet6_dump_ifmcaddr() and inet6_dump_ifacaddr(). Signed-off-by: Eric Dumazet --- net/ipv6/addrconf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 82ba44a23bd7434e93e8a847f38cc72d8ce228a8..b72bdbb850a86a45b4ba7c83df2772f7214891e2 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -7459,15 +7459,18 @@ int __init addrconf_init(void) goto errout; err = rtnl_register_module(THIS_MODULE, PF_INET6, RTM_GETADDR, inet6_rtm_getaddr, inet6_dump_ifaddr, - RTNL_FLAG_DOIT_UNLOCKED); + RTNL_FLAG_DOIT_UNLOCKED | + RTNL_FLAG_DUMP_UNLOCKED); if (err < 0) goto errout; err = rtnl_register_module(THIS_MODULE, PF_INET6, RTM_GETMULTICAST, - NULL, inet6_dump_ifmcaddr, 0); + NULL, inet6_dump_ifmcaddr, + RTNL_FLAG_DUMP_UNLOCKED); if (err < 0) goto errout; err = rtnl_register_module(THIS_MODULE, PF_INET6, RTM_GETANYCAST, - NULL, inet6_dump_ifacaddr, 0); + NULL, inet6_dump_ifacaddr, + RTNL_FLAG_DUMP_UNLOCKED); if (err < 0) goto errout; err = rtnl_register_module(THIS_MODULE, PF_INET6, RTM_GETNETCONF,