Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Jan 2002 14:50:02 -0800 (PST)
From:      Volker Stolz <stolz@hyperion.informatik.rwth-aachen.de>
To:        freebsd-alpha@freebsd.org
Subject:   Re: alpha/34232: rpc.statd throws alignment errors
Message-ID:  <200201272250.g0RMo2F41640@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR alpha/34232; it has been noted by GNATS.

From: Volker Stolz <stolz@hyperion.informatik.rwth-aachen.de>
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200201272250.g0RMo2F41640>