On Apr 4, 2012, at 7:36 PM, YASUOKA Masahiko wrote:

> Hi,
>
> On Wed, 4 Apr 2012 13:19:06 +0200
> Claudio Jeker <[email protected]> wrote:
>> On Wed, Apr 04, 2012 at 02:34:46PM +0900, Yasuoka Masahiko wrote:
>>> On Tue, 31 Jan 2012 13:59:17 +0100
>>> "Sebastian Reitenbach" <[email protected]> wrote:
>>>> However, I noted with tcpdump, listening on tun0:
>>>>
>>>> # tcpdump -n -i tun0
>>>> tcpdump: listening on tun0, link-type LOOP
>>>> 13:51:15.354776
>>>> tcpdump: WARNING: compensating for unaligned libpcap packets
>>>> 13:51:15.354795 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
>>>> 13:51:16.334984
>>>> 13:51:16.334997 10.66.66.1 > 10.66.66.129: icmp: echo reply (DF)
>>>> 13:51:17.355463
>>> (snip)
>>>> The incoming packets look weird, and this is not only true for icmp,
>>>> with tcp/udp its the same.
>>>
>>> Attached diff will fix the problem.
>>>
>>> bpf requires to use different byte order for DLT_LOOP and DLT_NULL on
>>> address family header.  pipex works with both pppx(DLT_NULL) and
>>> tun(DLT_LOOP), so it should switch the byte order.
>>>
>>> ok? or comment?
>>
>> Since pppx(4) is only used by npppd/pipex shouldn't we change the DLT
there
>> so that we don't need any magic inside pipex?
>
> Yes.  Using same DLT of tun for pppx makes things simple.
>
> Let me update the diff.  ok?
>
> Index: sys/net/if_pppx.c
> ===================================================================
> RCS file: /cvs/src/sys/net/if_pppx.c,v
> retrieving revision 1.13
> diff -u -p -r1.13 if_pppx.c
> --- sys/net/if_pppx.c 25 Oct 2011 23:54:58 -0000      1.13
> +++ sys/net/if_pppx.c 4 Apr 2012 15:10:23 -0000
> @@ -877,7 +877,7 @@ pppx_add_session(struct pppx_dev *pxd, s
>       if_alloc_sadl(ifp);
>
> #if NBPFILTER > 0
> -     bpfattach(&ifp->if_bpf, ifp, DLT_NULL, 0);
> +     bpfattach(&ifp->if_bpf, ifp, DLT_LOOP, 0);
> #endif
>       SET(ifp->if_flags, IFF_RUNNING);
>
> Index: sys/net/pipex.c
> ===================================================================
> RCS file: /cvs/src/sys/net/pipex.c,v
> retrieving revision 1.27
> diff -u -p -r1.27 pipex.c
> --- sys/net/pipex.c   4 Apr 2012 04:31:38 -0000       1.27
> +++ sys/net/pipex.c   4 Apr 2012 15:10:25 -0000
> @@ -1163,7 +1163,7 @@ pipex_ip_input(struct mbuf *m0, struct p
>
> #if NBPFILTER > 0
>       if (ifp->if_bpf)
> -             bpf_mtap_af(ifp->if_bpf, AF_INET, m0, BPF_DIRECTION_IN);
> +             bpf_mtap_af(ifp->if_bpf, htonl(AF_INET), m0, BPF_DIRECTION_IN);
> #endif
>
>       s = splnet();
> @@ -1240,7 +1240,7 @@ pipex_ip6_input(struct mbuf *m0, struct
>
> #if NBPFILTER > 0
>       if (ifp->if_bpf)
> -             bpf_mtap_af(ifp->if_bpf, AF_INET, m0, BPF_DIRECTION_IN);
> +             bpf_mtap_af(ifp->if_bpf, htonl(AF_INET), m0, BPF_DIRECTION_IN);
> #endif
>
>       s = splnet();
>


No breaks here. amd64

//maxim

Reply via email to