Date: Fri, 1 Sep 2000 05:33:06 -0700 (PDT) From: Ruslan Ermilov <ru@FreeBSD.org> To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/netinet ip_divert.c ip_icmp.c ip_input.c ip_mroute.c ip_output.c raw_ip.c udp_usrreq.c Message-ID: <200009011233.FAA69145@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
ru 2000/09/01 05:33:06 PDT
Modified files:
sys/netinet ip_divert.c ip_icmp.c ip_input.c
ip_mroute.c ip_output.c raw_ip.c
udp_usrreq.c
Log:
Fixed broken ICMP error generation, unified conversion of IP header
fields between host and network byte order. The details:
o icmp_error() now does not add IP header length. This fixes the problem
when icmp_error() is called from ip_forward(). In this case the ip_len
of the original IP datagram returned with ICMP error was wrong.
o icmp_error() expects all three fields, ip_len, ip_id and ip_off in host
byte order, so DTRT and convert these fields back to network byte order
before sending a message. This fixes the problem described in PR 16240
and PR 20877 (ip_id field was returned in host byte order).
o ip_ttl decrement operation in ip_forward() was moved down to make sure
that it does not corrupt the copy of original IP datagram passed later
to icmp_error().
o A copy of original IP datagram in ip_forward() was made a read-write,
independent copy. This fixes the problem I first reported to Garrett
Wollman and Bill Fenner and later put in audit trail of PR 16240:
ip_output() (not always) converts fields of original datagram to network
byte order, but because copy (mcopy) and its original (m) most likely
share the same mbuf cluster, ip_output()'s manipulations on original
also corrupted the copy.
o ip_output() now expects all three fields, ip_len, ip_off and (what is
significant) ip_id in host byte order. It was a headache for years that
ip_id was handled differently. The only compatibility issue here is the
raw IP socket interface with IP_HDRINCL socket option set and a non-zero
ip_id field, but ip.4 manual page was unclear on whether in this case
ip_id field should be in host or network byte order.
Revision Changes Path
1.46 +2 -1 src/sys/netinet/ip_divert.c
1.44 +8 -2 src/sys/netinet/ip_icmp.c
1.139 +13 -10 src/sys/netinet/ip_input.c
1.58 +3 -2 src/sys/netinet/ip_mroute.c
1.110 +23 -14 src/sys/netinet/ip_output.c
1.68 +2 -2 src/sys/netinet/raw_ip.c
1.73 +3 -2 src/sys/netinet/udp_usrreq.c
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009011233.FAA69145>
