[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 31 Dec 2012 19:29:02 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Miller <davem@...emloft.net>
Cc: dborkman@...hat.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next 0/8] Add complementary BPF conditional jump
instructions
On Mon, 2012-12-31 at 14:37 -0800, David Miller wrote:
> Whilst I agree that adding NE jumps adds great value and closes a
> serious gap, the rest can be synthesized by simply swapping the
> arguments and using a comparison that does already exist.
>
> Why isn't that sufficient?
I am afraid none of these patches is needed at all.
Swapping the jt/jf is plainly enough for the user land compiler.
libcap seems to do it already
# tcpdump -i lo 'len!=0 && ip6' -d
(000) ld #pktlen
(001) jeq #0x0 jt 5 jf 2
(002) ldh [12]
(003) jeq #0x86dd jt 4 jf 5
(004) ret #96
(005) ret #0
# tcpdump -i lo 'len==0 && ip6' -d
(000) ld #pktlen
(001) jeq #0x0 jt 2 jf 5
(002) ldh [12]
(003) jeq #0x86dd jt 4 jf 5
(004) ret #96
(005) ret #0
--
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