BIOCSSEESENT ioctl not honoured for single-mbuf packets

From: Ed Maste (emaste_at_phaedrus.sandvine.ca)
Date: 08/31/05

  • Next message: Digital Brain: "Re: dhclient and ADSL modem trouble..."
    Date: Wed, 31 Aug 2005 15:59:45 -0400
    To: freebsd-net@freebsd.org
    
    

    A coworker of mine discovered a bug in bpf with BIOCSEESENT.
    In sys/net/bpf.c, bpf_mtap() does

            if (pktlen == m->m_len) {
                    bpf_tap(bp, mtod(m, u_char *), pktlen);
                    return;
            }

            BPFIF_LOCK(bp);
            LIST_FOREACH(d, &bp->bif_dlist, bd_next) {
                    if (!d->bd_seesent && (m->m_pkthdr.rcvif == NULL))
                            continue;
            [...]

    The pktlen == m->m_len is an optimization for the case where
    the entire packet is in a single mbuf, added in version 1.95.
    However, bd_seesent then isn't checked so all packets will be
    seen.

    In order to make bpf_tap work correctly with BIOCSEESENT for
    both this case and the few drivers that use it, I think it needs
    another argument to indicate if the packet is being sent or not.
    Is it possible to change the API for bpf_tap? Or add a bpf_tap2
    that includes the flag, and make bpf_tap call it (for any third
    party drivers using bpf_tap)?

    --
    Ed Maste
    Sandvine Incorporated
    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
    

  • Next message: Digital Brain: "Re: dhclient and ADSL modem trouble..."