summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_subr.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2008-06-02 14:20:26 +0000
committerrwatson <rwatson@FreeBSD.org>2008-06-02 14:20:26 +0000
commit96dd177bf086cc3c1d60be0d092aa3bc06f7df20 (patch)
tree565ab939067a2b0fd5e01b48006e3346699da8c2 /sys/netinet/tcp_subr.c
parentff609f1187e6a6436decf9241cddf833963d9d8d (diff)
downloadFreeBSD-src-96dd177bf086cc3c1d60be0d092aa3bc06f7df20.zip
FreeBSD-src-96dd177bf086cc3c1d60be0d092aa3bc06f7df20.tar.gz
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
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 cb2d89a..4de3e59 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);
}
/*
OpenPOWER on IntegriCloud