Commit Graph

17526 Commits

Author SHA1 Message Date
Thomas Haller
b20092b51e cli: fix marking setting pretty name for translation 2017-04-23 23:45:02 +02:00
Thomas Haller
9fcbe4ff71 cli: don't use #define for translation texts
Text for translation cannot contain defines (or variables).
2017-04-23 23:45:02 +02:00
Thomas Haller
8abefbe86b config: don't mark default configuration values for translation
It anyway didn't work because N_() cannot be used on a #define.
2017-04-23 23:45:02 +02:00
Thomas Haller
b495d0bf94 proxy: merge branch 'th/proxy-rh1444374'
https://bugzilla.redhat.com/show_bug.cgi?id=1444374
2017-04-23 18:15:34 +02:00
Thomas Haller
019b9fbfc0 proxy: send proxy config after creating D-Bus proxy
As NMDevice now creates the NMPacrunnerManager instance
as needed, it is even more likely that the initial call
to nm_pacrunner_manager_send() will only queue (but not yet
send) the new config.

Later, when the D-Bus proxy is created, we will not get a
name-owner changed signal. We instead have to push the configuration
right away.
2017-04-23 18:13:02 +02:00
Thomas Haller
8c81a4b58b proxy: unify logging in nm-pacrunner-manager
Give logging lines that are concerned with a certain "config"
the same prefix: their call-id.
2017-04-23 18:13:02 +02:00
Thomas Haller
b04a9c90eb proxy: introduce call-id for clearing pacmanager configuration
nm_pacrunner_manager_remove() required a "tag" argument. It was a
bug for callers trying to remove a configuration for a non-existing
tag.

That effectively means, the caller must keep track of whether a certain
"tag" is pending. The caller also must remember the tag -- a tag that he
must choose uniquely in the first place.

Turn that around and have nm_pacrunner_manager_send() return a (non
NULL) call-id. This call-id may later be used to remove the
configuration.

Apparently, previously the tracking of the "tag" was not always correct
and we hit the assertion in nm_pacrunner_manager_remove().

https://bugzilla.redhat.com/show_bug.cgi?id=1444374
2017-04-23 18:12:09 +02:00
Thomas Haller
7d1f725743 firewall: merge branch 'th/firewall-dbus-policy-rh1436770'
https://bugzilla.redhat.com/show_bug.cgi?id=1436770
2017-04-21 13:39:37 +02:00
Thomas Haller
cc1d409ba8 dbus: allow firewalld to communicate with NetworkManager
Usually, this "<allow send_destination="..."/>" part is shipped
by firewalld's D-Bus policy. However, if firewalld is initially
not installed with NetworkManager already running, dbus-daemon
seems to cache the missing permission for the D-Bus connection.
As a result, when installing and starting firewalld, NetworkManager
requests fail until restart:

  firewall: [0x7f4b83643890,change:"eth1"]: complete: request failed (Rejected send message, 1 matched rules; type="method_call", sender=":1.3" (uid=0 pid=715 comm="/usr/sbin/NetworkManager --no-daemon ") interface="org.fedoraproject.FirewallD1.zone" member="changeZone" error name="(unset)" requested_reply="0" destination=":1.25" (uid=0 pid=1243 comm="/usr/bin/python -Es /usr/sbin/firewalld --nofork -"))

https://bugzilla.redhat.com/show_bug.cgi?id=1436770
2017-04-21 13:38:21 +02:00
Thomas Haller
8583e62276 org.freedesktop.NetworkManager.conf: don't use tabs 2017-04-21 13:38:21 +02:00
Thomas Haller
2ad8bb0ce3 firewall: fix supressing errors from D-Bus calls
We want to ignore certain errors from firewalld. In the past,
the error message contained only the error code.
Since recently ([1], [2]), the error message contains a longer text:

  NetworkManager[647]: <debug> [1492768494.7475] device[0x7f7f21e78f50] (eth0): Activation: setting firewall zone 'default'
  NetworkManager[647]: <debug> [1492768494.7475] firewall: [0x7f7f21ed8900,change:"eth0"]: firewall zone change eth0:default
  ...
  firewalld[2342]: ERROR: UNKNOWN_INTERFACE: 'eth0' is not in any zone
  NetworkManager[647]: <warn>  [1492768494.7832] firewall: [0x7f7f0400c780,remove:"eth0"]: complete: request failed (UNKNOWN_INTERFACE: 'eth0' is not in any zone)

