summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* cli: add ' nmcli connection clone' command for cloning connectionsjk/nmcli-con-cloneJiří Klimeš2015-11-063-1/+203
| | | | | | | | | | | | | | Synopsis: nmcli connection clone [--temporary] [id|uuid|path] <ID> <new name> It copies the <ID> connection as <new name>. The command is very useful if there is a connection, but another one is needed for a related configuration. One can copy the existing profile and modify it for the new situation. For example: $ nmcli con clone main-eth second-eth $ nmcli con mod second-eth connection.interface-name em4
* policy: fix looping through list while removing elements (rh #1175446)Jiří Klimeš2015-11-051-3/+7
| | | | | | | | | | | | When g_slist_remove() was called, iter2 became invalid and accessing it could cause a crash. The same was true for iter. Fix the problem by getting the next list item before an element removal. See a similar fix in bluez http://git.kernel.org/cgit/bluetooth/bluez.git/commit/?id=be8c5be809875ba449a10ca29f5244f0231f6b63 https://bugzilla.redhat.com/show_bug.cgi?id=1175446 https://bugzilla.redhat.com/show_bug.cgi?id=1277247
* linux-platform: don't overwrite network with preferred sourceLubomir Rintel2015-11-051-1/+1
| | | | A typo, likely.
* device: fix switched ip6_config_subtract argumentsLubomir Rintel2015-11-051-4/+4
| | | | Came up during review and received less thought than deserved.
* agent-manager: don't try to cancel requests that already finishedLubomir Rintel2015-11-041-2/+4
| | | | Fixes: 5d1cac81a0bcc66b891bc38f1a2cc4b84d47f08b
* device: terminate the activation chain when entering the failed stateBeniamino Galvani2015-11-031-0/+8
| | | | | | | | | | | | Device activation normally fails during one of the stages and in that case the activation chain is implicitly interrupted. But in some cases the device fails for external events (as a failure of master connection) while the activation sequence is still running and so we need to ensure that any pending activation source gets cleared upon entering the failed state. https://bugzilla.redhat.com/show_bug.cgi?id=1270814
* rdisc/tests: initialize iid passed to nm_rdisc_set_iid()Beniamino Galvani2015-11-032-2/+2
| | | | Fixes: b3e0811b811b8021dc52b32b88e13468494d9d7a
* test-link: skip test if iproute2 is not capable enoughLubomir Rintel2015-11-031-2/+8
| | | | Older iproute2 as shipped with Ubuntu 14 doesn't support vxlan dstport.
* core: fix assuming a connection without S390 properties (rh #1276343)Jiří Klimeš2015-11-032-0/+85
| | | | | | | | | | | | | | | | | | | | | When a connection should be assumed and the generated connection did not contain a wired setting, the connection did not match due to S390 properties. Such a connection should be allowed to match to a connection with a wired setting with default (empty) S390 properties. This can happen when there is a VLAN profile configured that contains a wired setting in it and NetworkManager is (re)started. Example/reproducer: $ nmcli con add type vlan con-name vlan-test autoconnect no dev em1 id 44 $ nmcli con mod vlan-test eth.mtu 1450 (modify the connection, so that it has a wired setting) $ nmcli con up vlan-test (activate the connection) $ sudo systemctl restart NetworkManager $ nmcli device check that 'vlan-test' connection is active on em1.44 device (and not the auto-generated em1.44) https://bugzilla.redhat.com/show_bug.cgi?id=1276343
* libnm-core: fix make dist with --enable-tests=noLubomir Rintel2015-11-021-2/+2
| | | | We still need BUILT_SOURCES.
* merge: branch 'lr/stable-privacy-rfc7217'Lubomir Rintel2015-11-0223-134/+768
|\ | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=755216
| * libnm-core: default to ip6.addr-gen-mode=stable-privacylr/stable-privacy-rfc7217Lubomir Rintel2015-11-024-10/+17
| | | | | | | | | | | | Take a missing value in keyfile/ifcfg-rh as EUI-64 to keep the compatibility with the old conneciton. Nevertheless, the new connections should default to the RFC7217 addresses.
| * core: add support for RFC7217 stable privacy addressingLubomir Rintel2015-11-0211-29/+314
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RFC7217 introduces an alternative mechanism for creating addresses during stateless IPv6 address configuration. It's supposed to create addresses whose host part stays stable in a particular network but changes when the hosts enters another network to mitigate possibility of tracking the host movement. It can be used alongside RFC 4941 privacy extensions (temporary addresses) and replaces the use of RFC 4862 interface identifiers. The address creation mode is controlld by ip6.addr_gen_mode property (ADDR_GEN_MODE in ifcfg-rh), with values of "stable-privacy" and "eui-64", defaulting to "eui-64" if unspecified. The host part of an address is computed by hashing a system-specific secret salted with various stable values that identify the connection with a secure hash algorithm: RID = F(Prefix, Net_Iface, Network_ID, DAD_Counter, secret_key) For NetworkManager we use these parameters: * F() SHA256 hash function. * Prefix This is a network part of the /64 address * Net_Iface We use the interface name (e.g. "eth0"). This ensures the address won't change with the change of interface hardware. * Network_ID We use the connection UUID here. This ensures the salt is different for wireless networks with a different SSID as suggested by RFC7217. * DAD_Counter A per-address counter that increases with each DAD failure. * secret_key We store the secret key in /var/lib/NetworkManager/secret_key. If it's shorter than 128 bits then it's rejected. If the file is not present we initialize it by fetching 256 pseudo-random bits from /dev/urandom on first use. Duplicate address detection uses IDGEN_RETRIES = 3 and does not utilize the IDGEN_DELAY delay (despite it SHOULD). This is for ease of implementation and may change in future. Neither parameter is currently configurable.
| * core: support IPv6 duplicate address detectionLubomir Rintel2015-11-025-6/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NMDevice detects the DAD failures by watching the removal of tentative addresses (happens for DAD of addresses with valid lifetime, typically discovered addresses) or changes to addresses with dadfailed flag (permanent addresses, typically link-local and manually configured addresses). It retries creation of link-local addresses itself and lets RDisc know about the rest so that it can decide if it's rdisc-managed address and retry with a new address. Currently NMDevice doesn't do anything useful about link-local address DAD failures -- it just fails the link-local address addition instead of just timing out, which happened before. RDisc just logs a warning and removes the address from the list. However, with RFC7217 stable privacy addresses the use of a different address and thus a recovery from DAD failures would be possible.
| * rdisc: move address generation into NMRDisc from NMLNDPRdiscLubomir Rintel2015-11-027-93/+118
| | | | | | | | | | It makes more sense in the generic place. It will make it possible for the NMRDisc to retry the address generation upon DAD failures.
| * cli: add addr-gen-mode propertyLubomir Rintel2015-11-021-4/+44
| |
| * ifcfg-rh: add support for addr-gen-mode propertyLubomir Rintel2015-11-022-7/+30
| |
| * keyfile: add support for addr-gen-mode propertyLubomir Rintel2015-11-022-0/+46
| |
| * setting-ip6-config: add addr-gen-mode propertyLubomir Rintel2015-11-023-0/+117
|/
* tests: fix error message in nmtst_assert_ip6_address()Thomas Haller2015-11-021-1/+1
| | | | Fixes: 09983442bd8be13392876cb8cf4e1564907b07e4
* merge: branch 'lr/vpn-aliases'Lubomir Rintel2015-11-024-23/+18
|\ | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=757432
| * vpn-plugin-info: add vpn plugin service aliaseslr/vpn-aliasesLubomir Rintel2015-11-021-1/+16
| |
| * vpn-plugin-info: drop nm_vpn_plugin_info_get_service()Lubomir Rintel2015-11-024-22/+2
|/ | | | | | It is not used externally and its use might be confusing and undesired when we add plugin aliases. The external users should only use the name when idenfiying the plugin and nm_vpn_plugin_info_list_find_by_service() when matchin the plugin.
* test: disable g_log_set_always_fatal() for non-assert tests on older glib ↵Thomas Haller2015-11-021-0/+5
| | | | | | | versions This fixes test-failure for src/platform/tests/test-link-fake on older systems.
* platform: use ifi_change field for setting link flagsThomas Haller2015-11-023-68/+60
| | | | | | | | | | Previously, we would not set the ifi_change field, so that all flags in ifi_flags were considered. That required us to lookup the currently set flags from the cache. Change that, to set only the flags in the netlink message that we want to change. This saves us a cache-lookup, but more importantly, the cache might be out of date.
* platform: merge branch 'th/platform-parse-nl-bgo754570'Thomas Haller2015-11-0256-3407/+5947
|\ | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=754570
| * vlan: handle vlan flags, ingress and egress map in NMDeviceVlanThomas Haller2015-11-023-20/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In update_connection(), pickup the configuration of the vlan interface from platform and create the proper NMSettingVlan setting. And during stage1, configure the flags of the device. Also, change all the ingress/egress mappings at once instead of having a netlink request for each mapping. Also, ensure we *clear* all other mappings so that only those are set, that were configured (done by the *gress_reset_all argument).
| * libnm: don't re-sort the vlan priorities every time in set_map()Thomas Haller2015-11-021-9/+30
| |
| * platform/vlan: add support for ingress/egress-qos-mappings and changing flagsThomas Haller2015-11-027-98/+1122
| | | | | | | | | | | | | | | | Previously, we could only set the ingress-qos-mappings/egress-qos-mappings. Now also cache the mappings and expose them from the platform cache. Also, support changing the vlan flags not only when creating the vlan interface.
| * libnm: internally expose NMVlanQosMapping struct in "nm-core-internal.h"Thomas Haller2015-11-022-21/+22
| |
| * libnm: add internal header file "nm-core-types-internal.h"Thomas Haller2015-11-024-0/+28
| | | | | | | | | | | | | | | | | | This shall contain type definitions, with similar use to "nm-core-internal.h". However, it should contain a minimal set, so that we can include this header in other headers under "src/", without including the whole "nm-core-internal.h" in headers.
| * platform: promise that the link lnk is an immutable NMPObject and expose itThomas Haller2015-11-028-56/+91
| | | | | | | | | | Expose internal lnk object and promise in the API that the object will not be modified (which allows the user to ref it).
| * nmp-object: add virtual function for implementing nmp_object_to_string()Thomas Haller2015-11-022-33/+36
| |
| * build: no longer link against libnl-route-3 libraryThomas Haller2015-11-021-1/+1
| |
| * platform: create netlink messages directly without libnl-route-3Thomas Haller2015-11-0210-1008/+938
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of using libnl-route-3 library to serialize netlink messages, construct the netlink messages ourselves. This has several advantages: - Creating the netlink message ourself is actually more straight forward then having an intermediate layer between NM and the kernel. Now it is immediately clear, how a platform request translates to a netlink/kernel request. You can look at the kernel sources how a certain netlink attribute behaves, and then it's immediately clear how to set that (and vice versa). - Older libnl versions might have bugs or missing features for which we needed to workaround (often by offering a reduced/broken/untested functionality). Now we can get rid or workaround like _nl_has_capability(), check_support_libnl_extended_ifa_flags(), HAVE_LIBNL_INET6_TOKEN. Another example is a libnl bug when setting vlan ingress map which isn't even yet fixed in libnl upstream. - We no longer need libnl-route-3 at all and can drop that runtime requirement, saving some 400k. Constructing the messages ourselves also gives better performance because we don't have to create the intermediate libnl object. - In the future we will add more link-type support which is easier to support by basing directly on the plain kernel/netlink API, instead of requiring also libnl3 to expose this functionality. E.g. adding macvtap support: we already parsed macvtap properties ourselves because of missing libnl support. To *add* macvtap support, we also would have to do it ourself (or extend libnl).
| * platform: reimplement netlink flags/enum to string conversionsThomas Haller2015-11-024-74/+93
| |
| * utils: add flags2str utility functionsThomas Haller2015-11-023-0/+244
| |
| * core: add nm_utils_to_string_buffer global bufferThomas Haller2015-11-028-39/+52
| | | | | | | | | | | | | | | | | | | | | | | | Having a static string buffer for convenience is useful not only for platform. Define the string buffer in NetworkManagerUtils.h, so that all to-string functions can reuse *one* buffer. Of course, this has the potential danger, that different to-string method might reuse the same buffer. Hence, low-level library functions are adviced to use their own buffer, because an upper level might already use the global buffer for another string.
| * platform/tests: test setting bridge addressThomas Haller2015-11-022-0/+53
| |
| * platform/trivial: rename variable "obj_needle" to "obj_id"Thomas Haller2015-11-021-46/+46
| | | | | | | | Both names were used for the same thing.
| * platform: properly handle IPv4 peer-addressesThomas Haller2015-11-0221-154/+227
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The peer-address (IFA_ADDRESS) can also be all-zero (0.0.0.0). That is distinct from an usual address without explicit peer-address, which implicitly has the same peer and local address. Previously, we treated an all-zero peer_address as having peer and local address equal. This is especially grave, because the peer is part of the primary key for an IPv4 address. So we not only get a property of the address wrong, but we wrongly consider two different addresses as one and the same. To properly handle these addresses, we always must explicitly set the peer.
| * ip4-config: let the IPv4 device route depend on the peer-addressThomas Haller2015-11-023-32/+28
| | | | | | | | | | | | | | | | | | | | | | | | Usually, the peer-address is the same as the local address. In case where it is not, it is the peer-address that determines the IPv4 device-route. So we must use the peer-address. Also, don't consider device-routes with the first octet of zero, just like kernel does. Also, nm_ip4_config_get_subnet_for_host() is effectively the same as nm_ip4_config_destination_is_direct(). So drop it.
| * platform/tests: add test setting vlan ingress/egress mappingsThomas Haller2015-11-021-0/+45
| |
| * platform/trivial: reorder declaration of structures in "nm-platform.h"Thomas Haller2015-11-021-25/+25
| | | | | | | | Just group the NMPlatformLnk* types together and sort them by name.
| * platform/trivial: rename nm_platform_infiniband_get_info() to get_properties()Thomas Haller2015-11-023-7/+7
| | | | | | | | | | | | We already have nm_platform_tun_get_properties(). Rename the function as they both sidestep the platform cache to lookup some link-specific properties.
| * platform: refactor nm_platform_veth_get_properties()Thomas Haller2015-11-026-60/+28
| | | | | | | | | | | | | | | | | | | | | | | | For recent kernels, the peer-ifindex of veths is reported as parent (IFA_LINK). Prefer that over the ethtool lookup. For one, this avoids the extra ethtool call which has the downside of sidestepping the platform cache. Also, looking up the peer-ifindex in ethtool does not report whether the peer lifes in another netns (NM_PLATFORM_LINK_OTHER_NETNS). Only use ethtool as fallback for older kernels.
| * platform/tests: add test cases for detecting lnk dataThomas Haller2015-11-023-9/+289
| |
| * platform/tests: remove "dump" test-programThomas Haller2015-11-012-145/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The program ran over the platform links and printed them. Our to-string methods of platform objects are already supposed to print all fields. So this only duplicates code to print a link. If you want to see what links were picked up by platfrom run: NMTST_DEBUG=log-level=TRACE ./src/platform/tests/monitor or just ./src/platform/tests/monitor Yes, this has less the iproute2 feeling, but it gives you a more native access to the platform objects -- which is what you want for debugging platform.
| * platform/tests: use "nm-test-utils.h" in "monitor.c"Thomas Haller2015-11-011-10/+12
| | | | | | | | | | | | This gives us a way to externally configure the logging level like: NMTST_DEBUG=log-level=TRACE ./src/platform/tests/monitor
| * platform: always complete link-type from cacheThomas Haller2015-11-011-9/+22
| | | | | | | | | | | | | | | | Previously, while detecting the link type we would lookup the @kind in case it was missing. Now, go one step further, and also prefer the link-type from the cache.