summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* platform/trivial: move code (nm_rtnl_link_parse_info_data)Thomas Haller2015-06-171-82/+84
|
* platform/trivial: rename by using _nl_*() prefix for libnl related functionsThomas Haller2015-06-171-29/+28
|
* platform: remove redundant NMPlatformLink fields "arp" and "up"Thomas Haller2015-06-176-31/+23
|
* platform: fetch objects via the event socketThomas Haller2015-06-175-508/+754
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the event socket to request object via NLM_F_DUMP. No longer use 'priv->nlh' socket to fetch objects. Instead fetch them via the priv->nlh_event socket that also provides asynchronous events when objects change. That way, the events are in sync with our explicit requests and we can directly use the events. Previously, the events were only used to indicate that a refetch must happen, so that every event triggered a complete dump of all addresses/routes. We still use 'priv->nlh' to make synchronous requests such as adding/changing/deleting objects. That means, after we send a request, we must make sure that the result manifested itself at 'nlh_event' socket and the platform cache. That's why we sometimes still must force a dump to sync changes. That could be improved by using only one netlink socket so that we would wait for the ACK of our request. While not yet perfect, this already significantly reduces the number of fetches. Additionally, before, whenever requesting a dump of addresses or routes (which we did much more often, search for "get_kernel_object for type" log lines), we always dumped IPv4 and IPv6 together. Now only request the addr-family in question. https://bugzilla.gnome.org/show_bug.cgi?id=747985 https://bugzilla.redhat.com/show_bug.cgi?id=1211133
* libnm: add _nm_utils_ptrarray_find_first() utility functionThomas Haller2015-06-172-0/+28
|
* utils: add nm_utils_is_power_of_two() macroThomas Haller2015-06-172-0/+115
|
* platform: register singleton instance early with NM_PLATFORM_REGISTER_SINGLETONThomas Haller2015-06-173-1/+59
| | | | | | | | | | | | | | Add a construct-only property NM_PLATFORM_REGISTER_SINGLETON to NMPlatform. When set to TRUE, the constructor will self-register to nm_platform_setup(). The reason for this is that the _LOG() macro in NMLinuxPlatform logs the self pointer if the instance is not the singleton instance. During construction, we already have many log lines due to initialization of the instance. These lines all end up qualified with the self pointer. By earlier self-registering, printing the pointer value is omitted. Yes, this patch is really just to prettify logging.
* platform: reorder initializationThomas Haller2015-06-171-11/+16
| | | | | First fully construct the GOjbect instance before starting to populate the cache.
* platform: add _support_user_ipv6ll_still_undecided() macroThomas Haller2015-06-171-2/+5
|
* platform: add priv pointer to NMLinuxPlatformThomas Haller2015-06-172-5/+19
|
* platform: refactor flushing of event socket to _nl_sock_flush_data()Thomas Haller2015-06-171-10/+28
|
* platform/test: add simple test for NMLinuxPlatformThomas Haller2015-06-171-0/+15
| | | | | Just create a NMLinuxPlatform instance and unref it again. This already connects to netlink and fetches all objects.
* platform: remove unused argument preserve_rtprot from rtprot_to_source()Thomas Haller2015-06-171-6/+4
|
* platform: remove obsolete functions after refactoring platform cacheThomas Haller2015-06-171-1426/+0
|
* platform: use new platform cachingThomas Haller2015-06-176-515/+410
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch platform caching implementation. Instead of caching libnl objects, cache our own types. Don't remove yet the now obsolete functions. Advantage: * Performance - as we now cache our native NMPlatformObject instances, we no longer have to convert libnl objects every time we access the platform cache. - for most cases, access is now O(1) because we can lookup the object in a hash table. Note that ip4_address_get_all() still has to create a copy of the result (O(n)), but as the caller is about to use those elements, he cannot do better then O(n) anyway. * We cache our own native types and have full control over them. We cannot extend the libnl objects, which has many short-commings: - _rtnl_addr_hack_lifetimes_rel_to_abs() to convert the timestamps to absolute values (and back). - hack_empty_master_iff_lower_up() would modify the internal flag, but it looses the original value. That means, we can only hack the state before putting a link into the cache, but we cannot revert that change, when a slave in the cache changes state. That was previously solved by always refetching the master when a slave changed. Now we can re-evaluate the connected state (DELAYED_ACTION_TYPE_MASTER_CONNECTED). - we implement functions like equality, to-string as most suitable for us. Before we needed hacks like nm_nl_object_diff(), nm_nl_cache_search(), route_search_cache(). - we can extend our objects with exactly those properties we care, and possibly additional properties that are not representable in the libnl objects. - we no longer cache RTM_F_CLONED routes and they get rejected early on as we receive them. - In the future, maybe it'd be interesting the make platform objects immutable (and ref-counted) and expose them directly. * Previous implementation did not order the refresh of objects but called check_cache_items(). Now, those actions are delayed and combined in an attempt to reduce the overall number of reloads. Realize how expensive a check_cache_items() for addresses and routes was: it would iterate all addresses/routes and call refresh_object(). The latter obtains a full dump of *all* objects again, and ignores all but the needle. Note that we probably still schedule some delayed actions that are not needed. Later we can optimize that further (related bug bgo #747985). While some of these points could also have been implemented with caching of libnl objects, that would have become hard to maintain. https://bugzilla.gnome.org/show_bug.cgi?id=747981
* platform: add new platform caching to nm-linux-platform.cThomas Haller2015-06-171-0/+1143
| | | | | It is not yet used, only add new code beside the existing implementation. It will be used later.
* platform: implement NMPObject and NMPCacheThomas Haller2015-06-177-5/+3064
| | | | | | | | | | | | | NMPObject is a simple "object" implemenation around NMPlatformObject. They are ref-counted and have a class-pointer. Several basic functions like equality, hash, to-string are implemented. NMPCache is can be used to store the NMPObject. Objects are indexed via their primary id, but there is also multi-lookup via NMCacheId and NMMultiIndex. Part of the implementation is inside "nm-linux-platform.c", because it depends on utility functions from there.
* platform: move ObjectType to nmp-object.hThomas Haller2015-06-172-13/+11
|
* platform: add nmp-object.h fileThomas Haller2015-06-176-0/+108
|
* core: add NMMultiIndex classThomas Haller2015-06-174-0/+912
| | | | | | | | | | | | | | | | | | | | | | | A class to do efficient lookup for multiple values based on a key. The values are opaque pointers (void*). These values can be associated with keys. The keys are an opaque type NMMultiIndexId with arbitrary hash/equal functions. Think of the keys being a set of buckets. A value can be associated with multiple keys, just like with a regular GHashTable (i.e. it can be in multiple buckets). But one key can also be associated with multiple values (i.e. one bucket can contain multiple values). Hence the name "multi". One bucket can only either contain a value or not. It cannot contain the same value multiple times. This is implemented as a hash of hashes with the outer keys being NMMultiIndexId. The inner hashes are the "buckets". This class will be used as an efficient lookup index to find all values that belong to a certain key (bucket). Later we will ask for example "Which IP4-Addresses are associated with a certain ifindex" and efficiently retrieve the cached result list.
* core: add NMRefStringThomas Haller2015-06-173-0/+182
| | | | | | | | NMRefString is a simple, refcounted, immutable string. Increasing/decreasing the refcount does not affect const-ness. It can be used just like a regular 'const char *' pointer. The only difference is that you need special alloc/free functions.
* glib-compat: add nm_g_hash_table_replace() compat functionThomas Haller2015-06-171-0/+17
| | | | | The newer version of g_hash_table_replace() is useful, because it saves an additional hash table lookup.
* platform: add _NM_IP_CONFIG_SOURCE_RTPROT_KERNEL sourceThomas Haller2015-06-173-4/+14
| | | | | | | Later we will need this flag to distinguish routes from kernel that have source RTPROT_KERNEL. This flag is still unused.
* platform: implement dispose() in NMLinuxPlatformThomas Haller2015-06-171-0/+7
|
* platform: print more fields in nm_platform_link_to_string()Thomas Haller2015-06-171-25/+69
|
* platform: expose internal buffer for to_string() functionsThomas Haller2015-06-172-1/+2
| | | | | I'd like to reuse this buffer for other to-string functions that are platform related.
* platform/trivial: rename to_string_buffer variableThomas Haller2015-06-171-11/+11
|
* platform: add inet6_token parameter to NMPlatformLinkThomas Haller2015-06-173-0/+32
|
* platform: add arptype parameter to NMPlatformLinkThomas Haller2015-06-173-0/+5
|
* platform: add inet6_addr_get_mode_inv parameter to NMPlatformLinkThomas Haller2015-06-173-0/+15
|
* platform: add addr parameter to NMPlatformLinkThomas Haller2015-06-173-0/+31
|
* platform: add vlan_id parameter to NMPlatformLinkThomas Haller2015-06-173-0/+15
|
* platform: add flags parameter to NMPlatformLinkThomas Haller2015-06-173-3/+23
|
* platform: add scope parameter to NMPlatformIP4RouteThomas Haller2015-06-176-5/+48
| | | | | | | Cache the scope as part of the NMPlatformIP4Route and no longer read it from libnl object when needed. Later there will be no more libnl objects around, and we need to scope when deleting an IPv4 route.
* platform: return @now from _rtnl_addr_last_update_time_to_nm()Thomas Haller2015-06-121-3/+9
| | | | Will be used later.
* merge: branch 'bg/hostname-bgo740409'Beniamino Galvani2015-06-1230-2492/+423
|\ | | | | | | | | | | | | | | | | | | - move all hostname-related functions from plugins to the core - allow to specify the method used to load and store the hostname at build time - add hostnamed support - remove unused setting plugins https://bugzilla.gnome.org/show_bug.cgi?id=740409
| * settings/example: remove 'example' settings pluginThomas Haller2015-06-1211-1214/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'example' settings plugin is (obviously) unused, but it is also badly maintained and no longer best-practice in several ways: - it directly reads "NetworkManager.conf" instead of using NMConfig. - it parses device specs itself, instead of using nm_match_spec_split(). - read_connections() doesn't ensure that loading a file does not replace a previously loaded one (due to conflicting UUID). In general the example doesn't show/handle the complexity of potential UUID conflicts. Instead of fixing these issues it is better to ensure our main plugin ('keyfile') corresponds to current best practices. Should we ever add a new pluginww, 'keyfile' should be the example.
| * keyfile: refactor reading "keyfile.unmanaged-devices" settingThomas Haller2015-06-121-80/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of parsing "/etc/NM/NetworkManager.conf" in keyfile plugin itself, use NMConfig. Parsing it outside of NMConfig API has the significant disadvantage of not considering files under "conf.d/". This also has a behavioral change: keyfile no longer monitors "NetworkManager.conf" file for changes, but instead only reacts on explict "config-changed" signals from NMConfig. This previous behavior of picking up file changes without user-interaction is anyway not what we want. NM should not react on mere file changes, but only on explicit reload commands. And even if we want to support it, file watching should be implemented properly inside NMConfig, watching *all* relevant files. This was the last out-of-api access to the configuration after refactoring NMConfig. Now that keyfile plugin no longer writes the hostname, we can get rid of this.
| * keyfile: refactor dispose() of SCPluginKeyfileThomas Haller2015-06-121-12/+8
| |
| * settings: remove ifcfg-suse pluginBeniamino Galvani2015-06-128-210/+9
| | | | | | | | | | | | | | | | | | After the hostname functionality has been moved from plugins to core, the ifcfg-suse plugin contains only boilerplate code with no actual functionality. Remove the plugin, mark it as deprecated in manual page and print a warning when it is selected in configuration file.
| * settings: add hostnamed supportBeniamino Galvani2015-06-121-1/+91
| | | | | | | | | | | | | | When the systemd-hostnamed daemon is available, use it to read and change the hostname. Based on 'danw/wip/hostnamed' branch by Dan Winship <danw@redhat.com>
| * settings: factor out monitor initialization from nm_settings_new()Beniamino Galvani2015-06-121-21/+29
| |
| * settings: remove hostname handling from pluginsBeniamino Galvani2015-06-1216-940/+28
| | | | | | | | | | Remove all hostname-related code from plugins since this functionality has been moved to the core.
| * core: move handling of hostname from plugins to coreBeniamino Galvani2015-06-122-46/+258
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | How to write and read the machine hostname is something that has been handled until now by plugins; this is questionable since the method using for storing the hostname should depend only on the distro used and not on which plugins are enabled. This commit moves all hostname-related functions from plugins to the core and allows to specify the method used to load and store the hostname at build time with the --with-hostname-persist=default|suse|gentoo configure option. 'default' method stores the hostname to /etc/hostname and monitors it to detect runtime changes. When the selected method is 'suse', the hostname gets read from and written to /etc/HOSTNAME; the file /etc/sysconfig/network/dhcp is also read to detect if the hostname is dynamic and thus invalid. Both files are monitored for changes. 'gentoo' method relies on /etc/conf.d/hostname for storing the hostname.
| * build: link core against SELinuxBeniamino Galvani2015-06-121-0/+5
|/ | | | | Some functions that rely on SELinux support are going to be moved from plugins to core. Enable linking against the library.
* libnm/utils: add _nm_utils_strv_find_first() functionThomas Haller2015-06-112-5/+47
|
* gitignore: ignore temporary files during buildThomas Haller2015-06-111-0/+5
| | | | | If you type `git status` a certain times during build, you see some temporary (untracked) files. Ignore them.
* cli: use color names when TAB-completing "nmcli prompt-color"Jiří Klimeš2015-06-111-1/+2
|
* cli: take color name arguments for "nmcli prompt-color" in editor (bgo #744936)Jiří Klimeš2015-06-113-15/+41
| | | | | | | | | Adjust nmcli prompt-color description and make it more friendly for translators. nmcli> nmcli prompt-color green https://bugzilla.gnome.org/show_bug.cgi?id=744936
* cli: fix metered to string propertyThomas Haller2015-06-101-0/+11
| | | | | | | nmc_property_connection_get_metered() must return non-localized strings that can be parsed by nmc_property_connection_set_metered(). Fixes: f0aebfd7462dea9b3ebc579a49248027f6d23905