aboutsummaryrefslogtreecommitdiffstats
path: root/epan/ftypes/ftype-ipv4.c
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2022-02-27 09:56:41 +0000
committerA Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2022-03-28 11:20:41 +0000
commitac0a69636ba799f976c7fc01f137c0bbb89b0a17 (patch)
tree67eacf57e0a627ed8da5053207e9d4ad0927414e /epan/ftypes/ftype-ipv4.c
parent677b68aa3b58558d9062f2c80ef72cfc2ec0c4d8 (diff)
dfilter: Add support for unary arithmetic
This change implements a unary minus operator. Filter: tcp.window_size_scalefactor == -tcp.dstport Instructions: 00000 READ_TREE tcp.window_size_scalefactor -> reg#0 00001 IF_FALSE_GOTO 6 00002 READ_TREE tcp.dstport -> reg#1 00003 IF_FALSE_GOTO 6 00004 MK_MINUS -reg#1 -> reg#2 00005 ANY_EQ reg#0 == reg#2 00006 RETURN It is supported for integer types, floats and relative time values. The unsigned integer types are promoted to a 32 bit signed integer. Unary plus is implemented as a no-op. The plus sign is simply ignored. Constant arithmetic expressions are computed during compilation. Overflow with constants is a compile time error. Overflow with variables is a run time error and silently ignored. Only a debug message will be printed to the console. Related to #15504.
Diffstat (limited to 'epan/ftypes/ftype-ipv4.c')
-rw-r--r--epan/ftypes/ftype-ipv4.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/epan/ftypes/ftype-ipv4.c b/epan/ftypes/ftype-ipv4.c
index d3cf02a947..fe032cf7f4 100644
--- a/epan/ftypes/ftype-ipv4.c
+++ b/epan/ftypes/ftype-ipv4.c
@@ -172,6 +172,7 @@ ftype_register_ipv4(void)
NULL,
slice,
bitwise_and,
+ NULL, /* unary_minus */
};
ftype_register(FT_IPv4, &ipv4_type);