Fix Packet usage.

This patch suppresses remaining direct access to pkt and pktlen in the
Packet structure.
remotes/origin/master-1.1.x
Eric Leblond 14 years ago committed by Victor Julien
parent 12369b4393
commit 0cf05856d0

@ -370,7 +370,7 @@ TmEcode AlertSyslogDecoderEvent(ThreadVars *tv, Packet *p, void *data,
pa->class_msg, pa->prio);
strlcpy(alert, temp_buf_hdr, sizeof(alert));
PrintRawLineHexBuf(temp_buf_pkt, sizeof(temp_buf_pkt), p->pkt, p->pktlen < 32 ? p->pktlen : 32);
PrintRawLineHexBuf(temp_buf_pkt, sizeof(temp_buf_pkt), GET_PKT_DATA(p), GET_PKT_LEN(p) < 32 ? GET_PKT_LEN(p) : 32);
strlcat(alert, temp_buf_pkt, sizeof(alert));
if (p->pcap_cnt != 0) {

@ -783,7 +783,7 @@ static int Unified2Test01 (void) {
p->alerts.alerts[p->alerts.cnt-1].sid = 1;
p->alerts.alerts[p->alerts.cnt-1].gid = 1;
p->alerts.alerts[p->alerts.cnt-1].rev = 1;
p->pktlen = sizeof(raw_ipv4_tcp);
SET_PKT_LEN(p, sizeof(raw_ipv4_tcp));
FlowInitConfig(FLOW_QUIET);
@ -866,7 +866,7 @@ static int Unified2Test02 (void) {
p->alerts.alerts[p->alerts.cnt-1].sid = 1;
p->alerts.alerts[p->alerts.cnt-1].gid = 1;
p->alerts.alerts[p->alerts.cnt-1].rev = 1;
p->pktlen = sizeof(raw_ipv6_tcp);
SET_PKT_LEN(p, sizeof(raw_ipv6_tcp));
FlowInitConfig(FLOW_QUIET);
@ -955,7 +955,7 @@ static int Unified2Test03 (void) {
p->alerts.alerts[p->alerts.cnt-1].sid = 1;
p->alerts.alerts[p->alerts.cnt-1].gid = 1;
p->alerts.alerts[p->alerts.cnt-1].rev = 1;
p->pktlen = sizeof(raw_gre);
SET_PKT_LEN(p, sizeof(raw_gre));
FlowInitConfig(FLOW_QUIET);
@ -1038,7 +1038,7 @@ static int Unified2Test04 (void) {
p->alerts.alerts[p->alerts.cnt-1].sid = 1;
p->alerts.alerts[p->alerts.cnt-1].gid = 1;
p->alerts.alerts[p->alerts.cnt-1].rev = 1;
p->pktlen = sizeof(raw_ppp);
SET_PKT_LEN(p, sizeof(raw_ppp));
FlowInitConfig(FLOW_QUIET);
@ -1119,7 +1119,7 @@ static int Unified2Test05 (void) {
p->alerts.alerts[p->alerts.cnt-1].sid = 1;
p->alerts.alerts[p->alerts.cnt-1].gid = 1;
p->alerts.alerts[p->alerts.cnt-1].rev = 1;
p->pktlen = sizeof(raw_ipv4_tcp);
SET_PKT_LEN(p, sizeof(raw_ipv4_tcp));
FlowInitConfig(FLOW_QUIET);

@ -94,7 +94,7 @@ static int DecodeRawTest01 (void) {
FlowInitConfig(FLOW_QUIET);
DecodeRaw(&tv, &dtv, p, raw_ip, p->pktlen, NULL);
DecodeRaw(&tv, &dtv, p, raw_ip, GET_PKT_LEN(p), NULL);
if (p->ip6h == NULL) {
printf("expected a valid ipv6 header but it was NULL: ");
FlowShutdown();
@ -140,7 +140,7 @@ static int DecodeRawTest02 (void) {
FlowInitConfig(FLOW_QUIET);
DecodeRaw(&tv, &dtv, p, raw_ip, p->pktlen, NULL);
DecodeRaw(&tv, &dtv, p, raw_ip, GET_PKT_LEN(p), NULL);
FlowShutdown();
if (p->ip4h == NULL) {
printf("expected a valid ipv4 header but it was NULL: ");
@ -186,7 +186,7 @@ static int DecodeRawTest03 (void) {
FlowInitConfig(FLOW_QUIET);
DecodeRaw(&tv, &dtv, p, raw_ip, p->pktlen, NULL);
DecodeRaw(&tv, &dtv, p, raw_ip, GET_PKT_LEN(p), NULL);
if (DECODER_ISSET_EVENT(p,IPRAW_INVALID_IPV)) {
FlowShutdown();
SCFree(p);

@ -172,9 +172,9 @@ static inline uint16_t TCPV6CalculateChecksum(uint16_t *, uint16_t *, uint16_t);
* \brief Calculates the checksum for the TCP packet
*
* \param shdr Pointer to source address field from the IP packet. Used as a
* part of the psuedoheader for computing the checksum
* part of the pseudoheader for computing the checksum
* \param pkt Pointer to the start of the TCP packet
* \param hlen Total length of the TCP packet(header + payload)
* \param tlen Total length of the TCP packet(header + payload)
*
* \retval csum Checksum for the TCP packet
*/

@ -744,7 +744,7 @@ int DetectTagTestPacket03 (void) {
int i = 0;
for (; i < num_packets; i++) {
SigMatchSignatures(&th_v, de_ctx, det_ctx, p[i]);
sum += p[i]->pktlen;
sum += GET_PKT_LEN(p[i]);
//printf("Sum %"PRIu32"\n", sum);
if (UTHCheckPacketMatchResults(p[i], sid, (uint32_t *)&results[i][0], numsigs) == 0)
goto cleanup;
@ -860,7 +860,7 @@ int DetectTagTestPacket04 (void) {
p[i]->flow = &f;
p[i]->flow->protoctx = &ssn;
SigMatchSignatures(&th_v, de_ctx, det_ctx, p[i]);
sum += p[i]->pktlen;
sum += GET_PKT_LEN(p[i]);
//printf("Sum %"PRIu32"\n", sum);
if (UTHCheckPacketMatchResults(p[i], sid, (uint32_t *)&results[i][0], numsigs) == 0)
goto cleanup;

Loading…
Cancel
Save