We cannot sleep in a software interrupt, so do not sockaddr_dl_alloc(...,

M_WAITOK).  Instead, sockaddr_dl_init() a sockaddr_dl on the stack.
This commit is contained in:
dyoung 2007-09-05 05:29:35 +00:00
parent 26281fbd54
commit 99975917cd
1 changed files with 11 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_atm.c,v 1.26 2007/08/30 02:17:36 dyoung Exp $ */
/* $NetBSD: if_atm.c,v 1.27 2007/09/05 05:29:35 dyoung Exp $ */
/*
*
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_atm.c,v 1.26 2007/08/30 02:17:36 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_atm.c,v 1.27 2007/09/05 05:29:35 dyoung Exp $");
#include "opt_inet.h"
#include "opt_natm.h"
@ -112,12 +112,16 @@ atm_rtrequest(int req, struct rtentry *rt, struct rt_addrinfo *info)
*/
if ((rt->rt_flags & RTF_HOST) == 0) {
struct sockaddr *sa;
union {
struct sockaddr sa;
struct sockaddr_dl sdl;
struct sockaddr_storage ss;
} u;
sa = sockaddr_dl_alloc(ifp->if_index, ifp->if_type,
NULL, namelen, NULL, addrlen, M_WAITOK);
rt_setgate(rt, sa);
sockaddr_free(sa);
sockaddr_dl_init(&u.sdl, sizeof(u.ss),
ifp->if_index, ifp->if_type,
NULL, namelen, NULL, addrlen);
rt_setgate(rt, &u.sa);
gate = rt->rt_gateway;
break;
}