diff options
author | Patrick McHardy <kaber@trash.net> | 2014-01-16 17:11:12 +0000 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2014-01-16 17:11:12 +0000 |
commit | 655fb611aecca135a3f09fe9a4c50ddb2c76a122 (patch) | |
tree | 1fb7124d5c644038148d1bc3366bf6b287c1cd3e /src/datatype.c | |
parent | 001661033e177a5f580ff49de8d1a56a2e9b8cb8 (diff) |
segtree: only use prefix expressions for ranges for selected datatypes
It is uncommon to represent f.i. port number ranges as prefix expressions.
Introduce a datatype DTYPE_F_PREFIX flag to indicate that the preferred
representation of a range is a prefix and use it for segtree decomposition
to decide whether to use a range or prefix expression.
The ipaddr, ip6addr, mark and realm datatypes are changed to include the
DTYPE_F_PREFIX flag.
This fixes completely unreadable output in cases where the ranges are
representable as prefixes, f.i. in case of port number:
{ 0/6 => jump chain1, 0/5 => jump chain2, 0/4 => continue}
becomes:
{ 0-1023 => jump chain1, 1024-2047 => jump chain2, 2048-4095 => continue}
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/datatype.c')
-rw-r--r-- | src/datatype.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/datatype.c b/src/datatype.c index 86ea80e3..45944907 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -380,6 +380,7 @@ const struct datatype ipaddr_type = { .basetype = &integer_type, .print = ipaddr_type_print, .parse = ipaddr_type_parse, + .flags = DTYPE_F_PREFIX, }; static void ip6addr_type_print(const struct expr *expr) @@ -437,6 +438,7 @@ const struct datatype ip6addr_type = { .basetype = &integer_type, .print = ip6addr_type_print, .parse = ip6addr_type_parse, + .flags = DTYPE_F_PREFIX, }; static void inet_protocol_type_print(const struct expr *expr) @@ -662,6 +664,7 @@ const struct datatype mark_type = { .basefmt = "0x%.8Zx", .print = mark_type_print, .parse = mark_type_parse, + .flags = DTYPE_F_PREFIX, }; static void time_type_print(const struct expr *expr) |