Warn if sign proto may be followed by padding

For now, we check and tell the user. The actual fix should be for
sign proto to add padding before it's content, if required

Updates #313
This commit is contained in:
Srivats P 2022-06-30 18:24:48 +05:30
parent 2970a292c6
commit 06ad12777f
2 changed files with 14 additions and 2 deletions

View File

@ -145,7 +145,7 @@ void StreamBase::setFrameProtocol(ProtocolList protocolList)
}
#endif
bool StreamBase::hasProtocol(quint32 protocolNumber)
bool StreamBase::hasProtocol(quint32 protocolNumber) const
{
foreach(const AbstractProtocol *proto, *currentFrameProtocols)
if (proto->protocolNumber() == protocolNumber)
@ -681,6 +681,7 @@ quint64 StreamBase::neighborMacAddress(int frameIndex) const
bool StreamBase::preflightCheck(QStringList &result) const
{
bool pass = true;
bool chkShort = true;
bool chkTrunc = true;
bool chkJumbo = true;
int count = isFrameSizeVariable() ? frameSizeVariableCount() : 1;
@ -689,6 +690,17 @@ bool StreamBase::preflightCheck(QStringList &result) const
{
int pktLen = frameLen(i);
if (chkShort && hasProtocol(OstProto::Protocol::kSignFieldNumber)
&& (pktLen > (frameProtocolLength(i) + kFcsSize)))
{
result << QObject::tr("Stream statistics may not work since "
"frame content &lt; 64 bytes and hence will get padded - "
"make sure special signature is at the end of the "
"frame and frame content &ge; 64 bytes");
chkShort = false;
pass = false;
}
if (chkTrunc && (pktLen < (frameProtocolLength(i) + kFcsSize)))
{
result << QObject::tr("One or more frames may be truncated - "

View File

@ -42,7 +42,7 @@ public:
void protoDataCopyFrom(const OstProto::Stream &stream);
void protoDataCopyInto(OstProto::Stream &stream) const;
bool hasProtocol(quint32 protocolNumber);
bool hasProtocol(quint32 protocolNumber) const;
ProtocolListIterator* createProtocolListIterator() const;
//! \todo (LOW) should we have a copy constructor??