Commit Graph

13265 Commits

Author SHA1 Message Date
Jiří Klimeš
eecb4c46cc modem-broadband: update modem's supported-ip-families (rh #1263959)
If SIM in a modem is locked, ModemManager can't initialize SupportedIpFamilies
and NetworkManager will set the property to 0. ModemManager then updates the
property after the modem is unlocked, but NetworkManager did not watch changes
to the property. And that resulted in a connection failure:
(ttyUSB1): Failed to connect 'O2 Internet': Connection requested IPv4 but IPv4 is unsuported by the modem.
(ttyUSB1): device state change: prepare -> failed (reason 'modem-init-failed') [40 120 28]

https://bugzilla.redhat.com/show_bug.cgi?id=1263959
2015-09-25 10:18:38 +02:00
Quentin Glidic
2a4a222d95 tools/check-exports.sh: use ${NM} when available
This way you can export NM to use a prefixed tool

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

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
2015-09-24 16:28:15 +02:00
Thomas Haller
1b7196ec51 systemd: merge branch 'th/systemd-dhcp-timer-rh1260727'
https://bugzilla.redhat.com/show_bug.cgi?id=1260727
2015-09-24 10:52:09 +02:00
Thomas Haller
401a2eb834 systemd: avoid potential crash due to uncanceled timers in client_receive_advertise()
Got a crash with unknown reason on nm-1-0 branch. It's unclear why,
but the reason could be that a lease in client_receive_advertise()
was cleared, but not its timers.

Backtrace from nm-1-0 branch (note that the systemd code where the crash
happend is different, but similar):

    #0  sd_event_source_unref (s=0xf5c007e8fb894853) at dhcp-manager/systemd-dhcp/nm-sd-adapt.c:53
    #1  0x0000555555682340 in client_timeout_t1 (s=<optimized out>, usec=<optimized out>, userdata=0x5555559f5240)
        at dhcp-manager/systemd-dhcp/src/libsystemd-network/sd-dhcp6-client.c:451
    #2  0x00005555556a078f in time_ready (source=0x5555559f3c20) at dhcp-manager/systemd-dhcp/nm-sd-adapt.c:146
    #3  0x00007ffff4a481b3 in g_timeout_dispatch () from /lib64/libglib-2.0.so.0
    #4  0x00007ffff4a4779a in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
    #5  0x00007ffff4a47ae8 in g_main_context_iterate.isra.24 () from /lib64/libglib-2.0.so.0
    #6  0x00007ffff4a47dba in g_main_loop_run () from /lib64/libglib-2.0.so.0
    #7  0x0000555555597073 in main (argc=1, argv=0x7fffffffe2b8) at main.c:512

Equivalent upstream systemd patch:
  https://github.com/systemd/systemd/pull/1332
  f89087272b

https://bugzilla.redhat.com/show_bug.cgi?id=1260727
2015-09-24 10:50:54 +02:00
Thomas Haller
ca00c146d4 systemd/adapt: update logging prefix for systemd log_internal()
We used to prefix messages from systemd with "sd-dhcp". Since we no
longer use the systemd code only for DHCP, change the prefix to
"libsystemd".
2015-09-23 16:09:43 +02:00
Thomas Haller
2d2d742cf1 systemd/adapt: refactor sd_event_source to use a union for holding mutually exclusive fields
sd_event_source is either used for sd_event_add_io() or sd_event_add_time().
Depending on the use, different fields of the struct are relevant. Refactor
the struct to have a union.

This reduces the size of the struct, but more importantly, it makes it
clear which fields are used in which context.
2015-09-23 16:09:43 +02:00
Thomas Haller
02c51d4231 systemd/adapt: assert that a @source argument is passed to sd_event_add_time()
Systemd supports omitting the output source argument. In this case,
the created event source is floating and the reference count
is handled properly.

We have however no callers that make use of that functionality, so
instead of implementing floating references, assert that we don't
need it.