[1] c77156d7f6
[2] 7c6ab456c5
2017-04-21 13:38:21 +02:00
Thomas Haller
ec3a9c0607 firewall: merge branch 'th/firewall-async' 2017-04-21 10:17:02 +02:00
Thomas Haller
fb7815df6e firewall: queue operations while NMFirewallManager instance is initializing
We now initialize the NMFirewallManager asynchronously. That means, at
first firewalld appears as "not running", for which we usually would
fake-success right away.

It would be complex for callers to wait for firewall-manager to be
ready. So instead, have the asynchronous requests be queued and
complete them once the D-Bus proxy is initialized.
2017-04-21 09:51:15 +02:00
Thomas Haller
04f4e327a9 firewall: drop _cb_info_is_idle()
Next we will get another mode, so an is-idle doesn't cut it.
It can be confusing where the mode is set and where it is only
accessed read-only. For that, add mode_mutable.
2017-04-21 09:09:01 +02:00
Thomas Haller
d8bf05d3e6 firewall: factor out D-Bus call from _start_request()
Will be used in the next commit.
2017-04-21 09:09:01 +02:00
Thomas Haller
db576b848a firewall: merge "started" signal and "available" property
The GObject property NM_FIREWALL_MANAGER_AVAILABLE is basically unused.
Drop it.
2017-04-21 09:09:01 +02:00
Thomas Haller
753f39fa82 firewall: create firewall D-Bus proxy asynchronously
Creating it asynchronously changes that on the first call to
nm_firewall_manager_get() the instance is not yet running.

Note that NMPolicy already connects to the "STARTED" signal and
reapplies the zones when firewalld appears. So, this delayed
change of the running state is handled mostly fine already.

One part is still missing, it's to queue add_or_change/remove calls
while the firewall manager is initializing. That follows next.
2017-04-21 08:43:28 +02:00
Beniamino Galvani
104795317f merge: branch 'bg/cli-completion'
Fix autocompletion and other regressions in nmcli editor.
2017-04-20 14:35:07 +02:00
Beniamino Galvani
ed824102ff cli: fix completion of connection types
Return only main settings and the special slave types.
2017-04-20 14:34:20 +02:00
Beniamino Galvani
07cba18036 cli: accept special slave connection types in editor 2017-04-20 14:34:20 +02:00
Beniamino Galvani
032a3b4712 cli: only return main setting names as connection types
Also, return the special slave types.
2017-04-20 14:34:20 +02:00
Beniamino Galvani
243061edb6 cli: normalize function name 2017-04-20 14:34:20 +02:00
Beniamino Galvani
212df5cbd8 libnm: fix memory leak in DNS manager
Fixes: a8d6005256
2017-04-20 14:33:31 +02:00
Thomas Haller
c828277872 device: merge branch 'th/device-assume-guess-rh1443878'
https://bugzilla.redhat.com/show_bug.cgi?id=1443878
2017-04-20 14:20:27 +02:00
Thomas Haller
27b2477cb7 device: assume matching connections during first start
Since commit 2d1b85f (th/assume-vs-unmanaged-bgo746440), we clearly
distinguish between two modes when encountering devices with external
IP configuration:
 a) external devices. For those devices we generate a volatile in-memory
   connection and pretend it's active. However, the device must not be
   touched by NetworkManager in any way.
 b) assume, seamless take over. Mostly for restart of NetworkManager,
   we activate a connection gracefully without going through an down-up
   cycle. After the device reaches activated state, the device is
   considered fully managed. For this only an existing, non volatile
   connection can be used.

Before 'th/assume-vs-unmanaged-bgo746440', the behaviors were not
clearly separated.

Since then, we only choose to assume a connection (b) when the state
file indicates a matching connection. Now, extend this to also assume
connections when:

  - during first-start (not after a restart) when there is no
    state file yet.
  - and, if we have an existing, non volatile, connection which
    matches the device's configuration.

This patch lets NetworkManager assume connection also on first start.
That is for example useful when handing over network configuration from
initrd.

This only applies to existing, permanent, matching(!) connections, so it is a
good guess that the user wants NM to take over this interface. This brings us
closer to the previous behavior before 'th/assume-vs-unmanaged-bgo746440'.

