summaryrefslogtreecommitdiffstats
path: root/sbin/ping
diff options
context:
space:
mode:
authormaxim <maxim@FreeBSD.org>2003-04-14 08:34:14 +0000
committermaxim <maxim@FreeBSD.org>2003-04-14 08:34:14 +0000
commitda1c42b4c0ecd653522d657a51eec4ef70210524 (patch)
treefdd4e412161fd7e295b8afaeda44479eb0ff76f5 /sbin/ping
parente27444e9974c97118445b1fef7aa490c2f53841c (diff)
downloadFreeBSD-src-da1c42b4c0ecd653522d657a51eec4ef70210524.zip
FreeBSD-src-da1c42b4c0ecd653522d657a51eec4ef70210524.tar.gz
o Skip timestamp part when checking payload.
PR: bin/50909 Submitted by: Barney Wolff <barney@lab.databus.com>
Diffstat (limited to 'sbin/ping')
-rw-r--r--sbin/ping/ping.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 1660760..a665048 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -1012,8 +1012,14 @@ pr_pack(buf, cc, from, tv)
cp = (u_char*)&icp->icmp_data[phdr_len];
dp = &outpack[MINICMPLEN + phdr_len];
cc -= ICMP_MINLEN + phdr_len;
- for (i = phdr_len; i < datalen && cc != 0;
- ++i, ++cp, ++dp, cc--) {
+ i = 0;
+ if (timing) { /* don't check variable timestamp */
+ cp += TIMEVAL_LEN;
+ dp += TIMEVAL_LEN;
+ cc -= TIMEVAL_LEN;
+ i += TIMEVAL_LEN;
+ }
+ for (; i < datalen && cc > 0; ++i, ++cp, ++dp, --cc) {
if (*cp != *dp) {
(void)printf("\nwrong data byte #%d should be 0x%x but was 0x%x",
i, *dp, *cp);
OpenPOWER on IntegriCloud