Commit Graph

15047 Commits

Author SHA1 Message Date
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
Thomas Haller
02dbe670ca device: for available connections check whether they are available for user-request
But not with ignoring-carrier and ignoring-ap.
2016-02-15 21:33:32 +01:00
Lubomir Rintel
30ce8c305b device: always do a unrealized delete check when rechecking available connections
It could be that what changed is the unrealize flag, not the number available
connections. That could happen when a last connection for a software device
is removed.
2016-02-15 21:32:49 +01:00
Lubomir Rintel
8b2abe0e2c device: check avaliable connections are really available
The nm_device_check_connection_available() call seem to have been accidentally
removed from nm_device_recheck_available_connections() resulting in all
connections always being added.

Fixes 02ec76df5a
2016-02-15 21:32:49 +01:00
Thomas Haller
7bb491c84e core: merge branch 'th/kill_dnsmasq_bgo762008'
https://bugzilla.gnome.org/show_bug.cgi?id=728342
https://bugzilla.gnome.org/show_bug.cgi?id=762008
2016-02-15 18:43:10 +01:00
Thomas Haller
0fbe055e2a utils: use stack allocated buffer for path in nm_utils_get_start_time_for_pid() 2016-02-15 18:41:11 +01:00
Thomas Haller
1178f814a1 dnsmasq: refactor creating dnsmasq command line args to pass listen_address argument 2016-02-15 18:41:11 +01:00
Thomas Haller
64335f9ebf dnsmasq: kill running process from pidfile synchronously
This should avoid a race when stopping dnsmasq.

This is still a hack, because we don't want to ever wait
for a process to terminate.

A better solution would be to have nm-dnsmasq-manager managing
the global state. Not only the dnsmasq instance of on NMDevice.
Instead it should keep track of all the child processes it starts
and it wants to start. This way, starting a new process should be
delayed until any (child or non-child) instances are gone.
That however would be a bigger change.

https://bugzilla.gnome.org/show_bug.cgi?id=728342
https://bugzilla.gnome.org/show_bug.cgi?id=762008
2016-02-15 18:41:11 +01:00
Thomas Haller
9c0cfbbae6 platform: fix detection of link-type for netlink event
Often a netlink event doesn't contain enough information to determine
the link type. Then we consult sysctl or ethtool. However, if we already
have the same object cached, we want to reused the (once detected) link-type.

There was a bug in lookup of the cached object.
2016-02-15 17:19:22 +01:00
Thomas Haller
9ce0995efb platform: change format to print link-type in nm_platform_link_to_string() 2016-02-15 16:23:38 +01:00
Thomas Haller
3d734b30a2 nmtst: drop deprecated test helper macro ASSERT()
It's no longer used.
2016-02-15 14:27:45 +01:00
Thomas Haller
16434c85f8 ifcfg-rh/tests: refactor test using helper functions and drop ASSERT() macro 2016-02-15 14:26:53 +01:00
Thomas Haller
b4cced2cea nmtst: add nmtst_assert_connection_verify() and don't normalize connection in assert
It is ugly that nmtst_assert_connection_verifies_after_normalization() would
normalize the argument and modify it. An assertion should not have side-effects.
2016-02-15 14:26:26 +01:00
Thomas Haller
34b7d49ea6 libnm/tests: convert test cases to use g_assert() instead of ASSERT() (test-setting-8021x.c) 2016-02-14 23:48:00 +01:00
Thomas Haller
432796817e libnm/tests: convert test cases to use g_assert() instead of ASSERT() (test-crypto.c) 2016-02-14 23:48:00 +01:00
Thomas Haller
78f558c706 nmtst: add nmtst_assert_no_success() macro 2016-02-14 23:48:00 +01:00
Thomas Haller
fde5f7bfab libnm/tests: convert test cases to use g_assert() instead of ASSERT() (test-secrets.c) 2016-02-14 20:43:21 +01:00
Thomas Haller
29aa13dc84 libnm/tests: convert test cases to use g_assert() instead of ASSERT() 2016-02-14 14:57:19 +01:00