Commit Graph

17197 Commits

Author SHA1 Message Date
Thomas Haller
8b1b6f3d1a libnm-core: expose internal _nm_connection_verify() function 2017-03-02 12:14:29 +01:00
Thomas Haller
72bfe62a9a all: use stack-allocated uuid at various places
No need to create a UUID on the heap in this case.
2017-03-02 12:14:29 +01:00
Thomas Haller
cf213216fd libnm-core: add ethernet setting for vlan connection
A "vlan" setting can optionally have an ethernet setting.
However, ifcfg-rh reader always adds such a setting, because
well... Anyway, the result is that writing a VLAN setting
without ethernet section will yield a different result
on re-read.

Let's have normalization add the ethernet setting, so that
two we consistently have it present.
2017-03-02 12:14:29 +01:00
Thomas Haller
53018b92e8 ifcfg-rh: fix reading team slave types of vlan type
https://bugzilla.redhat.com/show_bug.cgi?id=1427482
2017-03-02 12:14:29 +01:00
Thomas Haller
5a82494fa6 ifcfg-rh/tests: add test for writing team slave
This shows the current bug, needs to be fixed.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1427482
2017-03-02 12:14:29 +01:00
Thomas Haller
13e9967a3a ifcfg-rh: add internal API to re-read connection after write
Our reader/writer has flaws. We easily write out something that
is re-read differently. That is a problem and should be fixed.

Add API to re-read the connection after writing.

Extend the tests to check that the re-read value is identical
to what we wrote. In some cases, this does not hold. That is
usually a bug which needs fixing. Note that for certificate
blobs and paths we may intentionally mutate the connection
during writing, so there are valid cases where a connection
is re-read differently.
2017-03-02 12:14:29 +01:00
Thomas Haller
5ef4db18ce ifcfg-rh: change "goto error" pattern to return early and nm_auto* 2017-03-02 12:14:29 +01:00
Lubomir Rintel
d63b67b0e0 libnm/manager: make sure the devices and acs won't notify manager after the manager is gone
https://bugzilla.redhat.com/show_bug.cgi?id=1425838
2017-02-28 10:47:21 +01:00
Lubomir Rintel
1992945fab merge: 'lr/nmtui-slaves-after-master-rh1369008'
https://bugzilla.redhat.com/show_bug.cgi?id=1369008
2017-02-27 11:19:01 +01:00
Lubomir Rintel
9d2dfd9d97 ifcfg: avoid marking newly created connections as Unsaved 2017-02-27 11:17:39 +01:00
Lubomir Rintel
9cc15d39eb tui: recommit bond, bridge and team slaves on master save
The ifcfg-rh plugin may want to update its MASTER= key accordingly for
better compatibility with the legacy network service.
2017-02-27 11:17:39 +01:00
Lubomir Rintel
c8969dbf80 tui/editor: notify the pages after the connection is saved
This will make it possible for the pages to commit slave connections
when the master connection is saved.
2017-02-27 11:17:39 +01:00
Lubomir Rintel
8fce72360e tui/edit-connection-list: add routine to recommit connections in a list
This is useful when master connections are saved potentially influencing
how slave connections are serialized.
2017-02-27 11:16:45 +01:00
Lubomir Rintel
b47340fd3f settings-connection: fix Save()
Avoid using new_settings when they are none. Also, don't shortcut when
the connection hasn't been changed -- let the settings plugin decide if
it needs to rewrite the connection.
2017-02-27 11:16:45 +01:00
Lubomir Rintel
54086127ef ifcfg-rh: don't shortcut writing if the connection stays the same
Some keys, such as MASTER may still be different as they may depend on
other connections. svWriteFile() checks if the resulting file is
different already anyway.
2017-02-27 11:16:45 +01:00
Lubomir Rintel
61722fdeb1 libnm-core/trivial: fix a typo in doc comment 2017-02-25 22:17:46 +01:00
Beniamino Galvani
913896721d dns/resolved: consider configuration from unmanaged devices
The DNS configuration for VPN connections is associated to the VPN
device (tun, ppp, etc.) and that device can be unmanaged by NM: don't
ignore such configuration. We do the same for other DNS plugins.

