Commit Graph

15579 Commits

Author SHA1 Message Date
Thomas Haller
1f5c056700 man: describe logging domain "SYSTEMD" in man NetworkManager.conf 2016-05-17 19:57:55 +02:00
Thomas Haller
a2c843499c all/tests: split core part out of "nm-test-utils.h"
A large part of "nm-test-utils.h" is only relevant for tests inside "src/"
directory, as they are helpers related to NetworkManager core part.

Split this part out of "nm-test-utils.h" header.
2016-05-17 16:48:52 +02:00
Thomas Haller
65a254e03c trival: fix indention
Fixes: 5586ae80d1
2016-05-17 13:42:24 +02:00
Thomas Haller
1ad00095a1 wifi: refactor private data for NMAccessPoint
- make NMAccessPoint and NMAccessPointClass internal structs. This means,
  they cannot be subclassed anymore, but we also don't want that.

- This way, we can safely embed the private data directly in the now
  private access-point instance.

- change type of boolean fields from gboolean to bool.

- some whitespace fixes
2016-05-17 13:24:51 +02:00
Thomas Haller
5586ae80d1 wifi: refactor properties in NMAccessPoint using NM_GOBJECT_PROPERTIES_DEFINE() 2016-05-17 13:00:47 +02:00
Thomas Haller
54474993fd ifcfg-rh: merge branch 'th/ifcfg-rh-cleanup-bgo766518'
https://bugzilla.gnome.org/show_bug.cgi?id=766518
2016-05-17 12:26:35 +02:00
Thomas Haller
2d428bda35 ifcfg-rh: remove unused define ERR_GET_MSG() 2016-05-17 12:26:02 +02:00
Thomas Haller
4dcb5e5ba5 ifcfg-rh: cleanup includes
- don't include "nm-default.h" from headers. All source files
  include this header as first.

- drop G_BEGIN_DECLS/G_END_DECLS. This is not C++ nor public
  API.

- drop unnecessary includes from header files. They are either
  not required, or already provided via "nm-default.h".

- include in source files the corresponding header file as first
  after "nm-default.h". This should ensure that header files are
  self-contained (appart from "nm-default.h").
2016-05-17 12:25:55 +02:00
Thomas Haller
b503b37636 ifcfg-rh: don't print warning in svGetValueInt64()
Having a simple accessor print warnings is not nice. At that point there
is no context as to why we are trying to read the value.

Note that the function already handles and expects invalid values, it's
just not clear that printing warnings from a utility function is the right
thing to do.

Just ignore such cases silently (at this point). It's up to the caller
to print a warning or whatever.
2016-05-17 12:22:42 +02:00
Thomas Haller
f3bd778d6d ifcfg-rh: use _NMLOG() macro in writer
This gives every logging line a proper "ifcfg-rh" prefix.
But drop the "    " prefixes.
2016-05-17 12:22:42 +02:00
Thomas Haller
a519cc57b8 ifcfg-rh: use _NMLOG() macro in reader
This gives every logging line a proper "ifcfg-rh" prefix.
2016-05-17 12:22:42 +02:00
Thomas Haller
c949e1c429 ifcfg-rh: reject vlan id of value 4096
Maybe we should also reject 0 and 4095, but for now leave it.
2016-05-17 12:22:42 +02:00
Thomas Haller
a85c3db2f0 ifcfg-rh: use _nm_utils_ascii_str_to_int64() instead of strtol() 2016-05-17 12:22:42 +02:00
Thomas Haller
4b538ea8f1 ifcfg-rh: replace uses of get_int() 2016-05-17 12:22:42 +02:00
Thomas Haller
7328613d7b ifcfg-rh: don't use get_int() to parse MTU value
And print a warning also if the value is out of range.
2016-05-17 12:22:41 +02:00
Thomas Haller
ec639b5c63 ifcfg-rh: cast variadic arguments to proper int type 2016-05-17 12:22:41 +02:00
Thomas Haller
8e6d619c46 ifcfg-rh: use _nm_utils_ascii_str_to_int64() in reader's get_uint()/get_int() functions 2016-05-17 12:22:41 +02:00
Thomas Haller
25bf73292c device: merge branch 'th/device-rename-unmanaged-bgo766404'
https://bugzilla.gnome.org/show_bug.cgi?id=766404
2016-05-17 12:20:14 +02:00
Thomas Haller
7c785a064e device/trivial: rename nm_device_set_unmanaged_by_user_config() to nm_device_set_unmanaged_by_user_settings()
After all, it sets NM_UNMANAGED_USER_SETTINGS flag, so the name should
match with the flag.
2016-05-17 12:12:50 +02:00
Thomas Haller
0c4a23a438 device: update unamanged by user-config when device gets renamed
https://bugzilla.gnome.org/show_bug.cgi?id=766404
2016-05-17 12:06:36 +02:00
Thomas Haller
7961e1bb8a core: add nm_connection_provider_get_unmanaged_specs() 2016-05-17 11:54:08 +02:00
Beniamino Galvani
dbd0634c84 cli: append newline to failure message
Fixes: a06487a6ae
2016-05-16 17:55:21 +02:00
Thomas Haller
57a2aba0ea wwan: fix crash during nm_modem_deactivate()/disconnect_context_complete()
(gdb) bt
    #0  0x00007ffff4d9e075 in g_type_check_instance_is_fundamentally_a (type_instance=type_instance@entry=0x-1, fundamental_type=fundamental_type@entry=80) at gtype.c:4030
    #1  0x00007ffff4d7e447 in g_object_unref (_object=0xffffffffffffffff) at gobject.c:3076
    #2  0x00007fffe89cdfa8 in disconnect_context_complete (ctx=ctx@entry=0x555555b4c680) at nm-modem-broadband.c:1062
    #3  0x00007fffe89cf6e5 in disconnect (modem=<optimized out>, warn=0, cancellable=0x0, callback=0x0, user_data=0x0) at nm-modem-broadband.c:1126
    #4  0x00007fffe89d24cd in nm_modem_deactivate (self=0x555555aba1b0 [NMModemBroadband], device=device@entry=0x555555ab8c20 [NMDeviceModem]) at nm-modem.c:1164
    #5  0x00007fffdbd73022 in deactivate (device=0x555555ab8c20 [NMDeviceModem]) at nm-device-modem.c:455
    #6  0x00005555555e087b in nm_device_cleanup (self=self@entry=0x555555ab8c20 [NMDeviceModem], reason=reason@entry=NM_DEVICE_STATE_REASON_NOW_MANAGED, cleanup_type=cleanup_type@entry=CLEANUP_TYPE_DECONFIGURE)
        at devices/nm-device.c:10392
    #7  0x00005555555e0ffd in _set_state_full (self=self@entry=0x555555ab8c20 [NMDeviceModem], state=state@entry=NM_DEVICE_STATE_UNAVAILABLE, reason=reason@entry=NM_DEVICE_STATE_REASON_NOW_MANAGED, quitting=quitting@entry=0) at devices/nm-device.c:10804
    #8  0x00005555555e1a16 in nm_device_state_changed (self=self@entry=0x555555ab8c20 [NMDeviceModem], state=state@entry=NM_DEVICE_STATE_UNAVAILABLE, reason=reason@entry=NM_DEVICE_STATE_REASON_NOW_MANAGED)
        at devices/nm-device.c:11029

