It's a follow-up to
c8623960f050cb81c12b31107070021f27f14b18.
The support is now enabled by default. No more "#ifdef GUESS_TSO".
Output example:
length 2016 [was 0, presumed TSO]
Add a test file with presumed TSO.
(From http://cloudshark.org/captures/
25e40f73bc1c, found via
https://osqa-ask.wireshark.org/questions/16279/)
Use ND_ICHECKMSG_U() to test an invalid total length < header length.
Output example:
[total length 19 < 20] (invalid)
Add a test file for this case.
Move ND_TCHECK_SIZE(ip) after the new tests.
Add a const qualifier for the ip_print() parameter 'length'.
Update the man page.
(backported from commit
3465ec4a0c94f3abe774dfdb9874f966403e20ce)
extern void igrp_print(netdissect_options *, const u_char *, u_int);
extern void ip6_print(netdissect_options *, const u_char *, u_int);
extern void ipN_print(netdissect_options *, const u_char *, u_int);
-extern void ip_print(netdissect_options *, const u_char *, u_int);
+extern void ip_print(netdissect_options *, const u_char *, const u_int);
extern void ipcomp_print(netdissect_options *, const u_char *);
extern void ipx_netbios_print(netdissect_options *, const u_char *, u_int);
extern void ipx_print(netdissect_options *, const u_char *, u_int);
void
ip_print(netdissect_options *ndo,
const u_char *bp,
- u_int length)
+ const u_int length)
{
const struct ip *ip;
u_int off;
uint16_t sum, ip_sum;
const char *p_name;
int truncated = 0;
+ int presumed_tso = 0;
ndo->ndo_protocol = "ip";
ip = (const struct ip *)bp;
nd_print_invalid(ndo);
ND_PRINT(" ");
}
- ND_TCHECK_SIZE(ip);
- if (len < hlen) {
-#ifdef GUESS_TSO
- if (len) {
- ND_PRINT("bad-len %u", len);
- return;
- } else {
- /* we guess that it is a TSO send */
- len = length;
- }
-#else
- ND_PRINT("bad-len %u", len);
- return;
-#endif /* GUESS_TSO */
- }
+ if (len == 0) {
+ /* we guess that it is a TSO send */
+ len = length;
+ presumed_tso = 1;
+ } else
+ ND_ICHECKMSG_U("total length", len, <, hlen);
+ ND_TCHECK_SIZE(ip);
/*
* Cut off the snapshot length to the end of the IP payload.
*/
tok2str(ipproto_values, "unknown", ip_proto),
ip_proto);
- ND_PRINT(", length %u", GET_BE_U_2(ip->ip_len));
+ if (presumed_tso)
+ ND_PRINT(", length %u [was 0, presumed TSO]", length);
+ else
+ ND_PRINT(", length %u", GET_BE_U_2(ip->ip_len));
if ((hlen - sizeof(struct ip)) > 0) {
ND_PRINT(", options (");
and \fBDF\fP is reported if F is set. If neither are set, \fB.\fP is
reported.
\fIproto\fP is the protocol ID field.
-\fIlength\fP is the total length field.
+\fIlength\fP is the total length field; if the packet is a presumed TSO
+(TCP Segmentation Offload) send, [was 0, presumed TSO] is reported.
\fIoptions\fP are the IP options, if any.
.LP
Next, for TCP and UDP packets, the source and destination IP addresses
ipv4_invalid_hdr_length ipv4_invalid_hdr_length.pcap ipv4_invalid_hdr_length.out -v
ipv4_invalid_total_length ipv4_invalid_total_length.pcap ipv4_invalid_total_length.out -v
ipv4_tcp_http_xml ipv4_tcp_http_xml.pcap ipv4_tcp_http_xml.out -v
+ipv4_invalid_total_length_2 ipv4_invalid_total_length_2.pcap ipv4_invalid_total_length_2.out -v
+ipv4_tcp_http_xml_tso ipv4_tcp_http_xml_tso.pcap ipv4_tcp_http_xml_tso.out -v
#IPv6 tests
ipv6-bad-version ipv6-bad-version.pcap ipv6-bad-version.out
--- /dev/null
+ 1 08:57:44.621711 IP [total length 19 < 20] (invalid)
--- /dev/null
+ 1 19:50:14.587897 IP (tos 0x0, ttl 128, id 17097, offset 0, flags [DF], proto TCP (6), length 2016 [was 0, presumed TSO], bad cksum 0 (->d8df)!)
+ 30.7.181.121.39556 > 199.43.68.163.8080: Flags [P.], cksum 0xdf55 (incorrect -> 0x9cf2), seq 1891338696:1891340672, ack 727404759, win 256, length 1976: HTTP, length: 1976
+ POST http://gwm-ml-a2.wsodqa.com//research/module-loader/module-loader.asp?user_id=test HTTP/1.1
+ Content-Type: text/xml; charset=utf-8
+ SOAPAction: ""
+ User-Agent: Axis/1.4-LISA
+ lisaFrameRoot: true
+ lisaFrameRemoteIP: 169.254.169.30
+ lisaFrameID: 3ae1f0b0-0293-11e2-aa16-78e7d164f804
+ Host: gwm-ml-a2.wsodqa.com
+ Proxy-Connection: Keep-Alive
+ Content-Length: 1607
+
+ <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetResponse xmlns="http://tempuri.org/"><req><wgt wID="143"><inpt><mxRltm>false</mxRltm><hlds><HoldingsCount>0</HoldingsCount></hlds><wtlsts /><BondType /><IsCollapsed>false</IsCollapsed></inpt></wgt><wgt wID="151"><inpt><mxRltm>false</mxRltm><lnkUrls><url><key>RUN_RIReviewMarketsUI_RevMktNews</key><val>/RIReviewMarketsUI/RevMktNews.aspx</val></url><url><key>RUN_RIReviewMarketsUI_RevMktNewsFullStory</key><val>/RIReviewMarketsUI/RevMktNewsFullStory.aspx</val></url></lnkUrls><BondType /><IsCollapsed>false</IsCollapsed></inpt></wgt><wgt wID="144"><inpt><mxRltm>false</mxRltm><BondType /><IsCollapsed>false</IsCollapsed></inpt></wgt><wgt wID="146"><inpt><mxRltm>false</mxRltm><lnkUrls><url><key>RUN_RIStocksUI_RIStocksOverview</key><val>/RIStocksUI/RIStocksOverview.aspx</val></url><url><key>RUN_RIMutualFundsUI_RIMFOverview</key><val>/RIMutualFundsUI/RIMFOverview.aspx</val></url><url><key>RUN_RIEtfsUI_RIEtfsOverview</key><val>/RIEtfsUI/RIEtfsOverview.aspx</val></url><url><key>RUN_RIOptionsUI_RIOptionsOverview</key><val>/RIOptionsUI/RIOptionsOverview.aspx</val></url></lnkUrls><BondType /><IsCollapsed>false</IsCollapsed></inpt></wgt><wgt wID="145"><inpt><mxRltm>false</mxRltm><BondType /><IsCollapsed>false</IsCollapsed></inpt></wgt><wgt wID="147"><inpt><mxRltm>false</mxRltm><BondType /><IsCollapsed>false</IsCollapsed></inpt></wgt></req></GetResponse></soap:Body></soap:Envelope>