On 05/22/2013 04:32 PM, [email protected] wrote:

Currently it is not supported. What we could do here

would be a similar approach as in trafgen if you need

it, where we would pass the source file first to the

C preprocessor doing textual replacements and then to

bpfc. What do you say?

Hi Daniel,
That would be great!

Done, please pull from the repo to get this commit:

commit 4584b955420cd8d2fcae767c86b853fde4bccc6e
Author: Daniel Borkmann <[email protected]>
Date:   Thu May 23 11:08:03 2013 +0200

    bpfc: allow bpf programs to be passed to cpp

    This patch allows bpf programs to be passed to the C preprocessor
    before handing over to bpfc. Example:

      #define ETH_P_IP        0x800

      ldh [12]
      jne #ETH_P_IP, drop
      ldb [23]
      jneq #6, drop
      ldh [20]
      jset #0x1fff, drop
      ldxb 4 * ([14] & 0xf)
      ldh [x + 14]
      jeq #0x16, pass
      ldh [x + 16]
      jne #0x16, drop
      pass: ret #-1
      drop: ret #0

    Compile with: bpfc -i foo -p

    Suggested-by: John Lange <[email protected]>
    Signed-off-by: Daniel Borkmann <[email protected]>

--
You received this message because you are subscribed to the Google Groups 
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to