https://bugzilla.gnome.org/show_bug.cgi?id=779087
2017-02-24 21:08:54 +01:00
Thomas Haller
e40d47fe7c session: merge branch 'th/elogind-bgo779167'
https://bugzilla.gnome.org/show_bug.cgi?id=779167
2017-02-24 16:37:39 +01:00
Thomas Haller
c0d9243e7e session: make systemd-logind and elogind conflicting build options 2017-02-24 13:06:13 +01:00
Sven Eden
360e80b75f session: add elogind support
https://bugzilla.gnome.org/show_bug.cgi?id=779167
https://bugs.gentoo.org/show_bug.cgi?id=607352
2017-02-24 12:49:32 +01:00
Thomas Haller
dcd7a45a5f manager: fix clearing error variable in autoconnect_slaves() 2017-02-24 12:31:20 +01:00
Thomas Haller
405ee7cad0 device: mark uses of device's state-reason with nm_device_state_reason_check()
The state-change of a device has a reason argument, which is mostly for information
only.

There are many places in code that are the source of a state-reason.
Mostly these are calls to:
  - nm_device_state_changed()
  - nm_device_queue_state()
  - nm_device_queue_recheck_available()
  - nm_device_set_unmanaged_by_*()
  - nm_device_master_release_one_slave()
  - nm_device_ip_method_failed()
  - nm_modem_emit_prepare_result()
  - nm_modem_emit_ppp_failed()
  - nm_manager_deactivate_connection()
  - NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_*);

However, there are a few places in code that look at the reason
to decide how to proceed. I think this is a bad pattern, because
cause and effect are decoupled and it gets hard to understand where
a certain reason is set and what consequences that has.

Add a nop-function nm_device_state_reason_check() to mark all uses
of the device state reason that derive decisions from it. That is,
highlight the "effect" part.
2017-02-23 17:07:28 +01:00
Thomas Haller
71a22df337 settings: refactor autoconnect-blocked-reason to use own enum
Don't reuse NMDeviceStateReason for the autoconnect-blocked-reason. There are
only two cases we care: blocked-due-to-no-secrets, blocked-otherwise.

Encode these values in a new enum type.
2017-02-23 17:00:09 +01:00
Thomas Haller
9a64168c87 all: use "static inline" keywords instead of "inline static"
Use a consistent order of "static inline". This seems the prefered
order in general, and we also use it more often already.
2017-02-23 15:28:27 +01:00
Thomas Haller
8e12396b74 modem: remove unused reason argument from nm_modem_device_state_changed()
The reason has pecular meanings during a device state change.
Let's remove the unused reason argument to reduce the noise.
2017-02-23 14:42:36 +01:00
Thomas Haller
04c8517ea2 modem: merge branch 'th/modem-signal-cleanup' 2017-02-23 13:35:41 +01:00
Thomas Haller
434e7b2aa3 modem: cleanup integer types for ppp-stats signal
In practice, guint32 is identical to guint. However, that is not
guaranteed, and we should keep the types separate.
2017-02-23 12:33:41 +01:00
Thomas Haller
20b17910d0 modem: add nm_modem_emit_ppp_failed() function
... instead of emitting the signal by name.
2017-02-23 12:33:41 +01:00
Thomas Haller
0a1fd88d5a modem: add nm_modem_emit_prepare_result() function
... instead of emitting the signal by name. For one,
we get the casting of the NMDeviceStateReason enum right.
Also, emitting by the guint signal-id is faster then
emitting by name.
2017-02-23 12:33:41 +01:00
Thomas Haller
9a8f8e8a89 modem: remove unused variadic argument when emitting NM_MODEM_STATE_CHANGED signal
The signal only has two arguments, no reason.
2017-02-23 12:33:41 +01:00
Thomas Haller
42f60e30ad modem: emit signal NM_MODEM_AUTH_REQUESTED by id not name 2017-02-23 12:20:19 +01:00
Thomas Haller
6c8eac1a4c modem: use defines for signal names 2017-02-23 12:20:13 +01:00
Beniamino Galvani
fcb0fffb85 libnm-core: require interface name for dummy connections
Fixes: 1bf2d3b049
2017-02-23 10:58:32 +01:00
Beniamino Galvani
36bb22f598 team: merge branch 'bg/team-cloned-mac-rh1424641'
https://bugzilla.redhat.com/show_bug.cgi?id=1424641
2017-02-23 10:23:06 +01:00
Beniamino Galvani
9dac51d9c0 team: support the ethernet.cloned-mac-address property
The only reliable way of setting a MAC address for the team is through
the "hwaddr" property in the configuration passed to teamd. In order
to rewrite the configuration we need Jansson support; since it is
already a requirement for teamd, let the team plugin depend on it.
2017-02-23 10:07:06 +01:00
Beniamino Galvani
029a0a21ea device: split out cloned MAC decision from nm_device_hw_addr_set_cloned()
In this way, we can query the final cloned address (after special
values as 'random', 'stable', etc. have been evaluated) from
subclasses.
2017-02-23 10:05:48 +01:00
Beniamino Galvani
a1b729fddb build: automatically determine Jansson support if not specified
If configure is called without --enable-json-validation or
--disable-json-validation, let's automatically choose a value
depending on the availability of the library.
2017-02-23 10:05:48 +01:00
Beniamino Galvani
de66e15cc9 docs: add missing links to dummy and macsec device/setting
Fixes: b42f780e04
Fixes: d252a99fa2
2017-02-23 08:51:56 +01:00
Thomas Haller
5d336aa1ed device: rename reason argument for NMDeviceDummy
And remove assertion for out-argument to be present.

