diff options
Diffstat (limited to 'libexec/rbootd/bpf.c')
-rw-r--r-- | libexec/rbootd/bpf.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/libexec/rbootd/bpf.c b/libexec/rbootd/bpf.c index 2ccf7da..7ecd419 100644 --- a/libexec/rbootd/bpf.c +++ b/libexec/rbootd/bpf.c @@ -1,5 +1,3 @@ -/* $NetBSD: bpf.c,v 1.7 1997/01/27 22:51:50 thorpej Exp $ */ - /* * Copyright (c) 1988, 1992 The University of Utah and the Center * for Software Science (CSS). @@ -40,15 +38,14 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * from: @(#)bpf.c 8.1 (Berkeley) 6/4/93 + * @(#)bpf.c 8.1 (Berkeley) 6/4/93 * - * From: Utah Hdr: bpf.c 3.1 92/07/06 + * Utah $Hdr: bpf.c 3.1 92/07/06$ * Author: Jeff Forys, University of Utah CSS */ #ifndef lint -/*static char sccsid[] = "@(#)bpf.c 8.1 (Berkeley) 6/4/93";*/ -static char rcsid[] = "$NetBSD: bpf.c,v 1.7 1997/01/27 22:51:50 thorpej Exp $"; +static char sccsid[] = "@(#)bpf.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint */ #include <sys/param.h> @@ -71,7 +68,7 @@ static char rcsid[] = "$NetBSD: bpf.c,v 1.7 1997/01/27 22:51:50 thorpej Exp $"; static int BpfFd = -1; static unsigned BpfLen = 0; -static u_int8_t *BpfPkt = NULL; +static u_char *BpfPkt = NULL; /* ** BpfOpen -- Open and initialize a BPF device. @@ -148,9 +145,14 @@ BpfOpen() #endif ifr.ifr_addr.sa_family = AF_UNSPEC; bcopy(&RmpMcastAddr[0], (char *)&ifr.ifr_addr.sa_data[0], RMP_ADDRLEN); - if (ioctl(BpfFd, BIOCPROMISC, (caddr_t)0) < 0) { - syslog(LOG_ERR, "bpf: can't set promiscuous mode: %m"); - Exit(0); + if (ioctl(BpfFd, SIOCADDMULTI, (caddr_t)&ifr) < 0) { + syslog(LOG_WARNING, + "bpf: can't add mcast addr (%m), setting promiscuous mode"); + + if (ioctl(BpfFd, BIOCPROMISC, (caddr_t)0) < 0) { + syslog(LOG_ERR, "bpf: can't set promiscuous mode: %m"); + Exit(0); + } } /* @@ -161,7 +163,7 @@ BpfOpen() Exit(0); } if (BpfPkt == NULL) - BpfPkt = (u_int8_t *)malloc(BpfLen); + BpfPkt = (u_char *)malloc(BpfLen); if (BpfPkt == NULL) { syslog(LOG_ERR, "bpf: out of memory (%u bytes for bpfpkt)", @@ -310,7 +312,7 @@ BpfRead(rconn, doread) int doread; { register int datlen, caplen, hdrlen; - static u_int8_t *bp = NULL, *ep = NULL; + static u_char *bp = NULL, *ep = NULL; int cc; /* |