John Baldwin <j...@freebsd.org> wrote
  in <201201031608.59688....@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
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));

Attachment: pgpDCHKwHwYmL.pgp
Description: PGP signature

Reply via email to