diff options
author | Andrey V. Elsukov <ae@FreeBSD.org> | 2015-01-23 13:26:35 +0000 |
---|---|---|
committer | Andrey V. Elsukov <ae@FreeBSD.org> | 2015-01-23 13:26:35 +0000 |
commit | ffc610b221e853e3246be960bc9007de751ccf7e (patch) | |
tree | cd060354f456b68cf712a1046d9b7c003a906204 /sbin/ping/ping.c | |
parent | ec336f0f0c3b5a9383009306a5933de8f4d794a0 (diff) | |
download | src-ffc610b221e853e3246be960bc9007de751ccf7e.tar.gz src-ffc610b221e853e3246be960bc9007de751ccf7e.zip |
After r270929 RAW IP code assumes that all IP fields are in network
byte order. Fix ping(8) to pass an IP header with converted ip_off
and ip_len fields, when IP_HDRINCL socket option used.
Notes
Notes:
svn path=/head/; revision=277562
Diffstat (limited to 'sbin/ping/ping.c')
-rw-r--r-- | sbin/ping/ping.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index aeb301430fb6..f24ecdeea0c9 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -713,7 +713,7 @@ main(int argc, char *const *argv) ip->ip_hl = sizeof(struct ip) >> 2; ip->ip_tos = tos; ip->ip_id = 0; - ip->ip_off = df ? IP_DF : 0; + ip->ip_off = htons(df ? IP_DF : 0); ip->ip_ttl = ttl; ip->ip_p = IPPROTO_ICMP; ip->ip_src.s_addr = source ? sock_in.sin_addr.s_addr : INADDR_ANY; @@ -1078,7 +1078,7 @@ pinger(void) if (options & F_HDRINCL) { cc += sizeof(struct ip); ip = (struct ip *)outpackhdr; - ip->ip_len = cc; + ip->ip_len = htons(cc); ip->ip_sum = in_cksum((u_short *)outpackhdr, cc); packet = outpackhdr; } |