Follow-up to commit 437c12fc89.
2017-02-22 21:47:12 +01:00
Thomas Haller
8b7d38c8c5 device: remove out-reason argument from device's set-ip-config
The out-reason is only set to NM_DEVICE_STATE_REASON_CONFIG_FAILED.
And there is only one caller who cares about the reason.

If we one day decide to return a more distinguished error reasons,
we can revert this patch. Until then, drop the code.
2017-02-22 21:43:04 +01:00
Thomas Haller
437c12fc89 device: rename device-state-reason argument to out_failure_reason
This argument is only relevant when the NMActStageReturn argument
indicates NM_ACT_STAGE_RETURN_FAILURE. In all other cases it is ignored.

Rename the argument to make the meaning clearer. The argument is passed
through several layers of code, it isn't obvious that this argument only
matters for the failure case. Also, the distinct name makes it easier
to distinguish from other uses of the "reason" name.

While at it, do some drive-by cleanup:

  - use g_return_*() instead of g_assert() to have a more graceful
    assertion.
  - functions like dhcp4_start() don't need to return a failure reason.
    Most callers don't care, and the caller who does can determine the
    proper reason.
  - allow omitting the out-argument via NM_SET_OUT().
2017-02-22 21:37:47 +01:00
Beniamino Galvani
d5911fc551 merge: branch 'bg/dummy-bgo777863'
Implement a new connection type for dummy interfaces.

https://bugzilla.gnome.org/show_bug.cgi?id=777863
2017-02-22 21:05:55 +01:00
Beniamino Galvani
4db7890fae cli: support dummy connections 2017-02-22 21:05:04 +01:00
Beniamino Galvani
b42f780e04 core: add support for dummy devices
Add support for creating dummy devices. This commit adds a D-Bus
interface 'org.freedesktop.NetworkManager.Device.Dummy' which is used
primarily for determining the device type but does not carry any
properties.
2017-02-22 21:05:04 +01:00
Beniamino Galvani
1bf2d3b049 libnm-core: add dummy connection setting
The setting must be present in connections with type=dummy. It does
not contain any property.
2017-02-22 21:05:04 +01:00
Thomas Haller
f95b6cadd2 libnm: fix gtk-doc comment for nm_setting_802_1x_get_phase2_ca_cert_password()
Fixes: 538e510473
2017-02-22 13:57:31 +01:00
Thomas Haller
86ac68049a build: ensure libnm-core directory exists for generated files
Since we generate "libnm-core/nm-core-enum-types.h" via GLIB_GENERAED,
there is no obvious place to $(MKDIR_P). Add a dependency to the
.dirstamp of the directory to instruct automake to create the directory.
2017-02-22 13:16:28 +01:00
Thomas Haller
47e55561a7 build: ensure build directories exist for gdbus-codegen targets 2017-02-22 11:48:40 +01:00
Thomas Haller
d440958de1 build: don't depend on libnm-core directory for make target 2017-02-22 11:43:21 +01:00
Thomas Haller
c2f0764c1e build: add slash to directory name for mkdir
Just for consistency with other locations that call
$(MKDIR_P).
2017-02-22 11:42:38 +01:00