From owner-freebsd-net@FreeBSD.ORG Sat Dec 1 01:28:47 2007 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF4DF16A46C for ; Sat, 1 Dec 2007 01:28:47 +0000 (UTC) (envelope-from prvs=julian=848774d93@elischer.org) Received: from c60-outbound.ironport.com (c60-outbound.ironport.com [63.251.108.116]) by mx1.freebsd.org (Postfix) with ESMTP id CC8E813C461 for ; Sat, 1 Dec 2007 01:28:47 +0000 (UTC) (envelope-from prvs=julian=848774d93@elischer.org) Received: from jelischer-laptop.sfo.ironport.com (HELO julian-mac.elischer.org) ([10.251.22.38]) by c60-outbound.ironport.com with ESMTP; 30 Nov 2007 17:00:27 -0800 Message-ID: <4750B229.6070507@elischer.org> Date: Fri, 30 Nov 2007 17:00:25 -0800 From: Julian Elischer User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: FreeBSD Net Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: dup code in in6.c X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Dec 2007 01:28:48 -0000 The following diff removes some (whart looks to me to be) duplicate code. Anyone care to comment before I commit it? (I'm trying to imagine a case where it does something useful to do this twice but not really succeeding). Index: in6.c =================================================================== RCS file: /home/ncvs/src/sys/netinet6/in6.c,v retrieving revision 1.73 diff -u -r1.73 in6.c --- in6.c 5 Jul 2007 16:29:39 -0000 1.73 +++ in6.c 1 Dec 2007 00:56:25 -0000 @@ -1113,32 +1113,6 @@ */ rt = rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL); if (rt) { - if (memcmp(&mltaddr.sin6_addr, - &((struct sockaddr_in6 *)rt_key(rt))->sin6_addr, - MLTMASK_LEN)) { - RTFREE_LOCKED(rt); - rt = NULL; - } - } - if (!rt) { - /* XXX: we need RTF_CLONING to fake nd6_rtrequest */ - error = rtrequest(RTM_ADD, (struct sockaddr *)&mltaddr, - (struct sockaddr *)&ia->ia_addr, - (struct sockaddr *)&mltmask, RTF_UP | RTF_CLONING, - (struct rtentry **)0); - if (error) - goto cleanup; - } else - RTFREE_LOCKED(rt); - - /* - * XXX: do we really need this automatic routes? - * We should probably reconsider this stuff. Most applications - * actually do not need the routes, since they usually specify - * the outgoing interface. - */ - rt = rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL); - if (rt) { /* XXX: only works in !SCOPEDROUTING case. */ if (memcmp(&mltaddr.sin6_addr, &((struct sockaddr_in6 *)rt_key(rt))->sin6_addr, @@ -1148,6 +1122,7 @@ } } if (!rt) { + /* XXX: we need RTF_CLONING to fake nd6_rtrequest */ error = rtrequest(RTM_ADD, (struct sockaddr *)&mltaddr, (struct sockaddr *)&ia->ia_addr, (struct sockaddr *)&mltmask, RTF_UP | RTF_CLONING,