From takhus@takhus.mind.net  Mon Sep 18 22:41:56 2000
Return-Path: <takhus@takhus.mind.net>
Received: from ego.mind.net (ego.mind.net [206.99.66.9])
	by hub.freebsd.org (Postfix) with ESMTP id 5801B37B43C
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 18 Sep 2000 22:41:55 -0700 (PDT)
Received: from takhus-home.ashlandfn.org (AFN-Dyn-6315110844.pc.ashlandfiber.net [63.151.108.44])
	by ego.mind.net (8.9.3/8.9.3) with ESMTP id WAA09647
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 18 Sep 2000 22:41:51 -0700
Received: from localhost (fleisher@localhost)
	by takhus-home.ashlandfn.org (8.11.0/8.11.0) with ESMTP id e8J5foD00739
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 18 Sep 2000 22:41:50 -0700 (PDT)
	(envelope-from takhus@takhus.mind.net)
Message-Id: <Pine.BSF.4.21.0009182238570.727-100000@takhus-home.ashlandfn.org>
Date: Mon, 18 Sep 2000 22:41:50 -0700 (PDT)
From: Tony Fleisher <takhus@takhus.mind.net>
To: FreeBSD-gnats-submit@freebsd.org
Subject: WARNING: Driver mistake: repeat make_dev("bpf0")

>Number:         21391
>Category:       kern
>Synopsis:       WARNING messages occur when bpf is used with DEVFS in -current
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 18 22:50:00 PDT 2000
>Closed-Date:    Tue May 29 21:24:03 PDT 2001
>Last-Modified:  Tue May 29 21:24:34 PDT 2001
>Originator:     Tony Fleisher <takhus@takhus.mind.net>
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
>Environment:
	
FreeBSD 5.0-CURRENT #2: Mon Sep 18 21:41:42 PDT 2000

>Description:
	
The following error repeatedly occurrs under -current anytime a 
program opened the bpf device:
          
WARNING: Driver mistake: repeat make_dev("bpf0")

The problem seems to be caused by make_dev being called in both bpf_clone()
and bpfopen() in sys/net/bpf.c


>How-To-Repeat:
	
	Compile a kernel under -current with bpf and DEVFS.
	Use any program (such as tcpdump or dhclient) that uses bpf.

>Fix:
	
The errors went away when I applied the patch attached below. I
am not sure if this is the correct solution, but it does solve
the problem.


*** sys/net/bpf.c.ORIG	Mon Sep 18 21:14:02 2000
--- sys/net/bpf.c	Mon Sep 18 21:46:50 2000
***************
*** 363,369 ****
--- 363,374 ----
  	 */
  	if (d)
  		return (EBUSY);
+ 	/*
+ 	 * No need for make_dev here, as we make_dev() in bpf_clone()
+ 	 */
+ 	/*
  	make_dev(&bpf_cdevsw, minor(dev), 0, 0, 0600, "bpf%d", lminor(dev));
+ 	*/
  	MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_WAITOK);
  	bzero(d, sizeof(*d));
  	dev->si_drv1 = d;




>Release-Note:
>Audit-Trail:

From: Poul-Henning Kamp <phk@critter.freebsd.dk>
To: Tony Fleisher <takhus@takhus.mind.net>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/21391: WARNING: Driver mistake: repeat make_dev("bpf0") 
Date: Wed, 20 Sep 2000 15:10:00 +0200

 This fix is not quite correct.
 
 I am working on a better solution to this problem.
 
 Please ignore the message for now, it is harmless.
 
 --
 Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
 phk@FreeBSD.ORG         | TCP/IP since RFC 956
 FreeBSD coreteam member | BSD since 4.3-tahoe    
 Never attribute to malice what can adequately be explained by incompetence.
 

From: Tony Fleisher <takhus@takhus.mind.net>
To: Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/21391: WARNING: Driver mistake: repeat make_dev("bpf0") 
Date: Tue, 29 May 2001 21:16:50 -0700 (PDT)

 This PR can be closed.
 
State-Changed-From-To: open->closed 
State-Changed-By: dd 
State-Changed-When: Tue May 29 21:24:03 PDT 2001 
State-Changed-Why:  
Problem resolved. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=21391 
>Unformatted:
