summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* core/tests: add test matching s390-subchannels device specThomas Haller2017-01-251-43/+63
| | | | (cherry picked from commit 0f7098b71bbfc6024b0f39ce858448d928af6ae5)
* core: add missing initializers to match_data_s390_subchannels_eval()Lubomir Rintel2017-01-251-1/+1
| | | | | | | | | | | | | | | | match_device_s390_subchannels_parse() asserts that arguments point to zeroes. 1299 static gboolean 1300 match_data_s390_subchannels_eval (const char *spec_str, 1301 MatchDeviceData *match_data) 1302 { >>> CID 160923: Uninitialized variables (UNINIT) >>> Declaring variable "c" without initializer. 1303 guint32 a, b, c; Fixes: b0aaff86b61b9267cbc7640836823bbba82668b8 (cherry picked from commit 20328eaddfbe27bf3c9fbff9bfda56160fd2a77f)
* device: fix setting minimal MTU to 1280 for IPv6Thomas Haller2017-01-241-2/+3
| | | | | Fixes: 665e3980221c04c327b3c165f4a3f82fe470e87e (cherry picked from commit ec66135a40efa2326494af6e99f203654a302a69)
* core: avoid unexporting active-connection that is not exportedThomas Haller2017-01-241-1/+2
| | | | | | | | | | | For better or worse, nm_exported_object_unexport() asserts that the object is currently exported. It's not clear that an active connection at this place is always exported. Fixes: f0e3dfdace25bf19c6a6b1f1cee4e384de64c433 (cherry picked from commit c8a649b3ded70f63e5f3f7f3f75282d4cd8b0590)
* active-connection: drop off the bus when the settings connection disappearsLubomir Rintel2017-01-242-2/+19
| | | | | | | | | The active connection has an immutable connection property, but is cleaned asynchronously by the manager after its settings connection is done. Fine, let's remove it from the bus first though, so that we don't hang there with a dangling object path. (cherry picked from commit f0e3dfdace25bf19c6a6b1f1cee4e384de64c433)
* core: drop duplicate code searching for match in nm_match_spec_device()Thomas Haller2017-01-231-24/+9
| | | | | | | | | | | When searching for "*", we still need to check for higher priority "except:" matches. But don't duplicate the search loop and just proceed with the regular searched. It already has the "if (!except && match == NM_MATCH_SPEC_MATCH)" which short-cuts the search. (cherry picked from commit 9fff9f501ad984810b663d068c46b292fc9bc2a3)
* core: refactor nm_match_spec_device() to use match-data structureThomas Haller2017-01-231-75/+77
| | | | | | | | | | Instead of passing on invdividual arguments for the match, create a MatchDeviceData structure and pass it on. This reduces the number of arguments and extending it later should be easier. Also, lazily parse the hardware address as needed. (cherry picked from commit b0aaff86b61b9267cbc7640836823bbba82668b8)
* src/tests: randomize device spec list for testThomas Haller2017-01-201-7/+7
| | | | (cherry picked from commit b0e58a982374c56d06961d88a0b1551a8d8937bd)
* core: refactor evaluation of device's match-specThomas Haller2017-01-207-393/+408
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we would have different functions like - nm_match_spec_device_type() - nm_match_spec_hwaddr() - nm_match_spec_s390_subchannels() - nm_match_spec_interface_name() which all would handle one type of match-spec. So, to get the overall result whether the arguments match or not, nm_device_spec_match_list() had to stich them together and iterate the list multiple times. Refactor the code to have one nm_match_spec_device() function that gets all relevant paramters. The upside is: - the logic how to evaluate the match-spec is all at one place (match_device_eval()) instead of spread over multiple functions. - It requires iterating the list at most twice. Twice, because we do a fast pre-search for "*". One downside could be, that we have to pass all 4 arguments for the evaluation, even if the might no be needed. That is, because "nm-core-utils.c" shall be independend from NMDevice, it cannot receive a device instance to get the parameters as needed. As we would add new match-types, the argument list would grow. However, all arguments are cached and fetching them from the device's private data is very cheap. (cherry picked from commit b957403efd53ff7d826ac7a4f80487032c03824b)
* device: don't call _commit_mtu() when ipv4.method=disabledBeniamino Galvani2017-01-201-3/+2
| | | | | | | | | | After commit 553717bb1c9e ("device: don't set ip4_state=IP_FAIL for ipv4.method=disabled"), we commit an empty IPv4 configuration when IPv4 is disabled. This means that it's not necessary anymore to call _commit_mtu() because the MTU will be set in ip4_config_merge_and_apply(). (cherry picked from commit 714b18dcf77d029a53c3b371c2f05bd5c7cc3bff)
* vlan: use parent interface mtu as defaultBeniamino Galvani2017-01-201-1/+19
| | | | | | | | | | | | | | | | | After commit 22e8af624285 ("device: set a per-device default MTU on activation") we explicitly set the VLAN MTU to 1500 if not overridden by user settings. This has the advantage that the MTU is set to a predictable value, while before it could have different values depending on when the interface was created (for example, the interface would get a 1500 MTU if created during boot, or would inherit the parent's MTU if activated manually). However, a better default value is the MTU of the parent interface which is in most cases what the user wants. This value was the default before commit 22e8af624285 for manually activated connections. https://bugzilla.redhat.com/show_bug.cgi?id=1414186 (cherry picked from commit 7dde8d81060405c9c8f45be76300cdac7868fba4)
* device: mark properties in set_property() as construct-onlyThomas Haller2017-01-201-9/+10
| | | | (cherry picked from commit ba47744997091562ad1844c28d07a6de16a7c0bf)
* device: remove duplicate setting of device's driver propertyThomas Haller2017-01-201-8/+1
| | | | | Fixes: 4dbaac4ba24ebc8b257fffe5197cc8e362804a58 (cherry picked from commit 59f37f31d9747a7071d720367e0fe69007fc7570)
* veth: properly chain up the overridden notify methodLubomir Rintel2017-01-201-0/+1
| | | | | Fixes: 992beb4f3440b046e0ba03e300d62da946a6f40e (cherry picked from commit af16cd5a927e4b47564952ad5342731f36714a31)
* device: fix build with old glib & more assertsLubomir Rintel2017-01-191-1/+1
| | | | | | src/devices/nm-device.c:8319:4: error: invalid use of void expression (cherry picked from commit a4d61bf29905ac9e5c7e6f99344733a4ccb2297f)
* act-request: return empty properties when not activatedBeniamino Galvani2017-01-191-11/+19
| | | | | | | | | | We start to track changes to the device's properties only after the active connection gets activated. It's wrong to return properties while we don't track their changes as this causes stale objects references on D-Bus. Let's return DHCP and IP configurations from the device only when the connection is activated. (cherry picked from commit 4215c2640a6a24360fc0bfc59f45c6af3132ebb4)
* supplicant: update capabilities before marking manager as runningThomas Haller2017-01-181-3/+3
| | | | (cherry picked from commit 19ceaa1dc99f7fcbc443f938c018a0cb93a65d5e)
* supplicant: update whether EAP-FAST is supported for existing ↵Thomas Haller2017-01-183-24/+45
| | | | | | | | | | | supplicant-interface As the fast-supported flag changes, update the existing supplicant interfaces with the new information. Also, by default assume it is supported. (cherry picked from commit 872b9ec5ea20c702ccb08eab75ca012a7aa1895f)
* supplicant: fix detection of EAP-FASTThomas Haller2017-01-181-2/+8
| | | | | | | | | | | At least with my supplicant, the capability is called all-upper-case "FAST". The check used case-insensitive, but that was broken by a previous change. Fixes: 9f5f141100e390015341aee1f2fb50f7626da3b1 (cherry picked from commit 66ff601ecff0c740f449b61489397b75393f6ff2)
* tests: fix tests without libjansson support (--enable-json-validation=no)Thomas Haller2017-01-171-1/+1
| | | | (cherry picked from commit a5acd0bdc63449d9b499b62479f612c216cf24c0)
* device: add an initializerLubomir Rintel2017-01-171-2/+1
| | | | | | | | | | | | Basically to silence gcc that is not smart enough to understand how does .initialized and .value relate. src/devices/nm-device.c: In function '_commit_mtu': src/devices/nm-device.c:6754:15: error: 'ip6_mtu_sysctl.value' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (ip6_mtu && ip6_mtu != _IP6_MTU_SYS ()) { ^ (cherry picked from commit 7ce805d49d25fec60b50b4c53459df835512d279)
* ifcfg-rh: add a basic test for Proxy settingJiří Klimeš2017-01-172-0/+93
|
* pacrunner: fix a few typos, uniforms spelling of various forms to "pacrunner"Jiří Klimeš2017-01-171-16/+16
|
* device: make the MTU globally configurable via connection-defaultsThomas Haller2017-01-175-1/+46
| | | | | | | | | | | | | | | | This allows a user to restore the previous behavior where NetworkManager would not reconfigure the MTU during device activation, if no MTU is available (commit "22e8af6 device: set a per-device default MTU on activation"). Well, not exactly. The previous behavior was to use per-connection configuration, then DHCP provided value, or finally leave the MTU unspecified. Now, we prefer a per-connection configuration, followed by a global connection default. If "ethernet.mtu=0", the MTU is left unspecified. In absense of a global connection default, the value from DHCP is used or finally a per-device-type default. That is effectively 1500 for most types, except for infiniband where the MTU is still left unspecified.
* platform/tun: don't passing around the ifname guessLubomir Rintel2017-01-164-21/+7
| | | | | | | nm_platform_sysctl_open_netdir() doesn't take it anyways, gets it from the cache. CID 160209 (#1 of 1): Unused value (UNUSED_VALUE)
* ifupdown: remove redundant error checkLubomir Rintel2017-01-161-9/+0
| | | | | | The presence of a parameter is checked above. CID 59899 (#1 of 1): Logically dead code (DEADCODE)
* core: support macsec connectionsBeniamino Galvani2017-01-161-2/+646
| | | | | | | Add code to nm-device-macsec.c to support the creation of macsec connection. Most of the code for controlling wpa_supplicant is copied from nm-device-ethernet.c and probably could be consolidated in some ways.
* supplicant: add an enum to specify the driverBeniamino Galvani2017-01-167-20/+41
| | | | With macsec we now have 3 drivers and a boolean is no longer enough.
* supplicant: add support for macsec optionsBeniamino Galvani2017-01-163-0/+87
| | | | Add new configuration options for wpa_supplicant to support MACsec.
* core,libnm: introduce NMDeviceMacsecBeniamino Galvani2017-01-164-0/+422
| | | | | At the moment the device only exposes the current link status, but cannot create new links.
* platform: add support for macsec linksBeniamino Galvani2017-01-166-0/+279
| | | | | Add support for a new macsec link type and its netlink attributes to the platform code.
* ethernet: simplify supplicant error pathBeniamino Galvani2017-01-161-23/+5
| | | | | Replace the custom supplicant_iface_connection_error_cb_handler() with nm_device_queue_state().
* device: enforce a link MTU of at least 1280 for connections with IPv6Thomas Haller2017-01-161-0/+16
|
* device: set a per-device default MTU on activationThomas Haller2017-01-161-5/+25
| | | | | | | | | | | | | | In absence of an explicit MTU (either via user configuration, PPP or DHCP), set a default MTU on activation that depends on the device type. We only want to do that on the very first call to _commit_mtu(). Later calls (for example in response to new DHCP leases) skip over this step. This means, on activation the MTU will always be reset to a sensible value instead of preserving whatever was left from a previous configuration. This does not cover setting the MTU from the VPN plugin :(
* device: reset previous MTU when device disconnectsThomas Haller2017-01-161-8/+55
| | | | | | | | | | When you have a connection with "ethernet.mtu=0 (auto)", the MTU is not set during activation. That means, the effective MTU depends on the previous MTU configuration of the device. Which in turn, depends on the previously active connection, as we don't reset the MTU on deactivation. Restore the previous MTU on deactivation iff NetworkManager changed the MTU during device activation.
* device: refactor configuring MTU by dropping mtu_desiredThomas Haller2017-01-161-61/+47
| | | | | | | | | | | | | | Don't have this mtu_desired variable. All the data is readily available without redundancy. E.g. the applied-connection contains everything we need to know. Just get it as needed. Also drop apply_mtu_from_config(). It didn't take into account the MTU settings beside NMSettingWired. Also, no longer merge the NM_IP_CONFIG_SOURCE_USER MTU value into priv->ip4_config. NMIP4Config now only tracks the MTU from the various non-user-config sources, but the user config is no longer merged back into the composite.
* ip4-config: cleanup MTU handlingThomas Haller2017-01-161-11/+15
| | | | | | | | | | | | | | | | | | It is wrong that nm_ip4_config_set_mtu() tries to ~merge~ the new MTU with the existing. All callers of nm_ip4_config_set_mtu() want that the new value prevails. That is also already the case because the DHCP clients and PPP manager set the MTU on a newly created NMIP4Config instance, thus their value is taken. Similarly, the final merge with NM_IP_CONFIG_SOURCE_USER also prevails as the source has the highest priority. The setter should just set. The only place where we want the merge behavior is in nm_ip4_config_merge(), where it is now implemented in-place. For example, nm_ip4_config_replace() very much wants that the new value wins, regardless of the previous setting. Using nm_ip4_config_set_mtu() with the merge behavior was wrong because it means that the MTU of NMDevice's composite can never be raised again (for example with a new DHCP event).
* device/bridge: support setting bridge MTU via wired settingThomas Haller2017-01-161-0/+1
| | | | | | | | The problem is that the bridge's MTU cannot be larger then the slaves'. Configuring such a setting results in an error being logged and the activation proceeds (without applying the desired MTU). Unclear how to fix that best.
* device: refactor setting user-configured MTU during config commitThomas Haller2017-01-1613-173/+101
| | | | | | | | | Instead of overwriting ip4_config_pre_commit(), add a new function get_mtu(). This also adds a default value in case there is no user-configuration. This will allow us later to reset a default MTU based on the device type.
* device: refactor handling of MTU in deviceThomas Haller2017-01-161-76/+53
| | | | | | | | | | | | | The field priv->mtu should contain what is actually configured on the device, as that field is also exposed on D-Bus as NM_DEVICE_MTU property. That shall be handled distinct from what we want to configure as MTU on the device. Refactor the handling of MTU with a new functoin _set_mtu() which looks at the desired paramters and compares it with what is configured (in platform and sysctl). Then it makes a decision what to configure.
* device: cleanup setting of mtu in NMDeviceThomas Haller2017-01-161-23/+31
| | | | | | | | | | | Mark priv->mtu/priv->ip_mtu/ priv->ip6_mtu as const to highlight the places that explicitly set their mutable aliases priv->mtu_/ priv->ip_mtu_/priv->ip6_mtu_. Also, NM_DEVICE_MTU property is read-only. It cannot be set via g_object_set(). Also, clear priv->mtu in nm_device_unrealize().
* device: drop unused virtual function NMDevice:ip6_config_pre_commitThomas Haller2017-01-162-4/+0
|
* device: fix indention and assertion in apply_mtu_from_config()Thomas Haller2017-01-161-5/+4
| | | | | For the assertion use nm_streq0(). If we bother checking for invalid values (that are supposed to never happen), avoid a possible crash too.
* device: fix sysctl getter for MTU using guint32 typeThomas Haller2017-01-161-3/+8
| | | | | The only caller wants to read the MTU, which is more type guint32 then gint32.
* ip[46]-config: reorder fields in private struct and use bool bitfieldThomas Haller2017-01-162-18/+18
| | | | | | | | | bool:1 bitfields allow for tighter packing and are guaranteed to be strictly 0 or 1 (contrary to gboolean's typedef for int). Not that it matters too much, but it's favorable. Especially, because each device has several of these ip-config instances, we might save a few bytes for no(?) downsides.
* ip[46]-config/trivial: move code aroundThomas Haller2017-01-169-127/+141
| | | | | Move the GObject related functions to the end of the source file. Similar to how it's done for most other implementations.
* ppp: use defines for signal namesThomas Haller2017-01-166-14/+18
|
* platform: avoid one memset() in nmp_cache_id_init()Thomas Haller2017-01-162-28/+25
| | | | | | We end up calling nmp_cache_id_init_*() a lot to initialize stack-allocated cache-ids to lookup the NMMultiIndex. There is no need to memset() it to zero, because all relevant fields are supposed to be set explicitly.
* core: use nm_offsetofend() macroThomas Haller2017-01-162-22/+17
|
* core: use _nm_packed attribute instead of __attribute__((packed))Thomas Haller2017-01-161-1/+1
|