Subject: bpf: change of DLT affects promiscuous mode
To: None <tech-net@netbsd.org>
From: David Young <dyoung@ojctech.com>
List: tech-net
Date: 09/06/2002 01:24:32
In bpf, with a change of DLT through BIOCSDLT, promiscuous mode is turned
off by bpf_detachd and never turned back on again. In the interests of
"least astonishment," In bpf_setdlt, I suggest bpf save the promiscuous
mode state before calling bpf_detachd, and restore it after calling
reset_d. I.e.,

        s = splnet();
        opromisc = d->bd_promisc;
        bpf_detachd(d);
        bpf_attachd(d, bp);
        reset_d(d);
        if (opromisc) {
                int error;

                error = ifpromisc(bp->bif_ifp, 1);
                if (error && error != EINVAL)
                        panic("bpf: ifpromisc failed");
        }
        splx(s);

Dave

-- 
David Young             OJC Technologies
dyoung@ojctech.com      Engineering from the Right Brain
                        Urbana, IL * (217) 278-3933