Commit 274a2250 authored by kfox's avatar kfox

BugzId: 177

parent 60a84746
......@@ -61,6 +61,10 @@ set(LIBATHENA_ETH_SOURCE_FILES
athena_TransportLinkModuleETH.c
)
set(LIBATHENA_ETH1990_SOURCE_FILES
athena_TransportLinkModuleETH1990.c
)
set(LIBATHENA_TEMPLATE_SOURCE_FILES
athena_TransportLinkModuleTEMPLATE.c
)
......@@ -86,6 +90,7 @@ source_group(Sources FILES ${ATHENA_SOURCE_FILES})
source_group(Sources FILES ${LIBATHENA_TCP_SOURCE_FILES})
source_group(Sources FILES ${LIBATHENA_UDP_SOURCE_FILES})
source_group(Sources FILES ${LIBATHENA_ETH_SOURCE_FILES})
source_group(Sources FILES ${LIBATHENA_ETH1990_SOURCE_FILES})
source_group(Sources FILES ${LIBATHENA_TEMPLATE_SOURCE_FILES})
add_library(athena_ETH.shared SHARED ${LIBATHENA_ETH_SOURCE_FILES})
......@@ -95,6 +100,13 @@ set_target_properties(athena_ETH.shared PROPERTIES
VERSION 1.0
OUTPUT_NAME athena_ETH )
add_library(athena_ETH1990.shared SHARED ${LIBATHENA_ETH1990_SOURCE_FILES})
set_target_properties(athena_ETH1990.shared PROPERTIES
C_STANDARD 99
SOVERSION 1
VERSION 1.0
OUTPUT_NAME athena_ETH1990 )
add_library(athena_TEMPLATE.shared SHARED ${LIBATHENA_TEMPLATE_SOURCE_FILES})
set_target_properties(athena_TEMPLATE.shared PROPERTIES
C_STANDARD 99
......@@ -107,6 +119,7 @@ set(athena_libraries
athena_TCP.shared
athena_UDP.shared
athena_ETH.shared
athena_ETH1990.shared
athena_TEMPLATE.shared
)
......
......@@ -660,6 +660,7 @@ athenaTransportLinkAdapter_Poll(AthenaTransportLinkAdapter *athenaTransportLinkA
}
}
}
events += result;
}
result = poll(pollfdSendList, pollfdListSize, 0);
......
......@@ -468,18 +468,20 @@ _ETHReceiveMessage(AthenaTransportLink *athenaTransportLink, struct ether_addr *
parcBuffer_SetPosition(message, sizeof(struct ether_header));
PARCBuffer *wireFormatBuffer = parcBuffer_Slice(message);
parcBuffer_Release(&message);
parcBuffer_SetPosition(wireFormatBuffer, 0);
// Construct, and return a ccnxMetaMessage from the wire format buffer.
ccnxMetaMessage = ccnxMetaMessage_CreateFromWireFormatBuffer(wireFormatBuffer);
if (ccnxMetaMessage == NULL) {
linkData->_stats.receive_DecodeFailed++;
parcLog_Error(athenaTransportLink_GetLogger(athenaTransportLink), "Failed to decode message from received packet.");
} else if (ccnxTlvDictionary_GetSchemaVersion(ccnxMetaMessage) == CCNxTlvDictionary_SchemaVersion_V0) {
parcLog_Debug(athenaTransportLink_GetLogger(athenaTransportLink),
"received deprecated version %d message\n", ccnxTlvDictionary_GetSchemaVersion(ccnxMetaMessage));
if (wireFormatBuffer != NULL) {
// Construct, and return a ccnxMetaMessage from the wire format buffer.
parcBuffer_SetPosition(wireFormatBuffer, 0);
ccnxMetaMessage = ccnxMetaMessage_CreateFromWireFormatBuffer(wireFormatBuffer);
if (ccnxMetaMessage == NULL) {
linkData->_stats.receive_DecodeFailed++;
parcLog_Error(athenaTransportLink_GetLogger(athenaTransportLink), "Failed to decode message from received packet.");
} else if (ccnxTlvDictionary_GetSchemaVersion(ccnxMetaMessage) == CCNxTlvDictionary_SchemaVersion_V0) {
parcLog_Debug(athenaTransportLink_GetLogger(athenaTransportLink),
"received deprecated version %d message\n", ccnxTlvDictionary_GetSchemaVersion(ccnxMetaMessage));
}
parcBuffer_Release(&wireFormatBuffer);
}
parcBuffer_Release(&wireFormatBuffer);
return ccnxMetaMessage;
}
......@@ -537,6 +539,17 @@ _ETHOpenConnection(AthenaTransportLinkModule *athenaTransportLinkModule, const c
return NULL;
}
if (mtu) {
linkData->link.mtu = mtu;
if (mtu > athenaEthernet_GetMTU(linkData->athenaEthernet)) {
parcLog_Warning(athenaTransportLinkModule_GetLogger(athenaTransportLinkModule),
"Setting mtu larger than transport allows (%d > %d)", mtu,
athenaEthernet_GetMTU(linkData->athenaEthernet));
}
} else {
linkData->link.mtu = athenaEthernet_GetMTU(linkData->athenaEthernet);
}
// Use our default MAC address if none specified.
if (source == NULL) {
athenaEthernet_GetMAC(linkData->athenaEthernet, &(linkData->link.myAddress));
......@@ -624,6 +637,17 @@ _ETHOpenListener(AthenaTransportLinkModule *athenaTransportLinkModule, const cha
return NULL;
}
if (mtu) {
linkData->link.mtu = mtu;
if (mtu > athenaEthernet_GetMTU(linkData->athenaEthernet)) {
parcLog_Warning(athenaTransportLinkModule_GetLogger(athenaTransportLinkModule),
"Setting mtu larger than transport allows (%d > %d)", mtu,
athenaEthernet_GetMTU(linkData->athenaEthernet));
}
} else {
linkData->link.mtu = athenaEthernet_GetMTU(linkData->athenaEthernet);
}
// Use specified source MAC address, or default to device MAC
if (source) {
memcpy(&(linkData->link.myAddress), source, sizeof(struct ether_addr));
......
This diff is collapsed.
......@@ -306,7 +306,11 @@ athenaEthernet_Send(AthenaEthernet *athenaEthernet, struct iovec *iov, int iovcn
writeCount = writev(athenaEthernet->fd, iov, iovcnt);
parcLog_Debug(athenaEthernet->log, "sending message (size=%d)", writeCount);
if (writeCount == -1) {
parcLog_Error(athenaEthernet->log, "writev: %s", strerror(errno));
} else {
parcLog_Debug(athenaEthernet->log, "sending message (size=%d)", writeCount);
}
return writeCount;
}
......
......@@ -3,24 +3,23 @@ add_definitions(--coverage)
set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} " --coverage")
set(TestsExpectedToPass
test_athena
test_athena_FIB
test_athena_PIT
test_athena_TransportLinkAdapter
test_athena_TransportLink
test_athena_TransportLinkModule
test_athena_TransportLinkModuleTCP
test_athena_TransportLinkModuleUDP
test_athena_TransportLinkModuleETH
test_athena_TransportLinkModuleTEMPLATE
test_athena_ContentStore
test_athena_LRUContentStore
test_athena_InterestControl
test_athenactl
test_athena
test_athena_FIB
test_athena_PIT
test_athena_TransportLinkAdapter
test_athena_TransportLink
test_athena_TransportLinkModule
test_athena_TransportLinkModuleTCP
test_athena_TransportLinkModuleUDP
test_athena_TransportLinkModuleETH
test_athena_TransportLinkModuleETH1990
test_athena_TransportLinkModuleTEMPLATE
test_athena_ContentStore
test_athena_LRUContentStore
test_athena_InterestControl
test_athenactl
)
foreach(test ${TestsExpectedToPass})
AddTest(${test})
AddTest(${test})
endforeach()
......@@ -274,8 +274,6 @@ LONGBOW_TEST_CASE(Global, athenaTransportLinkModuleETH_SendReceive)
assertNotNull(resultVector, "athenaTransportLinkAdapter_Send failed");
assertTrue(parcBitVector_NumberOfBitsSet(resultVector) != 0, "athenaTransportLinkAdapter_Send failed");
parcBitVector_Release(&resultVector);
parcBitVector_Release(&sendVector);
ccnxMetaMessage_Release(&ccnxMetaMessage);
// Allow a context switch for the sends to complete
......@@ -303,6 +301,25 @@ LONGBOW_TEST_CASE(Global, athenaTransportLinkModuleETH_SendReceive)
parcBitVector_Release(&resultVector);
ccnxMetaMessage_Release(&ccnxMetaMessage);
// Try to send a large (>mtu) message
name = ccnxName_CreateFromCString("lci:/foo/bar");
ccnxMetaMessage = ccnxInterest_CreateSimple(name);
ccnxName_Release(&name);
size_t largePayloadSize = 8192 * 7;
char largePayload[largePayloadSize];
PARCBuffer *payload = parcBuffer_Wrap((void *)largePayload, largePayloadSize, 0, largePayloadSize);
ccnxInterest_SetPayload(ccnxMetaMessage, payload);
athena_EncodeMessage(ccnxMetaMessage);
resultVector = athenaTransportLinkAdapter_Send(athenaTransportLinkAdapter, ccnxMetaMessage, sendVector);
assertTrue(parcBitVector_NumberOfBitsSet(resultVector) == 0, "athenaTransportLinkAdapter_Send should have failed to send a large message");
parcBuffer_Release(&payload);
parcBitVector_Release(&sendVector);
parcBitVector_Release(&resultVector);
ccnxMetaMessage_Release(&ccnxMetaMessage);
// Close one end of the connection
int closeResult = athenaTransportLinkAdapter_CloseByName(athenaTransportLinkAdapter, "ETHListener");
assertTrue(closeResult == 0, "athenaTransportLinkAdapter_CloseByName failed (%s)", strerror(errno));
......
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