From owner-freebsd-net@FreeBSD.ORG Tue Jan 3 22:14:50 2012 Return-Path: Delivered-To: net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E18E6106564A; Tue, 3 Jan 2012 22:14:49 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (gatekeeper-int.allbsd.org [IPv6:2001:2f0:104:e002::2]) by mx1.freebsd.org (Postfix) with ESMTP id DD7CE8FC08; Tue, 3 Jan 2012 22:14:48 +0000 (UTC) Received: from alph.allbsd.org ([IPv6:2001:2f0:104:e010:862b:2bff:febc:8956]) (authenticated bits=128) by mail.allbsd.org (8.14.4/8.14.4) with ESMTP id q03MEaIL094552; Wed, 4 Jan 2012 07:14:46 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.allbsd.org (8.14.4/8.14.4) with ESMTP id q03MEYSY084288; Wed, 4 Jan 2012 07:14:36 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Wed, 04 Jan 2012 07:14:22 +0900 (JST) Message-Id: <20120104.071422.69305300858758112.hrs@allbsd.org> To: jhb@FreeBSD.org From: Hiroki Sato In-Reply-To: <201201031608.59688.jhb@freebsd.org> References: <201201031517.36251.jhb@freebsd.org> <201201031608.59688.jhb@freebsd.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.3.51 on Emacs 23.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart0(Wed_Jan__4_07_14_22_2012_438)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (mail.allbsd.org [IPv6:2001:2f0:104:e001::32]); Wed, 04 Jan 2012 07:14:46 +0900 (JST) X-Spam-Status: No, score=-104.6 required=13.0 tests=BAYES_00, CONTENT_TYPE_PRESENT, RDNS_NONE, SPF_SOFTFAIL, USER_IN_WHITELIST autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on gatekeeper.allbsd.org Cc: pluknet@FreeBSD.org, bz@FreeBSD.org, net@FreeBSD.org Subject: Re: [PATCH] Use of unreferenced ifa in in6 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: Tue, 03 Jan 2012 22:14:50 -0000 ----Security_Multipart0(Wed_Jan__4_07_14_22_2012_438)-- Content-Type: Multipart/Mixed; boundary="--Next_Part(Wed_Jan__4_07_14_22_2012_691)--" Content-Transfer-Encoding: 7bit ----Next_Part(Wed_Jan__4_07_14_22_2012_691)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit John Baldwin wrote in <201201031608.59688.jhb@freebsd.org>: jh> > With this patch in_lifaddr_ioctl() now looks more syntactically similar jh> > to in6_lifaddr_ioctl(). They could look even more similar by eliminating jh> > a lot of whitespace changes present here or there. jh> jh> Hmmm. Actually, it seems to be a bit more broken. Note that it is expecting jh> to get a sockaddr_in, but it is checking for AF_INET6, not AF_INET in its jh> loop. That bug seems to go back to the original import from KAME. I'm not jh> sure if the two can be merged since they work on different underyling data jh> structures though. Hmm, a fix for that bug was not merged for some reason. Something like the attached patch should be applied. -- Hiroki ----Next_Part(Wed_Jan__4_07_14_22_2012_691)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="in.c.20110104-1.diff" Index: in.c =================================================================== --- in.c (revision 229434) +++ in.c (working copy) @@ -735,7 +735,7 @@ if (iflr->flags & IFLR_PREFIX) return (EINVAL); - /* copy args to in_aliasreq, perform ioctl(SIOCAIFADDR_IN6). */ + /* copy args to in_aliasreq, perform ioctl(SIOCAIFADDR_IN). */ bzero(&ifra, sizeof(ifra)); bcopy(iflr->iflr_name, ifra.ifra_name, sizeof(ifra.ifra_name)); @@ -785,7 +785,7 @@ } TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (ifa->ifa_addr->sa_family != AF_INET6) + if (ifa->ifa_addr->sa_family != AF_INET) continue; if (match.s_addr == 0) break; @@ -817,7 +817,7 @@ } else { struct in_aliasreq ifra; - /* fill in_aliasreq and do ioctl(SIOCDIFADDR_IN6) */ + /* fill in_aliasreq and do ioctl(SIOCDIFADDR_IN) */ bzero(&ifra, sizeof(ifra)); bcopy(iflr->iflr_name, ifra.ifra_name, sizeof(ifra.ifra_name)); ----Next_Part(Wed_Jan__4_07_14_22_2012_691)---- ----Security_Multipart0(Wed_Jan__4_07_14_22_2012_438)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEABECAAYFAk8Dfb4ACgkQTyzT2CeTzy1heACg24CLnk58h0Vd9idaW064ejJ9 rloAn2nr/j7T1w718X+9pUKTF9MFhXgc =xxZ4 -----END PGP SIGNATURE----- ----Security_Multipart0(Wed_Jan__4_07_14_22_2012_438)----