- don't use M_WAIT within splnet.

- retain m_pkthdr for mbuf passed down to ifp->if_output.
  pointed out by is@netbsd
This commit is contained in:
itojun 2003-05-27 22:27:21 +00:00
parent 53588c2a8b
commit 01c8c2e99a
2 changed files with 18 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: aarp.c,v 1.12 2003/02/26 07:53:04 matt Exp $ */ /* $NetBSD: aarp.c,v 1.13 2003/05/27 22:27:21 itojun Exp $ */
/* /*
* Copyright (c) 1990,1991 Regents of The University of Michigan. * Copyright (c) 1990,1991 Regents of The University of Michigan.
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: aarp.c,v 1.12 2003/02/26 07:53:04 matt Exp $"); __KERNEL_RCSID(0, "$NetBSD: aarp.c,v 1.13 2003/05/27 22:27:21 itojun Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/socket.h> #include <sys/socket.h>
@ -202,7 +202,10 @@ aarpwhohas(ifp, sat)
bcopy(atmulticastaddr, eh->ether_dhost, bcopy(atmulticastaddr, eh->ether_dhost,
sizeof(eh->ether_dhost)); sizeof(eh->ether_dhost));
eh->ether_type = 0; /* if_output will treat as 802 */ eh->ether_type = 0; /* if_output will treat as 802 */
M_PREPEND(m, sizeof(struct llc), M_WAIT); M_PREPEND(m, sizeof(struct llc), M_DONTWAIT);
if (!m)
return;
llc = mtod(m, struct llc *); llc = mtod(m, struct llc *);
llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP; llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
llc->llc_control = LLC_UI; llc->llc_control = LLC_UI;
@ -597,7 +600,10 @@ aarpprobe(arp)
bcopy(atmulticastaddr, eh->ether_dhost, bcopy(atmulticastaddr, eh->ether_dhost,
sizeof(eh->ether_dhost)); sizeof(eh->ether_dhost));
eh->ether_type = 0; /* if_output will treat as 802 */ eh->ether_type = 0; /* if_output will treat as 802 */
M_PREPEND(m, sizeof(struct llc), M_WAIT); M_PREPEND(m, sizeof(struct llc), M_DONTWAIT);
if (!m)
return;
llc = mtod(m, struct llc *); llc = mtod(m, struct llc *);
llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP; llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP;
llc->llc_control = LLC_UI; llc->llc_control = LLC_UI;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ddp_output.c,v 1.6 2003/02/26 07:53:04 matt Exp $ */ /* $NetBSD: ddp_output.c,v 1.7 2003/05/27 22:27:21 itojun Exp $ */
/* /*
* Copyright (c) 1990,1991 Regents of The University of Michigan. * Copyright (c) 1990,1991 Regents of The University of Michigan.
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ddp_output.c,v 1.6 2003/02/26 07:53:04 matt Exp $"); __KERNEL_RCSID(0, "$NetBSD: ddp_output.c,v 1.7 2003/05/27 22:27:21 itojun Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -76,7 +76,9 @@ ddp_output(va_alist)
ddp = va_arg(ap, struct ddpcb *); ddp = va_arg(ap, struct ddpcb *);
va_end(ap); va_end(ap);
M_PREPEND(m, sizeof(struct ddpehdr), M_WAIT); M_PREPEND(m, sizeof(struct ddpehdr), M_DONTWAIT);
if (!m)
return (ENOBUFS);
deh = mtod(m, struct ddpehdr *); deh = mtod(m, struct ddpehdr *);
deh->deh_pad = 0; deh->deh_pad = 0;
@ -141,7 +143,6 @@ ddp_route(m, ro)
{ {
struct sockaddr_at gate; struct sockaddr_at gate;
struct elaphdr *elh; struct elaphdr *elh;
struct mbuf *m0;
struct at_ifaddr *aa = NULL; struct at_ifaddr *aa = NULL;
struct ifnet *ifp = NULL; struct ifnet *ifp = NULL;
u_short net; u_short net;
@ -168,12 +169,9 @@ ddp_route(m, ro)
* packets end up poorly aligned due to the three byte elap header. * packets end up poorly aligned due to the three byte elap header.
*/ */
if (!(aa->aa_flags & AFA_PHASE2)) { if (!(aa->aa_flags & AFA_PHASE2)) {
m0 = m_get(M_WAIT, MT_HEADER); M_PREPEND(m, SZ_ELAPHDR, M_DONTWAIT);
MCLAIM(m0, m->m_owner); if (!m)
m0->m_next = m; return (ENOBUFS);
/* XXX perhaps we ought to align the header? */
m0->m_len = SZ_ELAPHDR;
m = m0;
elh = mtod(m, struct elaphdr *); elh = mtod(m, struct elaphdr *);
elh->el_snode = satosat(&aa->aa_addr)->sat_addr.s_node; elh->el_snode = satosat(&aa->aa_addr)->sat_addr.s_node;