This isn't a change in behavior, because previously the could would just
SEGFAULT if a caller didn't want to take ownership of the created event.
2015-09-23 16:09:43 +02:00
Thomas Haller
9901047ae3 systemd/adapt: fix potential crash invoking sd_event_source callbacks
It is common that the callbacks unref the event source. Hence we must
ensure that the @source stays alive until the callback returns.
2015-09-23 16:09:43 +02:00
Thomas Haller
fb0e87be39 systemd/adapt: use slice-allocator for struct sd_event_source 2015-09-23 16:09:43 +02:00
Thomas Haller
41917a52c0 systemd/adapt: refactor creation of struct sd_event_source 2015-09-23 16:09:43 +02:00
Thomas Haller
d6370d09e6 logging: coerce negative error values to positive errno
Especially systemd, which makes use of the error argument for logging, likes
to represent errors as negative numbers. We hence must invert a negative error
code to get the real errno.
2015-09-23 16:09:43 +02:00
Jiří Klimeš
94bbe7465f supplicant: adjust fragment_size according to MTU (bgo #755145)
NetworkManager set wpa_supplicant's fragment_size option to 1300. But if MTU
was lower, wpa_supplicant failed with "l2_packet_send - sendto: Message too
long" due to fragmentation of EAP-TLS or EAP-PEAP packets.

Actually, MTU has to be 14 bytes bigger than the "fragment_size" parameter.

Ideally, wpa_supplicant would take MTU in the account and adjust the
fragmentation limit accordingly. See discussion in
http://lists.shmoo.com/pipermail/hostap/2015-August/033546.html

https://bugzilla.gnome.org/show_bug.cgi?id=755145
2015-09-23 12:41:11 +02:00
Beniamino Galvani
d7b72b2a3e dns-manager: fix DNS options syntax in resolv.conf
Fixes: e7ff906f91
2015-09-22 20:43:08 +02:00
Jiří Klimeš
2318c0de92 contrib/rpm: fix creating proper po/Makefile.in.in (rh #1265117)
Without that DATADIRNAME was not present in po/Makefile.in.in
and it resulted in /usr/\@DATADIRNAME\@/locale/cs/LC_MESSAGES/ path instead of
/usr/share/locale/cs/LC_MESSAGES/.

https://bugzilla.redhat.com/show_bug.cgi?id=1265117
2015-09-22 12:50:55 +02:00
Jiří Klimeš
85d7dc1a0f manager: cleanup NMRfkillManager in dispose()
Fixes: b15fb8641e
2015-09-22 08:21:54 +02:00
Jiří Klimeš
dd8c3ef3a0 manager: disconnect signal handlers on 'settings' in dispose() (rh #1264676)
Otherwise a crash can occur when shutting down.

https://bugzilla.redhat.com/show_bug.cgi?id=1264676
2015-09-22 08:21:54 +02:00
Thomas Haller
f0ea0cd402 device: refactor beginning of _set_state_full()
- Reorder statements, to first g_return_if_fail() and log state-change.

- Also log a message when leaving _set_state_full() early due to missing firmware.
2015-09-21 18:25:50 +02:00
Thomas Haller
4cb0ab5d29 cli: fix type on printed nmcli error message
Fixes: 4dffbf8f6a
2015-09-21 18:25:50 +02:00
Thomas Haller
fcc51f1ab7 nmcli/bash-completion: fix completion for device names for nmcli device set
Fixes: 7405d5c7b7
2015-09-21 18:25:50 +02:00
Jiří Klimeš
32e783e753 merge: make VPN timeout configurable - vpn.timeout property (bgo #754754)
https://bugzilla.gnome.org/show_bug.cgi?id=754754
2015-09-21 16:59:46 +02:00
Jiří Klimeš
9f1e9913b9 man: document that vpn.timeout property supports a default value 2015-09-21 16:59:04 +02:00
Jiří Klimeš
bbc7725218 vpn: use vpn.timeout property as timeout value for IP config (bgo #754754)
Some VPN services may take their time when establishing a connection. Let's
make our timeout configurable to be able to give such services a chance.

https://mail.gnome.org/archives/networkmanager-list/2015-April/msg00007.html

https://bugzilla.gnome.org/show_bug.cgi?id=754754
2015-09-21 16:59:04 +02:00
Jiří Klimeš
431cc8a517 cli: support vpn.timeout property in nmcli 2015-09-21 16:59:04 +02:00
Jiří Klimeš
ffe16c958f libnm-core: add vpn.timeout property for establishing connections
[1] https://mail.gnome.org/archives/networkmanager-list/2015-April/msg00007.html
2015-09-21 16:59:04 +02:00
Thomas Haller
5d36910d16 device: log the flags that are set/cleared in _set_unmanaged_flags()
Don't show only the flags that are set/cleared *in addition*.
2015-09-21 16:24:41 +02:00
Jiří Klimeš
e9f9f4ecb9 merge: fix ADSL in nmcli and libnm-core/libnm-utils (rh #1264089)
- implements 'nmcli connection add type adsl'
- initializes adsl.protocol for 'nmcli con edit type adsl'
- fixes errors in adsl properties in libnm-core/libnm-util
2015-09-21 15:32:25 +02:00
Jiří Klimeš
290c1626b9 cli: allow creating ADSL connections with 'nmcli connection add' (rh #1264089)
https://bugzilla.redhat.com/show_bug.cgi?id=1264089
2015-09-21 15:21:51 +02:00
Jiří Klimeš
5502d8691a cli: initialize adsl.protocol in editor when creating a new connection
The protocol is required and it is nice to have a valid initial value for
the property.
2015-09-21 15:21:51 +02:00
Jiří Klimeš
3d64d45d16 libnm-core/libnm-util: fix an assertion in adsl setting
(process:7799): GLib-CRITICAL **: g_ascii_strdown: assertion 'str != NULL' failed
2015-09-21 15:21:50 +02:00
Beniamino Galvani
5221180a20 core: fix crash in NMManager message filter
g_dbus_message_get_interface() can return NULL in the message filter,
for example when the client does:

  #!/usr/bin/env python
  import dbus
  bus = dbus.SystemBus()
  proxy = bus.get_object("org.freedesktop.NetworkManager",
                         "/org/freedesktop/NetworkManager")
  proxy.foobar()

Use g_strcmp0() to compare the interface and member names.

Fixes: 34ba4e14b8
2015-09-21 14:49:03 +02:00
Jiří Klimeš
73d2bd53c5 device: remove unused ip_iface 2015-09-21 09:09:36 +02:00
Jiří Klimeš
3b11b85753 wifi: remove unused variables 2015-09-21 09:04:35 +02:00
Thomas Haller
45f682e222 exported-object: explicitly disconnect bindings and signal handlers to GDBusInterfaceSkeleton interfaces
While an NMExportedObject is exported (i.e. registered at NMBusManager),
it has a list of GDBusInterfaceSkeleton interfaces. The properties of
the nm-object are bound to the interfaces and the signals connected.

Previously, when unexporting the NMExportedObject, we would only unref
the interfaces, but not explicitly disconnect. As there is no guarantee
that the lifetime of the interfaces is shorter then the lifetime of the
nm-object, hence, explicitly disconnect.
2015-09-18 18:01:55 +02:00
Thomas Haller
24dc78957f core: merge branch 'lr/applied-connection-bgo724041'
https://bugzilla.gnome.org/show_bug.cgi?id=724041
2015-09-18 17:39:33 +02:00
Lubomir Rintel
06da353242 core: separate active and applied connection
Clone the connection upon activation. This makes it safe for the user
to modify the original connection while it is activated.

This involves several changes:

- NMActiveConnection gets @settings_connection and @applied_connection.
  To support add-and-activate, we constructing a NMActiveConnection with
  no connection set. Previously, we would set the "connection" field to
  a temporary NMConnection. Now NMManager piggybacks this temporary
  connection as object-data (TAG_ACTIVE_CONNETION_ADD_AND_ACTIVATE).

- get rid of the functions nm_active_connection_get_connection_type()
  and nm_active_connection_get_connection_uuid(). From their names
  it is unclear whether this returns the settings or applied connection.
  The (few) callers should figure that out themselves.

- rename nm_active_connection_get_id() to
  nm_active_connection_get_settings_connection_id(). This function
  is only used internally for logging.

- dispatcher calls now get two connections as well. The
  applied-connection is used for the connection data, while
  the settings-connection is used for the connection path.

- needs special handling for properties that apply immediately
  when changed (nm_device_reapply_settings_immediately()).

Co-Authored-By: Thomas Haller <thaller@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=724041
2015-09-18 17:32:11 +02:00
Thomas Haller
c9b3617c35 libnm: mark properties that take effect immediately on active connection (REAPPLY_IMMEDIATELY)
The flag is still unused.
2015-09-18 17:31:51 +02:00
Thomas Haller
b1ebbf4c80 libnm: use NM_FLAGS_HAS() in nm_setting_compare() 2015-09-18 16:37:48 +02:00
Thomas Haller
d5716eed59 secrets: make agent-manager independent from NMSettingsConnection
NMSecretAgent (and in turn NMAgentManager) used the @connection argument both
for the connection data, but also for the connection path. Detangle these, and
accept the path separate from the connection.

This makes NMSecretAgent and NMAgentManager truly operate on a plain
NMConnection, without the non-obvious requirement, that the path of the
connection must be set.
2015-09-18 16:12:36 +02:00
Thomas Haller
80a7b41613 vpn-connection: refactor cancellation of secrets 2015-09-18 16:12:36 +02:00
Thomas Haller
674f778c41 settings: use nm_settings_connection_get_id/uuid() utils 2015-09-18 16:12:36 +02:00
Thomas Haller
1036cab5b4 settings: add nm_settings_connection_get_id/uuid() utils 2015-09-18 16:12:36 +02:00
Thomas Haller
af180da625 libnm: don't assert in nm_connection_get_*() for verified connection
Those getters are convenience methods to retrieve the id/type from
the NMSettingConnection. If the NMSettingConnection was missing
(and thus the connection invalid) we would raise an assertion.

Don't be so strict and just silently return NULL.
Otherwise, the caller cannot use the functions on unverified
connections.
2015-09-18 16:12:36 +02:00
Lubomir Rintel
f589c66b12 audit-manager: don't log connection whose addition fails
In AddAndActivate the uuid and id make no sense until authorization succeeds
and the connection is saved.
2015-09-18 16:12:36 +02:00
Thomas Haller
b5a6883c10 vpn-connection: use logging macros _LOG*()
This now gives every logging line of a NMVpnConnection
a fully descriptive prefix.

Especially for non-debug logging, this looks a bit verbose
and repetitive, so we could suppress the prefix in that case.
I still add it because I think the verbose information does help
during debugging.
2015-09-18 16:12:36 +02:00
Thomas Haller
72c85c29a7 vpn-connection: add logging macros _LOG*() 2015-09-18 16:12:36 +02:00
Thomas Haller
d48ed98eb3 vpn-connection/trivial: consistently rename @connection argument to @self 2015-09-18 16:12:36 +02:00
Thomas Haller
6006a0b134 core/manager: use active_connection_get_by_path() in impl_manager_deactivate_connection() 2015-09-18 16:12:36 +02:00
Thomas Haller
31deca0157 libnm: fix missing case in "nm-remote-connection.c"
Fixes: d20bed069c
2015-09-18 16:11:47 +02:00
Jiří Klimeš
d20bed069c libnm: fix initializing of new connections
connection_added() can be called before init_get_settings_cb(), and we can't
complete the connection until it is visible, else it would be uninitialized.

Test case:
* have 'em1' interface
$ nmcli con add type ethernet con-name myeth ifname em1 autoconnect no
(process:9039): libnm-CRITICAL **: nm_connection_get_id: assertion 's_con != NULL' failed
Connection '(null)' ((null)) successfully added.

$ nmcli con add type ethernet con-name myeth ifname em1X autoconnect no
Connection 'myeth' (71159504-c2af-4773-8ca9-a3626aa0da33) successfully added.

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

[lkundrak@v3.sk: This is not quite the correct fix, we shouldn't emit
NMObject:connection-added for an unfinished object. Nevertheless, let's go with
it until we have a better one. Will revert this afterwards. See linked bugs.]
2015-09-18 15:54:39 +02:00
Thomas Haller
6c989bb68f core: merge branch 'th/secret-requests-bgo754508'
https://bugzilla.gnome.org/show_bug.cgi?id=754508
2015-09-18 14:31:31 +02:00