[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#34299: midentd: reverse in procstr on PPC is a bad idea



On Wed, Mar 10, 1999 at 10:45:18AM +0100, Turbo Fredriksson wrote:
> Could someone with Debian/PPC help me fix this?
> 
> (it have too do with the files '/proc/net/tcp' and/or '/rpc/net/ip_masquerade')
> 

> Subject: Bug#34299: midentd: reverse in procstr on PPC is a bad idea
> Resent-From: Georg Bauer <gb@hugo.westfalen.de>
> Resent-Message-ID: <handler.34299.B.92101328025206@bugs.debian.org>
> Date: Tue, 9 Mar 1999 21:57:17 +0100
> From: Georg Bauer <gb@hugo.westfalen.de>
> To: submit@bugs.debian.org
> Message-Id: <E10KTYy-0000vZ-00@goggle.westfalen.de>
> 
> Package: midentd
> Version: 1.4-2
> 
> Due to different endianess between Intel and PPC, midentd only works right
> on one of both platforms in it's current form. At least the PPC version is
> broken in the procstr sub, as there the IPs are reversed before unpacked.
> Throw out the unpack and the lookup works.


On big-endian platforms, IP addresses in those files are displayed in
big-endian order:

   0: 7F000001:0017 7F000001:05F7 01 00000000:00000000 00:00000000 00000000     0        0 58292        


On a little-endian platform like the Intel, they are displayed in the
opposite order (0100007F instead of 7F000001).

I suspect the best solution will involve the 'N' template to pack in
some way.  If nothing else, there is always this method:

if ( pack("s", 1025) ne pack("n", 1025) ) {  # Not big-endian
  $l = unpack("H8", reverse($lip));
} else {
  $l = unpack("H8", $lip);
}




Dan

/--------------------------------\  /--------------------------------\
|       Daniel Jacobowitz        |__|     CMU, CS class of 2002      |
|   Debian GNU/Linux Developer    __   Part-Time Systems Programmer  |
|         dan@debian.org         |  |        drow@cs.cmu.edu         |
\--------------------------------/  \--------------------------------/


Reply to: