quit as soon as we see IPOPT_EOL;
*don't* quit as soon as we see IPOPT_NOP, just advance to the
next option, if any;
implement "quit" as "return the destination address from the IP
header rather than as "return 0".
Also, return the IP header destination address if we see a
source-routing option with a too-short length.
#ifndef lint
static const char rcsid[] _U_ =
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.128.2.6 2004-03-24 09:01:39 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-ip.c,v 1.128.2.7 2004-06-25 01:21:06 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
#endif
#ifdef HAVE_CONFIG_H
- * If source-routing is present, return the final destination.
+ * If source-routing is present and valid, return the final destination.
* Otherwise, return IP destination.
*
* This is used for UDP and TCP pseudo-header in the checksum
* Otherwise, return IP destination.
*
* This is used for UDP and TCP pseudo-header in the checksum
- if (tt == IPOPT_NOP || tt == IPOPT_EOL)
+ if (tt == IPOPT_EOL)
+ break;
+ else if (tt == IPOPT_NOP)
len = 1;
else {
TCHECK(cp[1]);
len = cp[1];
len = 1;
else {
TCHECK(cp[1]);
len = cp[1];
- }
- if (len < 2) {
- return 0;
}
TCHECK2(*cp, len);
switch (tt) {
}
TCHECK2(*cp, len);
switch (tt) {
case IPOPT_SSRR:
case IPOPT_LSRR:
if (len < 7)
case IPOPT_SSRR:
case IPOPT_LSRR:
if (len < 7)
memcpy(&retval, cp + len - 4, 4);
return retval;
}
}
memcpy(&retval, cp + len - 4, 4);
return retval;
}
}
- return ip->ip_dst.s_addr;
-
+ memcpy(&retval, &ip->ip_dst.s_addr, sizeof(u_int32_t));
+ return retval;