Fixes: 21b50c59ce
2016-05-16 17:45:04 +02:00
Thomas Haller
f8fb670c6f platform: declare nmp_utils_ip_config_source_*() functions as const 2016-05-16 13:16:49 +02:00
Thomas Haller
5847e70fd6 shared: add _nm_pure/_nm_const define for __attribute__ ((pure))/((const)) 2016-05-16 13:09:02 +02:00
Beniamino Galvani
926ba925ec core: fix creation of NMSettingIPConfig routes
Since commit 4c2410bc92 ("platform: extend NMIPConfigSource to
preserve the rtm_protocol field") the rt_source field of a
NMPlatformIP{4,6}Route contains the RTPROT value read from
kernel. Update checks on route source, otherwise existing routes are
not picked up when a generated connection is created, breaking the
connection matching.

Fixes: 4c2410bc92
2016-05-16 12:06:55 +02:00
Thomas Haller
b871106e25 macros: define NM_MORE_ASSERTS is not defined
In NetworkManager's configure script we have --with-more-asserts
option which always defines NM_MORE_ASSERTS in config.h.

When reusing the header file outside of NetworkManager, the
NM_MORE_ASSERTS define might be unset. Define it in that case
to avoid compiler warnings about undefined preprocessor define.
2016-05-14 23:11:59 +02:00
Thomas Haller
dab2d46aa2 core: fix wrong rebase
Fixes: 25aaaab3b7
2016-05-13 19:28:04 +02:00
Dan Williams
25aaaab3b7 manager: don't unmanage devices without L3 config on shutdown
Use the following logic when quitting, if the device is managed:

  1) if the connection is assumed, leave it up
  2) if the device has no connection (eg, !req) leave it up
  3) if the device only has L2 leave it up

[thaller@redhat.com: original patch reworked by bgalvani@redhat.com and me]

https://bugzilla.redhat.com/show_bug.cgi?id=1311988
https://bugzilla.redhat.com/show_bug.cgi?id=1333983
2016-05-13 19:23:30 +02:00
Beniamino Galvani
fc8cc8393e dns: properly remove existing configurations
When a configuration is replaced by another with different metadata,
disconnect signals and clear @best_conf pointers. Also, the check in
remove_ip_config() was wrong.

Fixes: 8e6d442477
Fixes: 570d73979b
2016-05-13 17:46:09 +02:00
Thomas Haller
7d0119d249 man: minor rewording in NetworkManager.conf about connection.stop-match 2016-05-13 15:06:02 +02:00
Beniamino Galvani
3fdffab955 core: merge branch 'bg/disconnect-on-suspend-rh1330694-v2'
Let devices go through the disconnected state before sleeping so that
applications are notified of the change in connectivity and dispatcher
scripts are run.

