[sheepdog] The magic number of 12
Liu Yuan
namei.unix at gmail.com
Wed Jul 8 07:41:01 CEST 2015
On Wed, Jul 08, 2015 at 11:10:47AM +0800, Yu Yang wrote:
> There is a struct node_id which saves the sheep node address and port as follows
> in internal_proto.h:
>
> struct node_id {
> uint8_t addr[16];
> uint16_t port;
> uint8_t io_addr[16];
> uint16_t io_port;
> uint8_t pad[4];
> };
>
> I find that NEITHER network byte order NOR host byte order is stored by the
> member addr and port.
> I print the byte in addr and find that there is a 12 byte offset.
> I also find that there is a magic offset 12 in function add_to_str().
>
> So, is there any resaon why there is a 12 byte offset?
> Anybody who knows ?
see INET_ADDRSTRLEN. shared lib used this marco and feel free to cook a patch
to replace these magic number.
Thanks,
Yuan
More information about the sheepdog
mailing list