You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.5 KiB

  1. From 7189bc088f558945972d82a9a3427001cb20000a Mon Sep 17 00:00:00 2001
  2. From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
  3. Date: Mon, 8 Jun 2015 22:03:19 +0200
  4. Subject: [PATCH] cdsk: fix big endian problem
  5. Without this patch the client will endianes swap the port number when
  6. sending the detailed request after it got the answer for his multicast
  7. get. Use the same method for storing the port number in the address
  8. array in ever part of the code and do not use memcpy and manual
  9. bytewise coping mixed over the code. memcpy was used once and byte wise
  10. copy was used twice so I choose the majority.
  11. This was tested on MIPS BE 32 Bit.
  12. Change-Id: Ib486171987004d10209d2bbf6b1d9ada75235651
  13. Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
  14. Reviewed-on: https://gerrit.iotivity.org/gerrit/1220
  15. Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
  16. Reviewed-by: Doug Hudson <douglas.hudson@intel.com>
  17. Reviewed-by: Erich Keane <erich.keane@intel.com>
  18. ---
  19. resource/csdk/stack/src/ocstack.c | 3 ++-
  20. 1 file changed, 2 insertions(+), 1 deletion(-)
  21. --- a/resource/csdk/stack/src/ocstack.c
  22. +++ b/resource/csdk/stack/src/ocstack.c
  23. @@ -723,7 +723,8 @@ OCStackResult UpdateResponseAddr(OCDevAd
  24. address->addr[i] = atoi(tok);
  25. }
  26. - memcpy(&address->addr[4], &endPoint->addressInfo.IP.port, sizeof(uint16_t));
  27. + address->addr[4] = (uint8_t)endPoint->addressInfo.IP.port;
  28. + address->addr[5] = (uint8_t)(endPoint->addressInfo.IP.port >> 8);
  29. ret = OC_STACK_OK;
  30. exit: