Commit Graph

13265 Commits

Author SHA1 Message Date
Thomas Haller
0e5af7fa46 Revert "libnm: don't add objects to cache until they're async-inited"
Reverting, because patch breaks tests for "libnm/tests".

This reverts commit 88f0d646d5.
2015-09-15 23:11:47 +02:00
Thomas Haller
e908c9c293 trivial: fix spelling in comment
Fixes: 9a88d72fd4
2015-09-15 18:25:24 +02:00
Lubomir Rintel
88f0d646d5 libnm: don't add objects to cache until they're async-inited
Otherwise the uninitializeded objects could be prematurely signalled if their
paths are seen twice in quick succession. This happens when you have ethernet
hardware and add an ethernet connection -- it's immediatelly added to
AvialableConnections and the property reload signals the object addition
before the NMRemoteSettings's GetSettings() finishes:

  # nmcli c add type ethernet autoconnect no ifname '*'
  (process:4610): libnm-CRITICAL **: nm_connection_get_id: assertion 's_con != NULL' failed
  Connection '(null)' ((null)) successfully added.
  #

https://bugzilla.gnome.org/show_bug.cgi?id=754794
2015-09-15 16:53:26 +02:00
Lubomir Rintel
9a88d72fd4 core: register G_TYPE_SOCKET early
Concurrent registrations later on can cause a deadlock due to a GLib bug.