https://bugzilla.redhat.com/show_bug.cgi?id=1439220
2017-04-20 14:20:04 +02:00
Thomas Haller
2131954a19 config: add first_start paramter to NMConfig to detect restart 2017-04-20 14:19:56 +02:00
Thomas Haller
1940be410c config: remove unused NMConfig self argument from nm_config_device_state_*() API
nm_config_device_state_*() always access the file system directly,
they don't cache data in NMConfig. Hence, they don't use the
@self argument.

Maybe those functions don't belong to nm-config.h, anyway. For lack
of a better place they are there.
2017-04-20 14:19:56 +02:00
Francesco Giudici
4bdb6b026a nmcli: show secrets when the --show-secrets option is put after the connection id
'nmcli connection show <con_id1> --show-secrets'
secrets were not shown.
'nmcli connection show <con_id1> --show-secrets <con_id2>'
secrets were shown only for connection ids following the
"--show-secrets" option (so only for 'con_id2').

Fix these behaviors showing secrets for all connections also
if the "--show-secrets" option is put after the connection ids.
2017-04-20 12:41:08 +02:00
Thomas Haller
6dfb3e9ffb cli/trivial: remove whitespace between N_ macro and parenthesis
For _() and N_() we don't have a space before the parenthesis.
Be consistent about that.
2017-04-19 18:27:19 +02:00
Piotr Drąg
fbf40a23ad po: update Polish (pl) translation (bgo #780277)
https://bugzilla.gnome.org/show_bug.cgi?id=780277

[thaller@redhat.com: with `make -C po NetworkManager.pot update-po`]
2017-04-19 17:33:37 +02:00
Thomas Haller
4f5464a914 po: make update-po 2017-04-19 11:52:28 +02:00
Piotr Drąg
70eb4c3dba po: update Polish (pl) translation (bgo #780277)
https://bugzilla.gnome.org/show_bug.cgi?id=780277
2017-04-19 11:52:28 +02:00
Thomas Haller
ef6787364a po: import Zanata translations 2017-04-19 11:52:27 +02:00
Thomas Haller
ef25459377 po: make update-po 2017-04-19 11:52:26 +02:00
Thomas Haller
b4b8e81153 gitignore: ignore .zanata-cache directory 2017-04-19 11:52:26 +02:00
Beniamino Galvani
2bb62945a3 supplicant: fix detection of PMF support
Fixes: a72ffe230b
2017-04-19 10:36:21 +02:00
Thomas Haller
d105a610d6 device: use define for "sriov-num-vfs" config entry 2017-04-19 10:29:04 +02:00
Beniamino Galvani
45e4cc67b3 merge: branch 'bg/sriov-numvfs-rh1398934'
https://bugzilla.redhat.com/show_bug.cgi?id=1398934
2017-04-18 23:25:30 +02:00
Beniamino Galvani
264624f91d device: re-apply sriov_numvfs after SIGHUP 2017-04-18 23:10:36 +02:00
Beniamino Galvani
32975b6aa5 core: allow setting SR-IOV num_vfs 2017-04-18 23:10:36 +02:00
Beniamino Galvani
f13fd4524c all: detect SR-IOV device support 2017-04-18 22:48:34 +02:00
Beniamino Galvani
0a7694cf81 platform: detect SR-IOV support and allow changing the number of VFs 2017-04-18 22:47:32 +02:00
Thomas Haller
9e8218f99a device: leave device up when setting it as unmanaged by user
Before, setting a device to unmanaged causes it to go down and clear
the interface state.

It may be useful to instruct NetworkManager not to touch the device
anymore but leave the current state up. Changing behavior for

  nmcli device set "$DEV" managed no

To get the previous behavior, one has to first disconnect the interface
via

  nmcli device disconnect "$DEV"
  nmcli device set "$DEV" managed no

Note that non-permanent addresses like from DHCP will eventually time
out because NetworkManager stops the DHCP client. When instructing
NetworkManager to let go of the device, you have to take it over in
any way you see fit.

https://bugzilla.redhat.com/show_bug.cgi?id=1371433
2017-04-18 15:52:44 +02:00
Thomas Haller
a31ddcfca5 core: merge branch 'th/netns-singleton-rh1440089'
https://bugzilla.redhat.com/show_bug.cgi?id=1440089
2017-04-18 15:52:01 +02:00
Thomas Haller
41148caba8 core: enable "log-with-ptr" by default for platform and route-manager
Arguably, we currently only have one instance of NMPlatform,
NMRouteManager, NMDefaultRouteManager -- the one owned by the
NMNetns singleton.

Hence, all these instances we create with "log-with-ptr" set explicitly
to false.

In the future we want to support namespaces, and it will be be common to
have multiple instances. For that we have "log-with-ptr" so we are able
to disambiguiate the logging.

Change the default to TRUE because it makes more sense. It has currently
no effect as the default is never used.
2017-04-18 15:49:14 +02:00
Thomas Haller
94d9ee129d device: don't use platform singleton getter in device subclasses
Reduce the use of NM_PLATFORM_GET / nm_platform_get() to get
the platform singleton instance.

For one, this is a step towards supporting namespaces, where we need
to use different NMNetns/NMPlatform instances depending on in which
namespace the device lives.

Also, we should reduce our use of singletons. They are difficult to
coordinate on shutdown. Instead there should be a clear order of
dependencies, expressed by owning a reference to those singelton
instances. We already own a reference to the platform singelton,
so use it and avoid NM_PLATFORM_GET.
2017-04-18 15:49:14 +02:00
Thomas Haller
c48a19b7c6 device: keep NMNetns instance per device
This also ensures that we own a reference to the
NMPlatform, NMRouteManager and NMDefaultRouteManager
instances. See bug rh#1440089 where we might access
the singleton getter after destroing the singleton
instance of NMRouteManager. This is prevented by
keeping a reference to those instances -- indirectly
via the netns instance.

Later, we may add support for multiple namespaces. Then it might
make sense to swap the NMNetns instance of a device when moving
the device between namespaces.

Also, drop the use of singelton instances.

https://bugzilla.redhat.com/show_bug.cgi?id=1440089
2017-04-18 15:49:14 +02:00
Thomas Haller
0af2f5c28b core: add NMNetns to bundle platform and route managers
NMPlatform, NMRouteManager and NMDefaultRouteManager are singletons
instances. Users of those are for example NMDevice, which registers
to GObject signals of both NMPlatform and NMRouteManager.

Hence, as NMDevice:dispose() disconnects the signal handlers, it must
ensure that those singleton instances live longer then the NMDevice
instance. That is usually accomplished by having users of singleton
instances own a reference to those instances.
For NMDevice that effectively means that it shall own a reference to
several singletons.

NMPlatform, NMRouteManager, and NMDefaultRouteManager are all
per-namespace. In general it doesn't make sense to have more then
one instances of these per name space. Nnote that currently we don't
support multiple namespaces yet. If we will ever support multiple
namespaces, then a NMDevice would have a reference to all of these
manager instances. Hence, introduce a new class NMNetns which bundles
them together.
2017-04-18 15:49:14 +02:00
Beniamino Galvani
df537d2eac manager: set interface as removed when the link disappears
Set the device state as removed when the link disappears, so that in
the call to unrealize() when the device is unmanaged we also perform a
cleanup of it and especially, we terminate any DHCP client instances
running on the device.

If we keep DHCP clients running, we can hit assertions later when we
start another instance on the same interface, because we kill the old
dhclient from the pidfile, and the g_child_watch_add() done by the
first client instance is not able to waitpid() it, complaining with:

  GChildWatchSource: Exit status of a child process was requested but
  ECHILD was received by waitpid(). Most likely the process is
  ignoring SIGCHLD, or some other thread is invoking waitpid() with a
  nonpositive first argument; either behavior can break applications
  that use g_child_watch_add()/g_spawn_sync() either directly or
  indirectly.

https://bugzilla.redhat.com/show_bug.cgi?id=1436602
2017-04-18 15:09:15 +02:00
Beniamino Galvani
afca8a4c0f clients: fix setting of enum properties
Ensure we call G_IS_ENUM_CLASS() or G_IS_FLAGS_CLASS() only on classed
types.

 $ nmcli connection modify foobar wifi.powersave 1
 Thread 1 "nmcli" received signal SIGSEGV, Segmentation fault.
 0x0000000000440a4d in _set_fcn_gobject_enum at
 clients/common/nm-meta-setting-desc.c:985
 985                 || G_IS_ENUM_CLASS (gtype_prop)) {

Fixes: f53218ed7c
2017-04-18 13:40:02 +02:00