Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-2-0]: src/usr.sbin/rarpd Pullup rev 1.50 (requested by darrenr in...



details:   https://anonhg.NetBSD.org/src/rev/788dfd7cef91
branches:  netbsd-2-0
changeset: 560481:788dfd7cef91
user:      jmc <jmc%NetBSD.org@localhost>
date:      Wed Apr 21 03:56:04 2004 +0000

description:
Pullup rev 1.50 (requested by darrenr in ticket #167)

Reduce bpf buffer to 32k from 1M to reduce kernel memory usage from userland
binaries.
Fix bpf so that select will return for a timeout.
Fix the behaviour of BIOCIMMEDIATE.
In bpf_mtap(), optimise the calling of bpf_filter() and catchpacket()
based on whether or not the entire packet is in one mbuf.
Various other bpf fixes, including PR#8674, PR#12170

diffstat:

 usr.sbin/rarpd/rarpd.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r dfc5a1d0b1c9 -r 788dfd7cef91 usr.sbin/rarpd/rarpd.c
--- a/usr.sbin/rarpd/rarpd.c    Wed Apr 21 03:56:00 2004 +0000
+++ b/usr.sbin/rarpd/rarpd.c    Wed Apr 21 03:56:04 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rarpd.c,v 1.49 2003/07/13 12:29:20 itojun Exp $        */
+/*     $NetBSD: rarpd.c,v 1.49.2.1 2004/04/21 03:56:04 jmc Exp $       */
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -28,7 +28,7 @@
 #endif /* not lint */
 
 #ifndef lint
-__RCSID("$NetBSD: rarpd.c,v 1.49 2003/07/13 12:29:20 itojun Exp $");
+__RCSID("$NetBSD: rarpd.c,v 1.49.2.1 2004/04/21 03:56:04 jmc Exp $");
 #endif
 
 
@@ -304,6 +304,7 @@
        struct ifreq ifr;
        u_int   dlt;
        int     immediate;
+       u_int   bufsize;
 
        static struct bpf_insn insns[] = {
                BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 12),
@@ -329,6 +330,11 @@
                rarperr(FATAL, "BIOCIMMEDIATE: %s", strerror(errno));
                /* NOTREACHED */
        }
+       /* Set a 32k buffer size for kernel use */
+       bufsize = 32768;
+       if (ioctl(fd, BIOCSBLEN, &bufsize) < 0) {
+               rarperr(NONFATAL, "BIOCSBLEN:%d: %s", bufsize, strerror(errno));
+       }
        (void)strncpy(ifr.ifr_name, device, sizeof ifr.ifr_name - 1);
        ifr.ifr_name[sizeof ifr.ifr_name - 1] = '\0';
        if (ioctl(fd, BIOCSETIF, (caddr_t) & ifr) < 0) {



Home | Main Index | Thread Index | Old Index