On Wed, 9 Jul 2014, Arne Schwabe wrote:

Am 29.06.14 18:13, schrieb Arne Schwabe:
Am 27.03.14 09:57, schrieb Lev Stipakov:
Hi,

Same patch with added NULL check in push.c:308. Turns out that
peer_info might be NULL.

I looked at the patched, a few minor nitpicks:

One more little nitpick:

  uint32_t sess;

   ...

  sess = ((P_DATA_V2 << P_OPCODE_SHIFT) | ks->key_id) | (multi->vpn_session_id 
<< 8);
  ASSERT (buf_write_prepend (buf, &sess, 4));

I think this will cause byte sex issues when talking between big and little endian machines.

A strategically placed htonl() + ntohl() pair might help. Have to make sure that the opcode really goes in as the first byte on the wire, and that the next 3 bytes are the 3 least significant bytes of the session ID.

  uint32_t sess = htonl(
    (((P_DATA_V2 << P_OPCODE_SHIFT) | ks->key_id) << 24)
    | (multi->vpn_session_id & 0xFFFFFF)
  );
  ASSERT (buf_write_prepend (buf, &sess, 4));

Right? Maybe? :)

I suppose this patch will improve things quite a bit for mobile clients which switch from network to another.

  - Hessu


Reply via email to