- Use m_getcl() instead of hand allocating.
- Convert panic() to KASSERT. - Remove superfluous cleaning of mbuf fields after allocation. - Add comment on possible use of m_get2() here. Sponsored by: Nginx, Inc.
This commit is contained in:
parent
79cb402edb
commit
76306b3465
@ -1118,20 +1118,17 @@ rt_msg1(int type, struct rt_addrinfo *rtinfo)
|
||||
default:
|
||||
len = sizeof(struct rt_msghdr);
|
||||
}
|
||||
if (len > MCLBYTES)
|
||||
panic("rt_msg1");
|
||||
m = m_gethdr(M_NOWAIT, MT_DATA);
|
||||
if (m && len > MHLEN) {
|
||||
MCLGET(m, M_NOWAIT);
|
||||
if ((m->m_flags & M_EXT) == 0) {
|
||||
m_free(m);
|
||||
m = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* XXXGL: can we use MJUMPAGESIZE cluster here? */
|
||||
KASSERT(len <= MCLBYTES, ("%s: message too big", __func__));
|
||||
if (len > MHLEN)
|
||||
m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
|
||||
else
|
||||
m = m_gethdr(M_NOWAIT, MT_DATA);
|
||||
if (m == NULL)
|
||||
return (m);
|
||||
|
||||
m->m_pkthdr.len = m->m_len = len;
|
||||
m->m_pkthdr.rcvif = NULL;
|
||||
rtm = mtod(m, struct rt_msghdr *);
|
||||
bzero((caddr_t)rtm, len);
|
||||
for (i = 0; i < RTAX_MAX; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user