1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-02 12:20:51 +00:00

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
This commit is contained in:
Robert Watson 2008-06-02 14:20:26 +00:00
parent a147e6cadf
commit 53640b0e3a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=179487
2 changed files with 7 additions and 11 deletions

View File

@ -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;
struct tcptemp *t;
m = m_get(M_DONTWAIT, MT_DATA);
if (m == NULL)
return (0);
m->m_len = sizeof(struct tcptemp);
n = mtod(m, struct tcptemp *);
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);
}
/*

View File

@ -313,7 +313,7 @@ tcp_timer_keep(void *xtp)
tcp_respond(tp, t_template->tt_ipgen,
&t_template->tt_t, (struct mbuf *)NULL,
tp->rcv_nxt, tp->snd_una - 1, 0);
(void) m_free(dtom(t_template));
free(t_template, M_TEMP);
}
callout_reset(&tp->t_timers->tt_keep, tcp_keepintvl, tcp_timer_keep, tp);
} else