Code in ocamerl (part of erlocaml) pass the node handshake. Hopefully nobody will read this code before I clean it up a bit … because right now it is a furious mess!!!

I spent some time (arg, that’s a lot in fact) on a stupid (as the bug’s author) bug. The (simplified) handshake is a follow:

  • the 2 nodes exchange a challenge which is 4 random bytes interpreted as a Int32;
  • each node computes the MD5 of (their own cookie + challenge);
  • each node compares its result with the digest of the other node.

My bug was to concatenate the cookie (string) with the raw 4 bytes of the challenge … where I had to concatenate the cookie with the string representation of the 32 bits long unsigned integer!

(in fact the handshake is done with 2 challenges: each node send a challenge to the other)

Anyway, the handshake pass correctly now, and ocaml node can receive the ping control message … but do not reply yet! after it reply, sure I clean the code!!!