Changeset a8a9355 for lib/trace.c
- Timestamp:
- 10/27/05 14:54:51 (17 years ago)
- Branches:
- 4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
- Children:
- 779d445
- Parents:
- 953c53f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/trace.c
r7c8eacf ra8a9355 508 508 509 509 if (libtrace->format->read_packet) { 510 return libtrace->format->read_packet(libtrace,packet); 511 } 510 return (packet->size=libtrace->format->read_packet(libtrace,packet)); 511 } 512 packet->size=-1; 512 513 return -1; 513 514 } … … 524 525 assert(libtrace); 525 526 assert(packet); 527 /* Verify the packet is valid */ 528 assert(packet->size<65536); 529 assert(packet->size>0); 526 530 527 531 if (libtrace->format->write_packet) { … … 540 544 void *trace_get_link(const struct libtrace_packet_t *packet) { 541 545 const void *ethptr = 0; 546 547 assert(packet->size>0 && packet->size<65536); 542 548 543 549 if (packet->trace->format->get_link) { … … 774 780 struct libtrace_udp *udpptr = 0; 775 781 776 if ((ip->ip_p == 6) && ((ip->ip_off & SW_IP_OFFMASK) == 0)) {782 if ((ip->ip_p == 17) && ((ip->ip_off & SW_IP_OFFMASK) == 0)) { 777 783 udpptr = (struct libtrace_udp *)((ptrdiff_t)ip+ (ip->ip_hl * 4)); 778 784 } … … 884 890 struct timeval ts; 885 891 892 assert(packet->size>0 && packet->size<65536); 893 886 894 if (packet->trace->format->get_erf_timestamp) { 887 895 // timestamp -> timestamp … … 912 920 uint64_t ts = 0; 913 921 double seconds = 0.0; 922 assert(packet->size>0 && packet->size<65536); 914 923 if (packet->trace->format->get_timeval) { 915 924 // timeval -> timeval … … 951 960 uint64_t ts = 0; 952 961 struct timeval tv; 962 963 assert(packet->size>0 && packet->size<65536); 953 964 954 965 if (packet->trace->format->get_seconds) { … … 984 995 int trace_get_capture_length(const struct libtrace_packet_t *packet) { 985 996 997 assert(packet->size>0 && packet->size<65536); 998 986 999 if (packet->trace->format->get_capture_length) { 987 1000 return packet->trace->format->get_capture_length(packet); … … 1000 1013 */ 1001 1014 int trace_get_wire_length(const struct libtrace_packet_t *packet){ 1015 assert(packet->size>0 && packet->size<65536); 1016 1002 1017 if (packet->trace->format->get_wire_length) { 1003 1018 return packet->trace->format->get_wire_length(packet); … … 1204 1219 int8_t trace_set_direction(struct libtrace_packet_t *packet, int8_t direction) { 1205 1220 assert(packet); 1221 assert(packet->size>0 && packet->size<65536); 1206 1222 if (packet->trace->format->set_direction) { 1207 1223 return packet->trace->format->set_direction(packet,direction); … … 1221 1237 int8_t trace_get_direction(const struct libtrace_packet_t *packet) { 1222 1238 assert(packet); 1239 assert(packet->size>0 && packet->size<65536); 1223 1240 if (packet->trace->format->get_direction) { 1224 1241 return packet->trace->format->get_direction(packet); … … 1394 1411 size_t trace_set_capture_length(struct libtrace_packet_t *packet, size_t size) { 1395 1412 assert(packet); 1413 assert(packet->size>0 && packet->size<65536); 1396 1414 1397 1415 if (packet->trace->format->set_capture_length) {
Note: See TracChangeset
for help on using the changeset viewer.