https://bugzilla.gnome.org/show_bug.cgi?id=754795
2015-09-15 16:53:17 +02:00
Jiří Klimeš
2b129cd8da merge: improve handling of wake-on-lan property (rh #1260584)
https://bugzilla.redhat.com/show_bug.cgi?id=1260584
2015-09-15 12:11:55 +02:00
Jiří Klimeš
4485b4ec2f nmcli: wake-on-lan property set/get fixes
- accept a numeric value (decimal or hex (0x prefix))
- display a numeric value of the property in addition to the strings
- add/accept spaces between string names

to behave similar to other flags' properties.
2015-09-15 11:46:37 +02:00
Jiří Klimeš
f88ce92b25 nmcli: allow "none" value for ethernet.wake-on-lan property (rh #1260584)
Aliases "disable" and "disabled" are accepted too.

nmcli> set 802-3-ethernet.wake-on-lan none

It was possible to remove flags by setting a string containing just white
spaces, but it was user unfriendly and non-intuitive.

https://bugzilla.redhat.com/show_bug.cgi?id=1260584
2015-09-15 11:46:37 +02:00
Thomas Haller
757999d484 manager: avoid wrong ref-counting in do_set_property_check()
Fixes: 52ed6a8e5c
2015-09-14 22:23:54 +02:00
Thomas Haller
4dd0b69a88 device: add debug log for setting unmanged flags
Only set priv->unmanaged_flags in one place and log
any changes. It is not trivial to understand from the
logfile why a device is unmanged.
2015-09-14 21:50:28 +02:00
Thomas Haller
b89826d874 device/trivial: move local variable closer to where it is used 2015-09-14 18:36:54 +02:00
Thomas Haller
de0f00e8d1 manager: avoid assertion in free_property_filter_data()
#0  0x00007fc52202dd3b in g_logv (breakpoint=1) at gmessages.c:315
    #1  0x00007fc52202dd3b in g_logv (log_domain=0x7fc522351b84 "GLib-GObject", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7ffeb818bfc0) at gmessages.c:1041
    #2  0x00007fc52202deaf in g_log (log_domain=<optimized out>, log_level=<optimized out>, format=<optimized out>) at gmessages.c:1079
    #3  0x000055c658ee819f in free_property_filter_data (pfd=0x55c65a009000) at nm-manager.c:4418
    #4  0x000055c658ee7e67 in do_set_property_check (user_data=0x55c65a009000) at nm-manager.c:4515
    #5  0x00007fc522026a8a in g_main_context_dispatch (context=0x55c659e161c0) at gmain.c:3122
    #6  0x00007fc522026a8a in g_main_context_dispatch (context=context@entry=0x55c659e161c0) at gmain.c:3737
    #7  0x00007fc522026e20 in g_main_context_iterate (context=0x55c659e161c0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3808
    #8  0x00007fc522027142 in g_main_loop_run (loop=0x55c659e16280) at gmain.c:4002
    #9  0x000055c658e047ee in main (argc=1, argv=0x7ffeb818c508) at main.c:449

Fixes: 751c674643
2015-09-14 18:36:54 +02:00
Thomas Haller
b0815813fa iface-helper: enabled dhcp4/slaac according to IP method
If at the moment when spawning nm-iface-helper dhcp4/slaac
did not yet complete, we would not enable it.

That is wrong. If the connection indicates to use dhcp4/slaac,
it should be used by nm-iface-helper without considering the
current state on the device.

https://bugzilla.redhat.com/show_bug.cgi?id=1260243
2015-09-13 15:50:44 +02:00
Dan Winship
5b512053e3 core: merge branch 'interface-types-bgo754416'
Fix the way NM uses GObject interface types, and use
G_DEFINE_INTERFACE().

https://bugzilla.gnome.org/show_bug.cgi?id=754416
2015-09-10 13:56:21 -04:00
Dan Winship
8e9f782082 core: fix interface type names
A GObject interface, like a class, has two different C types
associated with it; the type of the "class" struct (eg, GObjectClass,
GFileIface), and the type of instances of that class/interface (eg,
GObject, GFile).

NetworkManager was doing this wrong though, and using the same C type
to point to both the interface's class struct and to instances of the
interface. This ends up not actually breaking anything, since for
interface types, the instance type is a non-dereferenceable dummy type
anyway. But it's wrong, since if, eg, NMDeviceFactory is a struct type
containing members "start", "device_added", etc, then you should not
be using an NMDeviceFactory* to point to an object that does not
contain those members.

Fix this by splitting NMDeviceFactory into NMDeviceFactoryInterface
and NMDeviceFactory; by splitting NMConnectionProvider into
NMConnectionProviderInterface and NMConnectionProvider; and by
splitting NMSettingsPlugin into NMSettingsPluginInterface and
NMSettingsPlugin; and then use the right types in the right places.

As a bonus, this also lets us now use G_DEFINE_INTERFACE.
2015-09-10 13:43:47 -04:00
Dan Winship
b3d56e4885 settings: remove some NMSettingsPlugin cruft 2015-09-10 13:43:47 -04:00
Dan Winship
dfb77e3b19 settings: trivial: rename NMSystemConfigInterface to NMSettingsPlugin
Since there have not been separate system and user settings services
since 0.8, the "system" in NMSystemConfigInterface is kind of
meaningless. Rename it to NMSettingsPlugin, which describes what it
does better.

This is just:

    git mv src/settings/nm-system-config-interface.h src/settings/nm-settings-plugin.h
    git mv src/settings/nm-system-config-interface.c src/settings/nm-settings-plugin.c
    perl -pi -e 's/SystemConfigInterface/SettingsPlugin/g;' \
             -e 's/system_config_interface/settings_plugin/g;' \
             -e 's/system-config-interface/settings-plugin/g;' \
             -e 's/SYSTEM_CONFIG_INTERFACE/SETTINGS_PLUGIN/g;' \
             -e 's/sc_plugin/settings_plugin/g;' \
             -e 's/SC_PLUGIN/SETTINGS_PLUGIN/g;' \
             -e 's/SC_IS_PLUGIN/SETTINGS_IS_PLUGIN/g;' \
             -e 's/SC_TYPE_PLUGIN/SETTINGS_TYPE_PLUGIN/g;' \
             -e 's/SCPlugin/SettingsPlugin/g;' \
             -e 's/nm_system_config_factory/nm_settings_plugin_factory/g;' \
         $(find src/settings -type f)

(followed by some whitespace fixups in nm-settings-plugin.c, and a
Makefile.am fix for the rename)
2015-09-10 13:43:47 -04:00
Thomas Haller
04c4128356 core: fix D-Bus value for NM_IP6_CONFIG_ROUTES
Caused NMIP6Config:Routes property to have bogus values
and leaked the variants.

Fixes: 6c8f860820
2015-09-10 13:31:36 +02:00
Piotr Drąg
12746da039 po: update Polish (pl) translation (bgo #754798)
https://bugzilla.gnome.org/show_bug.cgi?id=754798
2015-09-10 11:25:07 +02:00
Thomas Haller
bbf56bf286 dns: fix bug setting dns-mode
Fixes: 18d2825ceb
2015-09-09 18:41:11 +02:00
Jiří Klimeš
28361e9238 manager: call nm_device_realize() also for generic devices
Without that the device is not properly initialized. It misses hardware
address and type description.

Testcase:
$ sudo ip link add dummy0 type dummy
$ nmcli device
DEVICE             TYPE      STATE         CONNECTION
em1                ethernet  connected     Ethernet connection 1
FF                 wifi      connected     --
bond0              bond      unmanaged     --
bond1              bond      unmanaged     --
dummy0                       unmanaged     --
lo                           unmanaged     --

Fixes: e8139f56c2
2015-09-09 16:28:01 +02:00
Thomas Haller
e0fe47b74e core: fix handling ignore-auto-dns for IPv6 nameservers
https://bugzilla.redhat.com/show_bug.cgi?id=1261428

Fixes: f7a8962dd4
2015-09-09 12:59:01 +02:00
Thomas Haller
52cd5ee612 platform/test: add test for invoking platform signals
There seems to be an issue with glib/ffi that causes failures
to pass enum-typed arguments to signals (related bug rh#1260577).

Add a test for platform signals which, beside NM_CONFIG_SIGNAL_CONFIG_CHANGED,
is the only place where we use enum-typed arguments for signals.

Strangely, this test doesn't cause the failure, so it's unclear why
the workaround was necessary for "config-changed" signal (commit
e7d66f1df6).
2015-09-09 12:33:34 +02:00
Thomas Haller
e7d66f1df6 config: workaround invocation of "config-changed" signal
There seems to be a bug in glib/ffi that hits on s390x/ppc64 architecture.
It causes @changes in nm-dns-manager.c:config_changed_cb() to be NONE,
although it is clearly set (see the related bug rh #1260577 for glib).

Workaround this, by making the argument type a plain guint.

Note that the ill behavior is caught by test_config_signal() in
"src/tests/config/test-config.c".

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1062301
2015-09-09 11:52:33 +02:00
Beniamino Galvani
8318672fe9 core: fix file descriptor leak in bus manager
There's a bug [1] in GLib for which a GDBusConnection is marked as
closed when the remote peer vanishes but its resources are not cleaned
up.

Work around the issue by explicitly closing the connection when
remote_peer_vanished is TRUE.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=754730

https://bugzilla.redhat.com/show_bug.cgi?id=1260920
2015-09-09 10:13:20 +02:00
Beniamino Galvani
998ab88949 device: retry DHCP after timeout/expiration for assumed connections
If DHCP fails for an assumed connection, NetworkManager would
transition the device to the FAILED and then to the ACTIVATED state
(because it is assumed); hence if the DHCP server goes temporarily
down the device will go into a permanent state without IP
configuration.

Fix this and try DHCP again after some time when the connection
is an assumed one.

https://bugzilla.redhat.com/show_bug.cgi?id=1246496
2015-09-08 13:23:14 +02:00
Lubomir Rintel
1c46ddf196 device: don't reset NM_UNMANAGED_DEFAULT when platform doesn't override this
This would cause the ip_vti0 generic device (that appears upon insertion of
ip_vti module during libreswan ipsec stack init) to go managed and brought UP.
Without addresses assigned the device would cause all the VPN traffic to
disappear in the oblivion.
2015-09-08 12:32:35 +02:00
Lubomir Rintel
da2ae8ce4e vpn-connection: fix unsetting the gateway
Addresses the clash between the two commits which would cause the parent device
gateway to be overwritten with 0.0.0.0 upon route-based VPN activation:

Fixes: 063677101a
Fixes: 1465c1d326
2015-09-08 12:32:34 +02:00
Jiří Klimeš
ff434af2c5 device: fix a crash when VLAN fails to realize
Program received signal SIGSEGV, Segmentation fault.
 0x0000555555646b59 in platform_link_added (self=self@entry=0x5555559fe1d0,
     ifindex=<optimized out>, plink=plink@entry=0x555555b10a70)
     at nm-manager.c:1889
 1889				nm_log_warn (LOGD_HW, "%s: factory failed to create device: %s",
 (gdb) bt
 #0  0x0000555555646b59 in platform_link_added (self=self@entry=0x5555559fe1d0, ifindex=<optimized out>, plink=plink@entry=0x555555b10a70) at nm-manager.c:1889
 #1  0x000055555564980c in nm_manager_start (self=0x5555559fe1d0)
     at nm-manager.c:1988
 #2  0x000055555564980c in nm_manager_start (self=0x5555559fe1d0, error=error@entry=0x7fffffffe658) at nm-manager.c:4212
 #3  0x00005555555ae173 in main (argc=1, argv=0x7fffffffe7c8) at main.c:428
 (gdb)
2015-09-08 09:46:56 +02:00
Thomas Haller
e6c64af8be config/test: add a test for nm_config_reload() with different signals 2015-09-07 10:50:24 +02:00
Thomas Haller
bf6187e030 core/test: extend timeout for kill-process utils test
On slow virtual machine, these tests could fail because the
timeout was too low. As in a successful run the timeouts should
not be reached anyway, just extend them.
2015-09-04 20:53:03 +02:00
Thomas Haller
39de56844e config: fix wrong signature of class-method config_changed() for signal
Actually, just drop it. It's unused anyway.
2015-09-04 16:34:10 +02:00
Thomas Haller
18d2825ceb dns: unify some logging statements for dns-manager
In update_dns(), prefix the logging lines with "update-dns:".
In init_resolv_conf_mode(), explicitly log the selected mode.
2015-09-04 14:25:23 +02:00
Thomas Haller
ed7198ad99 dns: fix logging in nm_dns_manager_end_updates() 2015-09-04 13:45:13 +02:00
Thomas Haller
de4357d9f4 dns: use _LOG*() macros in "nm-dns-manager.c" 2015-09-04 13:45:13 +02:00
Thomas Haller
9dbc63ac71 dns: add _LOG*() macros to "nm-dns-manager.c" 2015-09-04 13:45:13 +02:00
Thomas Haller
1d06000696 dns/trivial: rename @mgr variable to @self 2015-09-04 13:45:13 +02:00
Lubomir Rintel
f71f9d5fcf tests: fix 32-bit build
Fixes: 874f455d6d
2015-09-04 12:49:54 +02:00
Lubomir Rintel
874f455d6d test: fix duplicate test names
New glib complains.
2015-09-04 12:08:40 +02:00
Thomas Haller
7b70a8405e platform/trivial: add code-comment dividers between different sections of the source file 2015-09-04 11:50:49 +02:00
Thomas Haller
aecc6627d2 logging: merge branch 'th/logging-bgo754332'
https://bugzilla.gnome.org/show_bug.cgi?id=754332
2015-09-04 11:30:04 +02:00
Thomas Haller
b10210a744 rdisc: refactor logging and use common _LOGD() macro 2015-09-04 11:06:26 +02:00
Thomas Haller
edadef563f platform/test: introduce _LOGD() macros to fake platform and platform tests 2015-09-04 11:06:26 +02:00
Thomas Haller
6bb26f8680 platform: get rid of old logging macros
The naming of these logging macros is unexpected, as we use such
macros only here in platform.

For these messages we cannot use the default _LOGD() set of macros,
because there is no @platform instance around. So let's introduce an
alternative set of logging macros (_LOG2D(), etc) and use it.
2015-09-04 11:06:26 +02:00
Thomas Haller
ed5ebf7e74 logging: introduce an alternative set of logging macros
We already have the macros _LOGD(), _LOGI(), etc. to provide context sensitive
logging (such as printing the object pointer as prefix).

In some implementations, we would like to have a second set of logging
macros, that shall be used differently. For example, use the default
_LOGD() for messages that are explicitly issued by one objects, and use
_LOG2D() in a static context when no object is around.

The "_LOG2" prefix is not great from a naming point of view. However, it is
meant to be a second (alternative) set of logging macros with the same
usage pattern as the _LOGD() macros.
2015-09-04 11:06:26 +02:00
Thomas Haller
d47daeb4d9 platform: use _LOG*() macros instead of duplicated macros
Use the common logging macros _LOGD(), etc. instead of calling
nm_log_*() directly or the non-standard macros debug(), info(), etc.
2015-09-04 11:06:26 +02:00
Thomas Haller
084aec79df platform: refactor setup_socket() to accept explicit platform argument
Also, use _LOGW() in verify_source()
2015-09-04 11:06:26 +02:00
Thomas Haller
ffb931ca5c platform: refactor logging for sysctl functions
Use the standard _LOG*() macros and make the static cache
@sysctl_get_prev_values per instance.
2015-09-04 11:06:26 +02:00
Thomas Haller
4e461dab48 build: exclude private headers for mkenums and nm-enum-types.c 2015-09-04 11:06:26 +02:00
Beniamino Galvani
04e29df47d cli: describe usage of the 'connection.metered' property 2015-09-04 10:45:04 +02:00
Jiří Klimeš
54019a403a device: give the default wired profiles the lowest autoconnect-priority
Later when other connections are created, they will be preferred over the
default one.

https://bugzilla.redhat.com/show_bug.cgi?id=1075148#c15
2015-09-04 09:53:59 +02:00