diff options
author | Mauro Sardara <msardara+fdio@cisco.com> | 2017-03-06 15:00:04 +0100 |
---|---|---|
committer | Mauro Sardara <msardara+fdio@cisco.com> | 2017-03-06 14:31:11 +0000 |
commit | e1bda5c0821c3aae2e1609ba752fdb9f06a6dfb4 (patch) | |
tree | 28884c6b54c6b562311c72122c1d8a501b76b899 | |
parent | 65be9187da4b2fd67b79d2b28162b83ec2fd59bc (diff) |
This commit solves some little bugs in the iPing application.
1) The client sends to the server a name containing (among the other things) the size of the ContentObject the server has to reply to the client.
The problem is that the Server is expecting to find this size always at the same position in the name inside the interest; if the client sends an interest with a name that matches the FIB but is not exactly the name the server is expecting (e.g. ccnx:/ping/a instead if ccnx:/ping), the server reads the wrong segment (not the one with the size) and sends out a content object with an undefined size.
2) The maximum payload size of a content object is 64000. This causes fragmented packets to not be processed by the forwarder itself if they are coming from a remote connection. A quick fix consists in setting the max payload size of a content object to 1400.
So the max size of a content object should be 1400 and not 64000.
Change-Id: Ib555b7beb3cfe9172904bd63b8e3a76fe3f71a50
Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
-rw-r--r-- | apps/iping/iPing_Common.c | 2 | ||||
-rw-r--r-- | apps/iping/iPing_Common.h | 5 | ||||
-rw-r--r-- | apps/iping/iPing_Server.c | 7 |
3 files changed, 8 insertions, 6 deletions
diff --git a/apps/iping/iPing_Common.c b/apps/iping/iPing_Common.c index ec4fae69..9cc53559 100644 --- a/apps/iping/iPing_Common.c +++ b/apps/iping/iPing_Common.c @@ -22,7 +22,7 @@ #include <parc/security/parc_IdentityFile.h> const size_t ccnxPing_DefaultReceiveTimeoutInUs = 1000000; // 1 second -const size_t ccnxPing_DefaultPayloadSize = 4096; +const size_t ccnxPing_DefaultPayloadSize = 1400; const size_t mediumNumberOfPings = 100; const size_t smallNumberOfPings = 10; diff --git a/apps/iping/iPing_Common.h b/apps/iping/iPing_Common.h index 1ffd15a1..df91186b 100644 --- a/apps/iping/iPing_Common.h +++ b/apps/iping/iPing_Common.h @@ -37,9 +37,10 @@ extern const size_t ccnxPing_DefaultPayloadSize; /** * The maximum size of a content object payload. - * 64KB is the limit imposed by the packet structure + * 64KB is the limit imposed by the packet structure. + * Here we limit the max Payload Size to 1400 bytes. */ -#define ccnxPing_MaxPayloadSize 64000 +#define ccnxPing_MaxPayloadSize 1400 /** * A default "medium" number of messages to send. diff --git a/apps/iping/iPing_Server.c b/apps/iping/iPing_Server.c index 199823d5..d3e5211c 100644 --- a/apps/iping/iPing_Server.c +++ b/apps/iping/iPing_Server.c @@ -101,7 +101,7 @@ static void _ccnxPingServer_Run(CCNxPingServer *server) { size_t yearInSeconds = 60 * 60 * 24 * 365; - size_t sizeIndex = ccnxName_GetSegmentCount(server->prefix) + 1; + size_t sizeIndex; if (ccnxPortal_Listen(server->portal, server->prefix, yearInSeconds, CCNxStackTimeout_Never)) { while (true) { @@ -117,6 +117,7 @@ static void _ccnxPingServer_Run(CCNxPingServer *server) { CCNxName *interestName = ccnxInterest_GetName(interest); // Extract the size of the payload response from the client + sizeIndex = ccnxName_GetSegmentCount(interestName) - 2; CCNxNameSegment *sizeSegment = ccnxName_GetSegment(interestName, sizeIndex); char *segmentString = ccnxNameSegment_ToString(sizeSegment); int size = atoi(segmentString); @@ -152,13 +153,13 @@ static void _displayUsage(char *progName) { printf(" %s -h\n", progName); printf("\n"); printf("Example:\n"); - printf(" ccnxPing_Server -l ccnx:/some/prefix -s 4096\n"); + printf(" ccnxPing_Server -l ccnx:/some/prefix -s 1400\n"); printf("\n"); printf("Options:\n"); printf(" -h (--help) Show this help message\n"); printf(" -l (--locator) Set the locator for this server. The default is 'ccnx:/locator'. \n"); printf( - " -s (--size) Set the payload size (less than 64000 - see `ccnxPing_MaxPayloadSize` in ccnxPing_Common.h)\n"); + " -s (--size) Set the payload size (less than 1400 - see `ccnxPing_MaxPayloadSize` in ccnxPing_Common.h)\n"); } /** |