From owner-freebsd-alpha Sun Jan 27 14:50: 6 2002 Delivered-To: freebsd-alpha@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 28E9B37B400 for ; Sun, 27 Jan 2002 14:50:02 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g0RMo2F41640; Sun, 27 Jan 2002 14:50:02 -0800 (PST) (envelope-from gnats) Date: Sun, 27 Jan 2002 14:50:02 -0800 (PST) Message-Id: <200201272250.g0RMo2F41640@freefall.freebsd.org> To: freebsd-alpha@freebsd.org Cc: From: Volker Stolz Subject: Re: alpha/34232: rpc.statd throws alignment errors Reply-To: Volker Stolz Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR alpha/34232; it has been noted by GNATS. From: Volker Stolz To: freebsd-gnats-submit@freebsd.org Cc: alpha@freebsd.org Subject: Re: alpha/34232: rpc.statd throws alignment errors Date: Sun, 27 Jan 2002 23:43:44 +0100 Sigh. Okay. Here's my first take at this sucker: Some interface addresses have 26 bytes in size, which causes the alignment error. The attached fix will solve my rpc.statd problem and hopefully a couple of things more (I saw dhclient going mad on me earlier, but this seems to have been fixed now, too). The obvious disadvantage: Each time, the ioctl will copy up to 7(6?) bytes of garbage, but we can probably live with that :-) Should I hunt down the place where this ifa->ifa_addr is initialized and add the padding right then when the interface (address) is created? This patch seems to be closely related to the ifconfig patch. Another question: Can I safely replace memcpy(&ifreq, ifr, sizeof(ifreq)); with ifreq=*ifr; in lib/libc/rpc/get_myaddress.c? I know that this kind of assignment has been non-standard, but I'd like to know if this will safely work today. I did check, it works fine. It will de-obfuscate the code and even eliminate one warning :-) --- sys/net/if.c.orig Sun Jan 27 23:25:54 2002 +++ sys/net/if.c Sun Jan 27 23:12:54 2002 @@ -1298,6 +1298,7 @@ for ( ; space > sizeof (ifr) && ifa; ifa = ifa->ifa_link.tqe_next) { register struct sockaddr *sa = ifa->ifa_addr; + sa->sa_len = _ALIGN(sa->sa_len); if (curproc->p_prison && prison_if(curproc, sa)) continue; addrs++; -- Wonderful \hbox (0.80312pt too nice) in paragraph at lines 16--18 Volker Stolz * stolz@i2.informatik.rwth-aachen.de Please use PGP or S/MIME for correspondence! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message