[OpenAFS-devel] Patch for check_sysid

Tom Keiser Tom Keiser <tkeiser@gmail.com>
Sat, 26 Mar 2005 01:49:43 -0500


On Sat, 26 Mar 2005 00:49:17 +0100 (MET), Harald Barth <haba@pdc.kth.se> wrote:
> 
> The patch below fixes the wrong IP addr output.
> 
> bash-2.05b# ./check_sysid  /usr/afs/var/openafs/sysid
> versionStamp.magic   = 0x88aabbcc
> versionStamp.version = 0x1
> UUID.time(hi.mid.low)= 0x71f.7507.b6fc6500
> UUID.version         = 1 (0x1)
> UUID.clock(hi.low)   = 0x05.41
> UUID.reserved        = 2 (0x02)
> UUID.node            = 00.00.00.00.00.00
> Number of addreses   = 1 (0x1)
> Address              = 46.234.237.130 (0x2eeaed82)
> 
> (Well know fact for some of us: a greater part of Stockholm's
> universities share 130.237/16)
> 
> Are the other fields documented somewhere? (and I don't mean
> the source code ;-)
> 
> Harald.
> 
> --- src/viced/check_sysid.c.~1.6.~      2003-07-16 01:17:30.000000000 +0200
> +++ src/viced/check_sysid.c     2005-03-26 00:29:07.000000000 +0100
> @@ -104,8 +104,11 @@
>             exit(5);
>         }
>         printf("Address              = %d.%d.%d.%d (0x%x)\n",
> -              (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff,
> -              (addr) & 0xff, addr);
> +              (addr) & 0xff,
> +              (addr >> 8) & 0xff,
> +              (addr >> 16) & 0xff,
> +              (addr >> 24) & 0xff,
> +              addr);
>      }

this patch just masks the problem on little-endian machines. the
contents of the sysid file are stored in NBO.  the original code is
(mostly) correct; there should be an ntohl before the printf.

-- 
Tom Keiser
tkeiser@gmail.com