aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_subr.c
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2008-06-02 14:20:26 +0000
committerRobert Watson <rwatson@FreeBSD.org>2008-06-02 14:20:26 +0000
commit53640b0e3a63184e282621037174bf0b9075170e (patch)
tree565ab939067a2b0fd5e01b48006e3346699da8c2 /sys/netinet/tcp_subr.c
parenta147e6cadf7e0b040cabd185739a63a7f2f1d36d (diff)
downloadsrc-53640b0e3a63184e282621037174bf0b9075170e.tar.gz
src-53640b0e3a63184e282621037174bf0b9075170e.zip
When allocating temporary storage to hold a TCP/IP packet header
template, use an M_TEMP malloc(9) allocation rather than an mbuf with mtod(9) and dtom(9). This eliminates the last use of dtom(9) in TCP. MFC after: 3 weeks
Notes
Notes: svn path=/head/; revision=179487
Diffstat (limited to 'sys/netinet/tcp_subr.c')
-rw-r--r--sys/netinet/tcp_subr.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index cb2d89a147a2..4de3e59917c9 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -385,17 +385,13 @@ tcpip_fillheaders(struct inpcb *inp, void *ip_ptr, void *tcp_ptr)
struct tcptemp *
tcpip_maketemplate(struct inpcb *inp)
{
- struct mbuf *m;
- struct tcptemp *n;
-
- m = m_get(M_DONTWAIT, MT_DATA);
- if (m == NULL)
- return (0);
- m->m_len = sizeof(struct tcptemp);
- n = mtod(m, struct tcptemp *);
+ struct tcptemp *t;
- tcpip_fillheaders(inp, (void *)&n->tt_ipgen, (void *)&n->tt_t);
- return (n);
+ t = malloc(sizeof(*t), M_TEMP, M_NOWAIT);
+ if (t == NULL)
+ return (NULL);
+ tcpip_fillheaders(inp, (void *)&t->tt_ipgen, (void *)&t->tt_t);
+ return (t);
}
/*