I really missed one thing related to csum - so if I have proto field
with dynamic function then csum will be calculated
minimum twice - after packet is build and after all dynamic fields are
applied, well I have no particular solution for this,
but let me know if you want to have it fixed in this series or after
it will be applied.

Regards,
Vadim Kochan

On Tue, Jul 26, 2016 at 10:35 PM, Vadim Kochan <vadi...@gmail.com> wrote:
> Implemented 'dinc' and 'drnd' functions to be used for proto fields,
> and generate values at runtime. Parsing of proto field values
> for unified to make extending of field functions more easier w/o
> copy/paste similar rules for each proto field. Instead of that
> the field_expr struct is used to keep specified field and value which
> might be a func in the following form:
>
>     <proto>(<field>=<func>())
>
> Fields which has dynamic functions are stored in packet_dyn structure and
> generated after each packet run. After fields are updated the L3/L4 headers
> updates its csum if it is needed.
>
> Changed field lookup logic to make field set/get operations a little bit 
> faster by
> using field id as index in the array, as usually fields are defined regarding
> its index.
>
> Example:
>
>     { eth(sa=11:22:33:44:55:66, sa=dinc()), udp(sp=drnd(), dp=drnd()) }
>
> Vadim Kochan (15):
>   trafgen: Move applying dynamic elements to function
>   trafgen: proto: Reference to packet from proto_hdr struct
>   trafgen: proto: Move proto headers into packet
>   trafgen: proto: Force field id to be index in array
>   trafgen: proto: Increment proto field at runtime
>   trafgen: proto: Randomize proto field at runtime
>   trafgen: ipv4: Update csum at runtime if needed
>   trafgen: icmpv4: Update csum at runtime if needed
>   trafgen: icmpv6: Update csum at runtime if needed
>   trafgen: udp: Update csum at runtime if needed
>   trafgen: tcp: Update csum at runtime if it needed
>   trafgen: parser: Unify proto field value parsing
>   trafgen: parser: Add support of 'dinc' function for proto fields
>   trafgen: parser: Add 'drnd()' function for proto fields
>   trafgen: man: Add description for 'dinc' and 'drnd' field functions
>
>  trafgen.8        |  34 ++++-
>  trafgen.c        |  34 +++--
>  trafgen_conf.h   |  15 ++
>  trafgen_l3.c     |  51 ++++++-
>  trafgen_l3.h     |   4 +-
>  trafgen_l4.c     | 101 +++++++++----
>  trafgen_parser.y | 445 
> +++++++++++++++++++++++++++++++++++++------------------
>  trafgen_proto.c  | 205 ++++++++++++++++++++-----
>  trafgen_proto.h  |  39 +++++
>  9 files changed, 695 insertions(+), 233 deletions(-)
>
> --
> 2.6.3
>

-- 
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 netsniff-ng+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to