[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20150320.152448.1094343268366721552.davem@davemloft.net>
Date: Fri, 20 Mar 2015 15:24:48 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: daniel@...earbox.net
Cc: ast@...mgrid.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next] ebpf, filter: do not convert skb->protocol to
host endianess during runtime
From: Daniel Borkmann <daniel@...earbox.net>
Date: Thu, 19 Mar 2015 19:38:27 +0100
> Commit c24973957975 ("bpf: allow BPF programs access 'protocol' and 'vlan_tci'
> fields") has added support for accessing protocol, vlan_present and vlan_tci
> into the skb offset map.
>
> As referenced in the below discussion, accessing skb->protocol from an eBPF
> program should be converted without handling endianess.
>
> The reason for this is that an eBPF program could simply do a check more
> naturally, by f.e. testing skb->protocol == htons(ETH_P_IP), where the LLVM
> compiler resolves htons() against a constant automatically during compilation
> time, as opposed to an otherwise needed run time conversion.
>
> After all, the way of programming both from a user perspective differs quite
> a lot, i.e. bpf_asm ["ld proto"] versus a C subset/LLVM.
>
> Reference: https://patchwork.ozlabs.org/patch/450819/
> Signed-off-by: Daniel Borkmann <daniel@...earbox.net>
Applied, thanks Daniel.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists