Add proto_field_xxx functions to set/get value via specified
proto_field only.
It is good to have such API in case if application needs to set/get
value for some custom proto_field instance.
Signed-off-by: Vadim Kochan
---
trafgen_proto.c | 46 ++
tra
Rename all proto_field_xxx(...) functions to proto_hdr_field(...).
It is good for 2 reasons:
1) proto_hdr_field_xxx naming is more consistent as
it is related to proto_hdr API.
2) It makes possible to introduce proto_field_xxx API
which will operate only with struct proto_fi
Extend proto field expression to:
proto_field[{index}:{len}] = {func}
which allows to specify function/value on the part of the field via index
and value length (default is 1 - 1 byte). This rule is optional.
It was needed to keep of proto_field's copies in packet_dyn->fields
instead of orig
Used IPv6 pattern from nftables project to match valid only IPv6
address to do not mess with MAC or other syntax patterns with ':' symbol.
Signed-off-by: Vadim Kochan
---
trafgen_lexer.l | 51 +++
trafgen_parser.y | 2 +-
2 files changed, 48 inse
Add short note about field offset syntax with an example.
Signed-off-by: Vadim Kochan
---
trafgen.8 | 25 +
1 file changed, 25 insertions(+)
diff --git a/trafgen.8 b/trafgen.8
index 62716bb..c58d429 100644
--- a/trafgen.8
+++ b/trafgen.8
@@ -329,6 +329,31 @@ Example of u
Change __proto_field_set_bytes(...) function to take struct proto_field
instead of do looup by hdr & fid.
It is needed to able use this function with some custom
modified struct proto_field (len, pkt_offset).
Signed-off-by: Vadim Kochan
---
trafgen_proto.c | 50 +
Extend field expression with the following syntax:
[] | [:]
which allows to specify value or function at specified offset relative to the
field's offset within a header.
The trick to implement this was to use copies of proto_field instances
in the packet_dyn->fields array which allows to spe
Rename field_expr rule to field_value_expr to indicate the rule
relates to field value part in case if there will be added field_expr
rule to indicate field expression syntax.
Signed-off-by: Vadim Kochan
---
trafgen_parser.y | 30 +++---
1 file changed, 15 insertions(+),
Add proc_find_by_inode(...) in proc.c which finds pid by inode & gets
processe's command line and use it in the flowtop.c instead of
walk_processes(...).
Signed-off-by: Vadim Kochan
---
v2:
1) Remove sys/stat.h & dirent.h from flowtop.c includes.
2) Add static to __match_pid_by_inode(...)