Source-Changes-HG archive

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

[src/trunk]: src/dist/ipf/ipsend Use the cloning device if that is available



details:   https://anonhg.NetBSD.org/src/rev/9acb1725d299
branches:  trunk
changeset: 571583:9acb1725d299
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Dec 01 23:49:27 2004 +0000

description:
Use the cloning device if that is available

diffstat:

 dist/ipf/ipsend/sbpf.c |  19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diffs (48 lines):

diff -r cc827a4179ad -r 9acb1725d299 dist/ipf/ipsend/sbpf.c
--- a/dist/ipf/ipsend/sbpf.c    Wed Dec 01 23:45:12 2004 +0000
+++ b/dist/ipf/ipsend/sbpf.c    Wed Dec 01 23:49:27 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sbpf.c,v 1.4 2004/03/28 09:00:56 martti Exp $  */
+/*     $NetBSD: sbpf.c,v 1.5 2004/12/01 23:49:27 christos Exp $        */
 
 /*
  * (C)opyright 1995-1998 Darren Reed. (from tcplog)
@@ -38,6 +38,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <paths.h>
 #include <ctype.h>
 #include <signal.h>
 #include <errno.h>
@@ -63,8 +64,21 @@
        struct  bpf_version bv;
        struct  timeval to;
        struct  ifreq ifr;
+
+#ifndef _PATH_BPF
+       const char *bpfname = _PATH_BPF;
+       int fd;
+
+       if ((fd = open(bpfname, O_RDWR)) < 0) 
+           {
+               fprintf(stderr, "no bpf devices available (%s)\n",
+                   strerror(errno));
+               return -1;
+           }
+#else
+       int fd = 0;
        char    bpfname[16];
-       int     fd = 0, i;
+       int     i;
 
        for (i = 0; i < 16; i++)
            {
@@ -77,6 +91,7 @@
                fprintf(stderr, "no bpf devices available as /dev/bpfxx\n");
                return -1;
            }
+#endif
 
        if (ioctl(fd, BIOCVERSION, (caddr_t)&bv) < 0)
            {



Home | Main Index | Thread Index | Old Index