Commit graph

14214 commits

Author SHA1 Message Date
Thomas Haller
c38c4dce3e ifcfg-rh/tests: pass arguments to tests via nmtst_add_test_func()
And call all tests via g_test_run().
2016-02-18 01:46:56 +01:00
Dan Williams
304575e671 ifcfg-rh: more testcase cleanups 2016-02-17 16:43:13 -06:00
Lubomir Rintel
0aed7b5be6 cli: disable colors on dumb terminals
Nothing too sophisticated; just a simple way to get an color-less output on a
pty that wouldn't confuse the test suite.
2016-02-17 19:04:39 +01:00
Lubomir Rintel
3f669444ce manager: don't proceed with activation when there's no master device
Since the device-for-all merge it's a sin (trips an assert) to create an
activation request with NULL device.

If we get here, it's probably that the master device exists, but is not ready
for activation (it's in UNMANAGED state in the process of being created).
2016-02-17 19:04:05 +01:00
Lubomir Rintel
84543df1db merge: branch 'th/lr/conn-device-ifname'
https://bugzilla.gnome.org/show_bug.cgi?id=762154
2016-02-17 19:03:35 +01:00
Thomas Haller
e93abf0552 device: optimize nm_manager_get_connection_iface() 2016-02-17 18:43:45 +01:00
Thomas Haller
f31954c071 device: don't overwrite get_connection_iface() by default
Factories that overwrite this function are not supposed to chain
up the parent implementation. Thus there is no reason to have
a default implementation and it's clearer to inline it.
2016-02-17 18:43:45 +01:00
Thomas Haller
ca0dbefb02 manager: reused the factory looked up in nm_manager_get_connection_iface()
Only lookup the factory once and pass it down to find_parent_device_for_connection().
2016-02-17 18:43:44 +01:00
Lubomir Rintel
8b016cd9a7 device: remove interface name checks from all classes
Generic check_connection_compatible() already does the check.
2016-02-17 18:43:44 +01:00
Lubomir Rintel
f9ec713641 device: move the interface name check from manager
We not only want to check the device name when creating a virtual device, but
also when determining if the connection can actually be activated there.

Otherwise the device names will mix up if there's more connections that use
virtual devices of the same type.
2016-02-17 18:43:44 +01:00
Lubomir Rintel
adc9895ebe manager: export nm_manager_get_connection_iface()
We'll need the actual device name that should be used for a connection
activated on a given device when checking the connection availability.
2016-02-17 18:43:44 +01:00
Lubomir Rintel
cd81e0bd9f device-factory: always use the factory to determine the connection's interface name
This makes things a bit simpler when determining if any connection is
activatable on an existing device.
2016-02-17 18:43:33 +01:00
Lubomir Rintel
fd314ed7f7 device-factory/trivial: rename get_virtual_iface_name() to get_connection_iface() 2016-02-17 18:43:02 +01:00
Thomas Haller
8c1a9bbb8c utils: fix NM_UTILS_ENUM2STR_DEFINE() which always returned the last element
Fixes: 174b25d98c
2016-02-17 15:17:11 +01:00
Thomas Haller
e13925597f platform: add IN6_ADDR_GEN_MODE_RANDOM to nm_platform_link_inet6_addrgenmode2str()
There is a new address generation mode.
2016-02-17 14:19:19 +01:00
Thomas Haller
c6849be179 platform: use nm_platform_link_inet6_addrgenmode2str() in link-to-string
Reuse the to-string function nm_platform_link_inet6_addrgenmode2str() to print the
addrgenmode for nm_platform_link_to_string().

Also, now we support NM_IN6_ADDR_GEN_MODE_STABLE_PRIVACY.
2016-02-17 14:01:49 +01:00
Thomas Haller
c205ee6ce0 platform: stack-allocate temporary string in nm_platform_link_tun_get_properties_ifname() 2016-02-17 13:39:55 +01:00
Thomas Haller
0685780566 contrib/rpm: add README, improve usage output and rename --no-build option to --no-dist 2016-02-17 11:44:09 +01:00
Thomas Haller
6dc431b0c9 shared: move definition of "bool" to nm-macros-internal.h
"nm-default.h" should only include all the relevant header files based
on NETWORKMANAGER_COMPILATION. It should not contain definitions on
it's own.

Move the definition of "bool" to "nm-macros-internal.h".
2016-02-16 20:18:25 +01:00
Beniamino Galvani
b8c677a0eb manager: fix typo in error message
Fixes: 1762d58a8c
2016-02-16 16:22:50 +01:00
Thomas Haller
433d4fed6a platform: merge branch 'th/platform-recvmsgs-fixes-bgo761959'
https://bugzilla.gnome.org/show_bug.cgi?id=761959
2016-02-16 14:14:58 +01:00
Thomas Haller
3d759b1f11 platform: during @abort_parsing goto stop in event_handler_recvmsgs()
Now, that we no longer overwrite @err, we can jump to stop: instead
of out:.
2016-02-16 14:13:25 +01:00
Thomas Haller
329ac02d38 platform: don't set @err during stop: in event_handler_recvmsgs()
If we break the loop normally, @err must be already set to zero.
The only other way this can happen is when the credentials are
invalid. Move setting @err to there.
2016-02-16 14:13:25 +01:00
Thomas Haller
3f00899bde platform: continue reading in event_handler_recvmsgs() when not handling events
If @handle_events is FALSE, we want to drain the socket. In that case
even when encountering an error error we don't want to abort, but instead
continue reading the next message.
2016-02-16 14:13:25 +01:00
Thomas Haller
dc97a3b39b platform: fix error handling in event_handler_recvmsgs()
@abort_parsing is set TRUE at two places, which also explicitly
set @err to something. We don't want to reset @err and got to the
next @hdr. Instead error out first.
2016-02-16 14:13:25 +01:00
Thomas Haller
43381f9b85 platform: downgrade logging message to TRACE level in event_handler_recvmsgs()
Doesn't seem important and might be triggered by other processes.
2016-02-16 14:13:25 +01:00
Thomas Haller
9254cbe875 platform: don't return number of messages from event_handler_recvmsgs()
The value is not used by the callers. Also, with @handle_events set
to false, it is not clear what the value really means because we skip
over errors.
2016-02-16 14:13:25 +01:00
Thomas Haller
04805f659f platform: simplify event_handler_recvmsgs() by using cleanup attribute 2016-02-16 14:13:25 +01:00
Thomas Haller
c66ee23f73 macros: add nm_auto_free macro
Similar to gs_free to cleanup pointers with free(). Note that
g_free() and free() cannot be used interchangably.
2016-02-16 14:13:25 +01:00
Thomas Haller
ad45d232fe travis: update .travis.yml not to run tests when build fails
When building fails, we should not run the tests. They clutter
the output.
2016-02-16 13:01:47 +01:00
Thomas Haller
dec682f6d1 platform/tests: workaround test failure for kernel bug
Unenslaving from a bridge can cause a spurious RTM_DELLINK signal.
NMPlatform does raise those signals, but fixes the state of the
cache afterwards. Workaround the test failure.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1285719
2016-02-16 13:01:47 +01:00
Beniamino Galvani
3ac6769e60 merge: branch 'bg/dhcp-timeout-property-bgo761464'
https://bugzilla.gnome.org/show_bug.cgi?id=761464
2016-02-16 11:38:12 +01:00
Beniamino Galvani
b6f98126c7 libnm-core: fix ifcfg-rh documentation for dhcp-timeout property
Fixes: 3f0d595cc8
2016-02-16 11:37:26 +01:00
Beniamino Galvani
1bb3b6a4c6 libnm-core: make ipvx.dhcp-timeout signed
Change the dhcp-timeout property in NMSettingIPConfig to int type for
consistency with the dad-timeout property. For dad-timeout -1 means
"use default value", while for dhcp-timeout probably we will never use
negative values, but it seems more correct to use the same type for
the two properties.
2016-02-16 11:37:26 +01:00
Beniamino Galvani
206e074863 libnm,core,cli: move dhcp-timeout property to generic NMSettingIPConfig
The property applies to both IPv4 and IPv6 and so it should not be in
NMSettingIP4Config but in the base class.
2016-02-16 11:37:26 +01:00
Thomas Haller
a058cf41dc device: merge branch 'th/device-applied-connection-bgo760884'
https://bugzilla.gnome.org/show_bug.cgi?id=760884
https://bugzilla.gnome.org/show_bug.cgi?id=761714
2016-02-16 11:28:37 +01:00
Thomas Haller
f40c479845 introspection: document the meaning of active connections 2016-02-16 11:24:49 +01:00
Thomas Haller
54dc789314 device: fix signature for @flags argument of impl_device_reapply()
Thereby, also adjust the type for libnm's wrapper function -- as
we already broke ABI.
2016-02-16 11:24:49 +01:00
Thomas Haller
4bd45b9458 libnm: add nm_device_get_applied_connection() function 2016-02-16 11:24:49 +01:00
Thomas Haller
62910d19d7 core: add NMDevice's GetAppliedConnection D-Bus call
Expose applied connection in D-Bus API.

https://bugzilla.gnome.org/show_bug.cgi?id=760884
2016-02-16 11:24:49 +01:00
Thomas Haller
6898e2169e all: add version-id argument to device's Reapply method
This breaks API and ABI for the functions related to Reapply,
which got introduced in the current 1.1 development phase.

The version-id is here to allow users to error out if the connection
on the device was changed by a concurrent action.

https://bugzilla.gnome.org/show_bug.cgi?id=761714
2016-02-16 11:24:49 +01:00
Thomas Haller
b96a40c2ec core: add version-id to NMActiveConnection
This field will be later used by NMDevice's Reapply and
GetAppliedConnection methods. The usecase is to first fetch
the currently applied connection, adjust it and reapply it.
Using the version-id, a concurrent modification can be detected
and Reapply can reject the invocation.
2016-02-16 11:24:49 +01:00
Thomas Haller
4b76d86698 core/trivial: rename local function in "nm-settings-connection.c"
Only D-Bus implementations should be named "^impl_.*", not a helper
function.
2016-02-16 11:24:22 +01:00
Thomas Haller
5637d72af2 device: fix wrongly managing external devices by assuming on PLATFORM_INIT
Otherwise, a tun device from external openvpn service will be managed by
NetworkManager.

  <debug> [1455615148.716529] [devices/nm-device.c:9082] _set_unmanaged_flags(): [0x55e6f5756070] (tun7): unmanaged: flags set to [!sleeping,!loopback,!platform-init,!user-config,!external-down=0x0/0xa19/managed, set-managed [platform-init=0x10], reason managed, transition-state)
  <info>  (tun7): device state change: unmanaged -> unavailable (reason 'managed') [10 20 2]

Fixes: 87a3df2e57
2016-02-16 10:44:42 +01:00
Beniamino Galvani
10b222288e wifi: don't touch by default current powersave setting
Some drivers (or things outside NM like 'powertop') may turn powersave
on, so don't touch it unless explicitly configured by user.

To achieve this, add new 'default' and 'ignore' options; the former
can be used to fall back to a globally configured setting, while the
latter tells NM not to touch the current setting.

When 'default' is specified, a missing global default configuration is
equivalent to 'ignore'.

It is possible to enable Wi-Fi power saving for all connections by
dropping a file in /etc/NetworkManager/conf.d with the following
content:

 [connection]
 wifi.powersave=3

https://bugzilla.gnome.org/show_bug.cgi?id=760125
2016-02-16 00:18:06 +01:00
Beniamino Galvani
0f5c5ad446 dhcp/systemd: accept default gateway in classless static routes option
RFC 3442 allows a default gateway to be specified in option 121
(Classless Static Routes) and override the Router option.  Implement
this in the internal DHCP client.

https://bugzilla.gnome.org/show_bug.cgi?id=761268
2016-02-16 00:08:15 +01:00
Thomas Haller
dec3a7e58d shared: add nm_streq() and nm_streq0() macro
Using strcmp() to test for string equality is a well known pattern.
However the inverse logic still is still hard to grasp especially in
more complex expressions.

nm_streq() should is an alternative to use strcmp(). And there is a counterpart
nm_streq0() which is based on g_strcmp0().

Kernel and systemd have also similar streq() macros.

https://mail.gnome.org/archives/networkmanager-list/2016-February/msg00047.html
2016-02-15 23:47:14 +01:00
Thomas Haller
6f3d7cbd22 core: merge branch 'lr/default-unmanaged-bgo746566'
https://bugzilla.gnome.org/show_bug.cgi?id=746566
2016-02-15 21:43:45 +01:00
Thomas Haller
87a3df2e57 device: remove default-unmanaged and refactor unmanaged flags
Get rid of NM_UNMANAGED_DEFAULT and refine the interaction between
unmanaged flags, device state and managed property.

Previously, the NM_UNMANAGED_DEFAULT was special in that a device was
still considered managed if it had solely the NM_UNMANAGED_DEFAULT flag
set and its state was managed. Thus, whether the device (state) was managed,
depended on the device state too.

Now, a device is considered managed (or unmanaged) based on the unmanaged
flags and realization state alone. At the same time, the device state
directly corresponds to the managed property of the device. Of course,
while changing the unmanaged flags, that invariant is shortly violated
until the state transistion is complete.

Introduce more unmanaged flags whereas some of them are non-authorative.
For example, the EXTERNAL_DOWN flag has only effect as long as the user
didn't explicitly manage the device (NM_UNMANAGED_USER_EXPLICIT). In other
words, certain flags can render other flags ineffective. Whether the device
is considered managed depends on the flags but also at the explicitly unset flags.
In a way, this is similar to previous where NM_UNMANAGED_DEFAULT was ignored
(if no other flags were present).

Also, previously a device that was NM_UNMANAGED_DEFAULT and in disconnected
state would transition back to unmanaged. No longer do that. Once a device is
managed, it stays managed as long as the flags indicate it should be managed.
However, the user can also modify the unmanaged flags via the D-Bus API.

Also get rid or nm_device_finish_init(). That was previously called
by NMManager after add_device(). As we now realize devices (possibly
multiple times) this should be handled during realization.

https://bugzilla.gnome.org/show_bug.cgi?id=746566
2016-02-15 21:40:02 +01:00
Thomas Haller
2a17dbf48b device/trivial: rename nm_device_set_unmanaged_flags() 2016-02-15 21:33:32 +01:00