Commit graph

15000 commits

Author SHA1 Message Date
Lubomir Rintel
299feed54f act-request: queue failing the slave when master fails
We might be already handling a state change:

Aug 17 05:26:34 dacan.local NetworkManager[618]: (devices/nm-device.c:10982):
_set_state_full: runtime check failed: (priv->in_state_changed == FALSE)

  (gdb) bt
  #0  0x00007fc218dad643 in g_logv (log_domain=0x7fc21c0db3c3 "NetworkManager", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=args@entry=0x7ffe6f0b30d0) at gmessages.c:1086
  #1  0x00007fc218dad7bf in g_log (log_domain=log_domain@entry=0x7fc21c0db3c3 "NetworkManager", log_level=log_level@entry=G_LOG_LEVEL_WARNING, format=format@entry=0x7fc218e1b70f "%s") at gmessages.c:1119
  #2  0x00007fc218dadb16 in g_warn_message (domain=domain@entry=0x7fc21c0db3c3 "NetworkManager", file=file@entry=0x7fc21c0d6597 "devices/nm-device.c", line=line@entry=10982, func=func@entry=0x7fc21c0dabf0 <__FUNCTION__.42233> "_set_state_full", warnexpr=warnexpr@entry=0x7fc21c0d95a0 "priv->in_state_changed == FALSE") at gmessages.c:1152
  #3  0x00007fc21bf79bd6 in _set_state_full (self=0x7fc21ccd88b0 [NMDeviceEthernet], state=NM_DEVICE_STATE_FAILED, reason=NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED, quitting=0) at devices/nm-device.c:10982
  #7  0x00007fc2190bdd9f in <emit signal notify:master on instance 0x7fc21ccd88b0 [NMDeviceEthernet]> (instance=instance@entry=0x7fc21ccd88b0, signal_id=<optimized out>, detail=<optimized out>) at gsignal.c:3439
      #4  0x00007fc2190a3908 in g_closure_invoke (closure=0x7fc21cd009e0, return_value=return_value@entry=0x0, n_param_values=2, param_values=param_values@entry=0x7ffe6f0b34b0, invocation_hint=invocation_hint@entry=0x7ffe6f0b3450) at gclosure.c:801
      #5  0x00007fc2190b5a1d in signal_emit_unlocked_R (node=node@entry=0x7fc21cb66500, detail=detail@entry=588, instance=instance@entry=0x7fc21ccd88b0, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7ffe6f0b34b0)
      at gsignal.c:3627
      #6  0x00007fc2190bdab1 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7ffe6f0b3640) at gsignal.c:3383
  #8  0x00007fc2190a7fd4 in g_object_dispatch_properties_changed (object=0x7fc21ccd88b0 [NMDeviceEthernet], n_pspecs=<optimized out>, pspecs=<optimized out>) at gobject.c:1061
  #9  0x00007fc2190aa619 in g_object_notify_by_pspec (pspec=<optimized out>, object=0x7fc21ccd88b0 [NMDeviceEthernet]) at gobject.c:1155
  #10 0x00007fc2190aa619 in g_object_notify_by_pspec (object=object@entry=0x7fc21ccd88b0 [NMDeviceEthernet], pspec=<optimized out>) at gobject.c:1264
  #11 0x00007fc21bf7de3f in nm_device_master_enslave_slave (prop=PROP_MASTER, obj=0x7fc21ccd88b0 [NMDeviceEthernet]) at devices/nm-device.c:103
  #12 0x00007fc21bf7de3f in nm_device_master_enslave_slave (success=1, self=0x7fc21ccd88b0 [NMDeviceEthernet]) at devices/nm-device.c:2757
  #13 0x00007fc21bf7de3f in nm_device_master_enslave_slave (self=0x7fc21cd42810 [NMDeviceBond], slave=0x7fc21ccd88b0 [NMDeviceEthernet], connection=<optimized out>) at devices/nm-device.c:1300
  #14 0x00007fc2167c8dcc in ffi_call_unix64 () at ../src/x86/unix64.S:76
  #15 0x00007fc2167c86f5 in ffi_call (cif=cif@entry=0x7ffe6f0b3a10, fn=<optimized out>, rvalue=0x7ffe6f0b3980, avalue=avalue@entry=0x7ffe6f0b3900) at ../src/x86/ffi64.c:522
  #20 0x00007fc2190be2e8 in <emit signal 0x7fc21c0ea3d5 "state-changed" on instance 0x7fc21ccd88b0 [NMDeviceEthernet]> (instance=instance@entry=0x7fc21ccd88b0, detailed_signal=detailed_signal@entry=0x7fc21c0ea3d5 "state-changed") at gsignal.c:3479
      #16 0x00007fc2190a4148 in g_cclosure_marshal_generic (closure=0x7fc21cc84de0, return_gvalue=0x0, n_param_values=<optimized out>, param_values=<optimized out>, invocation_hint=<optimized out>, marshal_data=0x0) at gclosure.c:1487
      #17 0x00007fc2190a3908 in g_closure_invoke (closure=0x7fc21cc84de0, return_value=return_value@entry=0x0, n_param_values=4, param_values=param_values@entry=0x7ffe6f0b3c10, invocation_hint=invocation_hint@entry=0x7ffe6f0b3bb0) at gclosure.c:801
      #18 0x00007fc2190b5a1d in signal_emit_unlocked_R (node=node@entry=0x7fc21cbeef20, detail=detail@entry=0, instance=instance@entry=0x7fc21ccd88b0, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7ffe6f0b3c10) at gsignal.c:3627
      #19 0x00007fc2190bdab1 in g_signal_emit_valist (instance=instance@entry=0x7fc21ccd88b0, signal_id=signal_id@entry=112, detail=detail@entry=0, var_args=var_args@entry=0x7ffe6f0b3e48) at gsignal.c:3383
  #21 0x00007fc21bf79e3d in _set_state_full (self=self@entry=0x7fc21ccd88b0 [NMDeviceEthernet], state=state@entry=NM_DEVICE_STATE_IP_CONFIG, reason=reason@entry=NM_DEVICE_STATE_REASON_NONE, quitting=quitting@entry=0) at devices/nm-device.c:11123
  #22 0x00007fc21bf7a707 in nm_device_state_changed (self=self@entry=0x7fc21ccd88b0 [NMDeviceEthernet], state=state@entry=NM_DEVICE_STATE_IP_CONFIG, reason=reason@entry=NM_DEVICE_STATE_REASON_NONE) at devices/nm-device.c:11308
  #23 0x00007fc21bf7e92f in activate_stage3_ip_config_start (self=0x7fc21ccd88b0 [NMDeviceEthernet]) at devices/nm-device.c:6759
  #24 0x00007fc21bf68dac in activation_source_handle_cb (self=0x7fc21ccd88b0 [NMDeviceEthernet], family=family@entry=2) at devices/nm-device.c:3627
  #25 0x00007fc21bf68e6e in activation_source_handle_cb4 (user_data=<optimized out>) at devices/nm-device.c:3564
  #26 0x00007fc218da6d7a in g_main_context_dispatch (context=0x7fc21cb6e000) at gmain.c:3152
  #27 0x00007fc218da6d7a in g_main_context_dispatch (context=context@entry=0x7fc21cb6e000) at gmain.c:3767
  #28 0x00007fc218da70b8 in g_main_context_iterate (context=0x7fc21cb6e000, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3838
  #29 0x00007fc218da738a in g_main_loop_run (loop=0x7fc21cb6c8c0) at gmain.c:4032
  #30 0x00007fc21bf4a23e in main (argc=1, argv=0x7ffe6f0b43e8) at main.c:411
  (gdb)

