diff options
author | andre <andre@FreeBSD.org> | 2005-11-18 14:44:48 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2005-11-18 14:44:48 +0000 |
commit | 91d9d9ad2a39781af61fad44850de9520275cd0c (patch) | |
tree | 34579ec91ee7991a768c5d436c07110f7c838c4c /sys/netinet/ip_input.c | |
parent | ae3ca56f7b626f72c9ab7bf852f4733ec10a7f8e (diff) | |
download | FreeBSD-src-91d9d9ad2a39781af61fad44850de9520275cd0c.zip FreeBSD-src-91d9d9ad2a39781af61fad44850de9520275cd0c.tar.gz |
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
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 3aedccd..f84b562 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)); } |