Set socket family for IPv4 00/216600/3
authorSenthil Kumar G S <senthil.gs@samsung.com>
Thu, 24 Oct 2019 07:11:00 +0000 (12:41 +0530)
committerPyun DoHyun <dh79.pyun@samsung.com>
Wed, 30 Oct 2019 00:56:08 +0000 (00:56 +0000)
Patch for [CONPRO-1509] https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/588 has a bug
due to which the following error comes in Tizen Platform.

"01-01 11:43:56.060+0900 E/OIC_CA_TCP_SERVER_1023(P 2022, T 2031): catcpserver.c:
CATCPCreateSocket(1029) > bind socket failed: Address family not supported by protocol"

Reason: Address family is not set.

This patch fixes the issue.

https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/commit/992729fd6eab4f1b57280f6502ce09d460ace39c
(cherry-picked from 992729fd6eab4f1b57280f6502ce09d460ace39c)

Change-Id: I98edd8c18ec8183bd2208d587599bf9ae294db12
Signed-off-by: Senthil Kumar G S <senthil.gs@samsung.com>
Signed-off-by: Sudipto <sudipto.bal@samsung.com>
resource/csdk/connectivity/src/tcp_adapter/catcpserver.c

index ad7f8fb..1a1702a 100755 (executable)
@@ -1024,6 +1024,7 @@ static CAResult_t CATCPCreateSocket(int family, CATCPSessionInfo_t *svritem)
             {
                 struct sockaddr_in client;
                 memset(&client, 0x00, sizeof(client));
+                client.sin_family = AF_INET;
                 inet_pton(AF_INET, host_address, &(client.sin_addr.s_addr));
                 if (-1 == bind(fd, (struct sockaddr *)&client, socklen))
                 {