diff options
author | Thomas Haller <thaller@redhat.com> | 2017-07-07 23:34:41 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-07-25 06:44:12 +0200 |
commit | 22edeb5b691befd796c534cf71901b32f0b7945b (patch) | |
tree | 98cdbd184ae8d73242d267d27f4882094ecbf236 /src/dnsmasq | |
parent | 74816a22374091f1cde34372387f8c6bfcd688dc (diff) | |
download | NetworkManager-22edeb5b691befd796c534cf71901b32f0b7945b.tar.gz |
core: track addresses for NMIP4Config/NMIP6Config via NMDedupMultiIndex
Reasons:
- it adds an O(1) lookup index for accessing NMIPxConfig's addresses.
Hence, operations like merge/intersect have now runtime O(n) instead
of O(n^2).
Arguably, we expect low numbers of addresses in general. For low
numbers, the O(n^2) doesn't matter and quite likely in those cases
the previous implementation was just fine -- maybe even faster.
But the simple case works fine either way. It's important to scale
well in the exceptional case.
- the tracked objects can be shared between the various NMPI4Config,
NMIP6Config instances with NMPlatform and everybody else.
- the NMPObject can be treated generically, meaning it enables code to
handle both IPv4 and IPv6, or addresses and routes. See for example
_nm_ip_config_add_obj().
- I want core to evolve to somewhere where we don't keep copies of
NMPlatformIP4Address, et al. instances. Instead they shall all be
shared. I hope this will reduce memory consumption (although tracking a
reference consumes some memory too). Also, it shortcuts nmp_object_equal()
when comparing the same object. Calling nmp_object_equal() on the
identical objects would be a common case after the hash function
pre-evaluates equality.
Diffstat (limited to 'src/dnsmasq')
-rw-r--r-- | src/dnsmasq/nm-dnsmasq-manager.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dnsmasq/nm-dnsmasq-manager.c b/src/dnsmasq/nm-dnsmasq-manager.c index f76c983dcd..3296cd0e73 100644 --- a/src/dnsmasq/nm-dnsmasq-manager.c +++ b/src/dnsmasq/nm-dnsmasq-manager.c @@ -162,7 +162,7 @@ create_dm_cmd_line (const char *iface, const NMPlatformIP4Address *listen_address; guint i, n; - listen_address = nm_ip4_config_get_address (ip4_config, 0); + listen_address = nm_ip4_config_get_first_address (ip4_config); g_return_val_if_fail (listen_address, NULL); dm_binary = nm_utils_find_helper ("dnsmasq", DNSMASQ_PATH, error); |