From patchwork Thu Aug 26 18:50:24 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 62801 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D6B7AB70E5 for ; Fri, 27 Aug 2010 04:51:54 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754597Ab0HZSuc (ORCPT ); Thu, 26 Aug 2010 14:50:32 -0400 Received: from mail.candelatech.com ([208.74.158.172]:50958 "EHLO ns3.lanforge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754587Ab0HZSu2 (ORCPT ); Thu, 26 Aug 2010 14:50:28 -0400 Received: from [192.168.100.195] (firewall.candelatech.com [70.89.124.249]) (authenticated bits=0) by ns3.lanforge.com (8.14.2/8.14.2) with ESMTP id o7QIoPcb017487 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 26 Aug 2010 11:50:25 -0700 Message-ID: <4C76B770.4030800@candelatech.com> Date: Thu, 26 Aug 2010 11:50:24 -0700 From: Ben Greear Organization: Candela Technologies User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-2.fc11 Thunderbird/3.0.4 MIME-Version: 1.0 To: David Miller CC: netdev@vger.kernel.org Subject: Re: [net-next] ipv6: Enable netlink notification for tentative addresses. References: <1282760777-15381-1-git-send-email-greearb@candelatech.com> <20100825.212456.71107442.davem@davemloft.net> In-Reply-To: <20100825.212456.71107442.davem@davemloft.net> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 08/25/2010 09:24 PM, David Miller wrote: > From: Ben Greear > Date: Wed, 25 Aug 2010 11:26:17 -0700 > >> By default, netlink messages are not sent when an IPv6 address >> is added if it is in tentative state. This makes it harder >> for user-space applications to know the current state of the >> IPv6 addresses. This patch adds an ipv6 sysctl that will >> allow tentative address notifications to be sent. The sysctl >> is off by default. >> >> Signed-off-by: Ben Greear > > It's inconsistent to send two NEWADDR events for the same add. The ipv6 code seems to send a NEWADDR message every time there is a flag change for the IPv6 addresses. I suppose this better lets code that cares know the state of things. The patch below should always send an even on add, but it will keep all the other events. If you really think I should elide some of the others, I'll make the change, but I think it might be a bad idea. If the patch below looks ok as is, let me know and I'll resend it as a git patch. Thanks, Ben [greearb@ben-dt2 net-next-2.6]$ git diff diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index ab70a3f..7aa7535 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -125,6 +125,7 @@ static void ipv6_regen_rndid(unsigned long data); static int ipv6_generate_eui64(u8 *eui, struct net_device *dev); static int ipv6_count_addresses(struct inet6_dev *idev); +static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa); /* * Configured unicast address hash table @@ -697,9 +698,10 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen, out2: rcu_read_unlock_bh(); - if (likely(err == 0)) + if (likely(err == 0)) { atomic_notifier_call_chain(&inet6addr_chain, NETDEV_UP, ifa); - else { + inet6_ifa_notify(RTM_NEWADDR, ifa); + } else { kfree(ifa); ifa = ERR_PTR(err); }