summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSudipto <sudipto.bal@samsung.com>2020-06-19 22:28:06 +0530
committerSudipto <sudipto.bal@samsung.com>2020-06-19 22:28:14 +0530
commit10964d1a88ca6d940aad793653bfea7b460a0a1f (patch)
treee6f50a651405c4938b4628f75e81b8ffb368e55b
parent17b7414f6f5fbab35a1f0cc143f0ec3ab4808eb1 (diff)
downloadiotivity-10964d1a88ca6d940aad793653bfea7b460a0a1f.tar.gz
iotivity-10964d1a88ca6d940aad793653bfea7b460a0a1f.tar.bz2
iotivity-10964d1a88ca6d940aad793653bfea7b460a0a1f.zip
[CONPRO-1583]Enable Duplicate Ipv4/Ipv6 packets through build flag.
https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/697 (cherry-picked from 5f16b1a9e8aa57e535d3bdf7a7e318a8c3b557ff) Change-Id: I9188df1161d97302a837af2aeec76d0ee0a72592 Signed-off-by: Kush <kush.agrawal@samsung.com> Signed-off-by: Sudipto <sudipto.bal@samsung.com>
-rwxr-xr-xbuild_common/SConscript4
-rw-r--r--resource/csdk/connectivity/src/camessagehandler.c17
2 files changed, 19 insertions, 2 deletions
diff --git a/build_common/SConscript b/build_common/SConscript
index 6dc7f19a6..ed663ef01 100755
--- a/build_common/SConscript
+++ b/build_common/SConscript
@@ -140,6 +140,7 @@ help_vars.Add(EnumVariable('PLATFORM_TLS', 'Use platform tls instead of local mb
help_vars.Add(EnumVariable('OIC_SUPPORT_TIZEN_TRACE', 'Tizen Trace(T-trace) api availability', 'False', allowed_values=('True', 'False')))
help_vars.Add(BoolVariable('WITH_PROCESS_EVENT','Build including process event logics in ocstack', 'False'))
help_vars.Add(BoolVariable('DISABLE_AUTO_TCP_NSPROVIDER_DISCOVERY', 'Disable auto-discovery of NSProvider over TCP for TCP connected events', False))
+help_vars.Add(BoolVariable('ENABLE_DUP','Enable duplicate IPv4/IPv6 packets', 'False'))
AddOption('--prefix',
dest='prefix',
type='string',
@@ -385,6 +386,9 @@ if env.get('WITH_PROCESS_EVENT'):
if env.get('DISABLE_AUTO_TCP_NSPROVIDER_DISCOVERY'):
env.AppendUnique(CPPDEFINES = ['DISABLE_AUTO_TCP_NSPROVIDER_DISCOVERY'])
+if env.get('ENABLE_DUP'):
+ env.AppendUnique(CPPDEFINES = ['ENABLE_DUP'])
+
libs = []
if env.get('SECURED') == '1':
defines.append('-D__WITH_DTLS__=1')
diff --git a/resource/csdk/connectivity/src/camessagehandler.c b/resource/csdk/connectivity/src/camessagehandler.c
index da4320d30..ab515be57 100644
--- a/resource/csdk/connectivity/src/camessagehandler.c
+++ b/resource/csdk/connectivity/src/camessagehandler.c
@@ -768,7 +768,16 @@ static bool CADropSecondMessage(CAHistory_t *history, const CAEndpoint_t *ep, ui
{
CAHistoryItem_t *item = &(history->items[i]);
if (id == item->messageId && tokenLength == item->tokenLength
- && memcmp(item->token, token, tokenLength) == 0)
+#ifndef ENABLE_DUP
+ && ep->ifindex == item->ifindex && memcmp(item->token, token, tokenLength) == 0)
+ {
+ OIC_LOG_V(INFO, TAG, "IPv%c duplicate message ignored",
+ familyFlags & CA_IPV6 ? '6' : '4');
+ ret = true;
+ break;
+ }
+#else
+ && memcmp(item->token, token, tokenLength) == 0)
{
if ((familyFlags ^ item->flags) == CA_IPFAMILY_MASK)
{
@@ -777,11 +786,15 @@ static bool CADropSecondMessage(CAHistory_t *history, const CAEndpoint_t *ep, ui
ret = true;
break;
}
- }
+ }
+#endif
}
history->items[history->nextIndex].flags = familyFlags;
history->items[history->nextIndex].messageId = id;
+#ifndef ENABLE_DUP
+ history->items[history->nextIndex].ifindex = ep->ifindex;
+#endif
if (token && tokenLength)
{
memcpy(history->items[history->nextIndex].token, token, tokenLength);