From owner-freebsd-alpha Sun Jan 27 14:43:57 2002 Delivered-To: freebsd-alpha@freebsd.org Received: from r220-1.rz.RWTH-Aachen.DE (r220-1.rz.RWTH-Aachen.DE [134.130.3.31]) by hub.freebsd.org (Postfix) with ESMTP id 2D35137B402; Sun, 27 Jan 2002 14:43:53 -0800 (PST) Received: from r220-1.rz.RWTH-Aachen.DE (relay2.RWTH-Aachen.DE [134.130.3.1]) by r220-1.rz.RWTH-Aachen.DE (8.10.1/8.11.3-2) with ESMTP id g0RMhoq16766; Sun, 27 Jan 2002 23:43:50 +0100 (MET) Received: from hyperion.informatik.rwth-aachen.de (hyperion.Informatik.RWTH-Aachen.DE [137.226.194.33]) by r220-1.rz.RWTH-Aachen.DE (8.10.1/8.11.3/6) with ESMTP id g0RMhnv16761; Sun, 27 Jan 2002 23:43:49 +0100 (MET) Received: from margaux.informatik.rwth-aachen.de (margaux.Informatik.RWTH-Aachen.DE [137.226.194.72]) by hyperion.informatik.rwth-aachen.de (8.9.1b+Sun/8.9.1) with ESMTP id XAA04242; Sun, 27 Jan 2002 23:42:20 +0100 (MET) Received: (from stolz@localhost) by margaux.informatik.rwth-aachen.de (8.9.1b+Sun/8.9.1-gb-2) id XAA13315; Sun, 27 Jan 2002 23:43:45 +0100 (MET) Date: Sun, 27 Jan 2002 23:43:44 +0100 From: Volker Stolz To: freebsd-gnats-submit@freebsd.org Cc: alpha@freebsd.org Subject: Re: alpha/34232: rpc.statd throws alignment errors Message-ID: <20020127234344.A13308@i2.informatik.rwth-aachen.de> References: <200201271730.g0RHU3N67579@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.17i In-Reply-To: <200201271730.g0RHU3N67579@freefall.freebsd.org> 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 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