Skip to content

Commit 4adf503

Browse files
author
NorNet Praesum Presum
committed
Options handling improvements.
1 parent c09ba03 commit 4adf503

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/netperfmeter.cc

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -349,22 +349,6 @@ static const char* parseTrafficSpecOption(const char* parameters,
349349
std::cerr << "ERROR: Invalid \"cmt\" setting: " << (const char*)&parameters[4] << "!\n";
350350
exit(1);
351351
}
352-
353-
// ------ Use TCP or MPTCP? -------------------------------------------
354-
if( (trafficSpec.Protocol == IPPROTO_TCP) ||
355-
(trafficSpec.Protocol == IPPROTO_MPTCP) ) {
356-
if(trafficSpec.CMT == NPAF_PRIMARY_PATH) {
357-
trafficSpec.Protocol = IPPROTO_TCP;
358-
}
359-
else {
360-
trafficSpec.Protocol = IPPROTO_MPTCP;
361-
if(trafficSpec.CMT != NPAF_LikeMPTCP) {
362-
std::cerr << "WARNING: Invalid \"cmt\" setting: " << (const char*)&parameters[4]
363-
<< " for MPTCP! Using default instead!\n";
364-
}
365-
}
366-
}
367-
// --------------------------------------------------------------------
368352
}
369353
else if(strncmp(parameters, "ccid=", 5) == 0) {
370354
unsigned int ccid;
@@ -487,7 +471,7 @@ static const char* parseTrafficSpecOption(const char* parameters,
487471
}
488472
congestionControl[i] = 0x00;
489473
if( (parameters[3 + i] != ':') && (parameters[3 + i] != 0x00) ) {
490-
std::cerr << "ERROR: Invalid \"pathmgr\" setting: " << (const char*)&parameters[8]
474+
std::cerr << "ERROR: Invalid \"cc\" setting: " << (const char*)&parameters[8]
491475
<< " - name too long!\n";
492476
exit(1);
493477
}
@@ -498,6 +482,7 @@ static const char* parseTrafficSpecOption(const char* parameters,
498482
std::cerr << "ERROR: Invalid option \"" << parameters << "\"!\n";
499483
exit(1);
500484
}
485+
501486
if(parameters[n] == 0x00) {
502487
return nullptr;
503488
}
@@ -511,7 +496,7 @@ static Flow* createFlow(Flow* previousFlow,
511496
const uint64_t measurementID,
512497
const char* vectorNamePattern,
513498
const OutputFileFormat vectorFileFormat,
514-
const uint8_t initialProtocol,
499+
const int initialProtocol,
515500
const sockaddr_union& remoteAddress)
516501
{
517502
// ====== Get flow ID and stream ID ======================================
@@ -521,6 +506,10 @@ static Flow* createFlow(Flow* previousFlow,
521506
// ====== Get FlowTrafficSpec ============================================
522507
FlowTrafficSpec trafficSpec;
523508
trafficSpec.Protocol = initialProtocol;
509+
if(trafficSpec.Protocol == IPPROTO_MPTCP) {
510+
trafficSpec.CMT = NPAF_LikeMPTCP;
511+
}
512+
524513
if(strncmp(parameters, "default", 7) == 0) {
525514
trafficSpec.OutboundFrameRateRng = RANDOM_CONSTANT;
526515
trafficSpec.OutboundFrameRate[0] = 0.0;
@@ -567,6 +556,17 @@ static Flow* createFlow(Flow* previousFlow,
567556
trafficSpec.Description = format("Flow %u", flowID);
568557
}
569558

559+
// ------ Use TCP or MPTCP? ----------------------------------------------
560+
if( (trafficSpec.Protocol == IPPROTO_TCP) && (trafficSpec.CMT == NPAF_LikeMPTCP) ) {
561+
trafficSpec.Protocol = IPPROTO_MPTCP;
562+
}
563+
if( (trafficSpec.Protocol == IPPROTO_MPTCP) && (trafficSpec.CMT != NPAF_LikeMPTCP) ) {
564+
std::cerr << "WARNING: Invalid \"cmt\" setting: " << (const char*)&parameters[4]
565+
<< " for MPTCP! Using default instead!\n";
566+
exit(1);
567+
}
568+
// -----------------------------------------------------------------------
569+
570570
// ====== Create new flow ================================================
571571
if(FlowManager::getFlowManager()->findFlow(measurementID, flowID, streamID) != nullptr) {
572572
std::cerr << "ERROR: Flow ID " << flowID << " is used twice. Ensure correct id=<ID> parameters!\n";

0 commit comments

Comments
 (0)