https://bugzilla.redhat.com/show_bug.cgi?id=1330694
https://bugzilla.gnome.org/show_bug.cgi?id=748531
2016-05-13 14:42:14 +02:00
Beniamino Galvani
81ea812362 manager: disconnect devices before unmanaging them on suspend/sleep
So that dispatcher scripts are run and other applications notified of
the change in connectivity.

https://bugzilla.redhat.com/show_bug.cgi?id=1330694
https://bugzilla.gnome.org/show_bug.cgi?id=748531
2016-05-13 14:40:54 +02:00
Beniamino Galvani
69ab984fed sleep-monitor: add functions for delaying the suspension
To allow the execution of asynchronous actions before the system is
suspended, add a mechanism for delaying the drop of inhibitor lock.
Clients can supend the suspension by calling inhibit_take() in their
handler for SLEEPING signal and use inhibit_release() later when they
are done.

We take a "delay" type inhibitor lock, which means that the system
will proceed anyway after a certain amount of time.

Co-Authored-By: Thomas Haller <thaller@redhat.com>
2016-05-13 14:34:53 +02:00
Beniamino Galvani
31c2e0b57c device: add nm_device_set_unmanaged_by_flags_queue()
Useful for setting a device as unmanaged during another state change.
2016-05-13 14:34:53 +02:00
Thomas Haller
81499355b0 libnm: don't require initialized @out_encrypted argument in nm_utils_file_is_private_key()
No need to require the caller to initialize the optional out-argument.
Otherwise we get:

  (nm-connection-editor:2471): libnm-CRITICAL **: nm_utils_file_is_private_key: assertion 'out_encrypted == NULL || *out_encrypted == FALSE' failed

https://bugzilla.gnome.org/show_bug.cgi?id=763578

Fixes: 1c4f41c610
2016-05-13 14:26:32 +02:00
Beniamino Galvani
c094ee5f90 cli: also hide phase2 private key unless --show-secrets is passed
Fixes: ca6f1e7f25
2016-05-13 13:48:43 +02:00
Beniamino Galvani
ca6f1e7f25 cli: hide secret certificate blobs unless --show-secrets is passed
Client certificate and private key blobs should be considered private
as other secrets and not shown unless the --show-secrets option is
passed.

https://bugzilla.redhat.com/show_bug.cgi?id=1184530
2016-05-13 11:49:58 +02:00
Beniamino Galvani
8da3e658f7 dns: merge branch 'bg/dns-priority-bgo758772'
Introduce connection properties to change the priority of DNS entries.

https://bugzilla.gnome.org/show_bug.cgi?id=758772
2016-05-12 17:16:12 +02:00
Beniamino Galvani
570d73979b dns: use DNS priority from IP configuration
Use the ipvx.dns-priority when sorting the array of
configurations. When a negative value is found, all following entries
with a greater value are skipped.
2016-05-12 17:14:13 +02:00
Beniamino Galvani
77ded12da4 core: use default value for ipvx.dns-priority
Fall back to system default value for ipvx.dns-priority when it's zero
in the setting. For VPNs the default value is 50; for other
connections is 100, but it depends also on the content of
[connection*] sections in NetworkManager.conf.
2016-05-12 17:13:50 +02:00
Beniamino Galvani
bfabfb05ae core: add DNS priority to NMIP6Config 2016-05-12 17:13:50 +02:00
Beniamino Galvani
f09f5e1ec8 core: add DNS priority to NMIP4Config 2016-05-12 17:13:50 +02:00
Beniamino Galvani
d5855ed807 cli: add support for DNS priority 2016-05-12 17:13:50 +02:00
Beniamino Galvani
c5f17531b9 ifcfg-rh: add support for DNS priority 2016-05-12 17:13:50 +02:00
Beniamino Galvani
bdd0e7fec0 libnm-core: add dns-priority to NMSettingIPConfig 2016-05-12 17:13:50 +02:00
Beniamino Galvani
e53aa0dcff dns: pass config data array to plugins
Export NMDnsIPConfigData to DNS plugins and use it to pass additional
information about configurations.
2016-05-12 17:13:49 +02:00
Beniamino Galvani
8e6d442477 dns: use a single array for all configurations
In a following commit configurations will be ordered by their
priority; arrange them in a single array to make this simpler. Also,
instead of using g_object_set_data() to store metadata, introduce a
NMDnsIPConfigData structure.
2016-05-12 17:13:42 +02:00
Beniamino Galvani
16d5c8222b dns: don't use the global configuration to compute initial hash
If the initial hash includes the global configuration, every update
attempt will be skipped because the configuration never changes, and
resolv.conf will never be updated. Instead, use a NULL global
configuration to compute the hash and force an initial update.
2016-05-12 16:16:16 +02:00
Joel Holdsworth
8606060121 settings: Follow symbolic link when installing file monitor
https://bugzilla.gnome.org/show_bug.cgi?id=765645
2016-05-12 15:24:11 +02:00