summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* WIPth/platform_refact_caching-bgo747981-2Thomas Haller2015-05-061-86/+48
|
* nmp: add cache generation idThomas Haller2015-05-062-0/+17
|
* platform/test: add simple test for NMLinuxPlatformThomas Haller2015-05-061-0/+12
| | | | | 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-05-061-6/+4
|
* platform: remove obsolete functions after refactoring platform cacheThomas Haller2015-05-061-1392/+0
|
* platform: use new platform cachingThomas Haller2015-05-067-476/+361
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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, but that can be later improved by exposing the cached objects directly. * 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. - In the future, we could expose the cached objects directly to users of NMPlatform. * 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-05-061-0/+1121
| | | | | It is not yet used, only add new code beside the existing implementation. It will be used later.
* fixup! platform: implement NMPObject and NMPCacheThomas Haller2015-05-062-0/+6
|
* platform: implement NMPObject and NMPCacheThomas Haller2015-05-067-5/+2847
| | | | | | | | | | | | | Parts of the implementation is inside nm-linux-platform.c, because it depends on utility functions from there. 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.
* platform: move ObjectType to nmp-object.hThomas Haller2015-05-062-13/+11
|
* platform: add nmp-object.h fileThomas Haller2015-05-066-0/+109
|
* core: add NMMultiIndexThomas Haller2015-05-064-0/+863
| | | | | | | A class to do efficient lookup for values based on a key. One value can be referenced by multiple keys, and one key can contain multiple values. Hence the name.
* core: add NMRefStringThomas Haller2015-05-063-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 different alloc/free functions. It will be used for NMPlatformLink.udi field, which currently reuses the internal value from the GUdevDevice instance. Later we need to keep our own clone of that string, so let's make it ref-counted. -- especially, because we create throw-away clones of link objects while updating.
* glib-compat: add nm_g_hash_table_replace() compat functionThomas Haller2015-05-061-0/+16
| | | | | The newer version of g_hash_table_replace() is neat, because it saves an additional hash table lookup.
* glib-compat: add g_ptr_array_insert()Thomas Haller2015-05-062-0/+61
| | | | | | Yes, I end up not using this function on the branch. Maybe let's keep it, it might be useful -- until we bump our glib requirements.
* platform: add _NM_IP_CONFIG_SOURCE_RTPROT_KERNEL sourceThomas Haller2015-05-062-4/+12
| | | | | | | 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-05-061-0/+7
|
* platform: print more fields in nm_platform_link_to_string()Thomas Haller2015-05-061-24/+67
|
* platform: expose internal buffer for to_string() functionsThomas Haller2015-05-062-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-05-061-11/+11
|
* platform/trivial: rename NMPlatformLink.initialized to is_in_udevThomas Haller2015-05-066-9/+15
| | | | | Later we will have a @is_in_netlink property. Rename it to have a more specific name.
* platform: add inet6_token parameter to NMPlatformLinkThomas Haller2015-05-063-0/+32
|
* platform: add arptype parameter to NMPlatformLinkThomas Haller2015-05-063-0/+5
|
* platform: add inet6_addr_get_mode_inv parameter to NMPlatformLinkThomas Haller2015-05-063-0/+15
|
* platform: add addr parameter to NMPlatformLinkThomas Haller2015-05-063-0/+29
|
* platform: add vlan_id parameter to NMPlatformLinkThomas Haller2015-05-063-0/+15
|
* platform: add flags parameter to NMPlatformLinkThomas Haller2015-05-063-3/+23
|
* platform: add scope parameter to NMPlatformIP4RouteThomas Haller2015-05-069-5/+104
| | | | | | | We will later need the scope for NMPlatformIP4Route because for route deletion with old netlink library, we must explicitly set the scope of the route we want to delete.
* platform: return @now from _rtnl_addr_last_update_time_to_nm()Thomas Haller2015-05-061-3/+9
| | | | Will be used later.
* platform: expose nm_platform_signal_change_type_to_string()Thomas Haller2015-05-063-24/+11
|
* platform: refactor support_kernel_extended_ifa_flags to have support in ↵Thomas Haller2015-05-061-40/+44
| | | | | | | static variable Whether we have support depends on the kernel, and is not per NMLinuxPlatform instance.
* platform: move supports_mii_carrier_detect() to ↵Thomas Haller2015-05-053-44/+52
| | | | nmp_utils_mii_supports_carrier_detect()
* platform: move ethtool_*() to nmp_utils_ethtool_*()Thomas Haller2015-05-053-169/+186
|
* platform: factor out ethtool_get_wake_on_lan() functionThomas Haller2015-05-051-10/+19
|
* platform: factor out ethtool_get_peer_ifindex() functionThomas Haller2015-05-051-13/+28
|
* platform: factor out ethtool_supports_vlans() functionThomas Haller2015-05-051-24/+30
|
* platform/trivial: move ethtool_supports_carrier_detect() codeThomas Haller2015-05-051-13/+13
|
* platform: move code udev_get_driver() to nmp_utils_udev_get_driver()Thomas Haller2015-05-053-42/+48
|
* platform: add nm-platform-utils.[ch] filesThomas Haller2015-05-056-4/+107
| | | | | | | | | | | | There is no general purpose file for platform utilities. We only have nm-platform.h, which contains (mostly) functions that operate on a NMPlatform instance (and that can be mocked using NMFakePlatform). Add a new file for independent utility functions. nm-platform-utils.c should not call into functions having a NMPlatform instance, to have them independent from platform caching and the platform singleton.
* platform: move nm_platform_query_devices() to nm-managerThomas Haller2015-05-053-29/+16
| | | | | | | | | | | | | nm_platform_query_devices() would raise an 'added' signal for all its links. That is bad style because it could confuse other listeners for platform signals which don't expect such artificial change signals. The public API of NMPlatform already gives NMManager the ability to 'pull' all the links and iterate them itself. Before, nm_platform_query_devices() would also initialize udev devices, so there was a more compelling reason for this function.
* platform: merge setup_devices() function into constructed()Thomas Haller2015-05-053-18/+4
| | | | | | We already populate the netlink cache in constructed(). No need to wait with udev devices until nm_platform_query_devices(). Just do it right away.
* platform/test: include call location in signal assertionsThomas Haller2015-05-052-21/+29
| | | | | Hard to debug failures, if we don't print where the failure happens.
* platform/test: make asserting signals more flexibleThomas Haller2015-05-054-29/+37
| | | | | | | Support accepting more then one signal at a time. It is to be expected, that one change in platform raises several signals. Extend the assertion helpers to express that.
* route-manager/test: fix missing initialization of temporary variables on stackThomas Haller2015-05-051-3/+3
| | | | | | | | | Up to now, this code was correct. Later we will add another field to NMPlatformIP4Route which causes the test to operate on uninitialized data. Instead of explicitly initializing the field, just clear the whole struct.
* test: fix wrong use of memcmp() in nmtst_platform_ip4_routes_equal()Thomas Haller2015-05-051-6/+0
| | | | | | | | | | | | And nmtst_platform_ip6_routes_equal(). As already indicated by the comment, using memcmp() doesn't really work here. It worked up to now, because the NMPlatformIP4Route structure has no padding at the end. If we would have a last 'guint8' member (as we will add later), initializing an arry of routes on the stack would not clear the bytes from the padding and the comparison using memcmp() would fail.
* platform: fix nm_platform_link_cmp() to consider ifindexThomas Haller2015-05-051-0/+1
|
* vpn: don't fail if no system secrets existDan Williams2015-05-051-1/+1
| | | | | | | | | | | | The VPN connection requests secrets a few times; first it retrieves only system-owned secrets to see if they are sufficient (and thus doesn't need to bother the user), then it retrieves existing agent owned secrets (so the user doesn't get a popup), then finally if those aren't sufficient it asks the user interactively. But if there was some error retrieving system secrets, or if there weren't any system secrets at all, don't fail the VPN connection. Just go on and ask the user for the secrets.
* core: merge branch 'th/reload-ignore-carrier-bgo748050'Thomas Haller2015-05-055-17/+47
|\ | | | | | | | | | | | | Make the main.ignore-carrier configuration option reloadable via our usual SIGHUP mechanism. https://bugzilla.gnome.org/show_bug.cgi?id=748050
| * device: allow reloading of the ignore-carrier flagThomas Haller2015-05-051-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now on SIGHUP, when reloading NetworkManager configuration, also reload the ignore-carrier flag. While a device is activated, the reload is ignored until the device deactivates. Maybe it would be simpler just not to cache ignore_carrer and let it take effect immediately. But not caching ignore_carrer has the additional downside that every call to is_available must check the specs -- which in sum is potentially expensive for something that almost never changes. https://bugzilla.gnome.org/show_bug.cgi?id=748050
| * config: make ignore-carrier option reloadableThomas Haller2015-05-055-17/+19
|/ | | | | | | | Only move the ignore-carrier option from NMConfig to NMConfigData. The ignore-carrier option is still immutable after startup. https://bugzilla.gnome.org/show_bug.cgi?id=748050