[sheepdog] The magic number of 12

Yu Yang yuyanggg at gmail.com
Wed Jul 8 05:10:47 CEST 2015


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 ?



Regards,
Yang




More information about the sheepdog mailing list