Subject: Re: nul interface?
To: Alfred Perlstein <>
From: Andrew Brown <>
List: tech-net
Date: 10/25/2001 14:07:09
>> so i slapped in a cloning nul interface implementation and i'm struck
>> by one thing.  i can ping the ipv6 link-local address, but i can't see
>> the packets (on nul0).  i take it this is because the local address
>> gets a route automatically inserted for it via lo0.  is there any way
>> around this?  should i mark the interface as IFF_LOOPBACK?
>Since I can't see the code except the little snippet you posted
>which seems to neglect pushing packets into bpf, maybe that's
>what you're missing?

no, i didn't rip *that* much out of if_loop.c.  :)

>see (in 1.5.x) /usr/src/sys/dev/pcmcia/if_wi.c:wi_start()
>or (in -current) /usr/src/sys/dev/ic/wi.c:wi_start()
>#if NBPFILTER > 0
>        /*
>         * If there's a BPF listner, bounce a copy of
>         * this frame to him.
>         */
>        if (ifp->if_bpf)
>                bpf_mtap(ifp->if_bpf, m0);

actually, i've got this:

        if (ifp->if_bpf) {
                struct mbuf m0;
                u_int32_t af = dst->sa_family;
                m0.m_next = m;
                m0.m_len = 4;
                m0.m_data = (char *)&af;
                bpf_mtap(ifp->if_bpf, &m0);

since any traffic actually transitting the nul interface will need
something shoved in front of it for bpf to decide what it is.

>hope this helps.

not...entirely.  i can see ipv4 traffic, but no ipv6.  i suspect the
ipv6 stuff is just different enough...

|-----< "CODE WARRIOR" >-----|             * "ah!  i see you have the internet (Andrew Brown)                that goes *ping*!"       * "information is power -- share the wealth."