forked from osmocom/wireshark
0abe10e040
Wireshark defines the relation of equality A == B as A any_eq B <=> An == Bn for at least one An, Bn. More accurately I think this is (formally) an equivalence relation, not true equality. Whichever definition for "==" we choose we must keep the definition of "!=" as !(A == B), otherwise it will lead to logical contradictions like (A == B) AND (A != B) being true. Fix the '!=' relation to match the definition of equality: A != B <=> !(A == B) <=> A all_ne B <=> An != Bn, for every n. This has been the recomended way to write "not equal" for a long time in the documentation, even to the point where != was deprecated, but it just wasn't implemented consistently in the language, which has understandably been a persistent source of confusion. Even a field that is normally well-behaved with "!=" like "ip.src" or "ip.dst" will produce unexpected results with encapsulations like IP-over-IP. The opcode ALL_NE could have been implemented in the compiler instead using NOT and ANY_EQ but I chose to implement it in bytecode. It just seemed more elegant and efficient but the difference was not very significant. Keep around "~=" for any_ne relation, in case someone depends on that, and because we don't have an operator for true equality: A strict_equal B <=> A all_eq B <=> !(A any_ne B). If there is only one value then any_ne and all_ne are the same comparison operation. Implementing this change did not require fixing any tests so it is unlikely the relation "~=" (any_ne) will be very useful. Note that the behaviour of the '<' (less than) comparison relation is a separate, more subtle issue. In the general case the definition of '<' that is used is only a partial order. |
||
---|---|---|
.. | ||
__init__.py | ||
dfiltertest.py | ||
group_bytes_ether.py | ||
group_bytes_ipv6.py | ||
group_bytes_type.py | ||
group_deprecated.py | ||
group_dfunction_string.py | ||
group_double.py | ||
group_integer.py | ||
group_integer_1byte.py | ||
group_ipv4.py | ||
group_membership.py | ||
group_range_method.py | ||
group_scanner.py | ||
group_string_type.py | ||
group_stringz.py | ||
group_syntax.py | ||
group_time_relative.py | ||
group_time_type.py | ||
group_tvb.py | ||
group_uint64.py |