Commit 695ab893 authored by bg.chun's avatar bg.chun Committed by Ashok Babu Channa

[IOT-1528]update file path and remove static analysis warring

update file path(ifaddrs.x -> caifaddrs.x)
and fix netlink usage for remove static analysis warring

Change-Id: I672d9ba1250710cc10c66cbbde56b6b12afc15e8
Signed-off-by: default avatarbg.chun <bg.chun@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14153Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarJaehong Jo <jaehong.jo@samsung.com>
Reviewed-by: default avatarAshok Babu Channa <ashok.channa@samsung.com>
parent 2c2a423e
......@@ -8,6 +8,6 @@ import os.path
env.AppendUnique(CPPPATH = [ os.path.join(src_dir, 'android') ])
src_files = [ 'caipnwmonitor.c',
'ifaddrs.c' ]
'caifaddrs.c' ]
Return('src_files')
/******************************************************************
*
* Copyright 2014 Samsung Electronics All Rights Reserved.
*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************/
#include "ifaddrs.h"
/* *****************************************************************
*
* Copyright 2016 Samsung Electronics All Rights Reserved.
*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************/
#include "caifaddrs.h"
#include <stdbool.h>
#include <string.h>
......@@ -155,10 +155,21 @@ CAResult_t CAGetIfaddrsUsingNetlink(struct ifaddrs **ifap)
while (1)
{
char recvBuf[NETLINK_MESSAGE_LENGTH] = {0};
int len = recv(netlinkFd, recvBuf, sizeof(recvBuf), 0);
struct nlmsghdr *recvMsg = (struct nlmsghdr*)recvBuf;
struct nlmsghdr *recvMsg = NULL;
struct ifaddrs *node = NULL;
for (; NLMSG_OK(recvMsg, len); recvMsg = NLMSG_NEXT(recvMsg, len))
struct sockaddr_nl sa = { .nl_family = 0 };
struct iovec iov = { .iov_base = recvBuf,
.iov_len = sizeof (recvBuf) };
struct msghdr msg = { .msg_name = (void *)&sa,
.msg_namelen = sizeof (sa),
.msg_iov = &iov,
.msg_iovlen = 1 };
ssize_t len = recvmsg(netlinkFd, &msg, 0);
for (recvMsg = (struct nlmsghdr *)recvBuf; NLMSG_OK(recvMsg, len);
recvMsg = NLMSG_NEXT(recvMsg, len))
{
switch (recvMsg->nlmsg_type)
{
......
/******************************************************************
*
* Copyright 2014 Samsung Electronics All Rights Reserved.
*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************/
/* *****************************************************************
*
* Copyright 2016 Samsung Electronics All Rights Reserved.
*
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************/
#include "cacommon.h"
/**
......
......@@ -39,7 +39,7 @@
#include "oic_malloc.h"
#include "oic_string.h"
#include "org_iotivity_ca_CaIpInterface.h"
#include "ifaddrs.h"
#include "caifaddrs.h"
#define TAG "OIC_CA_IP_MONITOR"
#define NETLINK_MESSAGE_LENGTH (4096)
......@@ -194,7 +194,7 @@ u_arraylist_t *CAFindInterfaceChange()
.msg_iov = &iov,
.msg_iovlen = 1 };
size_t len = recvmsg(caglobals.ip.netlinkFd, &msg, 0);
ssize_t len = recvmsg(caglobals.ip.netlinkFd, &msg, 0);
return NULL;
}
......
......@@ -325,7 +325,7 @@ u_arraylist_t *CAFindInterfaceChange()
.msg_iov = &iov,
.msg_iovlen = 1 };
size_t len = recvmsg(caglobals.ip.netlinkFd, &msg, 0);
ssize_t len = recvmsg(caglobals.ip.netlinkFd, &msg, 0);
for (nh = (struct nlmsghdr *)buf; NLMSG_OK(nh, len); nh = NLMSG_NEXT(nh, len))
{
......
......@@ -167,7 +167,7 @@ u_arraylist_t *CAFindInterfaceChange()
.msg_iov = &iov,
.msg_iovlen = 1 };
size_t len = recvmsg(caglobals.ip.netlinkFd, &msg, 0);
ssize_t len = recvmsg(caglobals.ip.netlinkFd, &msg, 0);
for (struct nlmsghdr *nh = (struct nlmsghdr *)buf; NLMSG_OK(nh, len); nh = NLMSG_NEXT(nh, len))
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment