diff options
author | micpapal <micpapal+fdio@cisco.com> | 2018-02-16 05:31:44 -0800 |
---|---|---|
committer | micpapal <micpapal+fdio@cisco.com> | 2018-02-16 05:31:44 -0800 |
commit | 388494ae04bcbc9448547d3dcb5eab0a82d56ff3 (patch) | |
tree | 758eb228b9d043f68719bf85a520c87d4d0f19bb /metis | |
parent | d92759bde48a830bd87498ee95c85cf2b8184c9c (diff) |
corrected bug with pathlabel
Change-Id: Iab04f89b71c905f7f2ad55576f18b00c13ae6b7f
Signed-off-by: micpapal <micpapal+fdio@cisco.com>
Diffstat (limited to 'metis')
6 files changed, 54 insertions, 1 deletions
diff --git a/metis/ccnx/forwarder/metis/core/metis_Connection.c b/metis/ccnx/forwarder/metis/core/metis_Connection.c index c3f28e14..560c75b4 100644 --- a/metis/ccnx/forwarder/metis/core/metis_Connection.c +++ b/metis/ccnx/forwarder/metis/core/metis_Connection.c @@ -210,7 +210,13 @@ metisConnection_ReSend(const MetisConnection *conn, MetisMessage *message) //message has the same path label. However it could be a good idea to remove the path label //so that raaqm will discard this packet for the RTT estimation. - return metisIoOperations_Send(conn->ops, NULL, message); + //NEED here to recompute the path label (to avoid wrong path labeling, due to PIT aggregation) + uint8_t connectionId = (uint8_t) metisConnection_GetConnectionId(conn); + int old_label = metisMessage_GetPathLabel(message); + metisMessage_UpdatePathLabel(message, connectionId); + bool ret = metisIoOperations_Send(conn->ops, NULL, message); + metisMessage_SetPathLabel(message, (uint8_t)old_label); + return ret; } return false; } diff --git a/metis/ccnx/forwarder/metis/core/metis_Message.c b/metis/ccnx/forwarder/metis/core/metis_Message.c index 77295476..aa20d9a3 100644 --- a/metis/ccnx/forwarder/metis/core/metis_Message.c +++ b/metis/ccnx/forwarder/metis/core/metis_Message.c @@ -694,6 +694,20 @@ metisMessage_ResetPathLabel(MetisMessage *message) assertNotNull(message, "Parameter must be non-null"); metisTlvSkeleton_ResetPathLabel(&message->skeleton); } +int +metisMessage_GetPathLabel(MetisMessage *message) +{ + assertNotNull(message, "Parameter must be non-null"); + return metisTlvSkeleton_GetPathLabelValue(&message->skeleton); +} + +void +metisMessage_SetPathLabel(MetisMessage *message, uint8_t pathLabel) +{ + assertNotNull(message, "Parameter must be non-null"); + return metisTlvSkeleton_SetPathLabelValue(&message->skeleton, pathLabel); +} + MetisMessagePacketType metisMessage_GetType(const MetisMessage *message) diff --git a/metis/ccnx/forwarder/metis/core/metis_Message.h b/metis/ccnx/forwarder/metis/core/metis_Message.h index 3b954a4e..a609ac59 100644 --- a/metis/ccnx/forwarder/metis/core/metis_Message.h +++ b/metis/ccnx/forwarder/metis/core/metis_Message.h @@ -236,6 +236,8 @@ MetisMessagePacketType metisMessage_GetType(const MetisMessage *message); bool metisMessage_HasHopLimit(const MetisMessage *message); void metisMessage_UpdatePathLabel(MetisMessage *message, uint8_t outFace); +void metisMessage_SetPathLabel(MetisMessage *message, uint8_t outFace); +int metisMessage_GetPathLabel(MetisMessage *message); void metisMessage_ResetPathLabel(MetisMessage *message); /** diff --git a/metis/ccnx/forwarder/metis/processor/metis_MessageProcessor.c b/metis/ccnx/forwarder/metis/processor/metis_MessageProcessor.c index 26e67761..0451f633 100644 --- a/metis/ccnx/forwarder/metis/processor/metis_MessageProcessor.c +++ b/metis/ccnx/forwarder/metis/processor/metis_MessageProcessor.c @@ -734,11 +734,13 @@ metisMessageProcessor_ForwardToNexthops(MetisMessageProcessor *processor, MetisM size_t length = metisNumberSet_Length(nexthops); unsigned ingressId = metisMessage_GetIngressConnectionId(message); + int old_label = metisMessage_GetPathLabel(message); for (size_t i = 0; i < length; i++) { unsigned egressId = metisNumberSet_GetItem(nexthops, i); if (egressId != ingressId) { forwardedCopies++; metisMessageProcessor_ForwardToInterfaceId(processor, message, egressId); + metisMessage_SetPathLabel(message, (uint8_t)old_label); } } return forwardedCopies; diff --git a/metis/ccnx/forwarder/metis/tlv/metis_TlvSkeleton.c b/metis/ccnx/forwarder/metis/tlv/metis_TlvSkeleton.c index ce479ce5..bc201dc9 100644 --- a/metis/ccnx/forwarder/metis/tlv/metis_TlvSkeleton.c +++ b/metis/ccnx/forwarder/metis/tlv/metis_TlvSkeleton.c @@ -280,6 +280,33 @@ metisTlvSkeleton_UpdateHopLimit(MetisTlvSkeleton *opaque, uint8_t hoplimit) return updated; } +int +metisTlvSkeleton_GetPathLabelValue(MetisTlvSkeleton *opaque) +{ + _InternalSkeleton *skeleton = (_InternalSkeleton *) opaque; + int label = -1; + if (!metisTlvExtent_Equals(&skeleton->array[INDEX_PATHLABEL], &metisTlvExtent_NotFound)) { + if (skeleton->array[INDEX_PATHLABEL].length == 1) { + uint8_t *value = skeleton->packet + skeleton->array[INDEX_PATHLABEL].offset; + label = *value; + } + } + return label; +} + +void +metisTlvSkeleton_SetPathLabelValue(MetisTlvSkeleton *opaque, uint8_t pathLabel) +{ + _InternalSkeleton *skeleton = (_InternalSkeleton *) opaque; + if (!metisTlvExtent_Equals(&skeleton->array[INDEX_PATHLABEL], &metisTlvExtent_NotFound)) { + if (skeleton->array[INDEX_PATHLABEL].length == 1) { + uint8_t *value = skeleton->packet + skeleton->array[INDEX_PATHLABEL].offset; + *value = pathLabel; + } + } +} + + bool metisTlvSkeleton_UpdatePathLabel(MetisTlvSkeleton *opaque, uint8_t outFace) { diff --git a/metis/ccnx/forwarder/metis/tlv/metis_TlvSkeleton.h b/metis/ccnx/forwarder/metis/tlv/metis_TlvSkeleton.h index 7e4eb603..61910262 100644 --- a/metis/ccnx/forwarder/metis/tlv/metis_TlvSkeleton.h +++ b/metis/ccnx/forwarder/metis/tlv/metis_TlvSkeleton.h @@ -361,6 +361,8 @@ bool metisTlvSkeleton_UpdateHopLimit(MetisTlvSkeleton *skeleton, uint8_t hoplimi void metisTlvSkeleton_SetPathLabel(MetisTlvSkeleton *skeleton, size_t offset, size_t length); bool metisTlvSkeleton_UpdatePathLabel(MetisTlvSkeleton *opaque, uint8_t outFace); bool metisTlvSkeleton_ResetPathLabel(MetisTlvSkeleton *opaque); +int metisTlvSkeleton_GetPathLabelValue(MetisTlvSkeleton *opaque); +void metisTlvSkeleton_SetPathLabelValue(MetisTlvSkeleton *opaque, uint8_t pathLabel); // ==================================== // Getters |