You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lokinet/llarp/net
Jason Rhinelander 36792d4337
Fix multi-field < ordering
Lots and lots of places in the code had broken < operators because they
are returning something like:

    foo < other.foo or bar < other.bar;

but this breaks both the strict weak ordering requirements that are
required for the "Compare" requirement for things like
std::map/set/priority_queue.

For example:

    a = {.foo=1, .bar=3}
    b = {.foo=3, .bar=1}

does not have an ordering over a and b (both `a < b` and `b < a` are
satisfied at the same time).

This needs to be instead something like:

    foo < other.foo or (foo == other.foo and bar < other.bar)

but that's a bit clunkier, and it is easier to use std::tie for tuple's
built-in < comparison which does the right thing:

    std::tie(foo, bar) < std::tie(other.foo, other.bar)

(Initially I noticed this in SockAddr/sockaddr_in6, but upon further
investigation this extends to the major of multi-field `operator<`'s.)

This fixes it by using std::tie (or something similar) everywhere we are
doing multi-field inequalities.
2 years ago
..
address_info.cpp Fix multi-field < ordering 2 years ago
address_info.hpp changeset for windows port 2 years ago
bogon_ranges.hpp changeset for windows port 2 years ago
exit_info.cpp llarp_buffer_t: rename badly named operator== 2 years ago
exit_info.hpp Remote util::Printer and related cruft 2 years ago
interface_info.cpp Add a net::ToString() to help stringify ipaddr_t 2 years ago
interface_info.hpp Add InterfaceInfo formatter 2 years ago
ip.cpp standardize include format and pragma once 3 years ago
ip.hpp standardize include format and pragma once 3 years ago
ip_address.cpp changeset for windows port 2 years ago
ip_address.hpp changeset for windows port 2 years ago
ip_packet.cpp Simplify/fix ip_header layout 2 years ago
ip_packet.hpp Simplify/fix ip_header layout 2 years ago
ip_range.cpp DRY private range selection; add missing ranges 2 years ago
ip_range.hpp Fix multi-field < ordering 2 years ago
ip_range_map.hpp make comments with colins in them not have them in it 2 years ago
net.h standardize include format and pragma once 3 years ago
net.hpp Fix multi-field < ordering 2 years ago
net_bits.hpp changeset for windows port 2 years ago
net_if.hpp standardize include format and pragma once 3 years ago
net_int.cpp Add a net::ToString() to help stringify ipaddr_t 2 years ago
net_int.hpp Add a net::ToString() to help stringify ipaddr_t 2 years ago
posix.cpp Fix interface enumeration on posix 2 years ago
sock_addr.cpp Fix multi-field < ordering 2 years ago
sock_addr.hpp changeset for windows port 2 years ago
traffic_policy.cpp llarp_buffer_t: rename badly named operator== 2 years ago
traffic_policy.hpp Fix multi-field < ordering 2 years ago
uint128.hpp Fix multi-field < ordering 2 years ago
win32.cpp Windows fix: iterate over IPv4/IPv6 interfaces separately 2 years ago