Changeset c2afda6
- Timestamp:
- 01/21/10 10:10:46 (11 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:
- 1481ba7
- Parents:
- b5a23b3
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/protocols_l3.c
r59751a5 rc2afda6 47 47 48 48 if (!ret || ethertype!=TRACE_ETHERTYPE_IPV6) 49 return NULL; 50 51 /* Make sure we have at least the base IPv6 header */ 52 if (remaining < sizeof(libtrace_ip6_t)) 49 53 return NULL; 50 54 … … 247 251 * with these packets 248 252 */ 253 254 /* Ensure that optlen is not greater than the 255 * amount of buffer remaining */ 256 if (*optlen > *len) 257 return 0; 258 249 259 (*len)-=*optlen; 250 260 (*data)=(*ptr+2); -
lib/protocols_transport.c
rf0fa090 rc2afda6 46 46 DLLEXPORT libtrace_tcp_t *trace_get_tcp(libtrace_packet_t *packet) { 47 47 uint8_t proto; 48 uint32_t rem = 0; 48 49 libtrace_tcp_t *tcp; 49 50 50 tcp=(libtrace_tcp_t*)trace_get_transport(packet,&proto, NULL);51 tcp=(libtrace_tcp_t*)trace_get_transport(packet,&proto,&rem); 51 52 52 53 if (!tcp || proto != TRACE_IPPROTO_TCP) 54 return NULL; 55 56 /* We should return NULL if there isn't a full TCP header, because the 57 * caller has no way of telling how much of a TCP header we have 58 * returned - use trace_get_transport() if you want to deal with 59 * partial headers 60 * 61 * NOTE: We're not going to insist that all the TCP options are present 62 * as well, because lots of traces are snapped after 20 bytes of TCP 63 * header and I don't really want to break libtrace programs that 64 * use this function to process those traces */ 65 66 if (rem < sizeof(libtrace_tcp_t)) 53 67 return NULL; 54 68 … … 70 84 DLLEXPORT libtrace_udp_t *trace_get_udp(libtrace_packet_t *packet) { 71 85 uint8_t proto; 86 uint32_t rem = 0; 72 87 libtrace_udp_t *udp; 73 88 74 udp=(libtrace_udp_t*)trace_get_transport(packet,&proto, NULL);89 udp=(libtrace_udp_t*)trace_get_transport(packet,&proto,&rem); 75 90 76 91 if (!udp || proto != TRACE_IPPROTO_UDP) 92 return NULL; 93 94 /* Make sure we return a full UDP header as the caller has no way of 95 * telling how much of the packet is remaining */ 96 if (rem < sizeof(libtrace_udp_t)) 77 97 return NULL; 78 98 … … 94 114 DLLEXPORT libtrace_icmp_t *trace_get_icmp(libtrace_packet_t *packet) { 95 115 uint8_t proto; 116 uint32_t rem = 0; 96 117 libtrace_icmp_t *icmp; 97 118 98 icmp=(libtrace_icmp_t*)trace_get_transport(packet,&proto, NULL);119 icmp=(libtrace_icmp_t*)trace_get_transport(packet,&proto,&rem); 99 120 100 121 if (!icmp || proto != TRACE_IPPROTO_ICMP) 122 return NULL; 123 124 /* Make sure we return a full ICMP header as the caller has no way of 125 * telling how much of the packet is remaining */ 126 if (rem < sizeof(libtrace_icmp_t)) 101 127 return NULL; 102 128
Note: See TracChangeset
for help on using the changeset viewer.