diff options
author | Andre Oppermann <andre@FreeBSD.org> | 2005-11-18 14:44:48 +0000 |
---|---|---|
committer | Andre Oppermann <andre@FreeBSD.org> | 2005-11-18 14:44:48 +0000 |
commit | 780b2f698ccad0ba49e4837bf4b30e5af19b3926 (patch) | |
tree | 34579ec91ee7991a768c5d436c07110f7c838c4c /sys/netinet/ip_input.c | |
parent | 861daeff3af49bd379094d63e307eed58dbfe004 (diff) | |
download | src-780b2f698ccad0ba49e4837bf4b30e5af19b3926.tar.gz src-780b2f698ccad0ba49e4837bf4b30e5af19b3926.zip |
In ip_forward() copy as much into the temporary error mbuf as we
have free space in it. Allocate correct mbuf from the beginning.
This allows icmp_error() to quote the entire TCP header in error
messages.
Sponsored by: TCP/IP Optimization Fundraise 2005
Notes
Notes:
svn path=/head/; revision=152581
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r-- | sys/netinet/ip_input.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 3aedccd86459..f84b562f6e9d 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1764,7 +1764,7 @@ ip_forward(struct mbuf *m, int srcrt) * assume exclusive access to the IP header in `m', so any * data in a cluster may change before we reach icmp_error(). */ - MGET(mcopy, M_DONTWAIT, m->m_type); + MGETHDR(mcopy, M_DONTWAIT, m->m_type); if (mcopy != NULL && !m_dup_pkthdr(mcopy, m, M_DONTWAIT)) { /* * It's probably ok if the pkthdr dup fails (because @@ -1776,8 +1776,7 @@ ip_forward(struct mbuf *m, int srcrt) mcopy = NULL; } if (mcopy != NULL) { - mcopy->m_len = imin((ip->ip_hl << 2) + 8, - (int)ip->ip_len); + mcopy->m_len = min(ip->ip_len, M_TRAILINGSPACE(mcopy)); mcopy->m_pkthdr.len = mcopy->m_len; m_copydata(m, 0, mcopy->m_len, mtod(mcopy, caddr_t)); } |