Commit b1a955c0 authored by Jaewook Jung's avatar Jaewook Jung Committed by Ashok Babu Channa

added log messages on ip adapter to improve debugging

Because there was no log for the netlink event, it was hard to see the triggering
point for multicast group join.

And modified some codes for optimization.

Change-Id: I06c8ca4e7ec5e87db6f9fe3cb0b03ae22fb6b42e
Signed-off-by: default avatarJaewook Jung <jw0213.jung@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14201Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarAshok Babu Channa <ashok.channa@samsung.com>
parent 4667f8b1
......@@ -220,16 +220,19 @@ static void CAFindReadyMessage()
return;
}
if (ret <= 0)
if (0 == ret)
{
if (ret < 0)
{
OIC_LOG_V(FATAL, TAG, "select error %s", CAIPS_GET_ERROR);
}
return;
}
CASelectReturned(&readFds, ret);
else if (0 < ret)
{
CASelectReturned(&readFds, ret);
}
else // if (0 > ret)
{
OIC_LOG_V(FATAL, TAG, "select error %s", CAIPS_GET_ERROR);
return;
}
}
static void CASelectReturned(fd_set *readFds, int ret)
......@@ -250,6 +253,7 @@ static void CASelectReturned(fd_set *readFds, int ret)
else ISSET(m4s, readFds, CA_MULTICAST | CA_IPV4 | CA_SECURE)
else if ((caglobals.ip.netlinkFd != OC_INVALID_SOCKET) && FD_ISSET(caglobals.ip.netlinkFd, readFds))
{
OIC_LOG_V(DEBUG, TAG, "Netlink event detacted");
u_arraylist_t *iflist = CAFindInterfaceChange();
if (iflist)
{
......@@ -1188,12 +1192,12 @@ CAResult_t CAIPStartListenServer()
}
if (ifitem->family == AF_INET)
{
OIC_LOG_V(DEBUG, TAG, "Adding IPv4 interface %i to multicast group", ifitem->index);
OIC_LOG_V(DEBUG, TAG, "Adding IPv4 interface(%i) to multicast group", ifitem->index);
applyMulticastToInterface4(ifitem->index);
}
if (ifitem->family == AF_INET6)
{
OIC_LOG_V(DEBUG, TAG, "Adding IPv6 interface %i to multicast group", ifitem->index);
OIC_LOG_V(DEBUG, TAG, "Adding IPv6 interface(%i) to multicast group", ifitem->index);
applyMulticastToInterface6(ifitem->index);
}
}
......@@ -1253,10 +1257,12 @@ void CAProcessNewInterface(CAInterface_t *ifitem)
if (ifitem->family == AF_INET6)
{
OIC_LOG_V(DEBUG, TAG, "Adding a new IPv6 interface(%i) to multicast group", ifitem->index);
applyMulticastToInterface6(ifitem->index);
}
if (ifitem->family == AF_INET)
{
OIC_LOG_V(DEBUG, TAG, "Adding a new IPv4 interface(%i) to multicast group", ifitem->index);
applyMulticastToInterface4(ifitem->index);
}
}
......
......@@ -335,10 +335,15 @@ u_arraylist_t *CAFindInterfaceChange()
}
struct ifinfomsg *ifi = (struct ifinfomsg *)NLMSG_DATA(nh);
if (!ifi)
{
OIC_LOG_V(ERROR, TAG, "ifi is NULL");
return NULL;
}
int ifiIndex = ifi->ifi_index;
if ((!ifi || (ifi->ifi_flags & IFF_LOOPBACK) || !(ifi->ifi_flags & IFF_RUNNING)))
if ((ifi->ifi_flags & IFF_LOOPBACK) || !(ifi->ifi_flags & IFF_RUNNING))
{
bool isFound = CACmpNetworkList(ifiIndex);
if (isFound)
......
......@@ -258,16 +258,20 @@ static void CAFindReadyMessage()
OIC_LOG_V(DEBUG, TAG, "Packet receiver Stop request received.");
return;
}
if (0 >= ret)
if (0 == ret)
{
if (0 > ret)
{
OIC_LOG_V(FATAL, TAG, "select error %s", strerror(errno));
}
return;
}
CASelectReturned(&readFds);
else if (0 < ret)
{
CASelectReturned(&readFds);
}
else // if (0 > ret)
{
OIC_LOG_V(FATAL, TAG, "select error %s", strerror(errno));
return;
}
}
static void CASelectReturned(fd_set *readFds)
......
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