https://bugzilla.redhat.com/show_bug.cgi?id=1367702
(cherry picked from commit d070d7f47d)
2016-08-18 10:29:48 -05:00
Jiří Klimeš
cbc5ffefec cli: show pre-filled readline input if it is not a real password (rh #1351272)
Example:
$ nmcli -a con up test-conn
Passwords or encryption keys are required to access the wireless network 'kkk'.
Username (802-1x.identity): cimrman
Password (802-1x.password):

https://bugzilla.redhat.com/show_bug.cgi?id=1351272

(cherry picked from commit c9f6309910)
2016-08-17 15:38:11 +02:00
Beniamino Galvani
8540ca3a8a core: fix builds without polkit support
Fix the following build error:

 nm-auth-utils.c: In function ‘nm_auth_chain_add_call’:
 nm-auth-utils.c:402:46: error: ‘DBUS_GERROR’ undeclared (first use in this function)
     call->chain->error = g_error_new_literal (DBUS_GERROR,

Fixes: 1cf35cb26b
(cherry picked from commit b9e89c918f)
2016-08-17 11:50:01 +02:00
Piotr Drąg
ddf17c31c6 po: update Polish (pl) translation (bgo #769463)
https://bugzilla.gnome.org/show_bug.cgi?id=769463
2016-08-15 14:42:44 +02:00
Beniamino Galvani
99e34d7579 wifi: fix stalls in scanning
https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00055.html
https://bugzilla.redhat.com/show_bug.cgi?id=1362165

(cherry picked from commit 8e07ea351d)
2016-08-09 09:42:08 +02:00
Tony Espy
1b925c0028 wifi: clear WiFi requested_scan if suppl exits
It's possible for wpa_supplicant to exit with an
outstanding requested_scan pending.  This can lead
to a stall condition where scanning no longer occurs.

https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00117.html
(cherry picked from commit 899d7e5cb1)
2016-08-09 09:39:33 +02:00
Tony Espy
fdbe43d6d4 wifi: clear WiFi requested_scan if suppl goes INACTIVE
It's possible for wpa_supplicant to transition to INACTIVE
state with an outstanding requested_scan pending.  This can
lead to a stall condition where scanning no longer occurs.

[thaller@redhat.com: added break statement to avoid fall-through]

https://mail.gnome.org/archives/networkmanager-list/2016-June/msg00116.html
(cherry picked from commit eed8fd2e43)
2016-08-09 09:39:30 +02:00
Beniamino Galvani
f864c58cfe build: fix build with '--with-suspend-resume=upower'
Now we have a single file for all suspend APIs and the selection is
done through the preprocessor: remove stale AM_CONDITIONALs and define
SUSPEND_RESUME_UPOWER when needed.

Fixes: c76eb3e8f7
(cherry picked from commit e4b2c989dc)
2016-08-04 17:07:39 +02:00
Beniamino Galvani
2df604975d libnm: fix introspection annotations for nm_client_load_connections()
Add the "(array zero-terminated=1)" GLib introspection annotation when
the parameter is a NULL-terminated string array.

https://mail.gnome.org/archives/networkmanager-list/2016-August/msg00017.html

Reported-by: Petr Horacek <phoracek@redhat.com>
(cherry picked from commit 765dabd005)
2016-08-04 13:59:24 +02:00
Francesco Giudici
f92a4e6f86 release: bump version to 1.2.5 (development) 2016-08-03 16:55:11 +02:00
Francesco Giudici
54a84c6b3b release: bump version to 1.2.4 2016-08-03 15:23:34 +02:00
Francesco Giudici
14177f1e3b release: update NEWS 2016-08-03 15:15:37 +02:00
Beniamino Galvani
fa9300b76b tui: avoid failed assertion when adding bond slaves
When trying to add new slaves to a bond connection, for the first
slave nmt_add_connection_show() is called with !priv->single_type to
display a slave-type selection form. For the second slave the type is
predefined and thus nmt_add_connection_show() doesn't show the dialog;
instead it calls create_connection() directly, which invokes
nmt_newt_form_quit() on the not-shown dialog causing:

nmtui-CRITICAL **: nmt_newt_form_quit: assertion 'priv->form != NULL' failed

Don't call nmt_newt_form_quit() if the form was not shown.

https://bugzilla.gnome.org/show_bug.cgi?id=768981
(cherry picked from commit 2eafd0ea52)
2016-08-01 17:24:29 +02:00
Lubomir Rintel
528d1365c9 libnm: link with libdl
Not default when linking with GOLD linker, but used for loading the VPN
plugins. We still get it when using NSS by dumb luck, but GnuTLS doesn't
drag it in.

https://bugzilla.gnome.org/show_bug.cgi?id=769328
(cherry picked from commit b01219ad1b)
2016-08-01 17:05:45 +02:00
Beniamino Galvani
cab63901fa device: allow ipv6ll address to be set for disconnected devices
Commit f85941ee91 ("device: don't try to generate ipv6ll address for
disconnected devices") disabled the generation of IPv6 link-local
addresses for disconnected devices to fix a crash. However that broke
the following:

 $ ip a f dev eth0
 $ systemctl start NetworkManager
 $ nmcli d
 DEVICE  TYPE      STATE         CONNECTION
 eth0    ethernet  disconnected  eth0
 $ ip a a dev eth0 2001::42/64
 $ ip a show eth0
 4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
     link/ether 52:52:00:61:32:81 brd ff:ff:ff:ff:ff:ff
     inet6 2001::42/64 scope global
        valid_lft forever preferred_lft forever
     (no link-local address)

Revert that change.

Fixes: f85941ee91
(cherry picked from commit 75406d1760)
2016-07-09 13:20:26 +02:00
Beniamino Galvani
a7a206b8e2 platform: wifi: drop old wifi data when an interface is renamed
Drop the old wifi data when the interface is renamed, otherwise WEXT
methods would use the old name.

https://bugzilla.gnome.org/show_bug.cgi?id=768433
(cherry picked from commit 45484af2af)
2016-07-08 13:42:30 +02:00
Beniamino Galvani
6eca877ffd secret-agent: increase timeout for GetSecrets D-Bus call
The default value of 25 seconds is too short, bump it to 120.

https://bugzilla.gnome.org/show_bug.cgi?id=767321
https://bugzilla.redhat.com/show_bug.cgi?id=1349740
(cherry picked from commit 10c5352855)
2016-07-08 13:42:26 +02:00
Beniamino Galvani
1fdf9e4c41 device: don't try to generate ipv6ll address for disconnected devices
If the device is disconnected because it can't be assumed due to lack
of IP configuration, don't try to generate an ipv6 link-local address,
as this requires a connection.

 #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
 #1  __GI_abort () at abort.c:89
 #2  g_assertion_message (domain=domain@entry=0x5f41b4 "NetworkManager", file=file@entry=0x5ef9b5 "devices/nm-device.c", line=line@entry=831,
     func=func@entry=0x5f3220 <__FUNCTION__.37383> "nm_device_get_ip_iface_identifier", message=message@entry=0x1e86100 "assertion failed: (connection)") at gtestutils.c:2429
 #3  g_assertion_message_expr (domain=domain@entry=0x5f41b4 "NetworkManager", file=file@entry=0x5ef9b5 "devices/nm-device.c", line=line@entry=831,
     func=func@entry=0x5f3220 <__FUNCTION__.37383> "nm_device_get_ip_iface_identifier", expr=expr@entry=0x5e65c6 "connection") at gtestutils.c:2452
 #4  nm_device_get_ip_iface_identifier (self=self@entry=0x1e612a0, iid=iid@entry=0x7fffce40e3d0, ignore_token=ignore_token@entry=1) at devices/nm-device.c:831
 #5  check_and_add_ipv6ll_addr (self=self@entry=0x1e612a0) at devices/nm-device.c:5983
 #6  queued_ip6_config_change (user_data=0x1e612a0) at devices/nm-device.c:9489
 #7  g_main_dispatch (context=0x1d3e060) at gmain.c:3154
 #8  g_main_context_dispatch (context=context@entry=0x1d3e060) at gmain.c:3769
 #9  g_main_context_iterate (context=0x1d3e060, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3840
 #10 g_main_loop_run (loop=0x1d3ab00) at gmain.c:4034
 #11 main (argc=1, argv=0x7fffce40e6a8) at main.c:411

https://bugzilla.redhat.com/show_bug.cgi?id=1351633
(cherry picked from commit f85941ee91)
2016-07-06 12:22:04 +02:00
Beniamino Galvani
b5b7260873 libnm-core: ip-config: normalize may-fail for disabled IP methods
Since commit 7d1709d7f6 ("device: check may_fail when progressing to
IP_CHECK") NM correctly checks the may-fail properties to decide
whether a connection must fail after the completion of IP
configuration. But for ipv4.method=disabled and ipv6.method=ignore the
IP configuration is always considered failed and thus setting
may-fail=no results in a connection that can never succeed.

To prevent such wrong configuration, force may-fail to TRUE for those
methods during connection normalization.

https://bugzilla.redhat.com/show_bug.cgi?id=1334884
(cherry picked from commit ac73758305)
2016-07-06 10:12:27 +02:00
Beniamino Galvani
82a1c0d608 merge: branch 'bg/gateway-never-default-rh1313091-v2'
https://bugzilla.redhat.com/show_bug.cgi?id=1313091

(cherry picked from commit 1e3d464954)
2016-07-06 10:01:29 +02:00
Beniamino Galvani
99b07814e0 ifcfg-rh: emit a warning when DEFROUTE=no and GATEWAY is set
(cherry picked from commit 5b70254ea0)
2016-07-06 10:00:44 +02:00
Beniamino Galvani
9cf23f6445 libnm-core: remove gateway when never-default=yes in NMSettingIPConfig
Having a gateway defined when never-default=yes causes troubles in
connection matching and anyway makes no sense.

If the combination is found, remove the gateway during the
normalization phase.

https://bugzilla.redhat.com/show_bug.cgi?id=1313091
(cherry picked from commit c1907a218a)
2016-07-06 10:00:41 +02:00
Beniamino Galvani
132a8abdad dhcp: let dhcp clients hold a reference to NMDhcpListener
The dhclient and dhcpcd clients can be destroyed during disposal of
the DHCP manager singleton and at that point the NMDhcpListener
singleton can be already gone. Reference it in the clients.

(cherry picked from commit e5430a182c)
2016-07-01 15:04:33 +02:00
Beniamino Galvani
751e8b8914 cli: fix parsing of route metric on 32-bit archs
On 32-bit architectures long and int have the same size and thus it's
wrong to use nmc_string_to_int() since it uses strtol() and the @max
argument can't represent G_MAXUINT32. Use nmc_string_to_uint()
instead.

https://bugzilla.redhat.com/show_bug.cgi?id=1350201
(cherry picked from commit 938a4b35c6)
2016-06-30 13:22:32 +02:00
Beniamino Galvani
7ec5fa74e4 vpn,dns: merge branch 'bg/vpn-dns-rh1348901'
(cherry picked from commit 88637dee66)
2016-06-28 16:46:30 +02:00
Beniamino Galvani
762757cfa1 vpn: don't merge DNS properties into parent device's configuration
DNS properties should not be copied to parent device's configuration
otherwise they will be applied twice, possibly with two different DNS
priorities.

(cherry picked from commit df48628a48)
2016-06-28 16:45:55 +02:00
Beniamino Galvani
90dca9e0c9 dns: log DNS servers at TRACE level
Be more verbose at TRACE level and log the DNS servers associated to
configurations. This will help to debug issues like [0].

[0] https://bugzilla.redhat.com/show_bug.cgi?id=1348887

(cherry picked from commit a5d1db08f8)
2016-06-28 16:45:53 +02:00
Beniamino Galvani
7a343cc981 vpn: reuse existing ip_config objects when config gets updated
Previously we created a new NMIP[46]Config object to replace the
previous one every time the plugin reported a new IP configuration
through the Ip[46]Config signal, but the old configuration was not
removed from the DNS manager and would become stale.

The interaction with DNS manager is handled by NMPolicy, which only
reacts to changes in connection status, so it's not easy to have the
configuration removed from DNS while keeping the connection state
ACTIVATED.

A cleaner solutions is to avoid creating a new IP configuration object
and reuse the existing one if possible. The side effect is that the
D-Bus path of the object will not change, which seems also positive.

https://bugzilla.redhat.com/show_bug.cgi?id=1348901
(cherry picked from commit 641e8b00fe)
2016-06-28 16:45:50 +02:00
Beniamino Galvani
bea089c35d vpn: dispatch pre-up scripts only once
If the plugin sends a new configuration when the connection is already
activated the state should not go back to PRE_UP since this causes
dispatcher scripts to run again.

(cherry picked from commit 19133b08da)
2016-06-28 16:45:49 +02:00
Francesco Giudici
adce577dbc bond/trivial: fix typo
(cherry picked from commit fd4a8a202e)
2016-06-28 15:12:44 +02:00
Beniamino Galvani
cca92be83c cli: initialize connection list in do_device_connect()
The connection list may be required in nmc_secrets_requested() if
secrets are needed.

Fixes: 45fc268890

https://bugzilla.gnome.org/show_bug.cgi?id=767987
(cherry picked from commit bf7b9c60b6)
2016-06-27 13:12:14 +02:00
Beniamino Galvani
696becf0d9 tun,vxlan: add the CAP_IS_SOFTWARE capability
Software devices must report the NM_DEVICE_CAP_IS_SOFTWARE capability
in order to be properly activated. Add the flag to NMDeviceTun and
NMDeviceVxlan.

https://bugzilla.gnome.org/show_bug.cgi?id=767846
(cherry picked from commit f2d5c8d7f8)
2016-06-27 13:12:08 +02:00
Thomas Haller
9bd444b3b1 platform: avoid crash after calling nl_recv() for old libnl3 version
nl_recv() in libnl3 before version 3.2.15 would return dangling pointers
if nl_recv() fails or has nothing to read [1].

Workaround that by explicitly clearing @buf and @creds.

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

[1] 69468517d0

(cherry picked from commit 66715515dc)
2016-06-24 19:10:59 +02:00
Dan Williams
78c3d14a68 libnm/libnm-glib: use Bluetooth device name as description (bgo #592819)
Abuse the 'name' property for this, for now, so we don't have to grab
a free slot from NMDeviceClass.

https://bugzilla.gnome.org/show_bug.cgi?id=592819
(cherry picked from commit fdf5b6941a)
2016-06-21 10:36:45 -05:00
Beniamino Galvani
90677c1c66 team: check return value of g_dbus_connection_call_sync()
The call can fail; in such case assume that an existing teamd died and
our instance will be able to continue.

https://bugzilla.redhat.com/show_bug.cgi?id=1347015
(cherry picked from commit 072358dad0)
2016-06-21 15:08:37 +02:00
Thomas Haller
2748b84c98 dns: merge branch 'th/nm-1-2-dns-backports' into nm-1-2
Backpot a large set of patches from master related to handling DNS.

This includes:

- add support for DNS priorities
- extend rc-manager configuration option with new values
  "symlink" and "unmanaged"
- fix rc-manager=file behavior to follow symlinks
- make default rc-manager option configurable at compile time
- fix restarting dnsmasq
- restart DNS plugin on SIGHUP
- add Reload D-Bus call
- support CIDR for reverse DNS entries
2016-06-10 11:21:18 +02:00
Beniamino Galvani
98741c802c dns: remove nm-dns-utils.c and nm-dns-utils.h
The functions in the two files seem to belong to nm-dns-dnsmasq.c as
nobody else is using them.

(cherry picked from commit 6c5a5c9f2a)
2016-06-10 11:14:38 +02:00
Beniamino Galvani
c3c2ed489c dns: add reverse DNS IPv6 entries to dnsmasq
https://bugzilla.gnome.org/show_bug.cgi?id=767174
(cherry picked from commit ae763642d8)
2016-06-10 11:14:38 +02:00
Beniamino Galvani
70bd800038 dns: add CIDR reverse DNS IPv4 entries to dnsmasq
When a reverse DNS entry must be added to dnsmasq, instead of
considering IP addresses as classful use the prefix to compute one or
more "in-addr.arpa" according to CIDR rules.

https://bugzilla.gnome.org/show_bug.cgi?id=767174
(cherry picked from commit 4d1e7dc23c)
2016-06-10 11:14:38 +02:00
Thomas Haller
f95b7b9654 dns: minor fix of logging with unset dns mode
With
  [main]
  #dns=

we would see in the log:
  dns-mgr: init: dns=(null), rc-manager=symlink

Instead, it should be
  dns-mgr: init: dns=default, rc-manager=symlink

Also, we should avoid logging NULL values with "%s", although
glib's printf is fine with that.

(cherry picked from commit bcb88d540e)
2016-06-10 11:14:38 +02:00
Thomas Haller
2826c7ad0f dns: update detection of immutable resolv.conf
Before, we would first check whether the file is immuable before
parsing main.rc-manager setting. That means, if you configured

  [main]
  dns=default
  rc-manager=unmanged

we would still first try to detect whether the file is immutable.
The result of course is only minor, e.g. showing up in logging
as rc-manager=immutable instead of rc-manager=unmanged.
Also, an immutable resolv.conf would suppress a warning about
a bogus rc-manager setting.

Also, when selecting rc-manager=symlink and resolv.conf is a symlink
to an immutable file, we don't actually care about that. The reason is,
that if the link-target is not /var/run/NetworkManager/resolv.conf,
we anyway wouldn't modify the file.

The effect of this change is pretty minor, now in logging you would see:
  dns-mgr: init: dns=default, rc-manager=symlink
  dns-mgr: update-resolv-conf: write internal file /var/run/NetworkManager/resolv.conf succeeded but don't update /etc/resolv.conf as it points to /some/where/else
instead of
  dns-mgr: init: dns=default, rc-manager=immutable
  dns-mgr: update-resolv-conf: write internal file /var/run/NetworkManager/resolv.conf succeeded

Which feels slightly more right.

Note that symlinks cannot have file attributes.

(cherry picked from commit 4711867915)
2016-06-10 11:14:38 +02:00
Thomas Haller
486fc0eade dns: follow resolv.conf if it is a symlink for 'rc-manager=file'
Until before 1.2.0, NetworkManager would always write resolv.conf as file, but
if /etc/resolv.conf was a symlink, it would follow the link instead of
replacing it with a file ([1], [2]).

With 1.2.0, we initially dropped that behavior and added a new 'rc-manager=none'
which writes resolv.conf to /var/run/NetworkManager and symlinks resolv.conf [3].
In case resolv.conf being already a symlink to another target, it would
not be replaced [4].
Later, we added 'rc-manager=file', which always writes /etc/resolv.conf as
file [5].

With 1.4.0, we will rename 'rc-manager=none' to 'rc-manager=symlink' [6].

This commit now fixes 'rc-manager=file' to restores the pre-1.2 behavior
and follow symlinks.

[1] 5761e328b8
[2] https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/324233
[3] 4805be2ed2
[4] 583568e12f
[5] 288799713d
[6] cd6a469668

https://github.com/NetworkManager/NetworkManager/pull/7
(cherry picked from commit 718fd22436)
2016-06-10 11:14:38 +02:00
Thomas Haller
0b4ea9cbf1 dns: refactor logging statements to use _rc_manager_to_string()
Reuse _rc_manager_to_string() to stringify the rc-manager mode.
Also fix typo "rc-managed=file".

(cherry picked from commit 9418f81528)
2016-06-10 11:14:38 +02:00
Thomas Haller
f8a9c256a3 all: move NM_AUTH_PERMISSION_* defines to "nm-common-macros.h" header
(cherry picked from commit 8e54cfdb27)
2016-06-10 11:14:38 +02:00
Thomas Haller
05ae3e77fc shared: add "nm-common-macros.h" header
Shared headers are all project-wide and internal API.
Currently we have the following:

General purpose:

  - shared/gsystem-local-alloc.h: header-only, allocation macros
  - shared/nm-dbus-compat.h: header-only, D-Bus related defines
  - shared/nm-glib.h: header-only, glib compatibility defines
  - shared/nm-macros-internal.h: header-only, utils
  - shared/nm-shared-utils.[hc]: source and header, utils
  - shared/nm-test*.[hc]: source and header, libnm testing utils

Special to NetworkManager repository:

  - shared/nm-version-macros.h.in: header-only, version macros
  - shared/nm-default.h: header-only, default-include

Now we add "shared/nm-common-macros.h" which is header-only, but non
general purpose.

I am running low on good names, considering all the shared/core/macros
utils headers. Still, I think "nm-common-macros.h" is appropriate.

(cherry picked from commit ed551a4633)
2016-06-10 11:14:38 +02:00
Thomas Haller
0b4c55b541 config: cleanup includes
(cherry picked from commit 2c411e9070)
2016-06-10 11:14:38 +02:00
Thomas Haller
940b21f6de config: unify logging line when reloading configuration
Also when config_data changes, the logging line should start with
"config: signal" like it does in the other cases.

(cherry picked from commit 02034cead3)
2016-06-10 11:14:38 +02:00
Thomas Haller
265cfd7dee config: fix ignoring internal [.config] section
The [.config] section is configuration about the configuration file itself,
it should not be merged.

Properly ignore the [.config] section before merging the configuration
file.

(cherry picked from commit ca5028e608)
2016-06-10 11:14:38 +02:00
Thomas Haller
390778edec config,dns: support Reload flags to specify that only parts should be reloaded
Support 3 new flags for Reload:

  - 0x01 (CONF): reload the configuration from disk
  - 0x02 (DNS_RC): write DNS configuration to resolv.conf
  - 0x04 (DNS_FULL): restart DNS plugin

Omitting all flags is the same as reloading everything, thus SIGHUP.

(cherry picked from commit 0acee97220)
2016-06-10 11:14:38 +02:00
Thomas Haller
e7ebf1efff manager: add Reload() D-Bus command
Add new Reload D-Bus command to reload NetworkManager configuration.

For now, this is like sending SIGHUP to the process. There are several
advantages here:

  - it is guarded via PolicyKit authentication while signals
    can only be sent by root.

  - the user can wait for the reload to be complete instead of sending
    an asynchronous signal. For now, we operation completes after
    nm_config_reload() returns, but later we could delay the response
    further until specific parts are fully reloaded.

  - SIGHUP reloads everything including re-reading configuration from
    disk while SIGUSR1 reloads just certain parts such as writing out DNS
    configuration anew.
    Now, the Reload command has a flags argument which is more granular
    in selecting parts which are to be reloaded. For example, via
    signals the user can:

      1) send SIGUSR1: this writes out the DNS configuration to
         resolv.conf and possibly reloads other parts without
         re-reading configuration and without restarting the DNS plugin.
      2) send SIGHUP: this reloads configuration from disk,
         writes out resolv.conf and restarts the DNS plugin.

    There is no way, to only restart the DNS plugin without also reloading
    everything else.

(cherry picked from commit 1d0e0eeffd)
2016-06-10 11:14:38 +02:00