From 7189bc088f558945972d82a9a3427001cb20000a Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Date: Mon, 8 Jun 2015 22:03:19 +0200
Subject: [PATCH] cdsk: fix big endian problem

Without this patch the client will endianes swap the port number when
sending the detailed request after it got the answer for his multicast
get. Use the same method for storing the port number in the address
array in ever part of the code and do not use memcpy and manual
bytewise coping mixed over the code. memcpy was used once and byte wise
copy was used twice so I choose the majority.
This was tested on MIPS BE 32 Bit.

Change-Id: Ib486171987004d10209d2bbf6b1d9ada75235651
Signed-off-by: Hauke Mehrtens <hauke.mehrtens@lantiq.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1220
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Doug Hudson <douglas.hudson@intel.com>
Reviewed-by: Erich Keane <erich.keane@intel.com>
---
 resource/csdk/stack/src/ocstack.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/resource/csdk/stack/src/ocstack.c
+++ b/resource/csdk/stack/src/ocstack.c
@@ -723,7 +723,8 @@ OCStackResult UpdateResponseAddr(OCDevAd
         address->addr[i] = atoi(tok);
     }
 
-    memcpy(&address->addr[4], &endPoint->addressInfo.IP.port, sizeof(uint16_t));
+    address->addr[4] = (uint8_t)endPoint->addressInfo.IP.port;
+    address->addr[5] = (uint8_t)(endPoint->addressInfo.IP.port >> 8);
     ret = OC_STACK_OK;
 
 exit:
