Project

General

Profile

Bug #78 » 0001-bug-78.patch

Gurvinder Singh, 02/05/2010 03:52 AM

View differences:

src/app-layer-detect-proto.c
}
uint16_t AppLayerDetectGetProto(AlpProtoDetectCtx *ctx, AlpProtoDetectThreadCtx *tctx, uint8_t *buf, uint16_t buflen, uint8_t flags) {
//printf("AppLayerDetectGetProto: start\n");
SCEnter();
//PrintRawDataFp(stdout, buf, buflen);
//if (buflen < INSPECT_BYTES)
......
uint16_t proto;
uint32_t cnt = mpm_table[dir->mpm_ctx.mpm_type].Scan(&dir->mpm_ctx, &tdir->mpm_ctx, &tdir->pmq, buf, scanlen);
//printf("AppLayerDetectGetProto: scan cnt %" PRIu32 "\n", cnt);
SCLogDebug("scan cnt %" PRIu32 "", cnt);
if (cnt == 0) {
proto = ALPROTO_UNKNOWN;
goto end;
......
break;
}
#endif
return proto;
SCReturnInt(proto);
}
int AppLayerHandleMsg(AlpProtoDetectThreadCtx *dp_ctx, StreamMsg *smsg)
src/stream-tcp-reassemble.c
static void StreamTcpSetupMsg(TcpSession *ssn, TcpStream *stream, Packet *p,
StreamMsg *smsg)
{
SCEnter();
if (stream->ra_base_seq == stream->isn) {
smsg->flags = STREAM_START;
} else if (ssn->state > TCP_ESTABLISHED) {
......
COPY_PORT(p->flow->sp,smsg->data.src_port);
COPY_PORT(p->flow->dp,smsg->data.dst_port);
smsg->flags |= STREAM_TOSERVER;
} else {
COPY_ADDRESS(&p->flow->dst,&smsg->data.src_ip);
COPY_ADDRESS(&p->flow->src,&smsg->data.dst_ip);
COPY_PORT(p->flow->dp,smsg->data.src_port);
COPY_PORT(p->flow->sp,smsg->data.dst_port);
}
/* As we are opposing the stream to handle the ACK, we need to update the
smsg direction accordingly too */
if (stream == &ssn->client) {
smsg->flags |= STREAM_TOSERVER;
SCLogDebug("stream mesage is to_server");
} else {
smsg->flags |= STREAM_TOCLIENT;
SCLogDebug("stream mesage is to_client");
}
smsg->data.data_len = 0;
......
if (smsg->flow != NULL) {
smsg->flow->use_cnt++;
}
SCReturn;
}
/** \brief Check the minimum size limits for reassembly.
(2-2/2)