tcpdump mailing list archives

Re: pcap_inject() on loopback (FreeBSD)


From: Guy Harris <guy () alum mit edu>
Date: Mon, 16 Jun 2014 02:50:04 -0700


On Jun 15, 2014, at 1:56 PM, Fernando Gont <fernando () gont com ar> wrote:

I will certainly file a bug report, and CC you. My understanding is that
this should be filled in most (if not all) of the BSD variants? (because
besides the error message one obtains, it seems that in several flavors
of them, pcap_inject() fails for the same reason).

NetBSD, OpenBSD, and Dragonfly BSD appear not to even have the

        /* BPF writes need to be handled specially. */
        if (dst->sa_family == AF_UNSPEC)
                bcopy(dst->sa_data, &af, sizeof(af));
        else
                af = dst->sa_family;

code, so

        /* BPF writes need to be handled specially. */
        if (dst->sa_family == pseudo_AF_HDRCMPLT)
                bcopy(dst->sa_data, &af, sizeof(af));
        else
                af = dst->sa_family;

code needs to be added, and the subsequent switch needs to be changed from

        switch (dst->sa_family) {

to

        switch (af) {

with a

        u_int32_t af;

added to looutput().

Darwin's code path is very different, and I haven't followed the twisty little maze of code paths into 
xnu:bsd/net/dlil.c and through if_loop.c to see whether this bug exists or not (and haven't written code to test it).
_______________________________________________
tcpdump-workers mailing list
tcpdump-workers () lists tcpdump org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers


Current thread: