Allocate buffers with (M_WAITOK | M_CANFAIL) instead of M_NOWAIT.
M_NOWAIT cause dhcpd on a low-memory server with lots of interfaces to occasionally fail to start with ENOBUFS; (M_WAITOK | M_CANFAIL) seems to fix this. Tested on 3 different dhcp servers.
This commit is contained in:
parent
43785aba9a
commit
22637b9c37
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bpf.c,v 1.162 2011/01/22 19:12:58 christos Exp $ */
|
||||
/* $NetBSD: bpf.c,v 1.163 2011/03/30 18:04:27 bouyer Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1991, 1993
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.162 2011/01/22 19:12:58 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.163 2011/03/30 18:04:27 bouyer Exp $");
|
||||
|
||||
#if defined(_KERNEL_OPT)
|
||||
#include "opt_bpf.h"
|
||||
|
@ -1607,10 +1607,10 @@ static int
|
|||
bpf_allocbufs(struct bpf_d *d)
|
||||
{
|
||||
|
||||
d->bd_fbuf = malloc(d->bd_bufsize, M_DEVBUF, M_NOWAIT);
|
||||
d->bd_fbuf = malloc(d->bd_bufsize, M_DEVBUF, M_WAITOK | M_CANFAIL);
|
||||
if (!d->bd_fbuf)
|
||||
return (ENOBUFS);
|
||||
d->bd_sbuf = malloc(d->bd_bufsize, M_DEVBUF, M_NOWAIT);
|
||||
d->bd_sbuf = malloc(d->bd_bufsize, M_DEVBUF, M_WAITOK | M_CANFAIL);
|
||||
if (!d->bd_sbuf) {
|
||||
free(d->bd_fbuf, M_DEVBUF);
|
||||
return (ENOBUFS);
|
||||
|
|
Loading…
Reference in New Issue