Commit 550efad2 authored by Omkar Hegde's avatar Omkar Hegde Committed by Erich Keane

Removing unnecessary use of IPV6 flags.

Previously, default flags were interpreted as both
IPv4 and IPv6 and "[ ]" was added around the IP address
in presence uri. This was wrong for IPv4. Changing the
addition of brackets exclusive to IPv6 and removing IPv6
flag from caipserver since it is not supported yet.

Change-Id: Ic103f9f0f10dcda3252e95404bc6f1a19d56597b
Signed-off-by: default avatarOmkar Hegde <omkar.m.hegde@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1653Reviewed-by: default avatarErich Keane <erich.keane@intel.com>
Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
parent 4cdd52ff
......@@ -266,7 +266,7 @@ static void CAReceiveHandler(void *data)
CAEndpoint_t ep;
strncpy(ep.addr, srcIPAddress, MAX_ADDR_STR_SIZE_CA);
ep.port = srcPort;
ep.flags = (CATransportFlags_t)CA_IPV4 | CA_IPV6;
ep.flags = (CATransportFlags_t)CA_IPV4;
ep.adapter = CA_ADAPTER_IP;
if (info->endpoint.flags & CA_SECURE)
......
......@@ -733,7 +733,7 @@ static int FormCanonicalPresenceUri(const CAEndpoint_t *endpoint, char *resource
const char *format;
if (endpoint->flags & CA_IPV6)
if ((endpoint->flags & CA_IPV6) && !(endpoint->flags & CA_IPV4))
{
format = "coap://[%s]:%u%s";
}
......@@ -784,8 +784,18 @@ OCStackResult HandlePresenceResponse(const CAEndpoint_t *endpoint,
}
else
{
snprintf (presenceUri, MAX_URI_LENGTH, "coap://[%s]:%u%s", OC_MULTICAST_IP,
OC_MULTICAST_PORT, OC_RSRVD_PRESENCE_URI);
CAEndpoint_t endpointMulticast;
endpointMulticast.flags = endpoint->flags;
OICStrcpy(endpointMulticast.addr, sizeof(endpointMulticast.addr), OC_MULTICAST_IP);
endpointMulticast.port = OC_MULTICAST_PORT;
uriLen = FormCanonicalPresenceUri(&endpointMulticast, OC_RSRVD_PRESENCE_URI, presenceUri);
if (uriLen < 0 || uriLen >= sizeof (presenceUri))
{
return OC_STACK_INVALID_URI;
}
cbNode = GetClientCB(NULL, 0, NULL, presenceUri);
if (cbNode)
{
......
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