Subject: Re: dhcpd
To: Greg Troxel <gdt@ir.bbn.com>
From: Christos Zoulas <christos@zoulas.com>
List: tech-net
Date: 09/15/2007 11:31:54
On Sep 14,  7:29pm, gdt@ir.bbn.com (Greg Troxel) wrote:
-- Subject: Re: dhcpd

| I think so too, but the whole loop has:
| 
| 		TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
| 			struct sockaddr *sa = ifa->ifa_addr;
| 			/* all sockaddrs must fit in sockaddr_storage */
| 			KASSERT(sa->sa_len <= sizeof(ifr.ifr_ifru));
| 
| 			if (ifrp != NULL)
| 			{
| 				memcpy(&ifr.ifr_space, sa, sa->sa_len);
| 				if (space >= sz) {
| 					error = copyout(&ifr, ifrp, sz);
| 					if (error != 0)
| 						return (error);
| 					ifrp++; space -= sz;
| 				}
| 			}
| 			else
| 				space += sz;
| 		}
| 
| So perhaps you could argue that the KASSERT only belongs in the if branch.

Either way is fine.

| I used the union, not space, because that's the real destination of the
| copy.  But they should be the same.

fine.

| 
| Why < vs <= ?

<= is correct.

| Is _KASSERT just a typeo for KASSERT?

Right. Thanks for taking care of this!

christos